diff --git a/src/client/Sidebar.tsx b/src/client/Sidebar.tsx index 5509ef7f..311db8d2 100644 --- a/src/client/Sidebar.tsx +++ b/src/client/Sidebar.tsx @@ -33,6 +33,7 @@ import { referenceInChat as referenceInChatShared } from './reference-in-chat.ts import { DockFallback } from './sidebar/dock-fallback.tsx' import { BOTTOM_MIN, CONVERSATION_MIN, + isUnread, leafWithTab, moveTab, moveTabToEdge, openDiffTab, resizeSplitIn, setBottomHeight, toggleBottomPanel, toggleExpanded, type DropZone, type SidebarStore, type SidebarTab, @@ -657,6 +658,14 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) { return {text} } + /** + * Whether one workbench tab carries the unread dot: its page holds + * background work the reader has not looked at yet. Reads the SAME session + * state the native chip does, so the two carriers cannot disagree, and the + * shell re-renders on the store change that sets or retires the mark. + */ + const isTabUnread = (tab: SidebarTab): boolean => isUnread(state, tab.type) + /** * The active tab's right-aligned action area from the tab-type registry: * a descriptor that declares `rightActions` supplies its own toolbar @@ -795,6 +804,7 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) { renderTab={renderTab} getTabIcon={tabIconOf} getTabBadge={tabBadgeOf} + isTabUnread={isTabUnread} getTabRightActions={tabRightActionsOf} onRevealInFileManager={revealTabFile} /> diff --git a/src/client/TabBar.tsx b/src/client/TabBar.tsx index 9efc5d72..cd36315e 100644 --- a/src/client/TabBar.tsx +++ b/src/client/TabBar.tsx @@ -69,6 +69,14 @@ export function TabBar(props: { /** Badge resolver for tab labels (reads the descriptor's `badge`; the * resolver returns the rendered pill or null). */ getTabBadge?: (tab: SidebarTab) => ReactNode + /** + * Unread resolver for tab labels: the page has something the reader has not + * looked at yet (a background activation opened it without taking the column + * over). Rendered as a small dot beside the label; `false`/undefined draws + * nothing, so a strip with no marks is byte-identical to one that never had + * the feature. + */ + isTabUnread?: (tab: SidebarTab) => boolean /** * Right-aligned action area resolver for the active tab: returns a * ReactNode rendered at the tab strip's right end (between the + button @@ -91,6 +99,7 @@ export function TabBar(props: { }) { const { paneId, tabs, active, onActivate, onClose, onNewTab, newTabOptions, onDropTab, getTabIcon, getTabBadge, getTabRightActions, + isTabUnread, onRevealInFileManager, } = props const [menuOpen, setMenuOpen] = useState(false) @@ -251,6 +260,16 @@ export function TabBar(props: { {getTabIcon?.(tab) ?? null} {getTabBadge?.(tab) ?? null} {tab.title} + {isTabUnread?.(tab) === true + ? ( + + ) + : null}