@startsimpli/integrations 0.2.133 → 0.2.135
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 +1 -1
- package/src/__tests__/corpus-planning.test.tsx +13 -3
- package/src/__tests__/corpus-tracker.test.tsx +53 -69
- package/src/__tests__/focus-standings.test.tsx +3 -1
- package/src/__tests__/home-brief.test.tsx +84 -0
- package/src/__tests__/project-surfaces.test.tsx +1 -1
- package/src/__tests__/work-groups.test.ts +181 -0
- package/src/components/index.ts +1 -0
- package/src/components/pages/ConnectionsPage.tsx +7 -1402
- package/src/components/pages/PlanningPage.tsx +129 -67
- package/src/components/pages/TrackerPage.tsx +174 -149
- package/src/components/pages/connections/CapabilityPicker.tsx +75 -0
- package/src/components/pages/connections/CatalogCard.tsx +300 -0
- package/src/components/pages/connections/ConnectionCard.tsx +489 -0
- package/src/components/pages/connections/ConnectionForms.tsx +215 -0
- package/src/components/pages/connections/MemberPolicyToggle.tsx +106 -0
- package/src/components/pages/connections/bound-api.ts +175 -0
- package/src/components/pages/connections/copy.ts +74 -0
- package/src/components/pages/home/BriefCard.tsx +84 -0
- package/src/components/pages/home/CompactItemRow.tsx +61 -0
- package/src/components/pages/home/DueAcrossProjects.tsx +74 -0
- package/src/components/pages/home/HomeBriefPage.tsx +112 -0
- package/src/components/pages/home/RecentNotes.tsx +69 -0
- package/src/components/pages/home/index.ts +10 -0
- package/src/components/pages/home/useProjectNames.ts +23 -0
- package/src/components/pages/work-items.tsx +15 -9
- package/src/corpus/due-groups.ts +81 -0
- package/src/corpus/focus-overview.ts +54 -0
- package/src/corpus/index.ts +10 -0
- package/src/corpus/note-actions.ts +44 -0
- package/src/corpus/tracker-groups.ts +84 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TRACKER LIST: the day-to-day shape of what is owed (bd startsim-u57lr).
|
|
3
|
+
*
|
|
4
|
+
* Today overdue, or due today (an overdue in-progress item is here, once)
|
|
5
|
+
* In progress started, nothing forcing it today
|
|
6
|
+
* Up next due in the next 7 days
|
|
7
|
+
* Later due after that, or undated and recently touched
|
|
8
|
+
* Stale undated and untouched for 90+ days: hidden behind a fold
|
|
9
|
+
* Done finished (done / dropped)
|
|
10
|
+
* Statements meeting statements (decisions, needs, risks, questions) with no
|
|
11
|
+
* owner: evidence, not tasks, so they are not on the list
|
|
12
|
+
*
|
|
13
|
+
* PURE. Same clock and zone rules as `groupDue`. An item with a due date is never
|
|
14
|
+
* stale: somebody stated a date, so it is owed until it is closed or re-dated.
|
|
15
|
+
*/
|
|
16
|
+
import { daysBetween, WEEK_DAYS } from './due-groups';
|
|
17
|
+
import { dueDay, localDate } from './today';
|
|
18
|
+
import type { Commitment } from './types';
|
|
19
|
+
|
|
20
|
+
/** Subtypes that are things to do. The rest are what was said in the meeting. */
|
|
21
|
+
const TASK_SUBTYPES = new Set(['action', 'requirement']);
|
|
22
|
+
export const STALE_DAYS = 90;
|
|
23
|
+
const FINISHED = new Set(['done', 'dropped']);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A task, or a statement that has become one because somebody owns it AND it
|
|
27
|
+
* has a date. "We decided X" is not a to-do; "Dana to settle X by Friday" is.
|
|
28
|
+
*/
|
|
29
|
+
export function isTask(item: Pick<Commitment, 'subtype' | 'ownerName' | 'ownerSub' | 'dueAt'>): boolean {
|
|
30
|
+
if (TASK_SUBTYPES.has(item.subtype)) return true;
|
|
31
|
+
return Boolean((item.ownerName || item.ownerSub) && item.dueAt);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface TrackerEntry<T = Commitment> { item: T; due: string | null; days: number | null }
|
|
35
|
+
|
|
36
|
+
export interface TrackerGroups<T = Commitment> {
|
|
37
|
+
today: TrackerEntry<T>[];
|
|
38
|
+
inProgress: TrackerEntry<T>[];
|
|
39
|
+
upNext: TrackerEntry<T>[];
|
|
40
|
+
later: TrackerEntry<T>[];
|
|
41
|
+
stale: TrackerEntry<T>[];
|
|
42
|
+
done: TrackerEntry<T>[];
|
|
43
|
+
statements: TrackerEntry<T>[];
|
|
44
|
+
counts: Record<'today' | 'inProgress' | 'upNext' | 'later' | 'stale' | 'done' | 'statements', number>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type Row = Pick<Commitment, 'status' | 'dueAt' | 'subtype' | 'ownerName' | 'ownerSub' | 'lastSeenAt' | 'firstSeenAt' | 'resolvedAt'>
|
|
48
|
+
& { priority?: number };
|
|
49
|
+
|
|
50
|
+
export function groupTracker<T extends Row>(
|
|
51
|
+
items: T[],
|
|
52
|
+
options: { now: number; timeZone?: string; staleDays?: number },
|
|
53
|
+
): TrackerGroups<T> {
|
|
54
|
+
const timeZone = options.timeZone ?? 'UTC';
|
|
55
|
+
const today = localDate(options.now, timeZone);
|
|
56
|
+
const staleDays = options.staleDays ?? STALE_DAYS;
|
|
57
|
+
const out: TrackerGroups<T> = {
|
|
58
|
+
today: [], inProgress: [], upNext: [], later: [], stale: [], done: [], statements: [],
|
|
59
|
+
counts: { today: 0, inProgress: 0, upNext: 0, later: 0, stale: 0, done: 0, statements: 0 },
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
for (const item of items) {
|
|
63
|
+
const due = dueDay(item.dueAt, timeZone);
|
|
64
|
+
const days = due ? daysBetween(today, due) : null;
|
|
65
|
+
const entry: TrackerEntry<T> = { item, due, days };
|
|
66
|
+
if (FINISHED.has(item.status)) { out.done.push(entry); continue; }
|
|
67
|
+
if (!isTask(item)) { out.statements.push(entry); continue; }
|
|
68
|
+
if (days !== null && days <= 0) { out.today.push(entry); continue; }
|
|
69
|
+
if (item.status === 'in_progress') { out.inProgress.push(entry); continue; }
|
|
70
|
+
if (days !== null) { (days <= WEEK_DAYS ? out.upNext : out.later).push(entry); continue; }
|
|
71
|
+
const touched = Date.parse(item.lastSeenAt ?? item.firstSeenAt ?? '');
|
|
72
|
+
const idle = Number.isNaN(touched) ? 0 : (options.now - touched) / 86_400_000;
|
|
73
|
+
(idle >= staleDays ? out.stale : out.later).push(entry);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const dated = (a: TrackerEntry<T>, b: TrackerEntry<T>) =>
|
|
77
|
+
(a.due ?? '9999').localeCompare(b.due ?? '9999') || (a.item.priority ?? 99) - (b.item.priority ?? 99);
|
|
78
|
+
const recent = (a: TrackerEntry<T>, b: TrackerEntry<T>) =>
|
|
79
|
+
(b.item.resolvedAt ?? b.item.lastSeenAt ?? '').localeCompare(a.item.resolvedAt ?? a.item.lastSeenAt ?? '');
|
|
80
|
+
for (const key of ['today', 'inProgress', 'upNext', 'later', 'stale', 'statements'] as const) out[key].sort(dated);
|
|
81
|
+
out.done.sort(recent);
|
|
82
|
+
for (const key of Object.keys(out.counts) as Array<keyof TrackerGroups['counts']>) out.counts[key] = out[key].length;
|
|
83
|
+
return out;
|
|
84
|
+
}
|