@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,9 +1,9 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { Alert as RNAlert,
|
|
3
|
-
import { Alert,
|
|
2
|
+
import { Alert as RNAlert, View } from 'react-native';
|
|
3
|
+
import { Alert, Button, Chip, DetailScreen, Icon, ListRow, Section, StatusChip, Tag, Text, useTheme } from '@startsimpli/ui-native';
|
|
4
4
|
import type { VoiceFocus, VoiceNote } from '../../corpus/voice';
|
|
5
5
|
import type { VoiceNotesController } from '../voice/controller';
|
|
6
|
-
import { DELETE_NOTE_TITLE, deleteNoteMessage, formatDuration, formatNoteDate, statusLabel
|
|
6
|
+
import { DELETE_NOTE_TITLE, deleteNoteMessage, formatDuration, formatNoteDate, statusLabel } from '../voice/format';
|
|
7
7
|
import { noteSections, noteLead } from '../voice/sections';
|
|
8
8
|
import { usePullRefresh } from './usePullRefresh';
|
|
9
9
|
import { useVoiceNotes } from './useVoiceNotes';
|
|
@@ -33,18 +33,12 @@ export function NoteDetailScreen({ controller, noteId, onBack }: NoteDetailScree
|
|
|
33
33
|
// A deep link, or a note moved out of the active filter, is not on a loaded page: the controller fetches it by id.
|
|
34
34
|
useEffect(() => { void controller.open(noteId); }, [controller, noteId]);
|
|
35
35
|
const note: VoiceNote | undefined = state.notes?.find((n) => n.id === noteId) ?? (state.opened?.id === noteId ? state.opened : undefined);
|
|
36
|
-
const gap = { gap: theme.spacing.sm } as const;
|
|
37
36
|
const refreshControl = usePullRefresh(() => Promise.all([controller.refresh(), controller.open(noteId, { fresh: true })]));
|
|
37
|
+
const frame = { title: 'Note', onBack, headerTestID: 'note', testID: 'note-detail', refreshControl } as const;
|
|
38
38
|
|
|
39
39
|
if (!note) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<Header testID="note" title="Note" onBack={onBack} />
|
|
43
|
-
<ScrollView contentContainerStyle={{ padding: theme.spacing.lg, ...gap }} refreshControl={refreshControl} testID="note-detail">
|
|
44
|
-
{state.notes === null || state.opening ? <Spinner /> : <Text variant="muted">This note is no longer available. It may have been deleted.</Text>}
|
|
45
|
-
</ScrollView>
|
|
46
|
-
</View>
|
|
47
|
-
);
|
|
40
|
+
const loading = state.notes === null || state.opening;
|
|
41
|
+
return <DetailScreen {...frame} loading={loading} unavailable={loading ? undefined : { title: 'This note is no longer available', description: 'It may have been deleted.' }} />;
|
|
48
42
|
}
|
|
49
43
|
|
|
50
44
|
const sections = noteSections(note);
|
|
@@ -55,60 +49,58 @@ export function NoteDetailScreen({ controller, noteId, onBack }: NoteDetailScree
|
|
|
55
49
|
{ text: 'Delete', style: 'destructive', onPress: () => { void controller.remove(note.id).then(onBack); } },
|
|
56
50
|
]);
|
|
57
51
|
const meta = [formatNoteDate(note.occurredAt), formatDuration(note.durationMs)].filter(Boolean).join(' · ');
|
|
52
|
+
const lead = noteLead(note);
|
|
58
53
|
|
|
59
54
|
return (
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
55
|
+
<DetailScreen
|
|
56
|
+
{...frame}
|
|
57
|
+
hero={{
|
|
58
|
+
eyebrow: 'Voice note',
|
|
59
|
+
title: note.title,
|
|
60
|
+
subtitle: meta || undefined,
|
|
61
|
+
tags: (
|
|
62
|
+
<>
|
|
63
|
+
{note.status === 'ready' ? null : <StatusChip status={note.status === 'failed' ? 'failed' : 'processing'} label={statusLabel(note.status)} />}
|
|
64
|
+
<Tag label={focusTitle(note.focusId)} tone={note.focusId ? 'info' : 'neutral'} />
|
|
65
|
+
</>
|
|
66
|
+
),
|
|
67
|
+
}}
|
|
68
|
+
banner={(
|
|
69
|
+
<>
|
|
70
|
+
{state.error ? <Alert variant="destructive">{state.error}</Alert> : null}
|
|
71
|
+
{note.status === 'failed' ? <Alert variant="destructive">{note.error || 'This note could not be processed.'}</Alert> : null}
|
|
72
|
+
{note.status === 'processing' ? <Text variant="muted">Transcribing... this updates by itself.</Text> : null}
|
|
73
|
+
</>
|
|
74
|
+
)}
|
|
75
|
+
actions={note.status === 'failed' && controller.canRetry ? <Button title="Retry" onPress={() => { void controller.retry(note.id); }} testID="note-retry" /> : undefined}
|
|
76
|
+
footer={controller.canRemove ? <Button title="Delete note" variant="destructive" onPress={confirmDelete} testID="note-delete" /> : undefined}
|
|
77
|
+
>
|
|
78
|
+
{lead ? <Text variant="body">{lead}</Text> : null}
|
|
79
79
|
{sections.map((s, i) => (
|
|
80
|
-
<View key={`${s.label}-${i}`}
|
|
81
|
-
{sections.length > 1 || s.label ? (
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<Text variant="caption">To-dos</Text>
|
|
88
|
-
{s.items.map((item, j) => <Text key={j}>{`• ${item}`}</Text>)}
|
|
89
|
-
</View>
|
|
90
|
-
) : null}
|
|
91
|
-
{sections.length > 1 && s.focusId ? <Text variant="caption">Filed under {focusTitle(s.focusId)}</Text> : null}
|
|
80
|
+
<View key={`${s.label}-${i}`} testID={`section-${i}`}>
|
|
81
|
+
<Section title={sections.length > 1 || s.label ? `${s.label || focusTitle(s.focusId)}${s.kind === 'personal' ? ' (personal)' : ''}` : 'Summary'} footer={sections.length > 1 && s.focusId ? `Filed under ${focusTitle(s.focusId)}` : undefined}>
|
|
82
|
+
{s.summary ? <View style={{ paddingVertical: theme.spacing.md, paddingRight: theme.spacing.xs }}><Text variant="body">{s.summary}</Text></View> : null}
|
|
83
|
+
{s.items.map((item, j) => (
|
|
84
|
+
<ListRow key={j} title={item} titleLines={4} leading={<Icon name="check" size={20} color={theme.colors.mutedForeground} />} />
|
|
85
|
+
))}
|
|
86
|
+
</Section>
|
|
92
87
|
</View>
|
|
93
88
|
))}
|
|
94
89
|
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
{picking ? <ProjectPicker focuses={state.focuses} value={note.focusId} onPick={(id) => { void controller.file(note.id, id); }}
|
|
101
|
-
</
|
|
90
|
+
<Section title="Project">
|
|
91
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: theme.spacing.md, paddingVertical: theme.spacing.md, paddingRight: theme.spacing.xs }}>
|
|
92
|
+
<Text variant="headline" testID="note-project" style={{ flex: 1 }}>{focusTitle(note.focusId)}</Text>
|
|
93
|
+
<Button title={picking ? 'Done' : 'Change'} variant="outline" size="sm" onPress={() => setPicking((p) => !p)} testID="note-change-project" />
|
|
94
|
+
</View>
|
|
95
|
+
{picking ? <View style={{ paddingBottom: theme.spacing.md }}><ProjectPicker focuses={state.focuses} value={note.focusId} onPick={(id) => { void controller.file(note.id, id); }} /></View> : null}
|
|
96
|
+
</Section>
|
|
102
97
|
|
|
103
98
|
{note.transcript ? (
|
|
104
|
-
<
|
|
99
|
+
<Section title="Transcript">
|
|
105
100
|
<Button title={showTranscript ? 'Hide transcript' : 'Transcript'} variant="ghost" size="sm" style={{ alignSelf: 'flex-start' }} onPress={() => setShowTranscript((v) => !v)} testID="note-transcript-toggle" />
|
|
106
|
-
{showTranscript ? <Text testID="note-transcript">{note.transcript}</Text> : null}
|
|
107
|
-
</
|
|
101
|
+
{showTranscript ? <View style={{ paddingVertical: theme.spacing.md }}><Text testID="note-transcript" variant="callout">{note.transcript}</Text></View> : null}
|
|
102
|
+
</Section>
|
|
108
103
|
) : null}
|
|
109
|
-
|
|
110
|
-
{controller.canRemove ? <Button title="Delete" variant="destructive" size="sm" onPress={confirmDelete} testID="note-delete" /> : null}
|
|
111
|
-
</ScrollView>
|
|
112
|
-
</View>
|
|
104
|
+
</DetailScreen>
|
|
113
105
|
);
|
|
114
106
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Alert,
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Alert, DataList, Header, IconTile, ListRow, StatusChip, useTheme, type FilterGroup } from '@startsimpli/ui-native';
|
|
4
4
|
import { UNFILED_PROJECT } from '../../corpus/filing';
|
|
5
5
|
import type { VoiceNote, VoiceNoteOrder } from '../../corpus/voice';
|
|
6
6
|
import type { VoiceNotesController } from '../voice/controller';
|
|
7
|
-
import { formatDuration, formatNoteDate, statusLabel
|
|
7
|
+
import { formatDuration, formatNoteDate, statusLabel } from '../voice/format';
|
|
8
8
|
import { noteSections } from '../voice/sections';
|
|
9
9
|
import { useVoiceNotes } from './useVoiceNotes';
|
|
10
10
|
|
|
@@ -41,7 +41,7 @@ export function NotesListScreen({ controller, onOpen }: NotesListScreenProps) {
|
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
43
|
<View style={{ flex: 1 }} testID="notes-screen">
|
|
44
|
-
<Header testID="notes-header" title="Notes" subtitle={count !== null && canQuery ? `${count} note${count === 1 ? '' : 's'}` : undefined} />
|
|
44
|
+
<Header large testID="notes-header" title="Notes" subtitle={count !== null && canQuery ? `${count} note${count === 1 ? '' : 's'}` : undefined} />
|
|
45
45
|
<DataList<VoiceNote>
|
|
46
46
|
testID="notes-list"
|
|
47
47
|
data={notes ?? []}
|
|
@@ -89,24 +89,18 @@ export function NotesListScreen({ controller, onOpen }: NotesListScreenProps) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function NoteRow({ note, onPress }: { note: VoiceNote; onPress: () => void }) {
|
|
92
|
-
const theme = useTheme();
|
|
93
92
|
const preview = noteSections(note)[0]?.summary;
|
|
93
|
+
const ready = note.status === 'ready';
|
|
94
94
|
return (
|
|
95
|
-
<
|
|
95
|
+
<ListRow
|
|
96
96
|
testID={`note-row-${note.id}`}
|
|
97
|
-
|
|
97
|
+
leading={<IconTile icon="mic" tone={ready ? 'neutral' : note.status === 'failed' ? 'danger' : 'info'} />}
|
|
98
|
+
title={note.title}
|
|
99
|
+
meta={subtitle(note) || undefined}
|
|
100
|
+
preview={preview || undefined}
|
|
101
|
+
// A finished note needs no badge; one still working or failed does.
|
|
102
|
+
trailing={ready ? undefined : <StatusChip status={note.status === 'failed' ? 'failed' : 'processing'} label={statusLabel(note.status)} />}
|
|
98
103
|
onPress={onPress}
|
|
99
|
-
|
|
100
|
-
flexDirection: 'row', alignItems: 'center', gap: theme.spacing.sm, paddingVertical: theme.spacing.md,
|
|
101
|
-
borderBottomWidth: 1, borderBottomColor: theme.colors.border, opacity: pressed ? 0.6 : 1,
|
|
102
|
-
})}
|
|
103
|
-
>
|
|
104
|
-
<View style={{ flex: 1, gap: theme.spacing.xs }}>
|
|
105
|
-
<Text style={{ fontWeight: '600' }} numberOfLines={2}>{note.title}</Text>
|
|
106
|
-
{subtitle(note) ? <Text variant="caption">{subtitle(note)}</Text> : null}
|
|
107
|
-
{preview ? <Text variant="muted" numberOfLines={2}>{preview}</Text> : null}
|
|
108
|
-
</View>
|
|
109
|
-
<Badge label={statusLabel(note.status)} variant={statusVariant(note.status)} />
|
|
110
|
-
</Pressable>
|
|
104
|
+
/>
|
|
111
105
|
);
|
|
112
106
|
}
|
|
@@ -138,10 +138,10 @@ describe('NoteDetailScreen', () => {
|
|
|
138
138
|
it('to-dos come from the section items, one list per section', async () => {
|
|
139
139
|
const { r } = await mountDetail('n1');
|
|
140
140
|
const text = allText(r);
|
|
141
|
-
expect(text).toContain('
|
|
142
|
-
expect(text).toContain('
|
|
143
|
-
expect(text).toContain('
|
|
144
|
-
expect(text).toContain('
|
|
141
|
+
expect(text).toContain('Finish exhibit list');
|
|
142
|
+
expect(text).toContain('Call Megan about the filing receipt');
|
|
143
|
+
expect(text).toContain('Move weekly report to Monday');
|
|
144
|
+
expect(text).toContain('Book the dentist');
|
|
145
145
|
expect(text).toContain('Finish the exhibit list before the hearing.');
|
|
146
146
|
});
|
|
147
147
|
|
|
@@ -149,8 +149,8 @@ describe('NoteDetailScreen', () => {
|
|
|
149
149
|
const { r } = await mountDetail('n2', {
|
|
150
150
|
notes: [{ id: 'n2', title: 'Garage', status: 'ready', occurredAt: null, focusId: null, transcript: '', summary: 'Garage plans.\n\n## Next Steps\n- **Buy brackets** (Quinn)\n- **Cut shelves**' }],
|
|
151
151
|
});
|
|
152
|
-
expect(allText(r)).toContain('
|
|
153
|
-
expect(allText(r)).toContain('
|
|
152
|
+
expect(allText(r)).toContain('Buy brackets (Quinn)');
|
|
153
|
+
expect(allText(r)).toContain('Cut shelves');
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
it('a note past the first page still opens (fetched by id)', async () => {
|
|
@@ -161,6 +161,6 @@ describe('NoteDetailScreen', () => {
|
|
|
161
161
|
|
|
162
162
|
it('a note that does not exist says so', async () => {
|
|
163
163
|
const { r } = await mountDetail('nope');
|
|
164
|
-
expect(allText(r)).toContain('This note is no longer available
|
|
164
|
+
expect(allText(r)).toContain('This note is no longer available');
|
|
165
165
|
});
|
|
166
166
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { FlatList, Pressable, RefreshControl, View } from 'react-native';
|
|
3
|
-
import { Alert, Button, EmptyState, ListRow, Skeleton, StatTile,
|
|
3
|
+
import { Alert, Button, EmptyState, Header, IconTile, ListRow, SectionHeader, Skeleton, StatTile, useTheme, type IconName } from '@startsimpli/ui-native';
|
|
4
4
|
import { useControllerState } from '../components/useControllerState';
|
|
5
5
|
import { timeAgo, type HomeArrival, type HomeController } from './controller';
|
|
6
6
|
|
|
@@ -25,21 +25,19 @@ export function HomeScreen({ controller, brand, tagline, onRecord, onOpenType, o
|
|
|
25
25
|
const s = useControllerState(controller);
|
|
26
26
|
useEffect(() => { if (active) void controller.load(); }, [controller, active]);
|
|
27
27
|
return (
|
|
28
|
+
<View style={{ flex: 1 }}>
|
|
29
|
+
<Header large title={brand} subtitle={tagline} />
|
|
28
30
|
<FlatList
|
|
29
31
|
testID="home-list"
|
|
30
32
|
data={s.arrivals}
|
|
31
33
|
keyExtractor={(a) => `${a.type}-${a.id}`}
|
|
32
34
|
refreshControl={<RefreshControl refreshing={false} onRefresh={() => { void controller.refresh(); }} tintColor={theme.colors.mutedForeground} />}
|
|
33
|
-
contentContainerStyle={{
|
|
35
|
+
contentContainerStyle={{ paddingHorizontal: theme.layout.gutter, paddingBottom: theme.spacing.xl, flexGrow: 1 }}
|
|
34
36
|
ListHeaderComponent={
|
|
35
|
-
<View style={{ gap: theme.spacing.
|
|
36
|
-
<
|
|
37
|
-
<Text variant="heading">{brand}</Text>
|
|
38
|
-
{tagline ? <Text variant="muted">{tagline}</Text> : null}
|
|
39
|
-
</View>
|
|
40
|
-
{onRecord ? <Button testID="home-record" title="Record a note" onPress={onRecord} /> : null}
|
|
37
|
+
<View style={{ gap: theme.spacing.xs, paddingBottom: theme.spacing.xs }}>
|
|
38
|
+
{onRecord ? <Button testID="home-record" title="Record a note" size="lg" style={{ marginTop: theme.spacing.sm }} onPress={onRecord} /> : null}
|
|
41
39
|
{s.error ? <Alert variant="destructive">{s.error}</Alert> : null}
|
|
42
|
-
<
|
|
40
|
+
<SectionHeader title="What has come in" />
|
|
43
41
|
<View style={{ flexDirection: 'row', gap: theme.spacing.sm }}>
|
|
44
42
|
{s.metrics.map((m) => (
|
|
45
43
|
<View key={m.key} style={{ flex: 1, minWidth: 0 }} testID={`home-metric-${m.key}`}>
|
|
@@ -51,17 +49,22 @@ export function HomeScreen({ controller, brand, tagline, onRecord, onOpenType, o
|
|
|
51
49
|
</View>
|
|
52
50
|
))}
|
|
53
51
|
</View>
|
|
54
|
-
<
|
|
52
|
+
<SectionHeader title="Latest arrivals" />
|
|
55
53
|
</View>
|
|
56
54
|
}
|
|
57
|
-
ListEmptyComponent={s.loading ? null : <EmptyState title="No records yet" description="Record a note to get started." />}
|
|
55
|
+
ListEmptyComponent={s.loading ? null : <EmptyState icon="note" title="No records yet" description="Record a note to get started." />}
|
|
58
56
|
renderItem={({ item }) => (
|
|
59
57
|
<ListRow
|
|
58
|
+
leading={<IconTile icon={ARRIVAL_ICON[item.type] ?? 'dot'} tone={item.type === 'commitment' ? 'success' : item.type === 'focus' ? 'warning' : 'info'} />}
|
|
59
|
+
eyebrow={item.typeLabel || undefined}
|
|
60
60
|
title={item.title}
|
|
61
|
-
|
|
61
|
+
meta={timeAgo(item.createdAt, now())}
|
|
62
62
|
onPress={onOpenArrival ? () => onOpenArrival(item) : undefined}
|
|
63
63
|
/>
|
|
64
64
|
)}
|
|
65
65
|
/>
|
|
66
|
+
</View>
|
|
66
67
|
);
|
|
67
68
|
}
|
|
69
|
+
|
|
70
|
+
const ARRIVAL_ICON: Record<string, IconName> = { commitment: 'check', source_document: 'note', focus: 'planning' };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { FlatList, Pressable, View } from 'react-native';
|
|
3
|
-
import { Alert,
|
|
3
|
+
import { Alert, Button, ChatComposer, EmptyState, Header, ListRow, MessageBubble, Section, Select, Text, useTheme } from '@startsimpli/ui-native';
|
|
4
4
|
import { useControllerState as useStore } from '../../components/useControllerState';
|
|
5
5
|
import type { AnswerView } from './answer-view';
|
|
6
6
|
import type { AskController, AskMessage } from './controller';
|
|
@@ -21,7 +21,7 @@ export function AskScreen({ controller, onOpenDocument }: AskScreenProps) {
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<View style={{ flex: 1 }}>
|
|
24
|
-
<Header testID="ask-header" title="Ask" subtitle={scope ? `Scoped to ${scope}` : 'All projects'} />
|
|
24
|
+
<Header large testID="ask-header" title="Ask" subtitle={scope ? `Scoped to ${scope}` : 'All projects'} />
|
|
25
25
|
{s.projects.length ? (
|
|
26
26
|
<View style={{ paddingHorizontal: theme.spacing.lg, paddingBottom: theme.spacing.sm, flexDirection: 'row' }}>
|
|
27
27
|
<Select
|
|
@@ -46,7 +46,7 @@ export function AskScreen({ controller, onOpenDocument }: AskScreenProps) {
|
|
|
46
46
|
onContentSizeChange={() => list.current?.scrollToEnd?.({ animated: true })}
|
|
47
47
|
contentContainerStyle={{ padding: theme.spacing.lg, gap: theme.spacing.md, flexGrow: 1 }}
|
|
48
48
|
ListEmptyComponent={
|
|
49
|
-
<EmptyState icon="
|
|
49
|
+
<EmptyState icon="ask" title="Ask your documents" description="Answers come from your notes, meetings and files, with the records they used." />
|
|
50
50
|
}
|
|
51
51
|
renderItem={({ item }) => <Message message={item} onRetry={() => { void controller.retry(item.id); }} onOpenDocument={onOpenDocument} />}
|
|
52
52
|
/>
|
|
@@ -81,25 +81,23 @@ function Sources({ view, onOpenDocument }: { view: AnswerView; onOpenDocument: (
|
|
|
81
81
|
const [showUncited, setShowUncited] = useState(false);
|
|
82
82
|
const n = view.citations.length;
|
|
83
83
|
return (
|
|
84
|
-
<View style={{ gap: theme.spacing.
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</Pressable>
|
|
102
|
-
))}
|
|
84
|
+
<View style={{ gap: theme.spacing.xs }}>
|
|
85
|
+
{n > 0 ? (
|
|
86
|
+
<Section title={`${n} source${n === 1 ? '' : 's'}`}>
|
|
87
|
+
{view.citations.map((c) => (
|
|
88
|
+
<ListRow
|
|
89
|
+
key={c.documentId}
|
|
90
|
+
testID={`ask-citation-${c.documentId}`}
|
|
91
|
+
accessibilityLabel={`Open ${c.title}`}
|
|
92
|
+
eyebrow={c.sourceLabel}
|
|
93
|
+
title={c.title}
|
|
94
|
+
preview={c.quote ? `“${c.quote}”` : undefined}
|
|
95
|
+
meta={c.dateLabel || undefined}
|
|
96
|
+
onPress={() => onOpenDocument(c.documentId)}
|
|
97
|
+
/>
|
|
98
|
+
))}
|
|
99
|
+
</Section>
|
|
100
|
+
) : null}
|
|
103
101
|
{view.uncited.length ? (
|
|
104
102
|
<View style={{ gap: theme.spacing.xs }}>
|
|
105
103
|
<Pressable accessibilityRole="button" testID="ask-uncited-toggle" onPress={() => setShowUncited((v) => !v)}>
|
|
@@ -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
|
}
|