()
| 8 | import { resolveSystemFolderLabels } from '../lib/system-folder-labels' |
| 9 | |
| 10 | export function TitleBar(): JSX.Element { |
| 11 | const vault = useStore((s) => s.vault) |
| 12 | const activeNote = useStore((s) => s.activeNote) |
| 13 | const selectedPath = useStore((s) => s.selectedPath) |
| 14 | const systemFolderLabels = useStore((s) => s.systemFolderLabels) |
| 15 | const workspaceMode = useStore((s) => s.workspaceMode) |
| 16 | const isMac = window.zen.platformSync() === 'darwin' |
| 17 | const labels = resolveSystemFolderLabels(systemFolderLabels) |
| 18 | |
| 19 | const title = activeNote |
| 20 | ? activeNote.title |
| 21 | : isQuickNotesTabPath(selectedPath) |
| 22 | ? labels.quick |
| 23 | : isTasksTabPath(selectedPath) |
| 24 | ? labels.tasks |
| 25 | : isTagsTabPath(selectedPath) |
| 26 | ? 'Tags' |
| 27 | : isHelpTabPath(selectedPath) |
| 28 | ? 'Help' |
| 29 | : isArchiveTabPath(selectedPath) |
| 30 | ? labels.archive |
| 31 | : isTrashTabPath(selectedPath) |
| 32 | ? labels.trash |
| 33 | : vault |
| 34 | ? vault.name |
| 35 | : 'ZenNotes' |
| 36 | |
| 37 | return ( |
| 38 | <div |
| 39 | className="drag-region glass-titlebar flex h-11 shrink-0 items-center px-4 text-xs text-ink-500" |
| 40 | style={{ paddingLeft: isMac ? 80 : 12 }} |
| 41 | > |
| 42 | <div className="flex flex-1 items-center justify-center gap-2 text-center tracking-wide"> |
| 43 | <span className="truncate">{title}</span> |
| 44 | {workspaceMode === 'remote' && ( |
| 45 | <span className="rounded-full border border-paper-300/70 bg-paper-100/80 px-2 py-0.5 text-2xs font-medium uppercase tracking-[0.14em] text-ink-700"> |
| 46 | Remote |
| 47 | </span> |
| 48 | )} |
| 49 | </div> |
| 50 | {!isMac && ( |
| 51 | <div className="flex items-center gap-1"> |
| 52 | <WinButton onClick={() => window.zen.windowMinimize()} label="–" /> |
| 53 | <WinButton onClick={() => window.zen.windowToggleMaximize()} label="▢" /> |
| 54 | <WinButton |
| 55 | onClick={() => window.zen.windowClose()} |
| 56 | label="✕" |
| 57 | className="hover:bg-red-500/90 hover:text-white" |
| 58 | /> |
| 59 | </div> |
| 60 | )} |
| 61 | </div> |
| 62 | ) |
| 63 | } |
| 64 | |
| 65 | function WinButton({ |
| 66 | onClick, |
nothing calls this directly
no test coverage detected