@startsimpli/integrations 0.2.179 → 0.2.181

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/package.json +1 -1
  2. package/src/__tests__/converse-handoff.test.ts +129 -0
  3. package/src/__tests__/converse-meeting.test.ts +41 -0
  4. package/src/__tests__/converse-relay.test.ts +19 -3
  5. package/src/__tests__/corpus-ask-projects.test.ts +74 -0
  6. package/src/__tests__/home-brief.test.tsx +12 -24
  7. package/src/__tests__/home-needs-your-call.test.tsx +13 -16
  8. package/src/__tests__/library-asks-line.test.ts +27 -0
  9. package/src/__tests__/plan-shell.test.tsx +160 -0
  10. package/src/components/DocumentDetail.tsx +15 -4
  11. package/src/components/documentText.ts +33 -0
  12. package/src/components/index.ts +1 -0
  13. package/src/components/pages/AskPage.tsx +9 -1
  14. package/src/components/pages/LibraryPage.tsx +4 -0
  15. package/src/components/pages/PlanningPage.tsx +20 -10
  16. package/src/components/pages/TrackerPage.tsx +16 -3
  17. package/src/components/pages/home/DueSoonLine.tsx +28 -0
  18. package/src/components/pages/home/HomeBriefPage.tsx +19 -52
  19. package/src/components/pages/home/index.ts +1 -3
  20. package/src/components/pages/plan/ProjectsPage.tsx +54 -0
  21. package/src/components/pages/plan/TalkPage.tsx +48 -0
  22. package/src/components/pages/plan/TimelinePage.tsx +33 -0
  23. package/src/components/pages/plan/index.ts +6 -0
  24. package/src/corpus/ask-projects.ts +94 -0
  25. package/src/corpus/ask.ts +21 -2
  26. package/src/corpus/converse/handle.ts +10 -3
  27. package/src/corpus/converse/handled-asks.ts +29 -0
  28. package/src/corpus/converse/handoff.ts +52 -0
  29. package/src/corpus/converse/index.ts +4 -2
  30. package/src/corpus/converse/meeting.ts +23 -7
  31. package/src/corpus/converse/relay.ts +8 -4
  32. package/src/corpus/converse/store.ts +2 -0
  33. package/src/corpus/converse/transcript.ts +9 -0
  34. package/src/corpus/converse/types.ts +14 -0
  35. package/src/corpus/index.ts +5 -0
  36. package/src/corpus/nav-copy.ts +31 -0
  37. package/src/corpus/view-text.ts +3 -2
  38. package/src/native/__tests__/design-screens.test.tsx +3 -2
  39. package/src/native/app/FoundryApp.tsx +1 -1
  40. package/src/native/app/__tests__/plan-talk-registry.test.tsx +74 -0
  41. package/src/native/app/briefingServices.ts +1 -0
  42. package/src/native/app/config/defaults.ts +8 -2
  43. package/src/native/app/config/types.ts +1 -1
  44. package/src/native/app/converseServices.ts +1 -0
  45. package/src/native/app/registry.tsx +26 -6
  46. package/src/native/app/services.ts +3 -2
  47. package/src/native/components/NoteDetailScreen.tsx +16 -4
  48. package/src/native/components/__tests__/notes-screens.test.tsx +8 -8
  49. package/src/native/converse/ConverseScreen.tsx +24 -5
  50. package/src/native/converse/__tests__/liveScreen.test.tsx +15 -2
  51. package/src/native/home/HomeScreen.tsx +20 -7
  52. package/src/native/home/controller.ts +15 -5
  53. package/src/native/home/tab.tsx +31 -6
  54. package/src/native/plan/NewProjectRow.tsx +30 -0
  55. package/src/native/plan/PlanTab.tsx +105 -0
  56. package/src/native/plan/ProjectTodos.tsx +24 -0
  57. package/src/native/plan/TimelineScreen.tsx +68 -0
  58. package/src/native/plan/__tests__/plan-tab.test.tsx +76 -0
  59. package/src/native/plan/index.ts +5 -0
  60. package/src/native/plan/timeline.ts +56 -0
  61. package/src/native/recording/__tests__/recorderAudio.test.ts +10 -2
  62. package/src/native/recording/recorderAudio.ts +6 -2
  63. package/src/native/screens/__tests__/tabs.test.tsx +13 -0
  64. package/src/native/screens/ask/AskScreen.tsx +4 -2
  65. package/src/native/screens/library/LibraryDetailScreen.tsx +11 -4
  66. package/src/native/screens/planning/PlanningScreens.tsx +30 -13
  67. package/src/native/screens/tabs.tsx +5 -4
  68. package/src/native/talk/TalkTab.tsx +65 -0
  69. package/src/native/talk/__tests__/talk-tab.test.tsx +57 -0
  70. package/src/native/tracker/TrackerListScreen.tsx +7 -3
  71. package/src/native/tracker/tab.tsx +33 -8
  72. package/src/components/pages/home/DueAcrossProjects.tsx +0 -76
  73. package/src/components/pages/home/RecentNotes.tsx +0 -69
