Skip to content

Commit cf241d9

Browse files
committed
add action buttons in transcript editor
1 parent ec51a3b commit cf241d9

File tree

3 files changed

+49
-12
lines changed

3 files changed

+49
-12
lines changed

apps/desktop/src/routes/__root.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ function Component() {
4646
}, [navigate]);
4747

4848
useEffect(() => {
49-
scan({
50-
enabled: true,
51-
});
49+
scan({ enabled: false });
5250
}, []);
5351

5452
return (

apps/desktop/src/routes/app.transcript.$id.tsx

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
import { createFileRoute } from "@tanstack/react-router";
2+
import { PencilIcon } from "lucide-react";
23
import { useRef } from "react";
34

45
import { commands as dbCommands } from "@hypr/plugin-db";
6+
import { commands as windowsCommands } from "@hypr/plugin-windows";
7+
import { Button } from "@hypr/ui/components/ui/button";
58
import TranscriptEditor from "@hypr/tiptap/transcript";
69

710
export const Route = createFileRoute("/app/transcript/$id")({
811
component: Component,
912
loader: async ({ params: { id }, context: { onboardingSessionId } }) => {
13+
const session = await dbCommands.getSession({ id }).then((v) => v!);
1014
const timeline = onboardingSessionId
1115
? await dbCommands.getTimelineViewOnboarding()
1216
: await dbCommands.getTimelineView(id);
1317

14-
return { timeline };
18+
return { session, timeline };
1519
},
1620
});
1721

1822
function Component() {
19-
const { timeline } = Route.useLoaderData();
23+
const { session, timeline } = Route.useLoaderData();
2024
const editorRef = useRef(null);
2125

26+
const handleSave = () => {
27+
windowsCommands.windowDestroy({ type: "transcript", value: session.id });
28+
};
29+
30+
const handleCancel = () => {
31+
windowsCommands.windowDestroy({ type: "transcript", value: session.id });
32+
};
33+
2234
const content = {
2335
type: "doc",
2436
content: [
@@ -34,11 +46,36 @@ function Component() {
3446
};
3547

3648
return (
37-
<div className="p-12">
38-
<TranscriptEditor
39-
ref={editorRef}
40-
initialContent={content}
41-
/>
49+
<div className="h-full flex flex-col">
50+
<div className="absolute top-3 left-0 right-0 flex justify-center items-center h-4 px-4">
51+
<h1 className="text-md font-light flex items-center gap-2">
52+
<PencilIcon className="w-3 h-3" />
53+
<span>{session.title}</span>
54+
</h1>
55+
<div className="absolute right-3 flex items-center gap-2">
56+
<Button
57+
onClick={handleCancel}
58+
variant="ghost"
59+
size="sm"
60+
>
61+
Cancel
62+
</Button>
63+
<Button
64+
onClick={handleSave}
65+
size="sm"
66+
>
67+
Save
68+
</Button>
69+
</div>
70+
</div>
71+
<div className="p-6 pt-10 flex-1 flex flex-col overflow-hidden">
72+
<div className="h-full overflow-auto">
73+
<TranscriptEditor
74+
ref={editorRef}
75+
initialContent={content}
76+
/>
77+
</div>
78+
</div>
4279
</div>
4380
);
4481
}

packages/tiptap/src/transcript/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ const TranscriptEditor = forwardRef<{ editor: TiptapEditor | null }, TranscriptE
5656
}, [editor, initialContent]);
5757

5858
return (
59-
<div role="textbox">
60-
<EditorContent editor={editor} />
59+
<div role="textbox" className="h-full flex flex-col overflow-hidden">
60+
<div className="flex-1 overflow-y-auto">
61+
<EditorContent editor={editor} className="h-full" />
62+
</div>
6163
</div>
6264
);
6365
},

0 commit comments

Comments
 (0)