diff --git a/apps/client/src/widgets/mobile_widgets/TabSwitcher.tsx b/apps/client/src/widgets/mobile_widgets/TabSwitcher.tsx index 6ee84f046..fc72a739a 100644 --- a/apps/client/src/widgets/mobile_widgets/TabSwitcher.tsx +++ b/apps/client/src/widgets/mobile_widgets/TabSwitcher.tsx @@ -138,7 +138,6 @@ function Tab({ noteContext, containerRef, selectTab, activeNtxId }: { activeNtxId: string | null | undefined; }) { const { note } = noteContext; - const iconClass = useNoteIcon(note); const colorClass = note?.getColorClass() || ''; const workspaceTabBackgroundColorHue = getWorkspaceTabBackgroundColorHue(noteContext); const subContexts = noteContext.getSubContexts(); @@ -158,19 +157,7 @@ function Tab({ noteContext, containerRef, selectTab, activeNtxId }: { > {subContexts.map(subContext => ( -
- {subContext.note && } - {subContext.note?.title ?? t("tab_row.new_tab")} - {subContext.isMainContext() && { - // We are closing a tab, so we need to prevent propagation for click (activate tab). - e.stopPropagation(); - appContext.tabManager.removeNoteContext(subContext.ntxId); - }} - />} -
+
@@ -180,6 +167,32 @@ function Tab({ noteContext, containerRef, selectTab, activeNtxId }: { ); } +function TabHeader({ noteContext, colorClass }: { noteContext: NoteContext, colorClass: string }) { + const iconClass = useNoteIcon(noteContext.note); + const [ navigationTitle, setNavigationTitle ] = useState(null); + + // Manage the title for read-only notes + useEffect(() => { + noteContext?.getNavigationTitle().then(setNavigationTitle); + }, [noteContext]); + + return ( +
+ {noteContext.note && } + {navigationTitle ?? noteContext.note?.title ?? t("tab_row.new_tab")} + {noteContext.isMainContext() && { + // We are closing a tab, so we need to prevent propagation for click (activate tab). + e.stopPropagation(); + appContext.tabManager.removeNoteContext(noteContext.ntxId); + }} + />} +
+ ); +} + function TabPreviewContent({ note }: { note: FNote | null }) {