@@ -0,0 +1,65 @@
1
+ import { useMemo, useState } from 'react';
2
+ import { View } from 'react-native';
3
+ import { Header, SegmentedControl, Text, useTheme } from '@startsimpli/ui-native';
4
+ import { TAB_COPY, TALK_MODES, type TalkMode } from '../../corpus/nav-copy';
5
+ import { projectIdOf } from '../../corpus/ask-projects';
6
+ import type { MeetingController } from '../../corpus/converse/meeting';
7
+ import type { FoundryTab, TabContext } from '../components/FoundryTabsShell';
8
+ import type { NativeCorpusApi } from '../corpus/api';
9
+ import { ConverseScreen } from '../converse/ConverseScreen';
10
+ import type { SpeedStore } from '../converse/speed';
11
+ import { AskScreen } from '../screens/ask/AskScreen';
12
+ import { createAskController } from '../screens/ask/controller';
13
+
14
+ export const TALK_TAB = 'talk';
15
+
16
+ export interface TalkTabOptions {
17
+ api: Pick<NativeCorpusApi, 'corpus' | 'ask' | 'scope'>;
18
+ /** Absent when `features.converse` is off: Talk is then Ask alone. */
19
+ converse?: MeetingController | null;
20
+ speed?: SpeedStore | null;
21
+ key?: string;
22
+ label?: string;
23
+ /** The Library tab, where a cited source opens. */
24
+ libraryKey?: string;
25
+ /** The Plan tab, where a cited PROJECT opens. */
26
+ planKey?: string;
27
+ }
28
+
29
+ function TalkBody({ opts, ctx }: { opts: TalkTabOptions; ctx: TabContext }) {
30
+ const theme = useTheme();
31
+ const { api, converse, speed, libraryKey = 'library', planKey } = opts;
32
+ const modes = TALK_MODES.filter((m) => m.key === 'ask' || converse);
33
+ // `-tgTab talk -tgDetail ask` (and a link) land on Ask.
34
+ const [mode, setMode] = useState<TalkMode>(ctx.route?.id === 'ask' || !converse ? 'ask' : 'talk');
35
+ const ask = useMemo(() => createAskController({ api: api.ask, scope: api.scope, listProjects: async () => (await api.corpus.listFocusChoices?.()) ?? [] }), [api]);
36
+ const current = modes.find((m) => m.key === mode) ?? modes[0];
37
+ return (
38
+ <View style={{ flex: 1 }} testID="talk-screen">
39
+ <Header large testID="talk-header" title={TAB_COPY.talk.label} subtitle={TAB_COPY.talk.subtitle} />
40
+ <View style={{ paddingHorizontal: theme.layout.gutter, gap: theme.spacing.xs, paddingBottom: theme.spacing.sm }}>
41
+ {modes.length > 1 ? (
42
+ <SegmentedControl<TalkMode> testID="talk-mode" value={current.key} onChange={setMode} options={modes.map((m) => ({ value: m.key, label: m.label }))} />
43
+ ) : null}
44
+ <Text variant="footnote" testID="talk-mode-subtitle">{current.subtitle}</Text>
45
+ </View>
46
+ {/* Both stay mounted: switching modes must not end a meeting in progress. */}
47
+ {converse ? (
48
+ <View style={{ flex: 1, display: current.key === 'talk' ? 'flex' : 'none' }}>
49
+ <ConverseScreen controller={converse} speed={speed ?? undefined} embedded />
50
+ </View>
51
+ ) : null}
52
+ <View style={{ flex: 1, display: current.key === 'ask' ? 'flex' : 'none' }}>
53
+ <AskScreen controller={ask} onOpenDocument={(id) => { const project = projectIdOf(id); if (project && planKey) ctx.openTab(planKey, `project/${project}`); else ctx.openTab(libraryKey, id); }} embedded />
54
+ </View>
55
+ </View>
56
+ );
57
+ }
58
+
59
+ /**
60
+ * The Talk tab: ONE place to speak to Tandem. Start talking, a type box, and an Ask mode (a question answered with cited
61
+ * sources); Ask is a mode here, not a tab. Leaving the tab does not end a meeting.
62
+ */
63
+ export function talkTab(opts: TalkTabOptions): FoundryTab {
64
+ return { key: opts.key ?? TALK_TAB, label: opts.label ?? TAB_COPY.talk.label, render: (ctx) => <TalkBody opts={opts} ctx={ctx} /> };
65
+ }
@@ -0,0 +1,57 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+
3
+ vi.mock('react-native', async () => ({ ...(await import('../../../../../ui-native/test/rn-stub')) }));
4
+ import { act, allText, hostById, maybeById, press, render } from '../../../../../ui-native/test/render';
5
+ import { TALK_MODES, TAB_COPY } from '../../../corpus/nav-copy';
6
+ import type { TabContext } from '../../components/FoundryTabsShell';
7
+ import { createFakeNativeCorpusApi } from '../../corpus/fake';
8
+ import type { MeetingController } from '../../../corpus/converse/meeting';
9
+ import { talkTab } from '../TalkTab';
10
+
11
+ const tick = () => act(async () => { await new Promise((res) => setTimeout(res, 40)); });
12
+ const IDLE = { phase: 'idle', retryable: false, lines: [], error: null, noAudio: null, conversationId: null, saved: null, relayNotice: null };
13
+ const idleMeeting = () => {
14
+ const typed: string[] = [];
15
+ const controller = {
16
+ start() {}, end: async () => null, replay: async () => {}, sendText: async (t: string) => { typed.push(t); }, dismissNotice() {},
17
+ getState: () => IDLE, state: () => IDLE, subscribe: () => () => undefined,
18
+ } as unknown as MeetingController;
19
+ return { controller, typed };
20
+ };
21
+ const has = (r: ReturnType<typeof render>, id: string) => r.root.findAllByProps({ testID: id }).length > 0;
22
+ const ctx = (over: Partial<TabContext> = {}): TabContext => ({ tab: 'talk', active: true, route: null, push: vi.fn(), back: vi.fn(), openTab: vi.fn(), ...over });
23
+
24
+ describe('Talk tab', () => {
25
+ it('has start-talking, a type box and an Ask mode, with the one-line copy', async () => {
26
+ const { controller } = idleMeeting();
27
+ const r = render(<>{talkTab({ api: createFakeNativeCorpusApi(), converse: controller }).render(ctx())}</>);
28
+ await tick();
29
+ expect(allText(r)).toContain(TAB_COPY.talk.subtitle);
30
+ expect(has(r, 'converse-talk')).toBe(true);
31
+ expect(has(r, 'converse-input')).toBe(true);
32
+ expect(has(r, 'talk-mode-ask')).toBe(true);
33
+ expect(allText(r)).toContain(TALK_MODES[1].label);
34
+ });
35
+
36
+ it('Ask is a mode, not a tab: a question gets a cited answer and a source opens the Library', async () => {
37
+ const { controller } = idleMeeting();
38
+ const c = ctx({ route: { id: 'ask' } });
39
+ const r = render(<>{talkTab({ api: createFakeNativeCorpusApi(), converse: controller }).render(c)}</>);
40
+ await tick();
41
+ expect(allText(r)).toContain(TALK_MODES[1].subtitle);
42
+ act(() => { hostById(r, 'ask-composer-input').props.onChangeText('Debug launch checklist'); });
43
+ press(hostById(r, 'ask-composer-send'));
44
+ await tick(); await tick();
45
+ const cite = r.root.findAll((n) => typeof n.props.testID === 'string' && n.props.testID.startsWith('ask-citation-') && typeof n.props.onPress === 'function')[0];
46
+ expect(cite).toBeTruthy();
47
+ press(cite);
48
+ expect(c.openTab).toHaveBeenCalledWith('library', expect.any(String));
49
+ });
50
+
51
+ it('without a meeting controller Talk is Ask alone', async () => {
52
+ const r = render(<>{talkTab({ api: createFakeNativeCorpusApi(), converse: null }).render(ctx())}</>);
53
+ await tick();
54
+ expect(has(r, 'talk-mode-ask')).toBe(false);
55
+ expect(has(r, 'ask-composer-input')).toBe(true);
56
+ });
57
+ });
@@ -21,6 +21,10 @@ export interface TrackerListScreenProps {
21
21
  trackerName?: string;
22
22
  /** Open a tracker item's url (the app's opener: tracker app first, https fallback). */
23
23
  onOpenLink?: (url: string) => void;
24
+ /** The caller draws the title above the list (the Plan tab's header, a project's header): leave out the large "To-dos" one. */
25
+ embedded?: boolean;
26
+ /** The list belongs to one project (its controller is already filtered): no project picker. */
27
+ projectLocked?: boolean;
24
28
  }
