File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { type FC } from "react" ;
2
2
import { useState , useCallback , useEffect } from "react" ;
3
+ import { setDocumentTitle } from "@/utils/title" ;
3
4
import { useQuery , useQueryClient } from "@tanstack/react-query" ;
4
5
import { MenuBar } from "@/components/MenuBar" ;
5
6
import { LeftSidebar } from "@/components/LeftSidebar" ;
@@ -101,6 +102,16 @@ const Index: FC<Props> = () => {
101
102
( conv ) => conv . name === selectedConversation
102
103
) ?? allConversations [ 0 ] ; // Fallback to first conversation if none selected
103
104
105
+ // Update document title when selected conversation changes
106
+ useEffect ( ( ) => {
107
+ if ( conversation ) {
108
+ setDocumentTitle ( conversation . name ) ;
109
+ } else {
110
+ setDocumentTitle ( ) ;
111
+ }
112
+ return ( ) => setDocumentTitle ( ) ; // Reset title on unmount
113
+ } , [ conversation ] ) ;
114
+
104
115
return (
105
116
< div className = "h-screen flex flex-col" >
106
117
< MenuBar />
Original file line number Diff line number Diff line change
1
+ export function setDocumentTitle ( title ?: string ) {
2
+ document . title = title ? `gptme - ${ title } ` : 'gptme' ;
3
+ }
You can’t perform that action at this time.
0 commit comments