@startsimpli/integrations 0.2.201 → 0.2.202
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.
- package/package.json +5 -5
- package/src/__tests__/briefing-markdown.test.ts +64 -0
- package/src/__tests__/converse-cards.test.ts +53 -0
- package/src/__tests__/converse-page.test.tsx +148 -37
- package/src/__tests__/converse-roci.test.ts +22 -0
- package/src/__tests__/converse-structure.test.ts +27 -0
- package/src/__tests__/converse-view.test.ts +46 -0
- package/src/__tests__/corpus-tracker.test.tsx +32 -176
- package/src/__tests__/data-table-logic.test.ts +75 -0
- package/src/__tests__/data-table.test.tsx +133 -0
- package/src/__tests__/home-brief.test.tsx +25 -40
- package/src/__tests__/library-call-shape.test.tsx +164 -0
- package/src/__tests__/load-error.test.tsx +1 -1
- package/src/__tests__/mini-markdown.test.tsx +24 -0
- package/src/__tests__/overview-page.test.tsx +36 -6
- package/src/__tests__/plan-shell.test.tsx +6 -4
- package/src/__tests__/timeline-events.test.ts +65 -0
- package/src/__tests__/timeline-table.test.tsx +66 -0
- package/src/__tests__/todo-table-model.test.ts +75 -0
- package/src/__tests__/todo-table.test.tsx +202 -0
- package/src/__tests__/tracker-timeline-component.test.tsx +4 -4
- package/src/__tests__/tracker-timeline-reader.test.ts +1 -1
- package/src/comms/__tests__/app-sends-page.test.tsx +69 -0
- package/src/comms/api/comms.ts +23 -0
- package/src/comms/components/ResultsPanel.tsx +2 -2
- package/src/comms/components/SendLog.tsx +20 -8
- package/src/comms/components/index.ts +1 -0
- package/src/comms/components/pages/AppSendsPage.tsx +58 -0
- package/src/comms/hooks/index.ts +8 -3
- package/src/components/FolderTree.tsx +12 -3
- package/src/components/index.ts +2 -1
- package/src/components/pages/ConversePage.tsx +114 -105
- package/src/components/pages/LibraryPage.tsx +63 -24
- package/src/components/pages/TrackerPage.tsx +170 -474
- package/src/components/pages/converse/CardView.tsx +72 -0
- package/src/components/pages/converse/SettingsMenu.tsx +37 -0
- package/src/components/pages/converse/Thread.tsx +48 -33
- package/src/components/pages/converse/useNeedsYou.ts +60 -0
- package/src/components/pages/home/BriefCard.tsx +16 -7
- package/src/components/pages/home/HomeBriefPage.tsx +6 -91
- package/src/components/pages/home/MiniMarkdown.tsx +51 -0
- package/src/components/pages/home/{DueSoonLine.tsx → dueSoonText.ts} +2 -11
- package/src/components/pages/home/index.ts +1 -1
- package/src/components/pages/overview/OverviewPage.tsx +46 -83
- package/src/components/pages/plan/TalkPage.tsx +5 -14
- package/src/components/pages/plan/TimelinePage.tsx +4 -2
- package/src/components/pages/tracker/SweepPanel.tsx +108 -0
- package/src/components/pages/tracker/TimelineTable.tsx +70 -0
- package/src/components/pages/tracker/TrackerTimeline.tsx +32 -15
- package/src/components/table/DataTable.tsx +92 -0
- package/src/components/table/RowMenu.tsx +35 -0
- package/src/components/table/TablePagination.tsx +63 -0
- package/src/components/table/TableToolbar.tsx +56 -0
- package/src/components/table/TodoTable.tsx +142 -0
- package/src/components/table/index.ts +10 -0
- package/src/components/table/table-logic.ts +60 -0
- package/src/components/table/todo-model.ts +93 -0
- package/src/corpus/briefing/generate-weekly.ts +4 -0
- package/src/corpus/briefing/generate.ts +4 -0
- package/src/corpus/briefing/index.ts +1 -0
- package/src/corpus/briefing/markdown.ts +71 -0
- package/src/corpus/client.ts +38 -146
- package/src/corpus/converse/cards.ts +69 -0
- package/src/corpus/converse/index.ts +6 -0
- package/src/corpus/converse/roci.ts +13 -0
- package/src/corpus/converse/structure.ts +39 -0
- package/src/corpus/converse/view.ts +34 -0
- package/src/corpus/index.ts +2 -0
- package/src/corpus/participants.ts +220 -0
- package/src/corpus/timeline-events.ts +83 -0
- package/src/corpus/tracker-sort.ts +9 -3
- package/src/corpus/tracker-timeline-client.ts +2 -0
- package/src/corpus/tracker-timeline.ts +4 -0
- package/src/corpus/types.ts +32 -5
- package/src/native/app/__tests__/plan-talk-registry.test.tsx +2 -1
- package/src/native/converse/ConverseScreen.tsx +3 -5
- package/src/native/home/HomeScreen.tsx +1 -1
- package/src/native/home/tab.tsx +1 -2
- package/src/native/plan/PlanTab.tsx +1 -2
- package/src/native/plan/__tests__/plan-tab.test.tsx +5 -5
- package/src/native/talk/TalkTab.tsx +1 -1
- package/src/native/talk/__tests__/talk-tab.test.tsx +1 -1
- package/src/__tests__/home-needs-your-call.test.tsx +0 -65
- package/src/components/pages/tracker/TrackerBoard.tsx +0 -45
- package/src/components/pages/tracker/TrackerToolbar.tsx +0 -44
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TIMELINE TABLE'S ROWS: one plain-language event per thing that happened to a to-do (created, finished,
|
|
3
|
+
* went overdue), with when, who or what did it, and the to-do's CURRENT status. Pure: no clock reads (the caller
|
|
4
|
+
* passes `now`) and no HTTP. The events are derived from the bounded server read; `truncated` says when it was capped.
|
|
5
|
+
*/
|
|
6
|
+
import { dayOf } from './tracker-timeline';
|
|
7
|
+
import type { TimelineKind } from './tracker-timeline';
|
|
8
|
+
import type { TimelineRead } from './tracker-timeline-client';
|
|
9
|
+
import type { CommitmentStatus } from './types';
|
|
10
|
+
|
|
11
|
+
export interface TimelineRow {
|
|
12
|
+
id: string;
|
|
13
|
+
kind: TimelineKind;
|
|
14
|
+
/** "To-do created" / "To-do finished" / "To-do went overdue". */
|
|
15
|
+
what: string;
|
|
16
|
+
title: string;
|
|
17
|
+
/** The to-do's `externalId`, for the link; null when the row did not carry one. */
|
|
18
|
+
externalId: string | null;
|
|
19
|
+
/** Epoch ms of the event (a date-only value is read as midnight UTC). */
|
|
20
|
+
at: number;
|
|
21
|
+
/** The completion day is a guess (no completion stamp). */
|
|
22
|
+
estimated: boolean;
|
|
23
|
+
actor: string;
|
|
24
|
+
status: CommitmentStatus;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const EVENT_FILTERS = [
|
|
28
|
+
{ value: 'all', label: 'All events' },
|
|
29
|
+
{ value: 'created', label: 'Created' },
|
|
30
|
+
{ value: 'done', label: 'Finished' },
|
|
31
|
+
{ value: 'overdue', label: 'Overdue' },
|
|
32
|
+
] as const;
|
|
33
|
+
|
|
34
|
+
const WHAT: Record<TimelineKind, string> = { created: 'To-do created', done: 'To-do finished', overdue: 'To-do went overdue' };
|
|
35
|
+
const DAY = 86_400_000;
|
|
36
|
+
|
|
37
|
+
/** Who or what did it, in words. An overdue event is nobody's act. */
|
|
38
|
+
export function actorOf(kind: TimelineKind, origin: string | null | undefined): string {
|
|
39
|
+
if (kind === 'overdue') return 'Automatic';
|
|
40
|
+
const o = (origin ?? '').toLowerCase();
|
|
41
|
+
if (o === 'human' || o === 'user') return 'You';
|
|
42
|
+
if (o.includes('extraction') || o.includes('meeting')) return 'Meeting import';
|
|
43
|
+
if (o.includes('sync') || o.includes('linear')) return 'Tracker sync';
|
|
44
|
+
if (o.includes('roci')) return 'Roci';
|
|
45
|
+
if (o.includes('agent')) return 'An agent';
|
|
46
|
+
return 'Tandem';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** "3 days ago", "Yesterday", or a short date once it is more than a month back. */
|
|
50
|
+
export function relativeWhen(at: number, now: number): string {
|
|
51
|
+
const ms = now - at;
|
|
52
|
+
if (ms < 10_000) return 'Just now';
|
|
53
|
+
const plural = (n: number, unit: string) => `${n} ${unit}${n === 1 ? '' : 's'} ago`;
|
|
54
|
+
if (ms < 3_600_000) return plural(Math.max(1, Math.floor(ms / 60_000)), 'minute');
|
|
55
|
+
if (ms < DAY) return plural(Math.floor(ms / 3_600_000), 'hour');
|
|
56
|
+
const days = Math.floor(ms / DAY);
|
|
57
|
+
if (days === 1) return 'Yesterday';
|
|
58
|
+
if (days <= 30) return plural(days, 'day');
|
|
59
|
+
return new Date(at).toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function timelineEvents(read: TimelineRead, now: number, timeZone: string, rangeDays: number): TimelineRow[] {
|
|
63
|
+
const cutoff = now - rangeDays * DAY;
|
|
64
|
+
const out: TimelineRow[] = [];
|
|
65
|
+
const push = (kind: TimelineKind, item: TimelineRead['items'][number], when: string | null, estimated = false) => {
|
|
66
|
+
if (!when || !dayOf(when, timeZone)) return;
|
|
67
|
+
const at = Date.parse(when);
|
|
68
|
+
if (!Number.isFinite(at) || at < cutoff || at > now + DAY) return;
|
|
69
|
+
out.push({
|
|
70
|
+
id: `${kind}:${item.id}`, kind, what: WHAT[kind], title: item.title, externalId: item.externalId ?? null, at, estimated,
|
|
71
|
+
actor: actorOf(kind, item.origin), status: item.status,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
for (const item of read.items) {
|
|
75
|
+
push('created', item, item.firstSeenAt);
|
|
76
|
+
if (item.status === 'done') {
|
|
77
|
+
if (item.resolvedAt) push('done', item, item.resolvedAt);
|
|
78
|
+
else push('done', item, item.updatedAt, true);
|
|
79
|
+
}
|
|
80
|
+
if (item.status !== 'done' && item.status !== 'dropped' && item.dueAt && Date.parse(item.dueAt) < now) push('overdue', item, item.dueAt);
|
|
81
|
+
}
|
|
82
|
+
return out.sort((a, b) => b.at - a.at);
|
|
83
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Commitment, CommitmentSort } from './types';
|
|
11
11
|
|
|
12
|
-
type Sortable = Pick<Commitment, 'title' | 'ownerName' | 'dueAt' | 'lastSeenAt' | 'firstSeenAt'> & { priority?: number };
|
|
12
|
+
type Sortable = Pick<Commitment, 'title' | 'ownerName' | 'dueAt' | 'lastSeenAt' | 'firstSeenAt' | 'status'> & { priority?: number };
|
|
13
13
|
|
|
14
14
|
export const DEFAULT_TRACKER_SORT: CommitmentSort = 'due';
|
|
15
15
|
|
|
@@ -19,11 +19,15 @@ export const TRACKER_SORTS: ReadonlyArray<{ key: CommitmentSort; label: string;
|
|
|
19
19
|
{ key: 'newest', label: 'Newest first', order: '-attr.first_seen_at' },
|
|
20
20
|
{ key: 'title', label: 'Title (A to Z)', order: 'attr.title' },
|
|
21
21
|
{ key: 'owner', label: 'Owner (A to Z)', order: 'attr.owner_name' },
|
|
22
|
+
{ key: 'status', label: 'Status', order: 'attr.status' },
|
|
22
23
|
];
|
|
23
24
|
|
|
24
25
|
/** The server `order=` value for a sort key. */
|
|
25
|
-
export function commitmentOrder(sort: CommitmentSort = DEFAULT_TRACKER_SORT): string {
|
|
26
|
-
|
|
26
|
+
export function commitmentOrder(sort: CommitmentSort = DEFAULT_TRACKER_SORT, dir?: 'asc' | 'desc'): string {
|
|
27
|
+
const order = (TRACKER_SORTS.find((s) => s.key === sort) ?? TRACKER_SORTS[0]).order;
|
|
28
|
+
if (!dir) return order;
|
|
29
|
+
const bare = order.replace(/^-/, '');
|
|
30
|
+
return dir === 'desc' ? `-${bare}` : bare;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
const text = (v: string | undefined | null) => (v ?? '').trim().toLowerCase();
|
|
@@ -42,6 +46,8 @@ export function compareCommitments(sort: CommitmentSort = DEFAULT_TRACKER_SORT)
|
|
|
42
46
|
return (b.firstSeenAt ?? '').localeCompare(a.firstSeenAt ?? '') || byDue;
|
|
43
47
|
case 'title':
|
|
44
48
|
return text(a.title).localeCompare(text(b.title)) || byDue;
|
|
49
|
+
case 'status':
|
|
50
|
+
return text(a.status).localeCompare(text(b.status)) || byDue;
|
|
45
51
|
case 'owner':
|
|
46
52
|
return blankLast(text(a.ownerName), text(b.ownerName)) || byDue;
|
|
47
53
|
default:
|
|
@@ -55,6 +55,8 @@ function toItem(row: Wire) {
|
|
|
55
55
|
const status = String(data.status ?? 'open');
|
|
56
56
|
return {
|
|
57
57
|
id: String(row.id),
|
|
58
|
+
externalId: text(row as Record<string, unknown>, 'external_id', 'externalId'),
|
|
59
|
+
origin: text(data, '_origin'),
|
|
58
60
|
title: text(data, 'title') ?? (typeof row.name === 'string' && row.name ? row.name : 'Untitled item'),
|
|
59
61
|
status: (STATUSES.includes(status) ? status : 'open') as CommitmentStatus,
|
|
60
62
|
dueAt: text(data, 'due_at', 'dueAt'),
|
|
@@ -34,6 +34,10 @@ export interface ValueCount { value: string | null; count: number }
|
|
|
34
34
|
/** The slice of a to-do the timeline needs; dates are as stored. */
|
|
35
35
|
export interface TimelineItem {
|
|
36
36
|
id: string;
|
|
37
|
+
/** The to-do's own `externalId`, the key the detail page opens by. */
|
|
38
|
+
externalId?: string | null;
|
|
39
|
+
/** `_origin`: who wrote the row (human, tenant-extraction, a sync...). */
|
|
40
|
+
origin?: string | null;
|
|
37
41
|
title: string;
|
|
38
42
|
status: CommitmentStatus;
|
|
39
43
|
dueAt: string | null;
|
package/src/corpus/types.ts
CHANGED
|
@@ -389,16 +389,41 @@ export interface FolderQuery {
|
|
|
389
389
|
pageSize?: number;
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
+
export interface ListDocumentsOptions {
|
|
393
|
+
/** `false`: skip the people read and return the rows alone. Default `true`. */
|
|
394
|
+
participants?: boolean;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export interface ListSourcesOptions {
|
|
398
|
+
/** Receives `source key -> document count` once the counts have been read. */
|
|
399
|
+
onCounts?: (counts: Map<string, number | null>) => void;
|
|
400
|
+
}
|
|
401
|
+
|
|
392
402
|
/**
|
|
393
403
|
* What the composers are handed. An app implements it over its own HTTP client;
|
|
394
404
|
* `createCorpusApi` in `./client` does that for the tenant `/api/v1/*` endpoints.
|
|
395
405
|
*/
|
|
396
406
|
export interface CorpusApi {
|
|
397
|
-
|
|
407
|
+
/**
|
|
408
|
+
* One page of documents. `options.participants: false` returns the rows WITHOUT
|
|
409
|
+
* resolving who is on them, so the first paint waits for one read and not for
|
|
410
|
+
* an edge read plus the party roster; pair it with `participantsFor` to fill
|
|
411
|
+
* the people in afterwards. Omitted, behaviour is unchanged.
|
|
412
|
+
*/
|
|
413
|
+
listDocuments(query: DocumentQuery, options?: ListDocumentsOptions): Promise<CorpusPage<SourceDocument>>;
|
|
414
|
+
/**
|
|
415
|
+
* The people on these records, by record id. Optional: an adapter without it
|
|
416
|
+
* simply never defers, and `listDocuments` keeps returning them inline.
|
|
417
|
+
*/
|
|
418
|
+
participantsFor?(recordIds: Array<string | number>): Promise<Map<string, PartyRef[]>>;
|
|
398
419
|
getDocument(id: string): Promise<SourceDocument>;
|
|
399
420
|
listParties(query?: { search?: string; page?: number; pageSize?: number }): Promise<CorpusPage<Party>>;
|
|
400
|
-
/**
|
|
401
|
-
|
|
421
|
+
/**
|
|
422
|
+
* Per-source freshness, for the strip at the top of the Library. With
|
|
423
|
+
* `options.onCounts` the cards come back as soon as the connections do, with
|
|
424
|
+
* `documentCount: null`, and the per-source totals arrive through the callback.
|
|
425
|
+
*/
|
|
426
|
+
listSources(options?: ListSourcesOptions): Promise<SourceFreshness[]>;
|
|
402
427
|
/**
|
|
403
428
|
* THE CHILD FOLDERS of one container, paginated (bd startsim-ei8gm.5).
|
|
404
429
|
*
|
|
@@ -884,13 +909,15 @@ export interface ResolutionClaim {
|
|
|
884
909
|
|
|
885
910
|
/** Server-side filters for the tracking surface (CLAUDE.md rule 8). */
|
|
886
911
|
/** How the tracker orders a page of to-dos; see `tracker-sort.ts`. */
|
|
887
|
-
export type CommitmentSort = 'due' | 'updated' | 'newest' | 'title' | 'owner';
|
|
912
|
+
export type CommitmentSort = 'due' | 'updated' | 'newest' | 'title' | 'owner' | 'status';
|
|
888
913
|
|
|
889
914
|
export interface CommitmentQuery {
|
|
890
915
|
/** Server-side order. Default `due`. */
|
|
891
916
|
sort?: CommitmentSort;
|
|
917
|
+
/** Flip the order of `sort`. Absent: the sort's own natural direction. */
|
|
918
|
+
sortDir?: 'asc' | 'desc';
|
|
892
919
|
status?: CommitmentStatus | CommitmentStatus[];
|
|
893
|
-
subtype?: CommitmentSubtype;
|
|
920
|
+
subtype?: CommitmentSubtype | CommitmentSubtype[];
|
|
894
921
|
owner?: string;
|
|
895
922
|
/** ISO instants over `dueAt`. */
|
|
896
923
|
dueBefore?: string;
|
|
@@ -59,7 +59,8 @@ describe('the Tandem Go tab set', () => {
|
|
|
59
59
|
const text = allText(r);
|
|
60
60
|
expect(text).toContain('Today');
|
|
61
61
|
expect(r.root.findAllByProps({ testID: 'briefing-play' }).length).toBeGreaterThan(0);
|
|
62
|
-
expect(text).toContain('Your morning brief and what is due soon.');
|
|
62
|
+
expect(text).not.toContain('Your morning brief and what is due soon.');
|
|
63
|
+
expect(text).not.toContain('Your workspace');
|
|
63
64
|
expect(r.root.findAllByProps({ testID: 'home-talk' }).length).toBeGreaterThan(0);
|
|
64
65
|
expect(r.root.findAllByProps({ testID: 'home-due-soon' }).length).toBeGreaterThan(0);
|
|
65
66
|
expect(maybeById(r, 'home-record')).toHaveLength(0);
|
|
@@ -4,6 +4,7 @@ import { Alert, Button, Header, Icon, MessageBubble, Spinner, useHaptics, useThe
|
|
|
4
4
|
import { useControllerState } from '../components/useControllerState';
|
|
5
5
|
import type { MeetingController, MeetingLine } from '../../corpus/converse/meeting';
|
|
6
6
|
import type { ConverseSource } from '../../corpus/converse/types';
|
|
7
|
+
import { converseView } from '../../corpus/converse/view';
|
|
7
8
|
import { statusLine } from './format';
|
|
8
9
|
import { SPEEDS, speedLabel, type SpeedStore } from './speed';
|
|
9
10
|
|
|
@@ -35,10 +36,7 @@ export function ConverseScreen({ controller, speed, embedded, onOpenSource }: {
|
|
|
35
36
|
const list = useRef<FlatList<MeetingLine>>(null);
|
|
36
37
|
const lines = s.lines;
|
|
37
38
|
// `micOn` is the preference (true even before anything has started): it is listening only while a conversation is running.
|
|
38
|
-
const listening
|
|
39
|
-
const thinking = s.phase === 'thinking';
|
|
40
|
-
const speaking = s.phase === 'speaking';
|
|
41
|
-
const busy = s.phase === 'ending';
|
|
39
|
+
const { listening, thinking, speaking, busy, canStop } = converseView(s);
|
|
42
40
|
// A conversation is open while the mic listens, a turn runs, or there is a thread that has not been filed (typing still works with the mic off).
|
|
43
41
|
const open = listening || thinking || speaking || s.phase === 'stopped' || (lines.length > 0 && s.phase !== 'ended' && s.phase !== 'ending');
|
|
44
42
|
const sec = useElapsed(s.phase === 'listening');
|
|
@@ -104,7 +102,7 @@ export function ConverseScreen({ controller, speed, embedded, onOpenSource }: {
|
|
|
104
102
|
{s.phase === 'ended' ? null : <Button testID="converse-end" title="Done" variant="outline" size="sm" disabled={busy} onPress={() => { haptic('warning', 'converse.end'); void controller.end(); }} />}
|
|
105
103
|
</View>
|
|
106
104
|
) : null}
|
|
107
|
-
{
|
|
105
|
+
{canStop ? (
|
|
108
106
|
<Pressable
|
|
109
107
|
testID="converse-stop"
|
|
110
108
|
accessibilityRole="button"
|
|
@@ -35,7 +35,7 @@ export function HomeScreen({ controller, brand, tagline, onTalk, onOpenPlan, bri
|
|
|
35
35
|
useEffect(() => { if (active) void controller.load(); }, [controller, active]);
|
|
36
36
|
return (
|
|
37
37
|
<View style={{ flex: 1 }}>
|
|
38
|
-
<Header large testID="home-header" title={title ?? brand} subtitle={subtitle ?? tagline} />
|
|
38
|
+
<Header large testID="home-header" title={title ?? brand} subtitle={title ? undefined : (subtitle ?? tagline)} />
|
|
39
39
|
<FlatList
|
|
40
40
|
testID="home-list"
|
|
41
41
|
data={s.arrivals}
|
package/src/native/home/tab.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { groupDue } from '../../corpus/due-groups';
|
|
3
3
|
import { isTask } from '../../corpus/tracker-groups';
|
|
4
|
-
import { dueSoonText } from '../../components/pages/home/
|
|
4
|
+
import { dueSoonText } from '../../components/pages/home/dueSoonText';
|
|
5
5
|
import type { FoundryTab } from '../components/FoundryTabsShell';
|
|
6
6
|
import type { NativeCorpusApi } from '../corpus/api';
|
|
7
7
|
import { createHomeController, type HomeController, type HomeType } from './controller';
|
|
@@ -50,7 +50,6 @@ export function homeTab({ api, brand, tagline, key = 'home', label = 'Home', typ
|
|
|
50
50
|
brand={brand}
|
|
51
51
|
tagline={tagline}
|
|
52
52
|
title={copy?.label}
|
|
53
|
-
subtitle={copy?.subtitle}
|
|
54
53
|
briefing={briefing?.()}
|
|
55
54
|
onTalk={talkKey ? () => openTab(talkKey) : undefined}
|
|
56
55
|
onOpenPlan={planKey ? () => openTab(planKey) : undefined}
|
|
@@ -66,10 +66,9 @@ function PlanBody({ opts, tracker, timeline, ctx }: { opts: PlanTabOptions; trac
|
|
|
66
66
|
|
|
67
67
|
return (
|
|
68
68
|
<View style={{ flex: 1 }} testID="plan-screen">
|
|
69
|
-
<Header large testID="plan-header" title={TAB_COPY.plan.label}
|
|
69
|
+
<Header large testID="plan-header" title={TAB_COPY.plan.label} />
|
|
70
70
|
<View style={{ paddingHorizontal: theme.layout.gutter, gap: theme.spacing.xs, paddingBottom: theme.spacing.sm }}>
|
|
71
71
|
<SegmentedControl<PlanTabKey> testID="plan-subtabs" value={sub} onChange={setSub} options={PLAN_TABS.map((t) => ({ value: t.key, label: t.label }))} />
|
|
72
|
-
<Text variant="footnote" testID="plan-subtitle">{current.subtitle}</Text>
|
|
73
72
|
</View>
|
|
74
73
|
{sub === 'todos' ? (
|
|
75
74
|
<TrackerBody api={api} controller={tracker} todoId={null} onOpen={openTodo} onBack={ctx.back} notesKey={notesKey} openTab={ctx.openTab} memberConnections={memberConnections} openUrl={openUrl} embedded />
|
|
@@ -14,13 +14,13 @@ const has = (r: ReturnType<typeof render>, id: string) => r.root.findAllByProps(
|
|
|
14
14
|
const mount = (c: TabContext) => render(<>{planTab({ api: createFakeNativeCorpusApi() }).render(c)}</>);
|
|
15
15
|
|
|
16
16
|
describe('Plan tab', () => {
|
|
17
|
-
it('is one tab with the three sub-tabs
|
|
17
|
+
it('is one tab with the three sub-tabs with no subtitle lines', async () => {
|
|
18
18
|
const r = mount(ctx());
|
|
19
19
|
await tick();
|
|
20
20
|
const text = allText(r);
|
|
21
|
-
expect(text).toContain(TAB_COPY.plan.subtitle);
|
|
21
|
+
expect(text).not.toContain(TAB_COPY.plan.subtitle);
|
|
22
22
|
for (const t of PLAN_TABS) expect(text).toContain(t.label);
|
|
23
|
-
expect(allText(r)).toContain(PLAN_TABS[0].subtitle);
|
|
23
|
+
expect(allText(r)).not.toContain(PLAN_TABS[0].subtitle);
|
|
24
24
|
for (const t of PLAN_TABS) expect(has(r, `plan-subtabs-${t.key}`)).toBe(true);
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -38,12 +38,12 @@ describe('Plan tab', () => {
|
|
|
38
38
|
it('a launch route names the sub-tab: Timeline shows its chart range and table, Projects its list and a New project button', async () => {
|
|
39
39
|
const t = mount(ctx({ route: { id: 'timeline' } }));
|
|
40
40
|
await tick();
|
|
41
|
-
expect(allText(t)).toContain(PLAN_TABS[1].subtitle);
|
|
41
|
+
expect(allText(t)).not.toContain(PLAN_TABS[1].subtitle);
|
|
42
42
|
expect(has(t, 'timeline-screen')).toBe(true);
|
|
43
43
|
expect(has(t, 'timeline-range-30')).toBe(true);
|
|
44
44
|
const p = mount(ctx({ route: { id: 'projects' } }));
|
|
45
45
|
await tick();
|
|
46
|
-
expect(allText(p)).toContain(PLAN_TABS[2].subtitle);
|
|
46
|
+
expect(allText(p)).not.toContain(PLAN_TABS[2].subtitle);
|
|
47
47
|
expect(has(p, 'planning-list')).toBe(true);
|
|
48
48
|
expect(has(p, 'project-new')).toBe(true);
|
|
49
49
|
});
|
|
@@ -31,7 +31,7 @@ function TalkBody({ opts, ctx }: { opts: TalkTabOptions; ctx: TabContext }) {
|
|
|
31
31
|
const ask = useMemo(() => (converse ? null : createAskController({ api: api.ask, scope: api.scope, listProjects: async () => (await api.corpus.listFocusChoices?.()) ?? [] })), [api, converse]);
|
|
32
32
|
return (
|
|
33
33
|
<View style={{ flex: 1 }} testID="talk-screen">
|
|
34
|
-
<Header large testID="talk-header" title={TAB_COPY.talk.label}
|
|
34
|
+
<Header large testID="talk-header" title={TAB_COPY.talk.label} />
|
|
35
35
|
{/* ONE conversation: notes, questions, to-dos and the relay all go through the same thread, no modes. */}
|
|
36
36
|
{converse ? (
|
|
37
37
|
<ConverseScreen
|
|
@@ -26,7 +26,7 @@ describe('Talk tab', () => {
|
|
|
26
26
|
const { controller } = idleMeeting();
|
|
27
27
|
const r = render(<>{talkTab({ api: createFakeNativeCorpusApi(), converse: controller }).render(ctx())}</>);
|
|
28
28
|
await tick();
|
|
29
|
-
expect(allText(r)).toContain(TAB_COPY.talk.subtitle);
|
|
29
|
+
expect(allText(r)).not.toContain(TAB_COPY.talk.subtitle); // subtitles are banned
|
|
30
30
|
expect(has(r, 'converse-input')).toBe(true);
|
|
31
31
|
expect(has(r, 'converse-mic')).toBe(true);
|
|
32
32
|
expect(has(r, 'converse-talk')).toBe(false);
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Today with "Needs your call" (bd startsim-tmrvi.7): an answer moves its to-do into the due-soon line
|
|
3
|
-
* straight away, and a failed save puts everything back. Today draws no to-do rows of its own.
|
|
4
|
-
*/
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import userEvent from '@testing-library/user-event';
|
|
8
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
9
|
-
|
|
10
|
-
import { HomeBriefPage } from '../components/pages/home';
|
|
11
|
-
import type { NeedsYourCallApi } from '../components/pages/questions';
|
|
12
|
-
import type { BriefingResult } from '../corpus/briefing';
|
|
13
|
-
import type { OpenQuestion } from '../corpus/questions';
|
|
14
|
-
import type { Commitment, CommitmentApi, CorpusApi } from '../corpus/types';
|
|
15
|
-
|
|
16
|
-
const NOW = Date.parse('2026-11-06T17:00:00Z');
|
|
17
|
-
const RESULT = { briefingId: 'b1', text: 'Good morning.', audioUrl: null, items: [], remaining: 0, context: { itemIds: [], localDate: '2026-11-06', timeZone: 'UTC', offsets: [] }, scriptSource: 'template', cached: true, ms: 1 } as unknown as BriefingResult;
|
|
18
|
-
|
|
19
|
-
function item(id: string, over: Partial<Commitment> = {}): Commitment {
|
|
20
|
-
return {
|
|
21
|
-
id, externalId: `commit:${id}`, dedupeKey: id, subtype: 'action', title: id, detail: '', status: 'open', subjectKey: '', actionKey: '',
|
|
22
|
-
mentions: [], firstSeenAt: null, lastSeenAt: null, extractorVersion: 't', source: 'granola', sourceLabel: 'G', scope: { orgId: 'o' }, ...over,
|
|
23
|
-
} as Commitment;
|
|
24
|
-
}
|
|
25
|
-
const corpus = (): CorpusApi & CommitmentApi => ({
|
|
26
|
-
async listCommitments() { return { count: 1, next: null, previous: null, results: [item('Send the term sheet', { dueAt: '2026-11-30' })] }; },
|
|
27
|
-
async listDocuments() { return { count: 0, next: null, previous: null, results: [] }; },
|
|
28
|
-
}) as unknown as CorpusApi & CommitmentApi;
|
|
29
|
-
|
|
30
|
-
const QUESTION: OpenQuestion = {
|
|
31
|
-
id: 'q1', itemId: 'Send the term sheet', kind: 'due_date', question: 'Is next Friday right?', status: 'open', score: 80,
|
|
32
|
-
assumed: { value: '2026-11-30', confidence: 0.4, reason: '' }, candidates: [{ value: '2026-11-09', confidence: 0.3, reason: '' }],
|
|
33
|
-
ownerSub: 'u1', createdAt: '', updatedAt: '',
|
|
34
|
-
};
|
|
35
|
-
const questions = (answer: NeedsYourCallApi['answer']): NeedsYourCallApi => ({ list: async () => [QUESTION], answer, skip: async () => undefined });
|
|
36
|
-
const page = (api: NeedsYourCallApi) => <HomeBriefPage brief={{ fetch: async () => RESULT }} corpus={corpus()} now={NOW} timeZone="UTC" questions={api} />;
|
|
37
|
-
|
|
38
|
-
describe('Today: Needs your call', () => {
|
|
39
|
-
it('draws no to-do rows, only the due-soon line', async () => {
|
|
40
|
-
render(page(questions(async () => undefined)));
|
|
41
|
-
expect(await screen.findByTestId('due-soon')).toHaveTextContent('Nothing is due soon.');
|
|
42
|
-
expect(screen.queryByTestId('item-row')).toBeNull();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('moves the to-do into the due-soon line at once', async () => {
|
|
46
|
-
render(page(questions(async () => undefined)));
|
|
47
|
-
await screen.findByText('Is next Friday right?');
|
|
48
|
-
await userEvent.click(screen.getByRole('button', { name: /^Mon, Nov 9$/ }));
|
|
49
|
-
expect(await screen.findByText('1 due this week')).toBeInTheDocument();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('puts the date back when the save fails', async () => {
|
|
53
|
-
render(page(questions(async () => { throw new Error('boom'); })));
|
|
54
|
-
await screen.findByText('Is next Friday right?');
|
|
55
|
-
await userEvent.click(screen.getByRole('button', { name: /^Mon, Nov 9$/ }));
|
|
56
|
-
expect(await screen.findByRole('alert')).toBeInTheDocument();
|
|
57
|
-
expect(screen.getByTestId('due-soon')).toHaveTextContent('Nothing is due soon.');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('shows no section without a questions api', async () => {
|
|
61
|
-
render(<HomeBriefPage brief={{ fetch: async () => RESULT }} corpus={corpus()} now={NOW} timeZone="UTC" />);
|
|
62
|
-
await screen.findByTestId('due-soon');
|
|
63
|
-
expect(screen.queryByTestId('needs-your-call')).toBeNull();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* THE BOARD VIEW: what is owed, one column per status (Open, In progress,
|
|
3
|
-
* Blocked). The same rows, filters and sort as the list; only the layout
|
|
4
|
-
* differs. Each card is the shared `CompactItemRow`, so the two views cannot
|
|
5
|
-
* disagree about what a row says.
|
|
6
|
-
*/
|
|
7
|
-
import * as React from 'react';
|
|
8
|
-
|
|
9
|
-
import { compareCommitments } from '../../../corpus/tracker-sort';
|
|
10
|
-
import type { TrackerEntry } from '../../../corpus/tracker-groups';
|
|
11
|
-
import type { CommitmentSort } from '../../../corpus/types';
|
|
12
|
-
|
|
13
|
-
export const BOARD_COLUMNS = [
|
|
14
|
-
{ status: 'open', label: 'Open' },
|
|
15
|
-
{ status: 'in_progress', label: 'In progress' },
|
|
16
|
-
{ status: 'blocked', label: 'Blocked' },
|
|
17
|
-
] as const;
|
|
18
|
-
|
|
19
|
-
export function TrackerBoard({
|
|
20
|
-
entries, sort, renderRow, headingClassName, mutedClassName,
|
|
21
|
-
}: {
|
|
22
|
-
entries: TrackerEntry[];
|
|
23
|
-
sort: CommitmentSort;
|
|
24
|
-
renderRow: (entry: TrackerEntry) => React.ReactNode;
|
|
25
|
-
headingClassName: string;
|
|
26
|
-
mutedClassName: string;
|
|
27
|
-
}) {
|
|
28
|
-
const compare = React.useMemo(() => compareCommitments(sort), [sort]);
|
|
29
|
-
const columns = BOARD_COLUMNS.map((col) => ({
|
|
30
|
-
...col,
|
|
31
|
-
entries: entries.filter((e) => e.item.status === col.status).sort((a, b) => compare(a.item, b.item)),
|
|
32
|
-
}));
|
|
33
|
-
return (
|
|
34
|
-
<div className="grid gap-4 md:grid-cols-3" data-testid="tracker-board">
|
|
35
|
-
{columns.map((col) => (
|
|
36
|
-
<section key={col.status} aria-label={`${col.label} column`} className="min-w-0 space-y-1 rounded-lg bg-gray-50 p-3">
|
|
37
|
-
<h2 className={`flex items-baseline gap-2 ${headingClassName}`}>
|
|
38
|
-
{col.label} <span className="text-sm font-normal text-gray-500">{col.entries.length}</span>
|
|
39
|
-
</h2>
|
|
40
|
-
{col.entries.length ? <ul>{col.entries.map(renderRow)}</ul> : <p className={mutedClassName}>Nothing here.</p>}
|
|
41
|
-
</section>
|
|
42
|
-
))}
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sort and view controls for the tracker. Presentational: the page owns both
|
|
3
|
-
* values, and the sort is a SERVER parameter (so it re-reads page one).
|
|
4
|
-
*/
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
|
|
7
|
-
import { TRACKER_SORTS } from '../../../corpus/tracker-sort';
|
|
8
|
-
import type { CommitmentSort } from '../../../corpus/types';
|
|
9
|
-
|
|
10
|
-
export type TrackerView = 'list' | 'board';
|
|
11
|
-
|
|
12
|
-
const VIEWS: Array<[TrackerView, string]> = [['list', 'List'], ['board', 'Board']];
|
|
13
|
-
|
|
14
|
-
export function TrackerToolbar({
|
|
15
|
-
sort, onSort, view, onView, inputClassName,
|
|
16
|
-
}: {
|
|
17
|
-
sort: CommitmentSort;
|
|
18
|
-
onSort: (sort: CommitmentSort) => void;
|
|
19
|
-
view: TrackerView;
|
|
20
|
-
onView: (view: TrackerView) => void;
|
|
21
|
-
inputClassName: string;
|
|
22
|
-
}) {
|
|
23
|
-
return (
|
|
24
|
-
<div className="flex flex-wrap items-center gap-3">
|
|
25
|
-
<label className="flex items-center gap-2 text-xs text-gray-600">
|
|
26
|
-
Sort
|
|
27
|
-
<select
|
|
28
|
-
className={inputClassName} value={sort} aria-label="Sort to-dos"
|
|
29
|
-
onChange={(e) => onSort(e.target.value as CommitmentSort)}
|
|
30
|
-
>
|
|
31
|
-
{TRACKER_SORTS.map((s) => <option key={s.key} value={s.key}>{s.label}</option>)}
|
|
32
|
-
</select>
|
|
33
|
-
</label>
|
|
34
|
-
<div className="ml-auto flex overflow-hidden rounded-md border border-gray-300" role="group" aria-label="View">
|
|
35
|
-
{VIEWS.map(([key, label]) => (
|
|
36
|
-
<button
|
|
37
|
-
key={key} type="button" aria-pressed={view === key} onClick={() => onView(key)}
|
|
38
|
-
className={`px-3 py-1 text-xs ${view === key ? 'bg-gray-900 text-white' : 'text-gray-700'}`}
|
|
39
|
-
>{label}</button>
|
|
40
|
-
))}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}
|