25
29
 
26
30
  /** What an empty list says per view. Reached only when no project or search narrows it (those read "No to-dos match"). */
@@ -36,7 +40,7 @@ const EMPTY: Record<TrackerView, { title: string; description: string }> = {
36
40
  * Closed), project and search are all query parameters; swipe a row to mark it
37
41
  * done (or reopen it from Closed); pull to refresh; the list pages on scroll.
38
42
  */
39
- export function TrackerListScreen({ controller, onOpen, displays, now = Date.now, trackerName, onOpenLink }: TrackerListScreenProps) {
43
+ export function TrackerListScreen({ controller, onOpen, displays, now = Date.now, trackerName, onOpenLink, embedded, projectLocked }: TrackerListScreenProps) {
40
44
  const state = useControllerState(controller);
41
45
  const display = useTypeDisplay(displays, 'commitment');
42
46
  const theme = useTheme();
@@ -47,7 +51,7 @@ export function TrackerListScreen({ controller, onOpen, displays, now = Date.now
47
51
  const closed = state.filters.view === 'closed';
48
52
  const filters: FilterGroup[] = [
49
53
  { key: 'view', label: 'Show', view: true, options: TRACKER_VIEWS, value: state.filters.view },
50
- { key: 'project', label: 'Project', display: 'select', options: [{ value: UNFILED_PROJECT, label: 'Unfiled' }, ...state.projects.map((p) => ({ value: p.id, label: p.title }))], value: state.filters.focusId },
54
+ ...(projectLocked ? [] : [{ key: 'project', label: 'Project', display: 'select' as const, options: [{ value: UNFILED_PROJECT, label: 'Unfiled' }, ...state.projects.map((p) => ({ value: p.id, label: p.title }))], value: state.filters.focusId }]),
51
55
  ];
52
56
  const isFiltered = state.filters.focusId !== null || state.filters.search.trim() !== '';
53
57
 
@@ -81,7 +85,7 @@ export function TrackerListScreen({ controller, onOpen, displays, now = Date.now
81
85
 
82
86
  return (
83
87
  <View style={{ flex: 1 }} testID="todos-screen">
84
- <Header large testID="todos-header" title="To-dos" subtitle={subtitle} />
88
+ {embedded ? null : <Header large testID="todos-header" title="To-dos" subtitle={subtitle} />}
85
89
  <DataList<TrackerRow>
86
90
  testID="tracker-list"
87
91
  data={state.rows}
@@ -22,15 +22,40 @@ export interface TrackerTabOptions {
22
22
  itemsChanged?: { subscribe(listener: () => void): () => void };
23
23
  }
24
24
 
25
+ /** What the to-do list and its detail need from the shell. The Plan tab and the standalone tab both supply it. */
26
+ export interface TrackerBodyProps {
27
+ api: TrackerTabOptions['api'];
28
+ controller: TrackerController;
29
+ /** The open to-do's id, or null for the list. */
30
+ todoId: string | null;
31
+ onOpen: (id: string) => void;
32
+ onBack: () => void;
33
+ notesKey?: string;
34
+ openTab: (tab: string, id?: string) => void;
35
+ memberConnections?: TrackerTabOptions['memberConnections'];
36
+ openUrl?: TrackerTabOptions['openUrl'];
37
+ /** The caller draws the title (the Plan tab's header): the list leaves out its own. */
38
+ embedded?: boolean;
39
+ /** The list belongs to one project: no project picker. */
40
+ projectLocked?: boolean;
41
+ }
42
+
43
+ /** The to-do list, or one to-do's detail with the source note link. The ONE to-do list: every screen that shows to-dos mounts this. */
44
+ export function TrackerBody({ api, controller, todoId, onOpen, onBack, notesKey, openTab, memberConnections, openUrl, embedded, projectLocked }: TrackerBodyProps) {
45
+ const trackerName = useTrackerName(memberConnections);
46
+ const onOpenLink = openUrl ? (url: string) => { void openTrackerLink(url, openUrl).catch(() => undefined); } : undefined;
47
+ return todoId
48
+ ? <TrackerDetailScreen api={api} id={todoId} onBack={onBack} onChanged={() => { void controller.refresh(); }} onOpenNote={notesKey ? (docId) => openTab(notesKey, docId) : undefined} trackerName={trackerName} onOpenLink={onOpenLink} />
49
+ : <TrackerListScreen controller={controller} displays={api.schema?.displays} onOpen={(c) => onOpen(c.id)} trackerName={trackerName} onOpenLink={onOpenLink} embedded={embedded} projectLocked={projectLocked} />;
50
+ }
51
+
25
52
  /** The to-do tab as one `FoundryTabsShell` entry: list -> detail (with the source note link). */
26
53
  export function trackerTab({ api, key = 'tracker', label = 'To-dos', notesKey = 'notes', controller = createTrackerController({ api }), memberConnections, openUrl, itemsChanged }: TrackerTabOptions): FoundryTab {
27
54
  itemsChanged?.subscribe(() => { void controller.refresh(); });
28
- const onOpenLink = openUrl ? (url: string) => { void openTrackerLink(url, openUrl).catch(() => undefined); } : undefined;
29
- function Screen({ route, push, back, openTab }: { route: { id: string } | null; push: (id: string) => void; back: () => void; openTab: (tab: string, id?: string) => void }) {
30
- const trackerName = useTrackerName(memberConnections);
31
- return route
32
- ? <TrackerDetailScreen api={api} id={route.id} onBack={back} onChanged={() => { void controller.refresh(); }} onOpenNote={notesKey ? (docId) => openTab(notesKey, docId) : undefined} trackerName={trackerName} onOpenLink={onOpenLink} />
33
- : <TrackerListScreen controller={controller} displays={api.schema?.displays} onOpen={(c) => push(c.id)} trackerName={trackerName} onOpenLink={onOpenLink} />;
34
- }
35
- return { key, label, resetOnLeave: true, render: (props) => <Screen {...props} /> };
55
+ return {
56
+ key, label, resetOnLeave: true,
57
+ render: ({ route, push, back, openTab }) => (
58
+ <TrackerBody api={api} controller={controller} todoId={route?.id ?? null} onOpen={push} onBack={back} notesKey={notesKey} openTab={openTab} memberConnections={memberConnections} openUrl={openUrl} />
59
+ ),
60
+ };
36
61
  }
@@ -1,76 +0,0 @@
1
- /**
2
- * DUE ACROSS PROJECTS — Overdue / Today / This week / Later, one row each, with
3
- * the project as a chip (bd startsim-cpzoz). Takes the already-grouped result of
4
- * `groupDue` so the rule lives in one tested place. Later is folded; so are the
5
- * rows past `perGroup`, with the count on the button.
6
- */
7
- import * as React from 'react';
8
-
9
- import type { DueGroups } from '../../../corpus/due-groups';
10
- import type { Commitment } from '../../../corpus/types';
11
- import { CompactItemRow } from './CompactItemRow';
12
-
13
- const TONE: Record<string, string> = { overdue: 'text-red-700', today: 'text-gray-900', week: 'text-gray-900', later: 'text-gray-500' };
14
-
15
- export function DueAcrossProjects({
16
- due, projectNames = {}, perGroup = 6, trackerName, onOpen, onSeeAll, guessed,
17
- }: {
18
- due: DueGroups;
19
- projectNames?: Record<string, string>;
20
- perGroup?: number;
21
- trackerName?: string;
22
- onOpen?: (item: Commitment) => void;
23
- /** "Open the Tracker" — shown when there is more than the home lists. */
24
- onSeeAll?: () => void;
25
- /** Items whose date is still Tandem's guess: shown quietly. */
26
- guessed?: ReadonlySet<string>;
27
- }) {
28
- const [open, setOpen] = React.useState<Record<string, boolean>>({});
29
- if (due.total === 0) {
30
- return <p className="text-sm text-gray-500">Nothing is due. {due.undated ? `${due.undated} open item${due.undated === 1 ? ' has' : 's have'} no date.` : ''}</p>;
31
- }
32
- return (
33
- <div className="space-y-4">
34
- {due.groups.map((group) => {
35
- const folded = group.bucket === 'later' && !open.later;
36
- const shown = open[group.bucket] ? group.entries : group.entries.slice(0, perGroup);
37
- return (
38
- <section key={group.bucket} aria-label={group.label}>
39
- <h3 className={`mb-1 flex items-baseline gap-2 text-sm font-semibold ${TONE[group.bucket]}`}>
40
- {group.label}
41
- <span className="text-xs font-normal text-gray-500">{group.entries.length}</span>
42
- {group.bucket === 'later' ? (
43
- <button type="button" className="text-xs font-normal text-blue-700 underline" onClick={() => setOpen({ ...open, later: !open.later })}>
44
- {open.later ? 'hide' : 'show'}
45
- </button>
46
- ) : null}
47
- </h3>
48
- {folded ? null : (
49
- <ul>
50
- {shown.map((entry) => (
51
- <CompactItemRow
52
- key={entry.item.externalId}
53
- item={entry.item} days={entry.days} due={entry.due}
54
- project={entry.item.focusId ? projectNames[entry.item.focusId] : undefined}
55
- trackerName={trackerName} onOpen={onOpen} guessedDue={guessed?.has(entry.item.id)}
56
- />
57
- ))}
58
- </ul>
59
- )}
60
- {!folded && group.entries.length > shown.length ? (
61
- <button type="button" className="mt-1 text-xs text-blue-700 underline" onClick={() => setOpen({ ...open, [group.bucket]: true })}>
62
- Show {group.entries.length - shown.length} more
63
- </button>
64
- ) : null}
65
- </section>
66
- );
67
- })}
68
- {due.undated || onSeeAll ? (
69
- <p className="text-xs text-gray-500">
70
- {due.undated ? `${due.undated} open item${due.undated === 1 ? ' has' : 's have'} no date. ` : ''}
71
- {onSeeAll ? <button type="button" className="text-blue-700 underline" onClick={onSeeAll}>Open the Tracker</button> : null}
72
- </p>
73
- ) : null}
74
- </div>
75
- );
76
- }
@@ -1,69 +0,0 @@
1
- /**
2
- * RECENT NOTES, each with the actions that came out of it (bd startsim-cpzoz).
3
- * A row is the note's title, when, and "N to-dos · M open"; opening it shows the
4
- * summary and the to-dos themselves, each linking back to the full note. The
5
- * join (`actionsByNote`) is done by the caller; this only draws it.
6
- */
7
- import * as React from 'react';
8
-
9
- import { stripMarkdown } from '../../Markdown';
10
- import type { NoteActions } from '../../../corpus/note-actions';
11
- import type { Commitment, SourceDocument } from '../../../corpus/types';
12
- import { CompactItemRow } from './CompactItemRow';
13
- import { dueDay, localDate } from '../../../corpus/today';
14
- import { daysBetween } from '../../../corpus/due-groups';
15
-
16
- export interface RecentNote { doc: SourceDocument; actions: NoteActions }
17
-
18
- export function RecentNotes({
19
- notes, projectNames = {}, now, timeZone, onOpenNote, onOpenItem,
20
- }: {
21
- notes: RecentNote[];
22
- projectNames?: Record<string, string>;
23
- now: number;
24
- timeZone?: string;
25
- onOpenNote?: (documentId: string) => void;
26
- onOpenItem?: (item: Commitment) => void;
27
- }) {
28
- if (!notes.length) return <p className="text-sm text-gray-500">No notes yet. Record one, or connect a meeting source.</p>;
29
- const today = localDate(now, timeZone);
30
- return (
31
- <ul className="divide-y divide-gray-100 rounded-lg border border-gray-200 bg-white">
32
- {notes.map(({ doc, actions }) => (
33
- <li key={doc.id}>
34
- <details className="group">
35
- <summary className="flex cursor-pointer list-none items-center gap-3 px-4 py-3">
36
- <span className="min-w-0 flex-1 truncate text-sm font-medium text-gray-900">{doc.title || 'Untitled note'}</span>
37
- <span className="shrink-0 text-xs text-gray-500">
38
- {actions.tasks.length === 0 ? 'no to-dos' : `${actions.tasks.length} to-do${actions.tasks.length === 1 ? '' : 's'} · ${actions.open} open`}
39
- </span>
40
- <span className="w-20 shrink-0 text-right text-xs text-gray-500">
41
- {doc.occurredAt ? new Date(doc.occurredAt).toLocaleDateString(undefined, { month: 'short', day: 'numeric' }) : ''}
42
- </span>
43
- </summary>
44
- <div className="space-y-3 px-4 pb-4">
45
- {doc.summary ? <p className="whitespace-pre-line text-sm text-gray-700">{stripMarkdown(doc.summary)}</p> : null}
46
- {actions.tasks.length ? (
47
- <ul>
48
- {actions.tasks.map((item) => {
49
- const due = dueDay(item.dueAt, timeZone);
50
- return (
51
- <CompactItemRow
52
- key={item.externalId} item={item} due={due} days={due ? daysBetween(today, due) : null}
53
- project={item.focusId ? projectNames[item.focusId] : undefined} onOpen={onOpenItem}
54
- />
55
- );
56
- })}
57
- </ul>
58
- ) : null}
59
- {actions.statements ? <p className="text-xs text-gray-500">{actions.statements} decision{actions.statements === 1 ? '' : 's'} or question{actions.statements === 1 ? '' : 's'} noted</p> : null}
60
- {onOpenNote ? (
61
- <button type="button" className="text-sm text-blue-700 underline" onClick={() => onOpenNote(doc.id)}>Open the full note</button>
62
- ) : null}
63
- </div>
64
- </details>
65
- </li>
66
- ))}
67
- </ul>
68
- );
69
- }