返回 presentation-ai
RightEditPanel.tsx
根目录 / src / components / presentation / edit-panel / RightEditPanel.tsx
1 "use client";
2
3 import {
4 Blocks,
5 CaseSensitive,
6 ChartNoAxesCombined,
7 ChartPie,
8 Link as LinkIcon,
9 Video,
10 } from "lucide-react";
11
12 import { HelpMenu } from "@/components/sidebar/help-menu";
13 import { Button } from "@/components/ui/button";
14 import { usePresentationRecordingState } from "@/states/presentation-recording-state";
15 import { usePresentationState } from "@/states/presentation-state";
16 import { ZoomControl } from "../controls/ZoomControl";
17
18 const RIGHT_PANEL_BUTTON_CLASSNAME =
19 "size-12 text-foreground hover:bg-accent hover:text-accent-foreground";
20
21 export function RightEditPanel() {
22 const setActiveRightPanel = usePresentationState(
23 (s) => s.setActiveRightPanel,
24 );
25
26 return (
27 <div className="fixed right-3 bottom-4 z-30 flex justify-end lg:sticky lg:top-0 lg:right-auto lg:bottom-auto lg:z-10 lg:h-[calc(100dvh-4rem)] lg:flex-col lg:justify-between lg:px-3 lg:pr-6">
28 <div className="flex flex-col items-end gap-3 lg:hidden">
29 <HelpMenu hideKeyboardShortcutsOnMobile />
30 </div>
31
32 <div className="sheet-container relative hidden w-full max-w-max items-center justify-center gap-1 rounded-2xl border border-border/70 bg-background/95 px-2 py-2 shadow-lg backdrop-blur lg:flex lg:flex-1 lg:items-center lg:rounded-none lg:border-0 lg:bg-transparent lg:px-0 lg:py-0 lg:shadow-none">
33 <div className="flex items-center gap-1 rounded-2xl border border-border/70 bg-background/90 p-1 shadow-sm backdrop-blur-md lg:absolute lg:top-1/2 lg:left-1/2 lg:-translate-x-1/2 lg:-translate-y-1/2 lg:flex-col lg:gap-3">
34 <Button
35 size="icon"
36 variant="ghost"
37 className={RIGHT_PANEL_BUTTON_CLASSNAME}
38 onClick={() => setActiveRightPanel("basicBlocks")}
39 >
40 <CaseSensitive className="size-5" />
41 </Button>
42
43 <Button
44 size="icon"
45 variant="ghost"
46 className={RIGHT_PANEL_BUTTON_CLASSNAME}
47 onClick={() => setActiveRightPanel("elements")}
48 >
49 <Blocks className="size-5" />
50 </Button>
51
52 <Button
53 size="icon"
54 variant="ghost"
55 className={RIGHT_PANEL_BUTTON_CLASSNAME}
56 onClick={() => setActiveRightPanel("charts")}
57 >
58 <ChartPie className="size-5" />
59 </Button>
60
61 <Button
62 size="icon"
63 variant="ghost"
64 className={RIGHT_PANEL_BUTTON_CLASSNAME}
65 onClick={() => setActiveRightPanel("diagrams")}
66 >
67 <ChartNoAxesCombined className="size-5" />
68 </Button>
69
70 <Button
71 size="icon"
72 variant="ghost"
73 className={RIGHT_PANEL_BUTTON_CLASSNAME}
74 onClick={() => setActiveRightPanel("embed")}
75 >
76 <LinkIcon className="size-5" />
77 </Button>
78
79 <Button
80 size="icon"
81 variant="ghost"
82 className={RIGHT_PANEL_BUTTON_CLASSNAME}
83 onClick={() => {
84 // enter present mode and open recording setup
85 usePresentationState.getState().resetPresentingScaleLocks();
86 usePresentationState.getState().setIsPresentingLoading(true);
87 usePresentationState.getState().setIsPresenting(true);
88 usePresentationRecordingState.getState().setWantsToRecord(true);
89 }}
90 >
91 <Video className="size-5" />
92 </Button>
93 </div>
94 <div className="ml-1 flex items-center gap-1 rounded-2xl border border-border/70 bg-background/90 p-1 shadow-sm backdrop-blur-md lg:absolute lg:bottom-4 lg:left-1/2 lg:ml-0 lg:-translate-x-1/2 lg:flex-col">
95 <ZoomControl />
96 <HelpMenu hideKeyboardShortcutsOnMobile />
97 </div>
98 </div>
99 </div>
100 );
101 }
102
102 lines Plain Text