Skip to content

🎥 Make videos programmatically with React

Add top toolbar Open in tooltips

Jonny Burger0f77988c7836
diff --git a/packages/studio/src/components/AppLaunchButton.tsx b/packages/studio/src/components/AppLaunchButton.tsx
index 3c33107cbd..4d2cc296c5 100644
--- a/packages/studio/src/components/AppLaunchButton.tsx
+++ b/packages/studio/src/components/AppLaunchButton.tsx
@@ -101,6 +101,7 @@ export const AppLaunchButton: React.FC<{
selectedId: null,
style: dropdownSegmentStyle,
title: menuAriaLabel,
+ tooltipLabel: null,
type: 'menu' as const,
values: items,
},
diff --git a/packages/studio/src/components/InspectorLocationCopy.tsx b/packages/studio/src/components/InspectorLocationCopy.tsx
index 96ea6cd9a6..8b35718cd7 100644
--- a/packages/studio/src/components/InspectorLocationCopy.tsx
+++ b/packages/studio/src/components/InspectorLocationCopy.tsx
@@ -108,6 +108,7 @@ export const InspectorLocationCopy: React.FC<{
locationType={null}
contextForAgents={contextForAgents}
location={openInEditorLocation}
+ showTooltips={false}
/>
{contextForAgents ? (
<InlineAction
diff --git a/packages/studio/src/components/InspectorOpenInEditor.tsx b/packages/studio/src/components/InspectorOpenInEditor.tsx
index 6f15ee4b51..d39a475d6d 100644
--- a/packages/studio/src/components/InspectorOpenInEditor.tsx
+++ b/packages/studio/src/components/InspectorOpenInEditor.tsx
@@ -49,7 +49,14 @@ export const InspectorOpenInEditor: React.FC<{
readonly location: OriginalPosition | null;
readonly label?: React.ReactNode;
readonly locationType: 'file' | 'folder' | null;
-}> = ({contextForAgents = null, label, location, locationType}) => {
+ readonly showTooltips: boolean;
+}> = ({
+ contextForAgents = null,
+ label,
+ location,
+ locationType,
+ showTooltips,
+}) => {
const {previewServerState} = useContext(StudioServerConnectionCtx);
const configureDefaultApps = useConfigureDefaultApps();
const {
@@ -218,8 +225,8 @@ export const InspectorOpenInEditor: React.FC<{
),
segmentId: 'default-editor',
style: mainSegmentStyle,
- title: `Open in ${defaultAppName}`,
- tooltipLabel: null,
+ title: showTooltips ? '' : `Open in ${defaultAppName}`,
+ tooltipLabel: showTooltips ? `Open in ${defaultAppName}` : null,
type: 'action',
},
];
@@ -236,7 +243,8 @@ export const InspectorOpenInEditor: React.FC<{
segmentId: 'another-app',
selectedId: null,
style: dropdownSegmentStyle,
- title: 'Open in another app',
+ title: showTooltips ? '' : 'Open in another app',
+ tooltipLabel: showTooltips ? 'Open in another app' : null,
type: 'menu',
values: menuItems,
});
@@ -251,6 +259,7 @@ export const InspectorOpenInEditor: React.FC<{
label,
menuItems,
onOpenDefault,
+ showTooltips,
]);
if (getBrowserStudioOperations() !== null) {
diff --git a/packages/studio/src/components/InspectorPanel/ElementLibraryButton.tsx b/packages/studio/src/components/InspectorPanel/ElementLibraryButton.tsx
index a497843c72..ee7c600c8c 100644
--- a/packages/studio/src/components/InspectorPanel/ElementLibraryButton.tsx
+++ b/packages/studio/src/components/InspectorPanel/ElementLibraryButton.tsx
@@ -109,6 +109,7 @@ export const ElementLibraryButton: React.FC = () => {
selectedId: null,
style: elementLibraryDropdownSegmentStyle,
title: 'Choose an Element library to browse inside Studio.',
+ tooltipLabel: null,
type: 'menu',
values: [
{
diff --git a/packages/studio/src/components/MenuBuildIndicator.tsx b/packages/studio/src/components/MenuBuildIndicator.tsx
index ab00374bdb..09c63744c0 100644
--- a/packages/studio/src/components/MenuBuildIndicator.tsx
+++ b/packages/studio/src/components/MenuBuildIndicator.tsx
@@ -70,6 +70,7 @@ export const MenuBuildIndicator: React.FC<{
<InspectorOpenInEditor
location={folderLocation}
locationType="folder"
+ showTooltips
/>
</div>
{mobileLayout ? null : <Spacing x={0.5} />}
diff --git a/packages/studio/src/components/RenderButton.tsx b/packages/studio/src/components/RenderButton.tsx
index cdb76ee158..6a0887e2be 100644
--- a/packages/studio/src/components/RenderButton.tsx
+++ b/packages/studio/src/components/RenderButton.tsx
@@ -420,6 +420,7 @@ const RenderButtonInner: React.FC<{
? compactDropdownSegmentStyle
: defaultDropdownSegmentStyle,
title: 'Select render type',
+ tooltipLabel: null,
type: 'menu',
values: dropdownValues,
},
diff --git a/packages/studio/src/components/SegmentedButton.tsx b/packages/studio/src/components/SegmentedButton.tsx
index cce35859b1..f31027a3ce 100644
--- a/packages/studio/src/components/SegmentedButton.tsx
+++ b/packages/studio/src/components/SegmentedButton.tsx
@@ -38,6 +38,7 @@ type SegmentedButtonSegmentCommon = {
readonly segmentId: string;
readonly style: React.CSSProperties | null;
readonly title: string | null;
+ readonly tooltipLabel: string | null;
};
export type SegmentedButtonSegment = SegmentedButtonSegmentCommon &
@@ -45,7 +46,6 @@ export type SegmentedButtonSegment = SegmentedButtonSegmentCommon &
| {
readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
readonly onPointerDown: React.PointerEventHandler<HTMLButtonElement> | null;
- readonly tooltipLabel: string | null;
readonly type: 'action';
}
| {
@@ -335,26 +335,42 @@ const SegmentedButtonMenu: React.FC<{
};
}, [index, opened, segment, segmentCount]);
+ const button = (
+ <button
+ ref={ref}
+ aria-expanded={opened}
+ aria-haspopup="menu"
+ aria-label={segment.ariaLabel}
+ className={`${HOVERABLE_CLASS_NAME} ${FOCUS_VISIBLE_ONLY_CLASS_NAME} ${MENU_INITIATOR_CLASSNAME}`}
+ disabled={segment.disabled}
+ id={segment.buttonId ?? undefined}
+ onClick={onClick}
+ onMouseDown={preventMouseFocus}
+ onPointerDown={onPointerDown}
+ style={style}
+ tabIndex={tabIndex}
+ title={segment.title ?? undefined}
+ type="button"
+ >
+ {segment.renderContent(CURRENT_COLOR)}
+ </button>
+ );
+
return (
<>
- <button
- ref={ref}
- aria-expanded={opened}
- aria-haspopup="menu"
- aria-label={segment.ariaLabel}
- className={`${HOVERABLE_CLASS_NAME} ${FOCUS_VISIBLE_ONLY_CLASS_NAME} ${MENU_INITIATOR_CLASSNAME}`}
- disabled={segment.disabled}
- id={segment.buttonId ?? undefined}
- onClick={onClick}
- onMouseDown={preventMouseFocus}
- onPointerDown={onPointerDown}
- style={style}
- tabIndex={tabIndex}
- title={segment.title ?? undefined}
- type="button"
- >
- {segment.renderContent(CURRENT_COLOR)}
- </button>
+ {segment.tooltipLabel === null ? (
+ button
+ ) : (
+ <ActionTooltip
+ label={segment.tooltipLabel}
+ shortcut={null}
+ delay={800}
+ dismissOnClick
+ triggerStyle={tooltipTriggerStyle}
+ >
+ {button}
+ </ActionTooltip>
+ )}
{portalStyle
? ReactDOM.createPortal(
<div
diff --git a/packages/studio/src/components/SettingsModalFooter.tsx b/packages/studio/src/components/SettingsModalFooter.tsx
index d84edc74e1..bb0e4078e5 100644
--- a/packages/studio/src/components/SettingsModalFooter.tsx
+++ b/packages/studio/src/components/SettingsModalFooter.tsx
@@ -69,6 +69,7 @@ export const SettingsModalFooter: React.FC<{
locationType={null}
location={configFileLocation}
label={<strong style={configFileName}>remotion.config.ts</strong>}
+ showTooltips={false}
/>
</div>
{showLicenseFaq ? (
diff --git a/packages/studio/src/components/TimelineCombobox.tsx b/packages/studio/src/components/TimelineCombobox.tsx
index b5e551be48..3c7d9cbf74 100644
--- a/packages/studio/src/components/TimelineCombobox.tsx
+++ b/packages/studio/src/components/TimelineCombobox.tsx
@@ -82,6 +82,7 @@ export const TimelineCombobox: React.FC<{
selectedId,
style: {fontFamily: 'inherit', padding: '0 4px'},
title: tooltipDelay === null ? title : null,
+ tooltipLabel: null,
type: 'menu',
values,
},