1
1
import { createFileRoute } from "@tanstack/react-router" ;
2
+ import { PencilIcon } from "lucide-react" ;
2
3
import { useRef } from "react" ;
3
4
4
5
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" ;
5
8
import TranscriptEditor from "@hypr/tiptap/transcript" ;
6
9
7
10
export const Route = createFileRoute ( "/app/transcript/$id" ) ( {
8
11
component : Component ,
9
12
loader : async ( { params : { id } , context : { onboardingSessionId } } ) => {
13
+ const session = await dbCommands . getSession ( { id } ) . then ( ( v ) => v ! ) ;
10
14
const timeline = onboardingSessionId
11
15
? await dbCommands . getTimelineViewOnboarding ( )
12
16
: await dbCommands . getTimelineView ( id ) ;
13
17
14
- return { timeline } ;
18
+ return { session , timeline } ;
15
19
} ,
16
20
} ) ;
17
21
18
22
function Component ( ) {
19
- const { timeline } = Route . useLoaderData ( ) ;
23
+ const { session , timeline } = Route . useLoaderData ( ) ;
20
24
const editorRef = useRef ( null ) ;
21
25
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
+
22
34
const content = {
23
35
type : "doc" ,
24
36
content : [
@@ -34,11 +46,36 @@ function Component() {
34
46
} ;
35
47
36
48
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 >
42
79
</ div >
43
80
) ;
44
81
}
0 commit comments