MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / WorkspaceView

Function WorkspaceView

ui/src/components/InboxSidebar.tsx:181–227  ·  view source on GitHub ↗
({
  threads, selectedId, readIds, onSelect,
}: {
  threads: ReturnType<typeof groupThreads>
  selectedId: string | null
  readIds: Record<string, true>
  onSelect: (id: string) => void
})

Source from the content-addressed store, hash-verified

179// ==================== Workspace (clustered) view ====================
180
181function WorkspaceView({
182 threads, selectedId, readIds, onSelect,
183}: {
184 threads: ReturnType<typeof groupThreads>
185 selectedId: string | null
186 readIds: Record<string, true>
187 onSelect: (id: string) => void
188}) {
189 return (
190 <>
191 {threads.map((thread) => {
192 const unread = thread.entries.reduce((n, e) => (readIds[e.id] ? n : n + 1), 0)
193 return (
194 <div key={thread.workspaceId} className="mb-1.5">
195 {/* Cluster header: label · unread badge · latest time */}
196 <div className="flex items-center gap-1.5 px-3 mt-1.5 mb-0.5">
197 <span className="flex-1 truncate text-[12px] font-medium text-text/90">
198 {thread.workspaceLabel ?? thread.workspaceId}
199 </span>
200 {unread > 0 && (
201 <span className="shrink-0 min-w-[15px] h-[15px] px-1 rounded-full bg-accent text-bg text-[9px] font-semibold tabular-nums flex items-center justify-center">
202 {unread}
203 </span>
204 )}
205 <span className="shrink-0 text-[10px] text-text-muted/50 tabular-nums">
206 {formatRelativeTime(thread.latestTs)}
207 </span>
208 </div>
209
210 {/* Message rows on a kinship rail */}
211 <div className="ml-[18px] border-l border-border/50">
212 {thread.entries.map((entry) => (
213 <ClusterRow
214 key={entry.id}
215 entry={entry}
216 active={entry.id === selectedId}
217 unread={!readIds[entry.id]}
218 onClick={() => onSelect(entry.id)}
219 />
220 ))}
221 </div>
222 </div>
223 )
224 })}
225 </>
226 )
227}
228
229/** Row inside a workspace cluster — label lives in the header, so the
230 * row shows just the push preview + time. */

Callers

nothing calls this directly

Calls 1

formatRelativeTimeFunction · 0.90

Tested by

no test coverage detected