@@ -2,92 +2,7 @@ import { useState, useCallback, useEffect, useId, useRef, memo } from "react";
22import { formatTime , frameToSeconds } from "../lib/time" ;
33import { Tooltip } from "../../components/ui" ;
44import { useContextMenuDismiss } from "../../hooks/useContextMenuDismiss" ;
5-
6- const SHORTCUT_SECTIONS = [
7- {
8- title : "Playback" ,
9- hints : [
10- { key : "Space" , label : "Play / Pause" } ,
11- { key : "J" , label : "Play backward" } ,
12- { key : "K" , label : "Stop" } ,
13- { key : "L" , label : "Play forward" } ,
14- { key : "M" , label : "Toggle mute" } ,
15- { key : "⇧L" , label : "Toggle loop" } ,
16- { key : "←/→" , label : "Step 1 frame" } ,
17- { key : "⇧←/⇧→" , label : "Step 10 frames" } ,
18- { key : "F" , label : "Toggle fullscreen" } ,
19- ] ,
20- } ,
21- {
22- title : "Keyframes (when an element is selected)" ,
23- hints : [
24- { key : "K" , label : "Add keyframe at playhead" } ,
25- { key : "Del" , label : "Delete selected keyframe" } ,
26- { key : "H" , label : "Toggle hold / bezier" } ,
27- { key : "U" , label : "Expand / collapse properties" } ,
28- { key : "R" , label : "Record gesture" } ,
29- ] ,
30- } ,
31- {
32- title : "Editing" ,
33- hints : [
34- { key : "⌘Z" , label : "Undo" } ,
35- { key : "⌘⇧Z" , label : "Redo" } ,
36- { key : "⌘C" , label : "Copy element" } ,
37- { key : "⌘V" , label : "Paste element" } ,
38- { key : "⌘X" , label : "Cut element" } ,
39- { key : "S" , label : "Split clip at playhead" } ,
40- { key : "⇧Click" , label : "Razor tool: split all tracks" } ,
41- { key : "⌘G" , label : "Group elements" } ,
42- { key : "⌘⇧G" , label : "Ungroup" } ,
43- { key : "Del" , label : "Delete selected element (no keyframe selected)" } ,
44- ] ,
45- } ,
46- {
47- title : "Gesture recording modifiers" ,
48- hints : [
49- { key : "Drag" , label : "Record x / y position" } ,
50- { key : "Scroll" , label : "Record z depth" } ,
51- { key : "⇧ Drag" , label : "Record rotationX / rotationY" } ,
52- { key : "⌥ Drag" , label : "Record rotation" } ,
53- { key : "⌘ Drag↕" , label : "Record opacity" } ,
54- { key : "⌘ Scroll" , label : "Record scale" } ,
55- ] ,
56- } ,
57- {
58- title : "Canvas" ,
59- hints : [
60- { key : "Drag" , label : "Move element / add keyframe" } ,
61- { key : "⌥ Drag" , label : "Move entire animation path" } ,
62- { key : "⇧ Drag" , label : "Uniform resize" } ,
63- ] ,
64- } ,
65- {
66- title : "Crop" ,
67- hints : [
68- { key : "Drag edge" , label : "Crop a side" } ,
69- { key : "Drag center" , label : "Reposition the crop" } ,
70- ] ,
71- } ,
72- {
73- title : "Panels" ,
74- hints : [
75- { key : "⌘1" , label : "Compositions tab" } ,
76- { key : "⌘2" , label : "Assets tab" } ,
77- ] ,
78- } ,
79- {
80- title : "Work area" ,
81- hints : [
82- { key : "I" , label : "Set in-point" } ,
83- { key : "⇧I" , label : "Clear in-point" } ,
84- { key : "O" , label : "Set out-point" } ,
85- { key : "⇧O" , label : "Clear out-point" } ,
86- { key : "A" , label : "Jump to in-point" } ,
87- { key : "E" , label : "Jump to out-point" } ,
88- ] ,
89- } ,
90- ] as const ;
5+ import { DEFAULT_SHORTCUT_SECTIONS , type ShortcutSection } from "./studioShortcuts" ;
916
927interface ShortcutsPanelProps {
938 disabled : boolean ;
@@ -97,6 +12,7 @@ interface ShortcutsPanelProps {
9712 setInPoint : ( v : number | null ) => void ;
9813 setOutPoint : ( v : number | null ) => void ;
9914 onSeek : ( time : number ) => void ;
15+ sections ?: readonly ShortcutSection [ ] ;
10016}
10117
10218export const ShortcutsPanel = memo ( function ShortcutsPanel ( {
@@ -107,6 +23,7 @@ export const ShortcutsPanel = memo(function ShortcutsPanel({
10723 setInPoint,
10824 setOutPoint,
10925 onSeek,
26+ sections = DEFAULT_SHORTCUT_SECTIONS ,
11027} : ShortcutsPanelProps ) {
11128 const [ showShortcuts , setShowShortcuts ] = useState ( false ) ;
11229 const [ jumpFrame , setJumpFrame ] = useState ( "" ) ;
@@ -319,14 +236,14 @@ export const ShortcutsPanel = memo(function ShortcutsPanel({
319236 </ div >
320237 < div style = { { borderTop : "1px solid rgba(255,255,255,0.06)" } } />
321238 < div className = "px-3 pt-2.5 pb-3 flex flex-col gap-3" >
322- { SHORTCUT_SECTIONS . map ( ( section ) => (
323- < div key = { section . title } >
239+ { sections . map ( ( section , sectionIndex ) => (
240+ < div key = { sectionIndex } >
324241 < p className = "text-[9px] font-medium text-neutral-500 uppercase tracking-wider mb-1.5" >
325242 { section . title }
326243 </ p >
327244 < div className = "flex flex-col gap-1" >
328- { section . hints . map ( ( hint ) => (
329- < div key = { hint . key } className = "flex items-center gap-3" >
245+ { section . hints . map ( ( hint , hintIndex ) => (
246+ < div key = { hintIndex } className = "flex items-center gap-3" >
330247 < span
331248 className = "font-mono text-[10px] rounded-sm border border-neutral-700 px-1.5 py-0.5 text-neutral-300 min-w-[36px] text-center"
332249 style = { { background : "rgba(255,255,255,0.05)" } }
0 commit comments