diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 04e0eff76..8dee04c63 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -2031,7 +2031,8 @@ }, "presentation_view": { "edit-slide": "Edit this slide", - "start-presentation": "Start presentation" + "start-presentation": "Start presentation", + "slide-overview": "Toggle an overview of the slides" }, "command_palette": { "tree-action-name": "Tree: {{name}}", diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsx index 52339dc36..a370a793a 100644 --- a/apps/client/src/widgets/collections/presentation/index.tsx +++ b/apps/client/src/widgets/collections/presentation/index.tsx @@ -52,6 +52,23 @@ export default function PresentationView({ note, noteIds }: ViewModeProps<{}>) { } function ButtonOverlay({ containerRef, apiRef }: { containerRef: RefObject, apiRef: RefObject }) { + const [ isOverviewActive, setIsOverviewActive ] = useState(false); + useEffect(() => { + const api = apiRef.current; + if (!api) return; + setIsOverviewActive(api.isOverview()); + const onEnabled = () => setIsOverviewActive(true); + const onDisabled = () => setIsOverviewActive(false); + api.on("overviewshown", onEnabled); + api.on("overviewhidden", onDisabled); + return () => { + api.off("overviewshown", onEnabled); + api.off("overviewhidden", onDisabled); + }; + }, [ apiRef ]); + + console.log("Active ", isOverviewActive); + return (
+ { + apiRef.current?.toggleOverview(); + }} + /> + void; triggerCommand?: CommandNames; noIconActionClass?: boolean; frame?: boolean; + active?: boolean; + disabled?: boolean; } -export default function ActionButton({ text, icon, className, onClick, triggerCommand, titlePosition, noIconActionClass, frame }: ActionButtonProps) { +export default function ActionButton({ text, icon, className, onClick, triggerCommand, titlePosition, noIconActionClass, frame, active, disabled }: ActionButtonProps) { const buttonRef = useRef(null); const [ keyboardShortcut, setKeyboardShortcut ] = useState(); @@ -32,8 +34,9 @@ export default function ActionButton({ text, icon, className, onClick, triggerCo return