@@ -23,6 +23,10 @@ import { useSettings } from '../../hooks/useSettings';
2323
2424interface TitlebarProps {
2525 hasOpenFiles : boolean ;
26+ tabs : Array < { id : string ; fileName : string ; isModified : boolean } > ;
27+ activeTabId : string ;
28+ onTabClick : ( tabId : string ) => void ;
29+ onTabClose : ( tabId : string ) => void ;
2630 onNew : ( ) => void ;
2731 onOpen : ( ) => void ;
2832 onSave : ( ) => void ;
@@ -38,6 +42,10 @@ interface TitlebarProps {
3842
3943export function Titlebar ( {
4044 hasOpenFiles,
45+ tabs,
46+ activeTabId,
47+ onTabClick,
48+ onTabClose,
4149 onNew,
4250 onOpen,
4351 onSave,
@@ -137,16 +145,47 @@ export function Titlebar({
137145 </ div >
138146 </ div >
139147
140- { ! hasOpenFiles && (
141- < div className = "flex-1 flex items-center justify-center min-w-0" >
148+ < div className = "flex-1 flex items-center justify-center min-w-0 px-4" >
149+ { ! hasOpenFiles ? (
142150 < div className = "flex items-center gap-2 select-none wails-no-drag" >
143151 < div className = "w-5 h-5 rounded bg-gradient-to-br from-cyan-400 to-blue-500" />
144152 < span className = "text-sm font-semibold text-zinc-300 titlebar-text" > MarkView Pro</ span >
145153 </ div >
146- </ div >
147- ) }
148-
149- { hasOpenFiles && < div className = "flex-1" /> }
154+ ) : (
155+ < div className = "flex items-center gap-1 overflow-x-auto no-scrollbar wails-no-drag max-w-full" >
156+ { tabs . map ( tab => (
157+ < div
158+ key = { tab . id }
159+ onClick = { ( ) => onTabClick ( tab . id ) }
160+ className = { `
161+ flex items-center gap-2 px-3 py-1 min-w-[100px] max-w-[180px] cursor-pointer rounded
162+ transition-colors group
163+ ${ tab . id === activeTabId
164+ ? 'bg-zinc-800 text-zinc-100'
165+ : 'bg-zinc-900/50 text-zinc-400 hover:bg-zinc-800/50 hover:text-zinc-200'
166+ }
167+ ` }
168+ >
169+ < span className = "flex-1 truncate text-xs" >
170+ { tab . fileName || 'Untitled' }
171+ </ span >
172+ { tab . isModified && (
173+ < span className = "w-1.5 h-1.5 rounded-full bg-amber-500 flex-shrink-0" />
174+ ) }
175+ { tabs . length > 1 && (
176+ < button
177+ onClick = { ( e ) => { e . stopPropagation ( ) ; onTabClose ( tab . id ) ; } }
178+ className = "flex-shrink-0 p-0.5 rounded hover:bg-zinc-700 opacity-0 group-hover:opacity-100 transition-opacity"
179+ title = "Close tab"
180+ >
181+ < X className = "w-3 h-3" />
182+ </ button >
183+ ) }
184+ </ div >
185+ ) ) }
186+ </ div >
187+ ) }
188+ </ div >
150189
151190 < div className = "flex items-center gap-0.5 wails-no-drag" >
152191 < button onClick = { onPrint } className = "titlebar-btn" title = "Print (Ctrl+P)" >
0 commit comments