@startsimpli/integrations 0.2.190 → 0.2.191
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startsimpli/integrations",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.191",
|
|
4
4
|
"description": "Provider-agnostic types, API clients, hooks, and UI primitives for email + calendar integrations across StartSimpli apps, plus foundry customer email (subpath ./comms).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://startsimpli.com",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"@startsimpli/ui-native": ">=0.1.12",
|
|
52
52
|
"react-native-safe-area-context": ">=4.0.0",
|
|
53
53
|
"@startsimpli/auth": "^0.4.53",
|
|
54
|
-
"@startsimpli/
|
|
55
|
-
"@startsimpli/
|
|
54
|
+
"@startsimpli/ui": "^0.4.188",
|
|
55
|
+
"@startsimpli/utils": "^0.4.20"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"react": {
|
|
@@ -99,10 +99,10 @@
|
|
|
99
99
|
"react-native": "0.85.3",
|
|
100
100
|
"react-native-safe-area-context": "~5.7.0",
|
|
101
101
|
"@startsimpli/llm": "0.4.31",
|
|
102
|
-
"@startsimpli/ui": "0.4.
|
|
103
|
-
"@startsimpli/
|
|
102
|
+
"@startsimpli/ui": "0.4.188",
|
|
103
|
+
"@startsimpli/utils": "0.4.20",
|
|
104
104
|
"@startsimpli/auth": "0.4.53",
|
|
105
|
-
"@startsimpli/
|
|
105
|
+
"@startsimpli/ui-native": "0.1.15"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
108
|
"type-check": "tsc --noEmit && tsc --noEmit -p tsconfig.native.json",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { OverviewPage } from '../components/pages/overview/OverviewPage';
|
|
5
|
+
|
|
6
|
+
const page = <T,>(results: T[]) => ({ count: results.length, next: null, previous: null, results });
|
|
7
|
+
const people = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
|
|
8
|
+
const api = {
|
|
9
|
+
listFocuses: async () => page([{ id: 'f1', title: 'Alpha', status: 'active' }]),
|
|
10
|
+
listCommitments: async () => page(people.map((n, i) => ({ id: String(i), externalId: `c${i}`, title: `task ${n}`, status: 'open', ownerName: n, focusId: 'f1', mentions: [], dueAt: null, lastSeenAt: null }))),
|
|
11
|
+
} as never;
|
|
12
|
+
|
|
13
|
+
describe('OverviewPage with many people', () => {
|
|
14
|
+
it('shows a few columns plus Others, and every person still has a chip', async () => {
|
|
15
|
+
render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
|
|
16
|
+
await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
|
|
17
|
+
expect(screen.getAllByRole('columnheader').map((h) => h.textContent)).toEqual(['Project', 'A', 'B', 'C', 'D', 'E', 'Others (3)', 'Last activity']);
|
|
18
|
+
for (const n of people) expect(screen.getByRole('button', { name: new RegExp(`^${n} · 1$`) })).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -39,3 +39,14 @@ describe('buildOverview', () => {
|
|
|
39
39
|
expect(o.rows[0].cells.x.next?.id).toBe('3');
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
|
+
|
|
43
|
+
describe('buildOverview pointer fallback', () => {
|
|
44
|
+
it('files an item under the project its external_focus_id names when there is no link, and ignores a pointer to nothing', () => {
|
|
45
|
+
const o = buildOverview(
|
|
46
|
+
[focus('f1', 'Alpha')],
|
|
47
|
+
[item('1', { externalFocusId: 'f1' } as never), item('2', { externalFocusId: 'gone' } as never), item('3', { focusId: 'f1', externalFocusId: 'other' } as never)],
|
|
48
|
+
);
|
|
49
|
+
expect(o.rows.find((r) => r.id === 'f1')?.open).toBe(2);
|
|
50
|
+
expect(o.rows.find((r) => r.id === NO_PROJECT)?.open).toBe(1);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -27,6 +27,8 @@ const STATUS: Record<string, { label: string; cls: string }> = {
|
|
|
27
27
|
draft: { label: 'Draft', cls: 'bg-gray-100 text-gray-700' },
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const OTHERS = '__others__';
|
|
31
|
+
|
|
30
32
|
async function readAll<T>(read: (page: number) => Promise<{ results: T[]; next: string | null }>, maxPages = 20): Promise<T[]> {
|
|
31
33
|
const out: T[] = [];
|
|
32
34
|
for (let page = 1; page <= maxPages; page++) {
|
|
@@ -64,7 +66,19 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
64
66
|
|
|
65
67
|
// Nobody owns anything yet (e.g. every item is unassigned): one plain "Open" column, and no Waiting-on filter that would filter nothing.
|
|
66
68
|
const onlyUnassigned = overview.columns.length === 1 && overview.columns[0].key === '';
|
|
67
|
-
const
|
|
69
|
+
const people = onlyUnassigned ? [{ ...overview.columns[0], label: 'Open' }] : overview.columns;
|
|
70
|
+
// Many people would make a grid nobody can read: show the first few as columns and fold the rest into one "Others" column
|
|
71
|
+
// (the Waiting-on chips above still list everyone, and a chip filters to that person).
|
|
72
|
+
const MAX_COLUMNS = 5;
|
|
73
|
+
const hidden = people.length > MAX_COLUMNS + 1 ? people.slice(MAX_COLUMNS) : [];
|
|
74
|
+
const cols = hidden.length ? [...people.slice(0, MAX_COLUMNS), { key: OTHERS, label: `Others (${hidden.length})`, total: hidden.reduce((n, c) => n + c.total, 0), isMe: false }] : people;
|
|
75
|
+
const cellOf = (r: OverviewRow, key: string) => {
|
|
76
|
+
if (key !== OTHERS) return r.cells[key];
|
|
77
|
+
const parts = hidden.map((c) => r.cells[c.key]).filter(Boolean);
|
|
78
|
+
if (!parts.length) return undefined;
|
|
79
|
+
const next = parts.map((c) => c.next).filter((x): x is NonNullable<typeof x> => !!x)[0] ?? null;
|
|
80
|
+
return { count: parts.reduce((n, c) => n + c.count, 0), next };
|
|
81
|
+
};
|
|
68
82
|
const filtered = who === null ? overview.rows : overview.rows.filter((r) => r.cells[who]);
|
|
69
83
|
// Projects with nothing open would bury the ones that matter at real volumes: fold them under one line.
|
|
70
84
|
const rows = filtered.filter((r) => r.open > 0);
|
|
@@ -78,7 +92,7 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
78
92
|
{onlyUnassigned ? null : <div className="flex flex-wrap items-center gap-2" role="group" aria-label="Waiting on">
|
|
79
93
|
<span className="text-sm font-medium text-gray-600">Waiting on</span>
|
|
80
94
|
<Chip active={who === null} onClick={() => setWho(null)}>Everyone · {overview.columns.reduce((a, c) => a + c.total, 0)}</Chip>
|
|
81
|
-
{
|
|
95
|
+
{people.map((c) => (
|
|
82
96
|
<Chip key={c.key || 'unassigned'} active={who === c.key} onClick={() => setWho(who === c.key ? null : c.key)}>{c.label} · {c.total}</Chip>
|
|
83
97
|
))}
|
|
84
98
|
</div>}
|
|
@@ -103,11 +117,11 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
103
117
|
</div>
|
|
104
118
|
</th>
|
|
105
119
|
{cols.map((c) => {
|
|
106
|
-
const cell = r
|
|
120
|
+
const cell = cellOf(r, c.key);
|
|
107
121
|
return (
|
|
108
122
|
<td key={c.key || 'unassigned'} className="px-4 py-3 text-gray-700">
|
|
109
123
|
{cell ? (
|
|
110
|
-
<button type="button" onClick={() => open(r, c.key)} className="text-left hover:underline" aria-label={`${r.title}, ${c.label}: ${cell.count} open`}>
|
|
124
|
+
<button type="button" onClick={() => open(r, c.key === OTHERS ? undefined : c.key)} className="text-left hover:underline" aria-label={`${r.title}, ${c.label}: ${cell.count} open`}>
|
|
111
125
|
<b className="text-gray-900">{cell.count}</b> <span className="text-gray-600">{cell.next?.title}</span>
|
|
112
126
|
</button>
|
|
113
127
|
) : <span className="text-gray-300">–</span>}
|
|
@@ -129,8 +143,8 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
129
143
|
{r.focus && STATUS[r.focus.status] ? <span className={`rounded-full px-2 py-0.5 text-xs ${STATUS[r.focus.status].cls}`}>{STATUS[r.focus.status].label}</span> : null}
|
|
130
144
|
</div>
|
|
131
145
|
<div className="mt-2 flex flex-wrap gap-1.5 text-xs">
|
|
132
|
-
{cols.filter((c) => r
|
|
133
|
-
<button key={c.key || 'unassigned'} type="button" onClick={() => open(r, c.key)} className="rounded-md bg-gray-100 px-2 py-1 text-gray-800">{c.label} {r
|
|
146
|
+
{cols.filter((c) => cellOf(r, c.key)).map((c) => (
|
|
147
|
+
<button key={c.key || 'unassigned'} type="button" onClick={() => open(r, c.key === OTHERS ? undefined : c.key)} className="rounded-md bg-gray-100 px-2 py-1 text-gray-800">{c.label} {cellOf(r, c.key)?.count}</button>
|
|
134
148
|
))}
|
|
135
149
|
</div>
|
|
136
150
|
</li>
|
package/src/corpus/entities.ts
CHANGED
|
@@ -725,6 +725,7 @@ export function toCommitment(
|
|
|
725
725
|
? { resolvedBy: asText(pick(data, 'resolved_by', 'resolvedBy')) } : {}),
|
|
726
726
|
resolvedAt: asIso(pick(data, 'resolved_at', 'resolvedAt')),
|
|
727
727
|
...(pick(data, 'owner_name', 'ownerName') ? { ownerName: asText(pick(data, 'owner_name', 'ownerName')) } : {}),
|
|
728
|
+
...(pick(data, 'external_focus_id', 'externalFocusId') ? { externalFocusId: asText(pick(data, 'external_focus_id', 'externalFocusId')) } : {}),
|
|
728
729
|
...(pick(data, 'subject') ? { subject: asText(pick(data, 'subject')) } : {}),
|
|
729
730
|
subjectKey: asText(pick(data, 'subject_key', 'subjectKey')),
|
|
730
731
|
actionKey: asText(pick(data, 'action_key', 'actionKey')),
|
package/src/corpus/overview.ts
CHANGED
|
@@ -56,9 +56,12 @@ export function buildOverview(focuses: Focus[], items: Array<Commitment & { focu
|
|
|
56
56
|
const now = opts.now ?? Date.now();
|
|
57
57
|
const me = new Set((opts.meNames ?? []).map(norm).filter(Boolean));
|
|
58
58
|
const open = items.filter((c) => OPEN.has(c.status));
|
|
59
|
+
const known = new Set(focuses.map((f) => f.id));
|
|
59
60
|
const byFocus = new Map<string, Commitment[]>();
|
|
60
61
|
for (const c of open) {
|
|
61
|
-
|
|
62
|
+
// The project comes from the in_focus link; where extraction wrote only the pointer on the row (external_focus_id), use that
|
|
63
|
+
// when it names a real project, so such items are not all lumped under "No project". Read-side only: nothing is written.
|
|
64
|
+
const id = c.focusId || (c.externalFocusId && known.has(c.externalFocusId) ? c.externalFocusId : '') || NO_PROJECT;
|
|
62
65
|
byFocus.set(id, [...(byFocus.get(id) ?? []), c]);
|
|
63
66
|
}
|
|
64
67
|
const live = focuses.filter((f) => f.status !== 'completed' && f.status !== 'cancelled');
|