@startsimpli/integrations 0.2.103 → 0.2.104
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 +2 -2
- package/src/native/__tests__/design-screens.test.tsx +97 -0
- package/src/native/__tests__/ux-polish.test.tsx +4 -2
- package/src/native/app/FoundryApp.tsx +2 -2
- package/src/native/app/__tests__/launch.test.ts +4 -1
- package/src/native/app/entity/EntityTab.tsx +13 -18
- package/src/native/app/icon.tsx +6 -1
- package/src/native/app/launch.ts +4 -0
- package/src/native/app/screens/RecordScreen.tsx +37 -30
- package/src/native/app/screens/SignInScreen.tsx +4 -3
- package/src/native/components/FoundryTabsShell.tsx +8 -5
- package/src/native/components/MoreTabList.tsx +20 -25
- package/src/native/components/NoteDetailScreen.tsx +49 -57
- package/src/native/components/NotesListScreen.tsx +13 -19
- package/src/native/components/__tests__/notes-screens.test.tsx +7 -7
- package/src/native/home/HomeScreen.tsx +15 -12
- package/src/native/screens/ask/AskScreen.tsx +20 -22
- package/src/native/screens/connect-claude/ConnectClaudeScreen.tsx +68 -61
- package/src/native/screens/connections/ConnectionsScreens.tsx +46 -42
- package/src/native/screens/library/LibraryDetailScreen.tsx +35 -49
- package/src/native/screens/library/LibraryListScreen.tsx +13 -21
- package/src/native/screens/planning/PlanningScreens.tsx +49 -26
- package/src/native/tracker/TodoGlyph.tsx +11 -0
- package/src/native/tracker/TrackerDetailScreen.tsx +34 -39
- package/src/native/tracker/TrackerListScreen.tsx +28 -19
- package/src/native/tracker/__tests__/format.test.ts +3 -3
- package/src/native/tracker/format.ts +8 -7
- package/src/native/voice/format.ts +0 -3
- package/src/native/screens/shared/PressableCard.tsx +0 -14
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useMemo, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Alert, Button, DataList, Header, Sheet, StatusChip, Text, useTheme } from '@startsimpli/ui-native';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Alert, Button, DataList, DetailScreen, Header, IconTile, ListRow, Sheet, StatusChip, Text, useTheme, type ToneKey } from '@startsimpli/ui-native';
|
|
4
4
|
import { connectionStatusLabel } from '../../../components/pages/connection-format';
|
|
5
5
|
import type { Connection, ConnectionStatus, MemberConnectionsApi } from '../../../components/pages/types';
|
|
6
6
|
import { connectionHealthLine } from './format';
|
|
7
|
-
import { PressableCard } from '../shared/PressableCard';
|
|
8
7
|
import { useControllerState } from '../../components/useControllerState';
|
|
9
8
|
import { createConnectionsController, type ConnectionsController } from './controller';
|
|
10
9
|
|
|
@@ -12,6 +11,8 @@ import { createConnectionsController, type ConnectionsController } from './contr
|
|
|
12
11
|
const chipStatus = (s: ConnectionStatus): string =>
|
|
13
12
|
({ connected: 'connected', needs_reauth: 'warning', error: 'error', disabled: 'paused' } as const)[s] ?? s;
|
|
14
13
|
|
|
14
|
+
const TONE: Record<ConnectionStatus, ToneKey> = { connected: 'success', needs_reauth: 'warning', error: 'danger', disabled: 'neutral' };
|
|
15
|
+
|
|
15
16
|
const subtitle = (c: Connection) => [c.connector_name !== c.name ? c.connector_name : null, c.account_label].filter(Boolean).join(' · ');
|
|
16
17
|
|
|
17
18
|
export interface ConnectionsListScreenProps { controller: ConnectionsController; onOpen: (c: Connection) => void }
|
|
@@ -22,7 +23,7 @@ export function ConnectionsListScreen({ controller, onOpen }: ConnectionsListScr
|
|
|
22
23
|
const theme = useTheme();
|
|
23
24
|
return (
|
|
24
25
|
<View style={{ flex: 1 }}>
|
|
25
|
-
<Header title="Connections" subtitle={s.loading ? undefined : `${s.rows.length} connected account${s.rows.length === 1 ? '' : 's'}`} />
|
|
26
|
+
<Header large title="Connections" subtitle={s.loading ? undefined : `${s.rows.length} connected account${s.rows.length === 1 ? '' : 's'}`} />
|
|
26
27
|
<DataList
|
|
27
28
|
testID="connections-list"
|
|
28
29
|
data={s.rows}
|
|
@@ -34,21 +35,21 @@ export function ConnectionsListScreen({ controller, onOpen }: ConnectionsListScr
|
|
|
34
35
|
onRetry={() => { void controller.refresh(); }}
|
|
35
36
|
emptyTitle="Nothing connected"
|
|
36
37
|
emptyDescription="Connect an account (calendar, files, meeting notes) on the web and it shows up here."
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Open to connect: {s.catalog.map((c) => c.name).join(', ')}. Add new accounts on the web.
|
|
38
|
+
ListHeaderComponent={s.catalog.length ? (
|
|
39
|
+
<Text variant="footnote" style={{ paddingBottom: theme.spacing.sm }}>
|
|
40
|
+
{`Open to connect: ${s.catalog.map((c) => c.name).join(', ')}. Add new accounts on the web.`}
|
|
41
41
|
</Text>
|
|
42
42
|
) : undefined}
|
|
43
43
|
renderItem={({ item }: { item: Connection }) => (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
44
|
+
<ListRow
|
|
45
|
+
testID={`connection-${item.id}`}
|
|
46
|
+
leading={<IconTile icon="link" tone={TONE[item.status] ?? 'neutral'} />}
|
|
47
|
+
title={item.name || item.connector_name}
|
|
48
|
+
subtitle={subtitle(item) || undefined}
|
|
49
|
+
meta={connectionHealthLine(item)}
|
|
50
|
+
footer={<StatusChip status={chipStatus(item.status)} label={connectionStatusLabel(item.status)} />}
|
|
51
|
+
onPress={() => onOpen(item)}
|
|
52
|
+
/>
|
|
52
53
|
)}
|
|
53
54
|
/>
|
|
54
55
|
</View>
|
|
@@ -63,34 +64,37 @@ export function ConnectionDetailScreen({ controller, id, onBack }: { controller:
|
|
|
63
64
|
const check = s.checks[id];
|
|
64
65
|
|
|
65
66
|
if (!row) {
|
|
66
|
-
return
|
|
67
|
-
<View style={{ flex: 1 }}>
|
|
68
|
-
<Header title="Connection" onBack={onBack} />
|
|
69
|
-
<Text variant="muted" style={{ padding: theme.spacing.lg }}>{s.loading ? 'Loading...' : 'This connection is no longer available.'}</Text>
|
|
70
|
-
</View>
|
|
71
|
-
);
|
|
67
|
+
return <DetailScreen title="Connection" onBack={onBack} testID="connection-detail" loading={s.loading} unavailable={s.loading ? undefined : { title: 'This connection is no longer available' }} />;
|
|
72
68
|
}
|
|
73
69
|
const live = row.status !== 'disabled';
|
|
74
70
|
return (
|
|
75
|
-
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
71
|
+
<>
|
|
72
|
+
<DetailScreen
|
|
73
|
+
title="Connection"
|
|
74
|
+
onBack={onBack}
|
|
75
|
+
testID="connection-detail"
|
|
76
|
+
hero={{
|
|
77
|
+
eyebrow: row.connector_name !== row.name ? row.connector_name : 'Connection',
|
|
78
|
+
title: row.name || row.connector_name,
|
|
79
|
+
subtitle: row.account_label || undefined,
|
|
80
|
+
tags: <StatusChip status={chipStatus(row.status)} label={connectionStatusLabel(row.status)} />,
|
|
81
|
+
}}
|
|
82
|
+
meta={[
|
|
83
|
+
{ label: 'Health', value: connectionHealthLine(row), wide: true },
|
|
84
|
+
{ label: 'Allowed', value: row.capabilities_enabled.join(', '), wide: true },
|
|
85
|
+
]}
|
|
86
|
+
banner={(
|
|
87
|
+
<>
|
|
88
|
+
{row.check_error ? <Alert variant="destructive">{row.check_error}</Alert> : null}
|
|
89
|
+
{row.status === 'needs_reauth' ? <Text variant="muted">The vendor stopped accepting this grant. Reconnect it on the web.</Text> : null}
|
|
90
|
+
{s.actionError ? <Alert variant="destructive">{s.actionError}</Alert> : null}
|
|
91
|
+
{check ? <Alert variant={check.ok ? 'default' : 'destructive'}>{check.detail || (check.ok ? 'Connection is healthy.' : 'The check failed.')}</Alert> : null}
|
|
92
|
+
{live ? null : <Text variant="muted">Disconnected. Its key was deleted and its scheduled fetches stopped. Reconnect it on the web.</Text>}
|
|
93
|
+
</>
|
|
94
|
+
)}
|
|
95
|
+
actions={live ? <Button testID="connection-check" title={s.checking === id ? 'Testing...' : 'Test now'} disabled={s.checking !== null} onPress={() => { void controller.check(id); }} /> : undefined}
|
|
96
|
+
footer={live ? <Button testID="connection-disconnect" title="Disconnect" variant="destructive" onPress={() => setConfirming(true)} /> : undefined}
|
|
97
|
+
/>
|
|
94
98
|
<Sheet visible={confirming} onClose={() => setConfirming(false)} title={`Disconnect ${row.connector_name}?`} testID="connection-confirm">
|
|
95
99
|
<View style={{ gap: theme.spacing.md, padding: theme.spacing.lg }}>
|
|
96
100
|
<Text variant="muted">Its stored key is deleted and its scheduled fetches stop. This cannot be undone: you would connect again from the vendor.</Text>
|
|
@@ -99,7 +103,7 @@ export function ConnectionDetailScreen({ controller, id, onBack }: { controller:
|
|
|
99
103
|
<Button title="Cancel" variant="ghost" onPress={() => setConfirming(false)} />
|
|
100
104
|
</View>
|
|
101
105
|
</Sheet>
|
|
102
|
-
|
|
106
|
+
</>
|
|
103
107
|
);
|
|
104
108
|
}
|
|
105
109
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Alert,
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Alert, DetailScreen, Markdown, Section, Select, Tag, Text, useTheme } from '@startsimpli/ui-native';
|
|
4
4
|
import { formatDate, fullTextOf, summaryOf } from '../../../components/documentText';
|
|
5
5
|
import { usePullRefresh } from '../../components/usePullRefresh';
|
|
6
6
|
import { useControllerState as useStore } from '../../components/useControllerState';
|
|
@@ -21,45 +21,37 @@ export function LibraryDetailScreen({ controller, documentId, onBack }: LibraryD
|
|
|
21
21
|
const open = s.selected?.id === documentId ? s.selected : null;
|
|
22
22
|
const document = open?.document ?? null;
|
|
23
23
|
const refreshControl = usePullRefresh(() => Promise.all([controller.refresh(), controller.open(documentId, { fresh: true })]));
|
|
24
|
+
const frame = { title: 'Document', onBack, headerTestID: 'library-detail', testID: 'library-detail-scroll', refreshControl } as const;
|
|
24
25
|
|
|
25
26
|
if (!document) {
|
|
26
|
-
return
|
|
27
|
-
<View style={{ flex: 1 }}>
|
|
28
|
-
<Header testID="library-detail" title="Document" onBack={onBack} />
|
|
29
|
-
<ScrollView testID="library-detail-scroll" refreshControl={refreshControl} contentContainerStyle={{ padding: theme.spacing.lg, gap: theme.spacing.md }}>
|
|
30
|
-
{open?.error ? <Alert variant="destructive">{open.error}</Alert> : <Spinner />}
|
|
31
|
-
</ScrollView>
|
|
32
|
-
</View>
|
|
33
|
-
);
|
|
27
|
+
return open?.error ? <DetailScreen {...frame} unavailable={{ title: 'Could not open this document', description: open.error }} /> : <DetailScreen {...frame} loading />;
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
const filings = s.filings[document.id] ?? [];
|
|
37
31
|
const summary = summaryOf(document);
|
|
38
32
|
const fullText = fullTextOf(document);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
33
|
+
const people = document.participants.map((p) => p.name).join(', ');
|
|
34
|
+
const pad = { paddingVertical: theme.spacing.md, paddingRight: theme.spacing.xs } as const;
|
|
41
35
|
|
|
42
36
|
return (
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
<DetailScreen
|
|
38
|
+
{...frame}
|
|
39
|
+
hero={{
|
|
40
|
+
eyebrow: document.sourceLabel || document.source,
|
|
41
|
+
title: document.title,
|
|
42
|
+
subtitle: [formatDate(document.occurredAt), people].filter(Boolean).join(' · ') || undefined,
|
|
43
|
+
tags: document.subtype ? <Tag label={document.subtype.replace(/[_-]+/g, ' ')} /> : undefined,
|
|
44
|
+
}}
|
|
45
|
+
banner={s.filingError ? <Alert variant="destructive">{s.filingError}</Alert> : undefined}
|
|
46
|
+
>
|
|
47
|
+
<Section title="Filed under">
|
|
48
|
+
<View style={[pad, { flexDirection: 'row', flexWrap: 'wrap', gap: theme.spacing.sm }]}>
|
|
49
|
+
{filings.length === 0
|
|
50
|
+
? <Tag testID="library-detail-filed-none" label="Unfiled" />
|
|
51
|
+
: filings.map((f) => <Tag key={f.id} label={f.title} tone="info" />)}
|
|
53
52
|
</View>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<Text variant="caption">Filed under</Text>
|
|
57
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: theme.spacing.xs }}>
|
|
58
|
-
{filings.length === 0
|
|
59
|
-
? <Badge testID="library-detail-filed-none" label="Unfiled" variant="secondary" />
|
|
60
|
-
: filings.map((f) => <Badge key={f.id} label={f.title} variant="secondary" />)}
|
|
61
|
-
</View>
|
|
62
|
-
{s.projects.length ? (
|
|
53
|
+
{s.projects.length ? (
|
|
54
|
+
<View style={pad}>
|
|
63
55
|
<Select
|
|
64
56
|
testID="library-detail-project"
|
|
65
57
|
label="Change project"
|
|
@@ -71,25 +63,19 @@ export function LibraryDetailScreen({ controller, documentId, onBack }: LibraryD
|
|
|
71
63
|
disabled={s.filingBusy}
|
|
72
64
|
onChange={(id) => { void controller.fileUnder(document.id, id); }}
|
|
73
65
|
/>
|
|
74
|
-
) : null}
|
|
75
|
-
{s.filingError ? <Alert variant="destructive">{s.filingError}</Alert> : null}
|
|
76
|
-
</View>
|
|
77
|
-
|
|
78
|
-
<Separator />
|
|
79
|
-
{summary ? <Markdown testID="library-detail-summary">{summary}</Markdown> : <Text variant="muted">No summary was captured for this document.</Text>}
|
|
80
|
-
{document.sections.map((section) => (
|
|
81
|
-
<View key={section.key} style={gap}>
|
|
82
|
-
<Text style={{ fontWeight: '600' }}>{section.label}</Text>
|
|
83
|
-
<Markdown>{section.text}</Markdown>
|
|
84
|
-
</View>
|
|
85
|
-
))}
|
|
86
|
-
{fullText ? (
|
|
87
|
-
<View style={gap}>
|
|
88
|
-
<Text style={{ fontWeight: '600' }}>Full text</Text>
|
|
89
|
-
<Markdown>{fullText}</Markdown>
|
|
90
66
|
</View>
|
|
91
67
|
) : null}
|
|
92
|
-
</
|
|
93
|
-
|
|
68
|
+
</Section>
|
|
69
|
+
|
|
70
|
+
<Section title="Summary">
|
|
71
|
+
<View style={pad}>
|
|
72
|
+
{summary ? <Markdown testID="library-detail-summary">{summary}</Markdown> : <Text variant="muted">No summary was captured for this document.</Text>}
|
|
73
|
+
</View>
|
|
74
|
+
</Section>
|
|
75
|
+
{document.sections.map((section) => (
|
|
76
|
+
<Section key={section.key} title={section.label}><View style={pad}><Markdown>{section.text}</Markdown></View></Section>
|
|
77
|
+
))}
|
|
78
|
+
{fullText ? <Section title="Full text"><View style={pad}><Markdown>{fullText}</Markdown></View></Section> : null}
|
|
79
|
+
</DetailScreen>
|
|
94
80
|
);
|
|
95
81
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Alert,
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Alert, DataList, Header, IconTile, ListRow, Tag, useTheme, type FilterGroup } from '@startsimpli/ui-native';
|
|
4
4
|
import { documentPreview } from '../../../corpus/view-text';
|
|
5
5
|
import { formatDate } from '../../../components/documentText';
|
|
6
6
|
import type { SourceDocument } from '../../../corpus/types';
|
|
@@ -32,7 +32,7 @@ export function LibraryListScreen({ controller, onOpen }: LibraryListScreenProps
|
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<View style={{ flex: 1 }} testID="library-screen">
|
|
35
|
-
<Header testID="library-header" title="Library" subtitle={count !== null ? `${count} document${count === 1 ? '' : 's'}` : undefined} />
|
|
35
|
+
<Header large testID="library-header" title="Library" subtitle={count !== null ? `${count} document${count === 1 ? '' : 's'}` : undefined} />
|
|
36
36
|
<DataList<SourceDocument>
|
|
37
37
|
testID="library-list"
|
|
38
38
|
data={s.list.items}
|
|
@@ -72,27 +72,19 @@ export function LibraryListScreen({ controller, onOpen }: LibraryListScreenProps
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function DocumentRow({ document, filings, onPress }: { document: SourceDocument; filings: Array<{ id: string; title: string }> | undefined; onPress: () => void }) {
|
|
75
|
-
const theme = useTheme();
|
|
76
75
|
const preview = documentPreview(document, 140);
|
|
77
76
|
return (
|
|
78
|
-
<
|
|
77
|
+
<ListRow
|
|
79
78
|
testID={`library-row-${document.id}`}
|
|
80
|
-
|
|
79
|
+
leading={<IconTile icon="note" tone="info" />}
|
|
80
|
+
eyebrow={document.sourceLabel || document.source}
|
|
81
|
+
title={document.title}
|
|
82
|
+
preview={preview || undefined}
|
|
83
|
+
meta={formatDate(document.occurredAt) || undefined}
|
|
84
|
+
footer={filings === undefined ? undefined : filings.length === 0 ? (
|
|
85
|
+
<Tag testID={`library-chip-${document.id}-none`} label="Unfiled" />
|
|
86
|
+
) : filings.map((f) => <Tag key={f.id} testID={`library-chip-${document.id}-${f.id}`} label={f.title} tone="info" />)}
|
|
81
87
|
onPress={onPress}
|
|
82
|
-
|
|
83
|
-
>
|
|
84
|
-
<View style={{ flexDirection: 'row', alignItems: 'center', gap: theme.spacing.sm }}>
|
|
85
|
-
<Badge label={document.sourceLabel || document.source} variant="outline" />
|
|
86
|
-
<Text variant="caption">{formatDate(document.occurredAt)}</Text>
|
|
87
|
-
</View>
|
|
88
|
-
<Text style={{ fontWeight: '600' }} numberOfLines={2}>{document.title}</Text>
|
|
89
|
-
{preview ? <Text variant="muted" numberOfLines={2}>{preview}</Text> : null}
|
|
90
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: theme.spacing.xs }}>
|
|
91
|
-
{filings === undefined ? null : filings.length === 0 ? (
|
|
92
|
-
<Badge testID={`library-chip-${document.id}-none`} label="Unfiled" variant="secondary" />
|
|
93
|
-
) : filings.map((f) => <Badge key={f.id} testID={`library-chip-${document.id}-${f.id}`} label={f.title} variant="secondary" />)}
|
|
94
|
-
</View>
|
|
95
|
-
</Pressable>
|
|
88
|
+
/>
|
|
96
89
|
);
|
|
97
90
|
}
|
|
98
|
-
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { DataList, Header, Progress, SegmentedControl, StatusChip, Text, useTheme } from '@startsimpli/ui-native';
|
|
3
|
+
import { Card, DataList, DetailHero, Header, IconTile, ListRow, Progress, SegmentedControl, StatusChip, Text, useTheme } from '@startsimpli/ui-native';
|
|
4
4
|
import { standingLabel } from '../../../corpus/planning';
|
|
5
5
|
import type { Commitment, Focus, FocusStanding, SourceDocument } from '../../../corpus/types';
|
|
6
|
-
import {
|
|
6
|
+
import { TodoGlyph } from '../../tracker/TodoGlyph';
|
|
7
7
|
import { useControllerState } from '../../components/useControllerState';
|
|
8
8
|
import {
|
|
9
9
|
createFocusDetailController, createPlanningController,
|
|
10
10
|
type FocusDetailController, type PlanningScreenApi, type PlanningController,
|
|
11
11
|
} from './controller';
|
|
12
|
+
import { isOverdue } from '../../../corpus/work-item-logic';
|
|
12
13
|
import { documentLine, focusChipStatus, focusMeta, focusStatusLabel, itemLine, progressPercent, targetLine } from './format';
|
|
13
14
|
|
|
14
|
-
/** The standing, progress bar and facts for one focus
|
|
15
|
+
/** The standing, progress bar and facts for one focus (a project card on the list). */
|
|
15
16
|
function FocusSummary({ focus, standing }: { focus: Focus; standing: FocusStanding | null }) {
|
|
16
17
|
const theme = useTheme();
|
|
17
18
|
const percent = progressPercent(focus, standing);
|
|
18
19
|
const meta = focusMeta(focus);
|
|
19
|
-
const target = targetLine(focus);
|
|
20
20
|
return (
|
|
21
|
-
<View style={{ gap: theme.spacing.
|
|
22
|
-
<View style={{ flexDirection: 'row', alignItems: '
|
|
23
|
-
<Text variant="
|
|
21
|
+
<View style={{ gap: theme.spacing.sm }}>
|
|
22
|
+
<View style={{ flexDirection: 'row', alignItems: 'flex-start', justifyContent: 'space-between', gap: theme.spacing.sm }}>
|
|
23
|
+
<Text variant="headline" style={{ flex: 1 }} numberOfLines={2}>{focus.title}</Text>
|
|
24
24
|
<StatusChip status={focusChipStatus(focus.status)} label={focusStatusLabel(focus.status)} />
|
|
25
25
|
</View>
|
|
26
|
-
{meta ? <Text variant="
|
|
26
|
+
{meta ? <Text variant="footnote">{meta}</Text> : null}
|
|
27
27
|
{percent !== null ? <Progress value={percent} /> : null}
|
|
28
|
-
<Text variant="
|
|
28
|
+
<Text variant="subhead" style={{ color: theme.colors.mutedForeground }}>{[standingLabel(standing), targetLine(focus)].filter(Boolean).join(' · ')}</Text>
|
|
29
29
|
</View>
|
|
30
30
|
);
|
|
31
31
|
}
|
|
@@ -40,7 +40,7 @@ export function PlanningListScreen({ controller, onOpen }: PlanningListScreenPro
|
|
|
40
40
|
const f = state.focuses;
|
|
41
41
|
return (
|
|
42
42
|
<View style={{ flex: 1 }}>
|
|
43
|
-
<Header title="Planning" subtitle={f.count !== null ? `${f.count} project${f.count === 1 ? '' : 's'}` : undefined} />
|
|
43
|
+
<Header large title="Planning" subtitle={f.count !== null ? `${f.count} project${f.count === 1 ? '' : 's'}` : undefined} />
|
|
44
44
|
<DataList
|
|
45
45
|
testID="planning-list"
|
|
46
46
|
data={f.items}
|
|
@@ -59,9 +59,9 @@ export function PlanningListScreen({ controller, onOpen }: PlanningListScreenPro
|
|
|
59
59
|
noResultsTitle="No matching projects"
|
|
60
60
|
ItemSeparatorComponent={() => <View style={{ height: theme.spacing.sm }} />}
|
|
61
61
|
renderItem={({ item }: { item: Focus }) => (
|
|
62
|
-
<
|
|
62
|
+
<Card testID={`focus-${item.id}`} onPress={() => onOpen(item)}>
|
|
63
63
|
<FocusSummary focus={item} standing={state.standings[item.id] ?? null} />
|
|
64
|
-
</
|
|
64
|
+
</Card>
|
|
65
65
|
)}
|
|
66
66
|
/>
|
|
67
67
|
</View>
|
|
@@ -99,10 +99,27 @@ export function DetailBody({ controller, onBack, onOpenDocument, now = Date.now
|
|
|
99
99
|
if (next !== 'notes') void controller.setShowClosed(next === 'closed');
|
|
100
100
|
};
|
|
101
101
|
const clock = now();
|
|
102
|
+
const focus = state.focus;
|
|
103
|
+
const percent = focus ? progressPercent(focus, state.standing) : null;
|
|
102
104
|
const header = (
|
|
103
|
-
<View style={{ gap: theme.spacing.
|
|
104
|
-
{
|
|
105
|
-
|
|
105
|
+
<View style={{ gap: theme.spacing.md, paddingBottom: theme.spacing.md }}>
|
|
106
|
+
{focus ? (
|
|
107
|
+
<>
|
|
108
|
+
<DetailHero
|
|
109
|
+
eyebrow="Project"
|
|
110
|
+
title={focus.title}
|
|
111
|
+
subtitle={focusMeta(focus) || undefined}
|
|
112
|
+
tags={<StatusChip status={focusChipStatus(focus.status)} label={focusStatusLabel(focus.status)} />}
|
|
113
|
+
/>
|
|
114
|
+
<Card>
|
|
115
|
+
<View style={{ gap: theme.spacing.sm }}>
|
|
116
|
+
{percent !== null ? <Progress value={percent} /> : null}
|
|
117
|
+
<Text variant="callout">{[standingLabel(state.standing), targetLine(focus)].filter(Boolean).join(' · ')}</Text>
|
|
118
|
+
</View>
|
|
119
|
+
</Card>
|
|
120
|
+
{focus.detail ? <Text variant="body" style={{ color: theme.colors.mutedForeground }}>{focus.detail}</Text> : null}
|
|
121
|
+
</>
|
|
122
|
+
) : null}
|
|
106
123
|
<SegmentedControl<Mode>
|
|
107
124
|
testID="planning-mode"
|
|
108
125
|
value={mode}
|
|
@@ -114,11 +131,10 @@ export function DetailBody({ controller, onBack, onOpenDocument, now = Date.now
|
|
|
114
131
|
const common = {
|
|
115
132
|
onRefresh: () => { void controller.refresh(); },
|
|
116
133
|
ListHeaderComponent: header,
|
|
117
|
-
ItemSeparatorComponent: () => <View style={{ height: theme.spacing.sm }} />,
|
|
118
134
|
};
|
|
119
135
|
return (
|
|
120
|
-
<View style={{ flex: 1 }} testID="planning-detail">
|
|
121
|
-
<Header testID="planning-header" title=
|
|
136
|
+
<View style={{ flex: 1, backgroundColor: theme.surface.grouped }} testID="planning-detail">
|
|
137
|
+
<Header testID="planning-header" title="Project" onBack={onBack} background={theme.surface.grouped} />
|
|
122
138
|
{state.error ? (
|
|
123
139
|
<View style={{ padding: theme.spacing.lg, gap: theme.spacing.sm }}>
|
|
124
140
|
<Text variant="muted">{state.error}</Text>
|
|
@@ -138,10 +154,13 @@ export function DetailBody({ controller, onBack, onOpenDocument, now = Date.now
|
|
|
138
154
|
emptyTitle="No notes yet"
|
|
139
155
|
emptyDescription="Notes and documents filed under this project appear here."
|
|
140
156
|
renderItem={({ item }: { item: SourceDocument }) => (
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
<
|
|
144
|
-
|
|
157
|
+
<ListRow
|
|
158
|
+
testID={`doc-${item.id}`}
|
|
159
|
+
leading={<IconTile icon="note" tone="info" />}
|
|
160
|
+
title={item.title}
|
|
161
|
+
meta={documentLine(item, clock)}
|
|
162
|
+
onPress={onOpenDocument ? () => onOpenDocument(item.id) : undefined}
|
|
163
|
+
/>
|
|
145
164
|
)}
|
|
146
165
|
/>
|
|
147
166
|
) : (
|
|
@@ -159,10 +178,14 @@ export function DetailBody({ controller, onBack, onOpenDocument, now = Date.now
|
|
|
159
178
|
emptyTitle={mode === 'closed' ? 'Nothing closed yet' : 'Nothing open'}
|
|
160
179
|
emptyDescription={mode === 'closed' ? 'Finished items filed under this project appear here.' : 'Nothing is filed under this project yet.'}
|
|
161
180
|
renderItem={({ item }: { item: Commitment }) => (
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
|
|
181
|
+
<ListRow
|
|
182
|
+
testID={`item-${item.id}`}
|
|
183
|
+
leading={<TodoGlyph status={item.status} overdue={isOverdue(item, clock)} />}
|
|
184
|
+
title={item.title}
|
|
185
|
+
meta={itemLine(item, clock) || undefined}
|
|
186
|
+
metaTone={isOverdue(item, clock) ? 'danger' : undefined}
|
|
187
|
+
chevron={false}
|
|
188
|
+
/>
|
|
166
189
|
)}
|
|
167
190
|
/>
|
|
168
191
|
)}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Icon, useTheme } from '@startsimpli/ui-native';
|
|
2
|
+
import type { CommitmentStatus } from '../../corpus/types';
|
|
3
|
+
|
|
4
|
+
/** The leading mark of a to-do: an open ring, a green check when done, red ring when overdue, amber when blocked. */
|
|
5
|
+
export function TodoGlyph({ status, overdue = false, size = 22 }: { status: CommitmentStatus; overdue?: boolean; size?: number }) {
|
|
6
|
+
const { tones, colors } = useTheme();
|
|
7
|
+
if (status === 'done') return <Icon name="check" size={size} color={tones.success.fg} />;
|
|
8
|
+
if (status === 'dropped') return <Icon name="close" size={size} color={colors.mutedForeground} />;
|
|
9
|
+
if (status === 'blocked') return <Icon name="alert" size={size} color={tones.warning.fg} />;
|
|
10
|
+
return <Icon name="circle" size={size} color={overdue ? tones.danger.fg : colors.mutedForeground} />;
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Alert, Button,
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Alert, Button, DetailScreen, Section, StatusChip, Text, useTheme } from '@startsimpli/ui-native';
|
|
4
4
|
import type { NativeCorpusApi } from '../corpus/api';
|
|
5
5
|
import { usePullRefresh } from '../components/usePullRefresh';
|
|
6
6
|
import { useControllerState } from '../components/useControllerState';
|
|
@@ -26,59 +26,54 @@ export function TrackerDetailScreen({ api, id, onBack, onOpenNote, onChanged, no
|
|
|
26
26
|
const s = useControllerState(controller);
|
|
27
27
|
const item = s.item;
|
|
28
28
|
const refreshControl = usePullRefresh(() => controller.load());
|
|
29
|
+
const frame = { title: 'To-do', onBack, headerTestID: 'todo-header', testID: 'todo-detail', refreshControl } as const;
|
|
29
30
|
|
|
30
31
|
if (!item) {
|
|
31
|
-
return
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
<ScrollView testID="todo-detail" refreshControl={refreshControl} contentContainerStyle={{ padding: theme.spacing.lg }}>
|
|
35
|
-
{s.loading ? <Spinner /> : <Alert variant="destructive">{s.error ?? 'This to-do is no longer available.'}</Alert>}
|
|
36
|
-
</ScrollView>
|
|
37
|
-
</View>
|
|
38
|
-
);
|
|
32
|
+
return s.loading
|
|
33
|
+
? <DetailScreen {...frame} loading />
|
|
34
|
+
: <DetailScreen {...frame} unavailable={{ title: s.error ?? 'This to-do is no longer available' }} />;
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
const closed = item.status === 'done' || item.status === 'dropped';
|
|
42
38
|
const due = formatDue(item.dueAt, now());
|
|
43
|
-
const
|
|
44
|
-
due ? `${isOverdueAt(item, now()) ? 'Overdue · ' : 'Due '}${due}` : null,
|
|
45
|
-
item.ownerName ? `Owner ${item.ownerName}` : null,
|
|
46
|
-
s.projectTitle ? `Project ${s.projectTitle}` : null,
|
|
47
|
-
priorityText(item.priority),
|
|
48
|
-
].filter(Boolean) as string[];
|
|
39
|
+
const overdue = isOverdueAt(item, now());
|
|
49
40
|
|
|
50
41
|
return (
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
<DetailScreen
|
|
43
|
+
{...frame}
|
|
44
|
+
hero={{ eyebrow: 'To-do', title: item.title, tags: <StatusChip status={item.status} />, subtitle: item.statusReason || undefined }}
|
|
45
|
+
meta={[
|
|
46
|
+
{ label: 'Due', value: due ? `${overdue ? 'Overdue · ' : ''}${due}` : '', tone: overdue ? 'danger' : undefined },
|
|
47
|
+
{ label: 'Owner', value: item.ownerName ?? '' },
|
|
48
|
+
{ label: 'Project', value: s.projectTitle ?? '' },
|
|
49
|
+
{ label: 'Priority', value: priorityText(item.priority) ?? '' },
|
|
50
|
+
]}
|
|
51
|
+
banner={s.error ? <Alert variant="destructive">{s.error}</Alert> : undefined}
|
|
52
|
+
actions={(
|
|
62
53
|
<Button
|
|
63
54
|
testID="todo-toggle"
|
|
64
55
|
title={closed ? 'Reopen' : 'Mark done'}
|
|
65
56
|
variant={closed ? 'outline' : 'primary'}
|
|
57
|
+
size="lg"
|
|
66
58
|
disabled={s.busy}
|
|
67
59
|
onPress={() => { void controller.setStatus(closed ? 'open' : 'done'); }}
|
|
68
60
|
/>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
{item.detail ? <Section title="Details"><View style={{ paddingVertical: theme.spacing.md }}><Text variant="body">{item.detail}</Text></View></Section> : null}
|
|
64
|
+
{s.sources.length ? (
|
|
65
|
+
<Section title="Where it came from">
|
|
66
|
+
{s.sources.map((src) => (
|
|
67
|
+
<View key={`${src.documentId}-${src.quote.slice(0, 24)}`} style={{ paddingVertical: theme.spacing.md, gap: theme.spacing.xs }}>
|
|
68
|
+
<Text variant="headline">{src.title}{src.section ? ` · ${src.section}` : ''}</Text>
|
|
69
|
+
{src.quote ? <Text variant="callout" style={{ fontStyle: 'italic', color: theme.colors.mutedForeground }}>{`“${src.quote}”`}</Text> : null}
|
|
75
70
|
{src.isVoiceNote && onOpenNote ? (
|
|
76
|
-
<Button testID={`todo-open-note-${src.documentId}`} title="Open note" variant="
|
|
71
|
+
<Button testID={`todo-open-note-${src.documentId}`} title="Open note" variant="outline" size="sm" style={{ alignSelf: 'flex-start', marginTop: theme.spacing.xs }} onPress={() => onOpenNote(src.documentId)} />
|
|
77
72
|
) : null}
|
|
78
|
-
</
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</
|
|
73
|
+
</View>
|
|
74
|
+
))}
|
|
75
|
+
</Section>
|
|
76
|
+
) : null}
|
|
77
|
+
</DetailScreen>
|
|
83
78
|
);
|
|
84
79
|
}
|