* Get the unread state for a workspace from the WorkspaceStore.
(workspaceId: string)
| 26 | * Get the unread state for a workspace from the WorkspaceStore. |
| 27 | */ |
| 28 | function getWorkspaceUnreadState(workspaceId: string): { |
| 29 | recencyTimestamp: number | null; |
| 30 | isUnread: (lastReadTimestamp: number) => boolean; |
| 31 | } { |
| 32 | const state = workspaceStore.getWorkspaceSidebarState(workspaceId); |
| 33 | return { |
| 34 | recencyTimestamp: state.recencyTimestamp, |
| 35 | isUnread: (lastReadTimestamp: number) => |
| 36 | state.recencyTimestamp !== null && state.recencyTimestamp > lastReadTimestamp, |
| 37 | }; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Get the lastReadTimestamp from persisted state. |
no test coverage detected