diff --git a/apps/web/src/preview/components/toolbar.tsx b/apps/web/src/preview/components/toolbar.tsx
index 1a5ce1bc..ba195c9d 100644
--- a/apps/web/src/preview/components/toolbar.tsx
+++ b/apps/web/src/preview/components/toolbar.tsx
@@ -4,6 +4,7 @@ import { useState, useEffect } from "react";
import { useEditor } from "@/editor/use-editor";
import { formatTimecode } from "opencut-wasm";
import { invokeAction } from "@/actions";
+import { useKeyboardShortcutsHelp } from "@/actions/use-keyboard-shortcuts-help";
import { EditableTimecode } from "@/components/editable-timecode";
import { Button } from "@/components/ui/button";
import {
@@ -24,6 +25,11 @@ import { PREVIEW_ZOOM_PRESETS } from "@/preview/zoom";
import { usePreviewViewport } from "./preview-viewport";
import { GridPopover } from "./guide-popover";
import { usePreviewStore } from "@/preview/preview-store";
+import {
+ Tooltip,
+ TooltipTrigger,
+ TooltipContent,
+} from "@/components/ui/tooltip";
import type { MediaTime } from "@/wasm";
export function PreviewToolbar({
@@ -133,14 +139,24 @@ function ZoomSelect() {
function PlayPauseButton() {
const isPlaying = useEditor((e) => e.playback.getIsPlaying());
+ const { shortcuts } = useKeyboardShortcutsHelp();
+ const shortcut = shortcuts.find((s) => s.action === "toggle-play");
+ const tooltipText = shortcut
+ ? `Play/Pause (${shortcut.keys.join(" or ")})`
+ : "Play/Pause";
return (
-
+
+
+
+
+ {tooltipText}
+
);
}
diff --git a/apps/web/src/timeline/components/timeline-toolbar.tsx b/apps/web/src/timeline/components/timeline-toolbar.tsx
index 22acd447..fc667136 100644
--- a/apps/web/src/timeline/components/timeline-toolbar.tsx
+++ b/apps/web/src/timeline/components/timeline-toolbar.tsx
@@ -19,6 +19,7 @@ import { TIMELINE_ZOOM_MAX } from "@/timeline/scale";
import { sliderToZoom, zoomToSlider } from "@/timeline/zoom-utils";
import { ScenesView } from "@/components/editor/scenes-view";
import { type TActionWithOptionalArgs, invokeAction } from "@/actions";
+import { useKeyboardShortcutsHelp } from "@/actions/use-keyboard-shortcuts-help";
import {
canToggleSourceAudio,
getSourceAudioActionLabel,
@@ -143,18 +144,21 @@ function ToolbarLeftSection() {
}
tooltip="Split element"
onClick={({ event }) => handleAction({ action: "split", event })}
/>
}
tooltip="Split left"
onClick={({ event }) => handleAction({ action: "split-left", event })}
/>
}
tooltip="Split right"
onClick={({ event }) =>
@@ -163,6 +167,7 @@ function ToolbarLeftSection() {
/>
}
tooltip="Duplicate element"
onClick={({ event }) =>
@@ -191,6 +197,7 @@ function ToolbarLeftSection() {
/>
}
tooltip="Delete element"
onClick={({ event }) =>
@@ -200,16 +207,15 @@ function ToolbarLeftSection() {
-
- }
- isActive={isCurrentlyBookmarked}
- tooltip={isCurrentlyBookmarked ? "Remove bookmark" : "Add bookmark"}
- onClick={({ event }) =>
- handleAction({ action: "toggle-bookmark", event })
- }
- />
-
+ }
+ isActive={isCurrentlyBookmarked}
+ tooltip={isCurrentlyBookmarked ? "Remove bookmark" : "Add bookmark"}
+ onClick={({ event }) =>
+ handleAction({ action: "toggle-bookmark", event })
+ }
+ />
}
isActive={snappingEnabled}
tooltip="Auto snapping"
@@ -291,6 +298,7 @@ function ToolbarRightSection({
/>
}
isActive={rippleEditingEnabled}
tooltip="Ripple editing"
@@ -337,6 +345,7 @@ function ToolbarButton({
disabled,
isActive,
buttonWrapper,
+ action,
}: {
icon: React.ReactNode;
tooltip: string;
@@ -344,7 +353,17 @@ function ToolbarButton({
disabled?: boolean;
isActive?: boolean;
buttonWrapper?: (button: React.ReactElement) => React.ReactElement;
+ action?: TActionWithOptionalArgs;
}) {
+ const { shortcuts } = useKeyboardShortcutsHelp();
+ const shortcut = action
+ ? shortcuts.find((s) => s.action === action)
+ : null;
+
+ const tooltipContent = shortcut
+ ? `${tooltip} (${shortcut.keys.join(" or ")})`
+ : tooltip;
+
const button = (