@startsimpli/integrations 0.2.194 → 0.2.196
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 +4 -4
- package/src/__tests__/converse-page.test.tsx +8 -0
- package/src/__tests__/corpus-pages.test.tsx +2 -2
- package/src/__tests__/decisions-page.test.tsx +1 -1
- package/src/__tests__/load-error.test.tsx +46 -0
- package/src/components/LoadError.tsx +21 -0
- package/src/components/index.ts +1 -0
- package/src/components/pages/ConnectionsPage.tsx +6 -1
- package/src/components/pages/ConversePage.tsx +11 -3
- package/src/components/pages/DecisionsPage.tsx +13 -5
- package/src/components/pages/LibraryPage.tsx +18 -6
- package/src/components/pages/TrackerPage.tsx +10 -2
- package/src/components/pages/connections/ConnectionCard.tsx +10 -6
- package/src/components/pages/overview/OverviewPage.tsx +4 -2
- package/src/components/pages/plan/TimelinePage.tsx +1 -1
- package/src/components/pages/tracker/TrackerTimeline.tsx +9 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startsimpli/integrations",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.196",
|
|
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",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"react-native": ">=0.74.0",
|
|
51
51
|
"@startsimpli/ui-native": ">=0.1.12",
|
|
52
52
|
"react-native-safe-area-context": ">=4.0.0",
|
|
53
|
+
"@startsimpli/ui": "^0.4.190",
|
|
53
54
|
"@startsimpli/auth": "^0.4.53",
|
|
54
|
-
"@startsimpli/utils": "^0.4.20"
|
|
55
|
-
"@startsimpli/ui": "^0.4.189"
|
|
55
|
+
"@startsimpli/utils": "^0.4.20"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"react": {
|
|
@@ -99,8 +99,8 @@
|
|
|
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.190",
|
|
102
103
|
"@startsimpli/ui-native": "0.1.15",
|
|
103
|
-
"@startsimpli/ui": "0.4.189",
|
|
104
104
|
"@startsimpli/auth": "0.4.53",
|
|
105
105
|
"@startsimpli/utils": "0.4.20"
|
|
106
106
|
},
|
|
@@ -52,6 +52,14 @@ const type = (text: string) => {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
describe('the one converse screen', () => {
|
|
55
|
+
it('an empty thread offers a few things to say, and tapping one fills the input; Done is a real button', () => {
|
|
56
|
+
setup();
|
|
57
|
+
const hint = screen.getByTestId('converse-suggestions');
|
|
58
|
+
fireEvent.click(within(hint).getByRole('button', { name: 'What is due today?' }));
|
|
59
|
+
expect((screen.getByLabelText('Type a message') as HTMLInputElement).value).toBe('What is due today?');
|
|
60
|
+
expect(screen.getByRole('button', { name: 'Done' }).className).toContain('border');
|
|
61
|
+
});
|
|
62
|
+
|
|
55
63
|
it('has an input, a small mic and Send, and no Talk/Ask toggle and no start button', () => {
|
|
56
64
|
setup();
|
|
57
65
|
expect(screen.getByLabelText('Type a message')).toBeTruthy();
|
|
@@ -144,7 +144,7 @@ describe('LibraryPage — filtering and paging are SERVER round trips', () => {
|
|
|
144
144
|
});
|
|
145
145
|
render(<LibraryPage api={api} scope={SCOPE} />);
|
|
146
146
|
|
|
147
|
-
await screen.findByText('
|
|
147
|
+
await screen.findByText('All documents');
|
|
148
148
|
await user.type(screen.getByRole('searchbox'), 'renewal');
|
|
149
149
|
await user.click(screen.getByRole('button', { name: 'Search' }));
|
|
150
150
|
|
|
@@ -208,7 +208,7 @@ describe('LibraryPage — filtering and paging are SERVER round trips', () => {
|
|
|
208
208
|
};
|
|
209
209
|
render(<LibraryPage api={api} scope={SCOPE} />);
|
|
210
210
|
|
|
211
|
-
await screen.findByText('
|
|
211
|
+
await screen.findByText('All documents');
|
|
212
212
|
await user.type(screen.getByRole('searchbox'), 'renewal');
|
|
213
213
|
await user.click(screen.getByRole('button', { name: 'Search' }));
|
|
214
214
|
|
|
@@ -38,7 +38,7 @@ describe('DecisionsPage', () => {
|
|
|
38
38
|
const c = client({ pending: vi.fn(async () => []) });
|
|
39
39
|
render(<DecisionsPage client={c} />);
|
|
40
40
|
await screen.findByTestId('decisions-empty');
|
|
41
|
-
fireEvent.click(await screen.findByLabelText(/
|
|
41
|
+
fireEvent.click(await screen.findByLabelText(/notify me on my phone/i));
|
|
42
42
|
expect(c.setPush).toHaveBeenCalledWith(false);
|
|
43
43
|
});
|
|
44
44
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { LoadError } from '../components/LoadError';
|
|
5
|
+
import { OverviewPage } from '../components/pages/overview/OverviewPage';
|
|
6
|
+
|
|
7
|
+
describe('LoadError', () => {
|
|
8
|
+
it('says what failed in a sentence, keeps the server words, and Try again calls back', () => {
|
|
9
|
+
let tries = 0;
|
|
10
|
+
render(<LoadError what="the thing" message="simulated outage" onRetry={() => { tries += 1; }} />);
|
|
11
|
+
expect(screen.getByRole('alert').textContent).toContain('Could not load the thing.');
|
|
12
|
+
expect(screen.getByRole('alert').textContent).toContain('simulated outage');
|
|
13
|
+
fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
|
|
14
|
+
expect(tries).toBe(1);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('OverviewPage failing then recovering', () => {
|
|
19
|
+
it('shows a retryable error, and Try again loads the page', async () => {
|
|
20
|
+
let calls = 0;
|
|
21
|
+
const page = <T,>(results: T[]) => ({ count: results.length, next: null, previous: null, results });
|
|
22
|
+
const api = {
|
|
23
|
+
listFocuses: async () => { calls += 1; if (calls === 1) throw new Error('simulated outage'); return page([{ id: 'f1', title: 'Alpha', status: 'active' }]); },
|
|
24
|
+
listCommitments: async () => page([{ id: '1', externalId: 'c1', title: 'task', status: 'open', ownerName: 'Sam', focusId: 'f1', mentions: [], dueAt: null, lastSeenAt: null }]),
|
|
25
|
+
} as never;
|
|
26
|
+
render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
|
|
27
|
+
await waitFor(() => expect(screen.getByTestId('load-error')).toBeTruthy());
|
|
28
|
+
fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
|
|
29
|
+
await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
import { TrackerPage } from '../components/pages/TrackerPage';
|
|
34
|
+
|
|
35
|
+
describe('TrackerPage when the load fails', () => {
|
|
36
|
+
it('shows a retryable error and no 0-owed counts, then loads on Try again', async () => {
|
|
37
|
+
let calls = 0;
|
|
38
|
+
const page = { count: 0, next: null, previous: null, results: [] as never[] };
|
|
39
|
+
const api = { listCommitments: async () => { calls += 1; if (calls <= 1) throw new Error('simulated outage'); return page; } } as never;
|
|
40
|
+
render(<TrackerPage api={api} scope={{} as never} classNames={{} as never} />);
|
|
41
|
+
await waitFor(() => expect(screen.getByTestId('load-error')).toBeTruthy());
|
|
42
|
+
expect(screen.getByTestId('tracker-summary').textContent).toBe('');
|
|
43
|
+
fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
|
|
44
|
+
await waitFor(() => expect(screen.queryByTestId('load-error')).toBeNull());
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A load failure that says what happened in a sentence and offers Try again. The server's own words stay visible
|
|
7
|
+
* underneath (they are the useful part for whoever has to fix it), but they are never the whole message.
|
|
8
|
+
*/
|
|
9
|
+
export function LoadError({ message, onRetry, what = 'this' }: { message: string; onRetry?: () => void; what?: string }) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="rounded-xl border border-red-200 bg-red-50 p-4 text-sm" role="alert" data-testid="load-error">
|
|
12
|
+
<p className="font-medium text-red-900">Could not load {what}.</p>
|
|
13
|
+
{message ? <p className="mt-1 text-red-800">{message}</p> : null}
|
|
14
|
+
{onRetry ? (
|
|
15
|
+
<button type="button" onClick={onRetry} className="mt-3 rounded-md border border-red-300 bg-white px-3 py-1.5 font-medium text-red-900 hover:bg-red-100">
|
|
16
|
+
Try again
|
|
17
|
+
</button>
|
|
18
|
+
) : null}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
*/
|
|
35
35
|
import * as React from 'react';
|
|
36
36
|
|
|
37
|
+
import { LoadError } from '../LoadError';
|
|
38
|
+
|
|
37
39
|
import type { Connection, ConnectionPermissions, ConnectorCatalogEntry } from './types';
|
|
38
40
|
import { MemberConnectionRoster } from './MemberConnectionRoster';
|
|
39
41
|
import { connectableEntries } from './connectable-entries';
|
|
@@ -91,7 +93,7 @@ export function ConnectionsPage(props: ConnectionsPageProps) {
|
|
|
91
93
|
React.useEffect(() => { void reload(); }, [reload]);
|
|
92
94
|
|
|
93
95
|
if (loadError) {
|
|
94
|
-
return <
|
|
96
|
+
return <LoadError what="your connections" message={loadError} onRetry={() => { setLoadError(''); void reload(); }} />;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
return (
|
|
@@ -132,6 +134,8 @@ export function ConnectionsPage(props: ConnectionsPageProps) {
|
|
|
132
134
|
))}
|
|
133
135
|
</section>
|
|
134
136
|
|
|
137
|
+
{/* Nothing to offer is no section: a heading over a blank gap reads as a broken page. */}
|
|
138
|
+
{(personal ? connectableEntries(catalog, connections) : catalog).length > 0 || (personal && !loading && catalog.length === 0) ? (
|
|
135
139
|
<section className={cn.section}>
|
|
136
140
|
<h2 className={cn.heading}>
|
|
137
141
|
{personal ? 'Connect your own account' : 'Available connectors'}
|
|
@@ -164,6 +168,7 @@ export function ConnectionsPage(props: ConnectionsPageProps) {
|
|
|
164
168
|
/>
|
|
165
169
|
))}
|
|
166
170
|
</section>
|
|
171
|
+
) : null}
|
|
167
172
|
|
|
168
173
|
{/* THE OTHER HALF OF THE ALLOWLIST (bd startsim-768w.22.25.8): who has
|
|
169
174
|
actually connected. Its own component, and deliberately not folded into
|
|
@@ -193,10 +193,18 @@ export function ConversePage({ client, classNames, meeting, createIO, savedLink
|
|
|
193
193
|
/>
|
|
194
194
|
<button type="submit" className={cx('secondary')} disabled={!draft.trim()}>Send</button>
|
|
195
195
|
</form>
|
|
196
|
-
|
|
197
|
-
<
|
|
196
|
+
{lines.length === 0 ? (
|
|
197
|
+
<div className="flex flex-wrap items-center gap-2 text-sm" data-testid="converse-suggestions">
|
|
198
|
+
<span className={cx('muted')}>Try:</span>
|
|
199
|
+
{['What is due today?', 'Add a to-do: call the vendor', 'What am I waiting on?'].map((s) => (
|
|
200
|
+
<button key={s} type="button" className="rounded-full border border-gray-300 bg-white px-3 py-1 text-gray-700 hover:border-gray-400" onClick={() => setDraft(s)}>{s}</button>
|
|
201
|
+
))}
|
|
202
|
+
</div>
|
|
203
|
+
) : null}
|
|
204
|
+
<div className="flex flex-wrap items-center gap-3 text-sm">
|
|
205
|
+
<button type="button" className={cx('secondary')} title="Save this conversation" onClick={() => void onDone()} disabled={busy || (!ctl.current)}>Done</button>
|
|
198
206
|
<label className={cx('muted')} htmlFor="converse-speed">Speed</label>
|
|
199
|
-
<select id="converse-speed" className="rounded border px-
|
|
207
|
+
<select id="converse-speed" className="rounded-md border border-gray-300 bg-white px-2 py-1 text-sm text-gray-800" value={speed} onChange={(e) => onSpeed(normalizeSpeed(e.target.value))} data-testid="converse-speed" aria-label="Speech speed">
|
|
200
208
|
{SPEEDS.map((v) => <option key={v} value={v}>{v}x</option>)}
|
|
201
209
|
</select>
|
|
202
210
|
</div>
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
|
|
8
|
+
import { LoadError } from '../LoadError';
|
|
9
|
+
|
|
8
10
|
import type { NotifyClient } from '../../corpus/notify/client';
|
|
9
11
|
import type { DecisionIndexRow, DecisionRecord } from '../../corpus/notify/types';
|
|
10
12
|
|
|
@@ -61,14 +63,20 @@ export function DecisionsPage({ client, classNames, focus }: DecisionsPageProps)
|
|
|
61
63
|
const ordered = (rows ?? []).slice().sort((a, b) => Number(b.id === focus) - Number(a.id === focus));
|
|
62
64
|
return (
|
|
63
65
|
<div className={cx('root')}>
|
|
66
|
+
{error ? <LoadError what="your decisions" message={error} onRetry={() => { setError(null); load(); }} /> : null}
|
|
67
|
+
{rows && !rows.length ? (
|
|
68
|
+
<div className="rounded-xl border border-gray-200 bg-white p-6 text-center" data-testid="decisions-empty">
|
|
69
|
+
<p className="font-medium text-gray-900">Nothing is waiting on you.</p>
|
|
70
|
+
<p className={cx('muted')}>When an agent needs your call, it shows up here.</p>
|
|
71
|
+
</div>
|
|
72
|
+
) : null}
|
|
73
|
+
{ordered.map((row) => <DecisionCard key={row.id} row={row} client={client} cx={cx} onDone={load} />)}
|
|
64
74
|
{push !== null ? (
|
|
65
|
-
<label className=
|
|
66
|
-
<input type="checkbox" checked={push} onChange={(e) => { const v = e.target.checked; setPush(v); client.setPush(v).catch(() => setPush(!v)); }} />
|
|
75
|
+
<label className="mt-2 flex items-center gap-3 rounded-xl border border-gray-200 bg-white px-4 py-3 text-sm text-gray-800">
|
|
76
|
+
<input type="checkbox" className="h-4 w-4 accent-indigo-600" checked={push} onChange={(e) => { const v = e.target.checked; setPush(v); client.setPush(v).catch(() => setPush(!v)); }} />
|
|
77
|
+
<span>Notify me on my phone when a decision is waiting</span>
|
|
67
78
|
</label>
|
|
68
79
|
) : null}
|
|
69
|
-
{error ? <div className={cx('error')} role="alert">{error}</div> : null}
|
|
70
|
-
{rows && !rows.length ? <p className={cx('muted')} data-testid="decisions-empty">Nothing is waiting on you.</p> : null}
|
|
71
|
-
{ordered.map((row) => <DecisionCard key={row.id} row={row} client={client} cx={cx} onDone={load} />)}
|
|
72
80
|
</div>
|
|
73
81
|
);
|
|
74
82
|
}
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import * as React from 'react';
|
|
29
29
|
|
|
30
|
+
import { LoadError } from '../LoadError';
|
|
31
|
+
|
|
30
32
|
import { DocumentDetail } from '../DocumentDetail';
|
|
31
33
|
import { formatDate, summaryOf } from '../documentText';
|
|
32
34
|
import { FolderTree, folderTrail } from '../FolderTree';
|
|
@@ -192,6 +194,7 @@ export function LibraryPage({
|
|
|
192
194
|
const [selectError, setSelectError] = React.useState('');
|
|
193
195
|
const [loading, setLoading] = React.useState(true);
|
|
194
196
|
const [loadError, setLoadError] = React.useState('');
|
|
197
|
+
const [attempt, setAttempt] = React.useState(0);
|
|
195
198
|
/**
|
|
196
199
|
* LATCHED, not per-page. "The data API returned another workspace's rows" is a
|
|
197
200
|
* fact about the API, and paging forward past the offending page must not make
|
|
@@ -256,7 +259,7 @@ export function LibraryPage({
|
|
|
256
259
|
}
|
|
257
260
|
})();
|
|
258
261
|
return () => { live = false; };
|
|
259
|
-
}, [api, query, scope]);
|
|
262
|
+
}, [api, query, scope, attempt]);
|
|
260
263
|
|
|
261
264
|
React.useEffect(() => {
|
|
262
265
|
if (!selectedId) { setSelected(null); setSelectError(''); return; }
|
|
@@ -342,8 +345,10 @@ export function LibraryPage({
|
|
|
342
345
|
.map(([name]) => name);
|
|
343
346
|
}, [applied, filters, query]);
|
|
344
347
|
|
|
348
|
+
const hasFilters = Boolean(filters.source || filters.partyId || filters.occurredAfter || filters.occurredBefore);
|
|
349
|
+
|
|
345
350
|
if (loadError) {
|
|
346
|
-
return <
|
|
351
|
+
return <LoadError what="the library" message={loadError} onRetry={() => { setLoadError(''); setAttempt((n) => n + 1); }} />;
|
|
347
352
|
}
|
|
348
353
|
|
|
349
354
|
return (
|
|
@@ -355,10 +360,10 @@ export function LibraryPage({
|
|
|
355
360
|
className="flex flex-wrap items-end gap-2"
|
|
356
361
|
onSubmit={(event) => { event.preventDefault(); update({ search: draftSearch || undefined }); }}
|
|
357
362
|
>
|
|
358
|
-
<label className="flex flex-col gap-1">
|
|
363
|
+
<label className="flex min-w-0 flex-1 flex-col gap-1">
|
|
359
364
|
<span className="text-xs font-medium text-gray-700">Search</span>
|
|
360
365
|
<input
|
|
361
|
-
className={cn.input}
|
|
366
|
+
className={`${cn.input} w-full`}
|
|
362
367
|
type="search"
|
|
363
368
|
value={draftSearch}
|
|
364
369
|
placeholder="Search everything pulled in"
|
|
@@ -366,6 +371,12 @@ export function LibraryPage({
|
|
|
366
371
|
/>
|
|
367
372
|
</label>
|
|
368
373
|
|
|
374
|
+
<button type="submit" className={cn.button}>Search</button>
|
|
375
|
+
|
|
376
|
+
{/* The rest of the filters fold away: a phone should see the search box first, not a form a third of the screen tall. */}
|
|
377
|
+
<details className="w-full rounded-lg border border-gray-200 bg-white px-3 py-2" open={hasFilters}>
|
|
378
|
+
<summary className="cursor-pointer text-sm font-medium text-gray-700">Filters{hasFilters ? ' (on)' : ''}</summary>
|
|
379
|
+
<div className="mt-3 flex flex-wrap items-end gap-2">
|
|
369
380
|
<label className="flex flex-col gap-1">
|
|
370
381
|
<span className="text-xs font-medium text-gray-700">Source</span>
|
|
371
382
|
<select
|
|
@@ -419,7 +430,6 @@ export function LibraryPage({
|
|
|
419
430
|
/>
|
|
420
431
|
</label>
|
|
421
432
|
|
|
422
|
-
<button type="submit" className={cn.button}>Search</button>
|
|
423
433
|
<button
|
|
424
434
|
type="button"
|
|
425
435
|
className={cn.button}
|
|
@@ -436,6 +446,8 @@ export function LibraryPage({
|
|
|
436
446
|
>
|
|
437
447
|
Clear
|
|
438
448
|
</button>
|
|
449
|
+
</div>
|
|
450
|
+
</details>
|
|
439
451
|
</form>
|
|
440
452
|
|
|
441
453
|
{ignored.length ? (
|
|
@@ -481,7 +493,7 @@ export function LibraryPage({
|
|
|
481
493
|
|
|
482
494
|
<section className={cn.section}>
|
|
483
495
|
<div className="flex items-baseline justify-between gap-4">
|
|
484
|
-
<h2 className={cn.heading}>{folder ? folderName(folder) : '
|
|
496
|
+
<h2 className={cn.heading}>{folder ? folderName(folder) : 'All documents'}</h2>
|
|
485
497
|
<p className={cn.muted}>
|
|
486
498
|
{count} record{count === 1 ? '' : 's'}
|
|
487
499
|
{count > 0 ? ` · page ${page} of ${lastPage}` : ''}
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import * as React from 'react';
|
|
28
28
|
|
|
29
|
+
import { LoadError } from '../LoadError';
|
|
30
|
+
|
|
29
31
|
import { isStalled, runProgress } from '../../corpus/runs';
|
|
30
32
|
import { isOverdue } from '../../corpus/work-item-logic';
|
|
31
33
|
import { useTrackerName } from '../../task-tracker/useTrackerName';
|
|
@@ -181,6 +183,8 @@ export function TrackerPage({
|
|
|
181
183
|
const [applied, setApplied] = React.useState<string[]>([]);
|
|
182
184
|
const [loading, setLoading] = React.useState(true);
|
|
183
185
|
const [error, setError] = React.useState('');
|
|
186
|
+
// a failed LOAD (offer Try again, hide the counts) is different from a failed action on one row (keep the plain message)
|
|
187
|
+
const [loadFailed, setLoadFailed] = React.useState(false);
|
|
184
188
|
const [running, setRunning] = React.useState(false);
|
|
185
189
|
/**
|
|
186
190
|
* The SWEEP, when this deployment runs extraction as a job
|
|
@@ -214,6 +218,8 @@ export function TrackerPage({
|
|
|
214
218
|
const load = React.useCallback(async () => {
|
|
215
219
|
setLoading(true);
|
|
216
220
|
setError('');
|
|
221
|
+
setLoadFailed(false);
|
|
222
|
+
setLoadFailed(false);
|
|
217
223
|
try {
|
|
218
224
|
const page = await apiRef.current.listCommitments(query);
|
|
219
225
|
setRows(page.results);
|
|
@@ -232,6 +238,8 @@ export function TrackerPage({
|
|
|
232
238
|
} catch (err) {
|
|
233
239
|
setRows([]);
|
|
234
240
|
setError(failureMessage(err));
|
|
241
|
+
setLoadFailed(true);
|
|
242
|
+
setLoadFailed(true);
|
|
235
243
|
} finally {
|
|
236
244
|
setLoading(false);
|
|
237
245
|
}
|
|
@@ -499,7 +507,7 @@ export function TrackerPage({
|
|
|
499
507
|
) : null}
|
|
500
508
|
<div className="flex flex-wrap items-center gap-3">
|
|
501
509
|
<p className={cn.muted} data-testid="tracker-summary">
|
|
502
|
-
{loading ? 'Loading…' : `${owed} owed · ${c.today} today · ${c.inProgress} in progress`}
|
|
510
|
+
{loading ? 'Loading…' : loadFailed ? '' : `${owed} owed · ${c.today} today · ${c.inProgress} in progress`}
|
|
503
511
|
</p>
|
|
504
512
|
<div className="ml-auto">
|
|
505
513
|
{canQueue ? (
|
|
@@ -560,7 +568,7 @@ export function TrackerPage({
|
|
|
560
568
|
<p className={`mt-2 ${cn.warning}`} role="status">{unfilteredMessage(['status'] as const, applied, query)}</p>
|
|
561
569
|
</details>
|
|
562
570
|
) : null}
|
|
563
|
-
{error ? <p className={cn.error} role="alert">{error}</p> : null}
|
|
571
|
+
{error ? (loadFailed ? <LoadError what="your to-dos" message={error} onRetry={() => void load()} /> : <p className={cn.error} role="alert">{error}</p>) : null}
|
|
564
572
|
{sweep ? <SweepPanel sweep={sweep} now={clock} classNames={cn} /> : null}
|
|
565
573
|
|
|
566
574
|
{!loading && owed === 0 && c.stale === 0 && !filtering ? (
|
|
@@ -12,6 +12,10 @@ import { ConnectionSettingsForm, ReplaceKeyForm } from './ConnectionForms';
|
|
|
12
12
|
import type { BoundApi } from './bound-api';
|
|
13
13
|
import { DEFAULTS, RUN_KIND_COPY } from './copy';
|
|
14
14
|
|
|
15
|
+
// One main action per card: Reconnect (when the account is broken) is the only filled button; the rest are outlined, and Disconnect is a quiet red link.
|
|
16
|
+
const SECONDARY_BTN = 'rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-gray-800 hover:border-gray-400 disabled:opacity-50';
|
|
17
|
+
const QUIET_DANGER_BTN = 'rounded-md px-3 py-1.5 text-sm font-medium text-red-700 hover:bg-red-50 disabled:opacity-50';
|
|
18
|
+
|
|
15
19
|
export function ConnectionCard({
|
|
16
20
|
api, personal, connection, entry, canManage, classNames: cn, onChanged,
|
|
17
21
|
}: {
|
|
@@ -112,7 +116,7 @@ export function ConnectionCard({
|
|
|
112
116
|
{api.connectionRuns ? (
|
|
113
117
|
<button
|
|
114
118
|
type="button"
|
|
115
|
-
className={
|
|
119
|
+
className={SECONDARY_BTN}
|
|
116
120
|
disabled={Boolean(busy)}
|
|
117
121
|
onClick={() => {
|
|
118
122
|
const opening = !activityOpen;
|
|
@@ -131,7 +135,7 @@ export function ConnectionCard({
|
|
|
131
135
|
<>
|
|
132
136
|
<button
|
|
133
137
|
type="button"
|
|
134
|
-
className={
|
|
138
|
+
className={SECONDARY_BTN}
|
|
135
139
|
disabled={Boolean(busy)}
|
|
136
140
|
onClick={() => void guard('check', async () => {
|
|
137
141
|
setCheckWhy(null);
|
|
@@ -167,7 +171,7 @@ export function ConnectionCard({
|
|
|
167
171
|
) : (
|
|
168
172
|
<button
|
|
169
173
|
type="button"
|
|
170
|
-
className={
|
|
174
|
+
className={SECONDARY_BTN}
|
|
171
175
|
disabled={Boolean(busy)}
|
|
172
176
|
onClick={() => {
|
|
173
177
|
setConfirmingDisconnect(false);
|
|
@@ -186,7 +190,7 @@ export function ConnectionCard({
|
|
|
186
190
|
{api.connectionChoices && api.connectionActions ? (
|
|
187
191
|
<button
|
|
188
192
|
type="button"
|
|
189
|
-
className={
|
|
193
|
+
className={SECONDARY_BTN}
|
|
190
194
|
disabled={Boolean(busy)}
|
|
191
195
|
onClick={() => void guard('discover', async () => {
|
|
192
196
|
const page = await api.connectionChoices!(connection.id);
|
|
@@ -217,7 +221,7 @@ export function ConnectionCard({
|
|
|
217
221
|
{(configFields.length || trackerApi) && api.updateConnectionConfig ? (
|
|
218
222
|
<button
|
|
219
223
|
type="button"
|
|
220
|
-
className={
|
|
224
|
+
className={SECONDARY_BTN}
|
|
221
225
|
disabled={Boolean(busy) || confirmingDisconnect}
|
|
222
226
|
onClick={() => {
|
|
223
227
|
setReplacing(false);
|
|
@@ -230,7 +234,7 @@ export function ConnectionCard({
|
|
|
230
234
|
) : null}
|
|
231
235
|
<button
|
|
232
236
|
type="button"
|
|
233
|
-
className={
|
|
237
|
+
className={QUIET_DANGER_BTN}
|
|
234
238
|
disabled={Boolean(busy) || confirmingDisconnect}
|
|
235
239
|
onClick={() => {
|
|
236
240
|
setReplacing(false);
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
|
|
10
|
+
import { LoadError } from '../../LoadError';
|
|
10
11
|
import { buildOverview, NO_PROJECT, type OverviewRow } from '../../../corpus/overview';
|
|
11
12
|
import type { Commitment, CorpusScope, Focus, PlanningApi } from '../../../corpus/types';
|
|
12
13
|
|
|
@@ -45,6 +46,7 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
45
46
|
const [error, setError] = React.useState('');
|
|
46
47
|
const [who, setWho] = React.useState<string | null>(null);
|
|
47
48
|
const [sort, setSort] = React.useState<{ key: SortKey; dir: 1 | -1 } | null>(null);
|
|
49
|
+
const [attempt, setAttempt] = React.useState(0);
|
|
48
50
|
|
|
49
51
|
React.useEffect(() => {
|
|
50
52
|
let live = true;
|
|
@@ -59,10 +61,10 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
59
61
|
return () => {
|
|
60
62
|
live = false;
|
|
61
63
|
};
|
|
62
|
-
}, [api, scope]);
|
|
64
|
+
}, [api, scope, attempt]);
|
|
63
65
|
|
|
64
66
|
const overview = React.useMemo(() => (data ? buildOverview(data.focuses, data.items, { meNames, now }) : null), [data, meNames, now]);
|
|
65
|
-
if (error) return <
|
|
67
|
+
if (error) return <LoadError what="the overview" message={error} onRetry={() => setAttempt((n) => n + 1)} />;
|
|
66
68
|
if (!overview) return <p className="text-sm text-gray-500">Loading…</p>;
|
|
67
69
|
if (!overview.rows.length) return <p className="text-sm text-gray-500">Nothing in flight yet. Projects and their open to-dos show up here as they are connected or planned.</p>;
|
|
68
70
|
|
|
@@ -27,7 +27,7 @@ export function TimelinePage({ api, scope, now, timeZone, className }: TimelineP
|
|
|
27
27
|
return (
|
|
28
28
|
<TrackerTimeline
|
|
29
29
|
api={api} orgId={scope.orgId} now={now ?? mountedAt} timeZone={timeZone}
|
|
30
|
-
filter={NO_FILTER} className={className}
|
|
30
|
+
filter={NO_FILTER} className={className} heading={false}
|
|
31
31
|
/>
|
|
32
32
|
);
|
|
33
33
|
}
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* or render would be a second.
|
|
12
12
|
*/
|
|
13
13
|
import * as React from 'react';
|
|
14
|
+
|
|
15
|
+
import { LoadError } from '../../LoadError';
|
|
14
16
|
import { DEFAULT_RANGES, RangeEventTable, RangeSelector, RangeTimelineChart } from '@startsimpli/ui/insights';
|
|
15
17
|
|
|
16
18
|
import { buildTimeline, anchorOf, type TimelineFilter } from '../../../corpus/tracker-timeline';
|
|
@@ -29,6 +31,8 @@ export interface TrackerTimelineProps {
|
|
|
29
31
|
/** Free-text filters wait this long before they become a server query. */
|
|
30
32
|
debounceMs?: number;
|
|
31
33
|
className?: string;
|
|
34
|
+
/** Draw the 'Timeline' heading. A page that already titles itself Timeline turns this off (one title per page). */
|
|
35
|
+
heading?: boolean;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
const FILTER_DEBOUNCE_MS = 400;
|
|
@@ -44,7 +48,7 @@ function useDebounced<T>(value: T, ms: number): T {
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
export function TrackerTimeline({
|
|
47
|
-
api, orgId, filter, now, timeZone = 'UTC', debounceMs = FILTER_DEBOUNCE_MS, className,
|
|
51
|
+
api, orgId, filter, now, timeZone = 'UTC', debounceMs = FILTER_DEBOUNCE_MS, className, heading = true,
|
|
48
52
|
}: TrackerTimelineProps) {
|
|
49
53
|
const apiRef = React.useRef(api);
|
|
50
54
|
apiRef.current = api;
|
|
@@ -59,6 +63,7 @@ export function TrackerTimeline({
|
|
|
59
63
|
owner: filter.owner ?? '', search: debouncedSearch,
|
|
60
64
|
});
|
|
61
65
|
const anchor = anchorOf(now, timeZone);
|
|
66
|
+
const [attempt, setAttempt] = React.useState(0);
|
|
62
67
|
|
|
63
68
|
React.useEffect(() => {
|
|
64
69
|
let live = true;
|
|
@@ -75,14 +80,14 @@ export function TrackerTimeline({
|
|
|
75
80
|
return () => { live = false; };
|
|
76
81
|
// `now` is the page's frozen clock; the anchor day stands in for it.
|
|
77
82
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
|
-
}, [orgId, filterKey, anchor, timeZone]);
|
|
83
|
+
}, [orgId, filterKey, anchor, timeZone, attempt]);
|
|
79
84
|
|
|
80
85
|
const built = React.useMemo(() => (read ? buildTimeline(read, now, timeZone) : null), [read, now, timeZone]);
|
|
81
86
|
|
|
82
87
|
return (
|
|
83
88
|
<section className={className ?? 'space-y-4'} aria-label="Tracker timeline" data-testid="tracker-timeline">
|
|
84
|
-
<h2 className="text-lg font-semibold text-gray-900">Timeline</h2>
|
|
85
|
-
{error ? <
|
|
89
|
+
{heading ? <h2 className="text-lg font-semibold text-gray-900">Timeline</h2> : null}
|
|
90
|
+
{error ? <LoadError what="the timeline" message={error} onRetry={() => setAttempt((n) => n + 1)} /> : null}
|
|
86
91
|
{loading && !built ? <p className="text-sm text-gray-500">Loading the timeline…</p> : null}
|
|
87
92
|
{built ? (
|
|
88
93
|
<>
|