@startsimpli/integrations 0.2.102 → 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 +4 -4
- package/src/__tests__/focus-standings.test.tsx +119 -0
- package/src/components/pages/PlanningPage.tsx +16 -4
- package/src/corpus/client.ts +5 -0
- package/src/corpus/entity-query.ts +67 -4
- package/src/corpus/index.ts +4 -2
- package/src/corpus/standings.ts +75 -0
- package/src/corpus/types.ts +6 -0
- 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/corpus/__tests__/counts.test.ts +82 -0
- package/src/native/corpus/__tests__/display.test.ts +37 -0
- package/src/native/corpus/api.ts +35 -2
- package/src/native/corpus/counts.ts +16 -0
- package/src/native/corpus/display.ts +62 -0
- package/src/native/corpus/fake-counts.ts +59 -0
- package/src/native/corpus/fake-tenant.ts +31 -3
- package/src/native/home/HomeScreen.tsx +15 -12
- package/src/native/home/__tests__/controller.test.ts +24 -11
- package/src/native/home/controller.ts +23 -17
- package/src/native/index.ts +3 -1
- 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/screens/planning/__tests__/controller.test.ts +17 -23
- package/src/native/screens/planning/controller.ts +18 -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__/detail.test.ts +17 -0
- package/src/native/tracker/__tests__/format.test.ts +3 -3
- package/src/native/tracker/detail.ts +32 -19
- 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,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo } from 'react';
|
|
2
2
|
import { Share, ScrollView, View } from 'react-native';
|
|
3
|
-
import { Alert, Button, Header, Input, Select,
|
|
3
|
+
import { Alert, Button, Header, Input, ListRow, Section, Select, Skeleton, Tag, Text, useTheme } from '@startsimpli/ui-native';
|
|
4
4
|
import type { McpTokensApi } from '../../../api/mcp-tokens';
|
|
5
5
|
import { readableDate } from '../../../components/pages/connect-claude-format';
|
|
6
6
|
import { useControllerState } from '../../components/useControllerState';
|
|
@@ -15,11 +15,13 @@ export const shareWithSystem: ShareText = async (text) => {
|
|
|
15
15
|
export function ConnectClaudeScreen({ controller }: { controller: ConnectClaudeController }) {
|
|
16
16
|
const s = useControllerState(controller);
|
|
17
17
|
const theme = useTheme();
|
|
18
|
-
const gap = { gap: theme.spacing.
|
|
18
|
+
const gap = { gap: theme.spacing.lg } as const;
|
|
19
|
+
const pad = { paddingVertical: theme.spacing.md, paddingRight: theme.spacing.xs, gap: theme.spacing.sm } as const;
|
|
20
|
+
const mono = { fontFamily: 'Menlo', fontSize: theme.fontSizes.xs, color: theme.colors.foreground } as const;
|
|
19
21
|
|
|
20
22
|
let body;
|
|
21
23
|
if (s.phase === 'loading') {
|
|
22
|
-
body = <
|
|
24
|
+
body = <View style={{ gap: theme.spacing.md }}><Skeleton height={20} width="50%" /><Skeleton height={48} /><Skeleton height={120} /></View>;
|
|
23
25
|
} else if (s.phase === 'error') {
|
|
24
26
|
body = (
|
|
25
27
|
<View style={gap}>
|
|
@@ -33,25 +35,24 @@ export function ConnectClaudeScreen({ controller }: { controller: ConnectClaudeC
|
|
|
33
35
|
const m = s.minted;
|
|
34
36
|
body = (
|
|
35
37
|
<View style={gap} testID="connect-claude-token">
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
<Text variant="
|
|
39
|
-
|
|
40
|
-
<Text variant="muted">{s.expiry}</Text>
|
|
41
|
-
</View>
|
|
42
|
-
<Alert variant="destructive">{m.notice}</Alert>
|
|
38
|
+
<Alert variant="destructive" title="Your token: copy it now">{m.notice}</Alert>
|
|
39
|
+
<Section title="This connection reads" footer={s.expiry}>
|
|
40
|
+
<View style={pad}><Text variant="headline">{m.foundry}{m.acting_as.email ? ` as ${m.acting_as.email}` : ''}{m.acting_as.role ? ` (${m.acting_as.role})` : ''}</Text></View>
|
|
41
|
+
</Section>
|
|
43
42
|
{m.claude_code_command ? (
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
<Section title="Run this in your terminal">
|
|
44
|
+
<View style={pad}>
|
|
45
|
+
<Text selectable testID="connect-claude-command" style={mono}>{m.claude_code_command}</Text>
|
|
46
|
+
<Button testID="connect-claude-share-command" title={s.shared === 'command' ? 'Shared' : 'Copy or share command'} onPress={() => { void controller.share('command'); }} />
|
|
47
|
+
</View>
|
|
48
|
+
</Section>
|
|
49
49
|
) : null}
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
<Section title="Just the token">
|
|
51
|
+
<View style={pad}>
|
|
52
|
+
<Text selectable testID="connect-claude-token-text" style={mono}>{m.token}</Text>
|
|
53
|
+
<Button testID="connect-claude-share-token" variant="outline" title={s.shared === 'token' ? 'Shared' : 'Copy or share token'} onPress={() => { void controller.share('token'); }} />
|
|
54
|
+
</View>
|
|
55
|
+
</Section>
|
|
55
56
|
<Button testID="connect-claude-done" title="Done" variant="ghost" onPress={() => controller.done()} />
|
|
56
57
|
</View>
|
|
57
58
|
);
|
|
@@ -59,58 +60,64 @@ export function ConnectClaudeScreen({ controller }: { controller: ConnectClaudeC
|
|
|
59
60
|
body = (
|
|
60
61
|
<View style={gap} testID="connect-claude-form">
|
|
61
62
|
{s.foundries.length > 1 ? (
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
<Section title="Workspace">
|
|
64
|
+
<View style={pad}>
|
|
65
|
+
<Select
|
|
66
|
+
label="Which workspace?"
|
|
67
|
+
testID="connect-claude-workspace"
|
|
68
|
+
options={s.foundries.map((f) => ({ value: f.slug, label: f.name }))}
|
|
69
|
+
value={s.selected || null}
|
|
70
|
+
onChange={(v) => controller.select(v ?? '')}
|
|
71
|
+
/>
|
|
72
|
+
</View>
|
|
73
|
+
</Section>
|
|
69
74
|
) : null}
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</
|
|
75
|
+
<Section title="How long should it last?" footer={`Up to ${s.maxTtl} days. Shorter is safer.`}>
|
|
76
|
+
<View style={pad}>
|
|
77
|
+
<Input
|
|
78
|
+
testID="connect-claude-ttl"
|
|
79
|
+
keyboardType="number-pad"
|
|
80
|
+
placeholder={`${s.defaultTtl} days`}
|
|
81
|
+
value={s.ttlDays === null ? '' : String(s.ttlDays)}
|
|
82
|
+
onChangeText={(t) => controller.setTtlDays(t.trim() === '' || Number.isNaN(Number(t)) ? null : Number(t))}
|
|
83
|
+
/>
|
|
84
|
+
</View>
|
|
85
|
+
</Section>
|
|
81
86
|
<Alert variant="notice" title="Before you create this">
|
|
82
87
|
It reads this workspace as you: whatever you can see, it can see. It is shown once and cannot be retrieved again, and it cannot be cancelled before it expires. Turning off your access to the workspace stops new ones being made; it does not switch this one off.
|
|
83
88
|
</Alert>
|
|
84
89
|
{s.error ? <Alert variant="destructive">{s.error}</Alert> : null}
|
|
85
|
-
<Button testID="connect-claude-create" title={s.minting ? 'Creating...' : 'Create connection token'} disabled={!s.selected || s.minting} onPress={() => { void controller.mint(); }} />
|
|
86
|
-
<View
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
90
|
+
<Button testID="connect-claude-create" title={s.minting ? 'Creating...' : 'Create connection token'} size="lg" disabled={!s.selected || s.minting} onPress={() => { void controller.mint(); }} />
|
|
91
|
+
<View testID="connect-claude-issued">
|
|
92
|
+
<Section title="Tokens you made earlier">
|
|
93
|
+
{s.tokens.length === 0 ? <View style={pad}><Text variant="muted">None yet.</Text></View> : null}
|
|
94
|
+
{s.tokens.map((t) => (
|
|
95
|
+
<View key={t.jti} testID={`connect-claude-token-${t.jti}`}>
|
|
96
|
+
<ListRow
|
|
97
|
+
title={t.foundry}
|
|
98
|
+
subtitle={t.status === 'revoked' ? 'Revoked' : t.status === 'expired' ? `Expired ${readableDate(t.expires_at)}` : `Expires ${readableDate(t.expires_at)}`}
|
|
99
|
+
trailing={t.status === 'active' ? (
|
|
100
|
+
<Button
|
|
101
|
+
testID={`connect-claude-revoke-${t.jti}`}
|
|
102
|
+
title={s.revoking === t.jti ? 'Revoking...' : 'Revoke'}
|
|
103
|
+
variant="outline"
|
|
104
|
+
size="sm"
|
|
105
|
+
disabled={s.revoking !== ''}
|
|
106
|
+
onPress={() => { void controller.revoke(t.jti); }}
|
|
107
|
+
/>
|
|
108
|
+
) : <Tag label={t.status === 'revoked' ? 'Revoked' : 'Expired'} tone="neutral" />}
|
|
102
109
|
/>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
</View>
|
|
111
|
+
))}
|
|
112
|
+
</Section>
|
|
106
113
|
</View>
|
|
107
114
|
</View>
|
|
108
115
|
);
|
|
109
116
|
}
|
|
110
117
|
return (
|
|
111
|
-
<View style={{ flex: 1 }}>
|
|
112
|
-
<Header title="Connect Claude" subtitle="Let an MCP client read this workspace" />
|
|
113
|
-
<ScrollView contentContainerStyle={{ padding: theme.
|
|
118
|
+
<View style={{ flex: 1, backgroundColor: theme.surface.grouped }}>
|
|
119
|
+
<Header large title="Connect Claude" subtitle="Let an MCP client read this workspace" background={theme.surface.grouped} />
|
|
120
|
+
<ScrollView contentContainerStyle={{ padding: theme.layout.gutter, paddingBottom: theme.layout.sectionGap * 2 }} keyboardShouldPersistTaps="handled">{body}</ScrollView>
|
|
114
121
|
</View>
|
|
115
122
|
);
|
|
116
123
|
}
|
|
@@ -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
|
-
|