@startsimpli/integrations 0.2.103 → 0.2.105

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.
Files changed (31) hide show
  1. package/package.json +5 -5
  2. package/src/native/__tests__/design-screens.test.tsx +97 -0
  3. package/src/native/__tests__/ux-polish.test.tsx +4 -2
  4. package/src/native/app/FoundryApp.tsx +2 -2
  5. package/src/native/app/__tests__/launch.test.ts +4 -1
  6. package/src/native/app/entity/EntityTab.tsx +13 -18
  7. package/src/native/app/icon.tsx +6 -1
  8. package/src/native/app/launch.ts +4 -0
  9. package/src/native/app/screens/RecordScreen.tsx +37 -30
  10. package/src/native/app/screens/SignInScreen.tsx +4 -3
  11. package/src/native/components/FoundryTabsShell.tsx +8 -5
  12. package/src/native/components/MoreTabList.tsx +20 -25
  13. package/src/native/components/NoteDetailScreen.tsx +49 -57
  14. package/src/native/components/NotesListScreen.tsx +13 -19
  15. package/src/native/components/__tests__/notes-screens.test.tsx +7 -7
  16. package/src/native/home/HomeScreen.tsx +15 -12
  17. package/src/native/recording/__tests__/recovery.test.ts +12 -0
  18. package/src/native/recording/recovery.ts +5 -2
  19. package/src/native/screens/ask/AskScreen.tsx +20 -22
  20. package/src/native/screens/connect-claude/ConnectClaudeScreen.tsx +68 -61
  21. package/src/native/screens/connections/ConnectionsScreens.tsx +46 -42
  22. package/src/native/screens/library/LibraryDetailScreen.tsx +35 -49
  23. package/src/native/screens/library/LibraryListScreen.tsx +13 -21
  24. package/src/native/screens/planning/PlanningScreens.tsx +49 -26
  25. package/src/native/tracker/TodoGlyph.tsx +11 -0
  26. package/src/native/tracker/TrackerDetailScreen.tsx +34 -39
  27. package/src/native/tracker/TrackerListScreen.tsx +28 -19
  28. package/src/native/tracker/__tests__/format.test.ts +3 -3
  29. package/src/native/tracker/format.ts +8 -7
  30. package/src/native/voice/format.ts +0 -3
  31. 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, ScrollView, View } from 'react-native';
3
- import { Alert, Badge, Button, Chip, Header, Separator, Spinner, Text, useTheme } from '@startsimpli/ui-native';
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, statusVariant } from '../voice/format';
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
- return (
41
- <View style={{ flex: 1 }}>
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
- <View style={{ flex: 1 }}>
61
- <Header testID="note" title="Note" onBack={onBack} />
62
- <ScrollView contentContainerStyle={{ padding: theme.spacing.lg, ...gap }} refreshControl={refreshControl} testID="note-detail">
63
- <Text variant="heading">{note.title}</Text>
64
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: theme.spacing.sm }}>
65
- <Badge label={statusLabel(note.status)} variant={statusVariant(note.status)} />
66
- {meta ? <Text variant="caption">{meta}</Text> : null}
67
- </View>
68
- {state.error ? <Alert variant="destructive">{state.error}</Alert> : null}
69
-
70
- {note.status === 'failed' ? (
71
- <View style={gap}>
72
- <Alert variant="destructive">{note.error || 'This note could not be processed.'}</Alert>
73
- {controller.canRetry ? <Button title="Retry" onPress={() => { void controller.retry(note.id); }} testID="note-retry" /> : null}
74
- </View>
75
- ) : null}
76
- {note.status === 'processing' ? <Text variant="muted">Transcribing... this updates by itself.</Text> : null}
77
-
78
- {noteLead(note) ? <Text>{noteLead(note)}</Text> : null}
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}`} style={gap} testID={`section-${i}`}>
81
- {sections.length > 1 || s.label ? (
82
- <Text variant="body" style={{ fontWeight: '600' }}>{s.label || focusTitle(s.focusId)}{s.kind === 'personal' ? ' (personal)' : ''}</Text>
83
- ) : null}
84
- {s.summary ? <Text>{s.summary}</Text> : null}
85
- {s.items.length ? (
86
- <View style={{ gap: 4 }}>
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
- <Separator />
96
- <View style={gap}>
97
- <Text variant="caption">Project</Text>
98
- <Text testID="note-project">{focusTitle(note.focusId)}</Text>
99
- <Button title={picking ? 'Done' : 'Change project'} variant="outline" size="sm" style={{ alignSelf: 'flex-start' }} onPress={() => setPicking((p) => !p)} testID="note-change-project" />
100
- {picking ? <ProjectPicker focuses={state.focuses} value={note.focusId} onPick={(id) => { void controller.file(note.id, id); }} /> : null}
101
- </View>
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
- <View style={gap}>
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
- </View>
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 { Pressable, View } from 'react-native';
3
- import { Alert, Badge, DataList, Header, Text, useTheme, type FilterGroup } from '@startsimpli/ui-native';
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, statusVariant } from '../voice/format';
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
- <Pressable
95
+ <ListRow
96
96
  testID={`note-row-${note.id}`}
97
- accessibilityRole="button"
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
- style={({ pressed }) => ({
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('• 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');
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('• Buy brackets (Quinn)');
153
- expect(allText(r)).toContain('• Cut shelves');
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, Text, useTheme } from '@startsimpli/ui-native';
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={{ padding: theme.spacing.lg, paddingBottom: theme.spacing.xl, flexGrow: 1 }}
35
+ contentContainerStyle={{ paddingHorizontal: theme.layout.gutter, paddingBottom: theme.spacing.xl, flexGrow: 1 }}
34
36
  ListHeaderComponent={
35
- <View style={{ gap: theme.spacing.md, paddingBottom: theme.spacing.md }}>
36
- <View>
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
- <Text variant="caption" style={{ fontWeight: '600' }}>WHAT HAS COME IN</Text>
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
- <Text variant="caption" style={{ fontWeight: '600' }}>LATEST ARRIVALS</Text>
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
- subtitle={[item.typeLabel, timeAgo(item.createdAt, now())].filter(Boolean).join(' · ')}
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' };
@@ -37,6 +37,18 @@ describe('orphan recovery (app killed mid-recording)', () => {
37
37
  expect(ids[0]).toBe(ids[1]);
38
38
  });
39
39
 
40
+ it('queues the recovered file with the duration the device read from it (startsim-150po.9)', async () => {
41
+ const enqueue = vi.fn().mockResolvedValue('queued');
42
+ const log = vi.fn();
43
+ await recoverOrphans({
44
+ list: async () => [{ uri: 'file:///docs/AAAA-1111-bbbb.m4a', bytes: 5000, durationMs: 13781 }, { uri: 'file:///docs/CCCC-2222-dddd.m4a', bytes: 9000 }],
45
+ enqueue, log,
46
+ });
47
+ expect(enqueue.mock.calls[0][0]).toMatchObject({ id: 'AAAA-1111-bbbb', durationMs: 13781 });
48
+ expect(enqueue.mock.calls[1][0]).toMatchObject({ id: 'CCCC-2222-dddd', durationMs: 0 });
49
+ expect(log).toHaveBeenCalledWith('orphan.recovered', expect.objectContaining({ id: 'AAAA-1111-bbbb', durationMs: 13781 }));
50
+ });
51
+
40
52
  it('excludes the file being recorded right now', async () => {
41
53
  const enqueue = vi.fn().mockResolvedValue('queued');
42
54
  await recoverOrphans({ list: async () => files, enqueue, log: vi.fn(), isActive: (uri) => uri.includes('AAAA') });
@@ -3,6 +3,8 @@ import type { QueuedUpload } from '@startsimpli/utils';
3
3
  export interface RecordingFile {
4
4
  uri: string;
5
5
  bytes: number;
6
+ /** Read from the finalized file by the device (a recording killed mid-write has no stored duration). */
7
+ durationMs?: number;
6
8
  }
7
9
 
8
10
  /** Same file name -> same id, in the charset and length the server accepts. */
@@ -32,8 +34,9 @@ export async function recoverOrphans(deps: {
32
34
  deps.log('orphan.skipped', { id, uri: file.uri, bytes: file.bytes });
33
35
  continue;
34
36
  }
35
- deps.log('orphan.recovered', { id, uri: file.uri, bytes: file.bytes });
36
- await deps.enqueue({ id, uri: file.uri, durationMs: 0 });
37
+ const durationMs = file.durationMs && file.durationMs > 0 ? Math.round(file.durationMs) : 0;
38
+ deps.log('orphan.recovered', { id, uri: file.uri, bytes: file.bytes, durationMs });
39
+ await deps.enqueue({ id, uri: file.uri, durationMs });
37
40
  recovered += 1;
38
41
  }
39
42
  return { recovered, skipped };
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
2
  import { FlatList, Pressable, View } from 'react-native';
3
- import { Alert, Badge, Button, ChatComposer, EmptyState, Header, MessageBubble, Select, Text, useTheme } from '@startsimpli/ui-native';
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="💬" title="Ask your documents" description="Answers come from your notes, meetings and files, with the records they used." />
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.sm }}>
85
- {view.status !== 'no_evidence' ? <Text variant="caption">{`${n} source${n === 1 ? '' : 's'}`}</Text> : null}
86
- {view.citations.map((c) => (
87
- <Pressable
88
- key={c.documentId}
89
- testID={`ask-citation-${c.documentId}`}
90
- accessibilityRole="button"
91
- accessibilityLabel={`Open ${c.title}`}
92
- onPress={() => onOpenDocument(c.documentId)}
93
- style={({ pressed }) => ({ gap: 2, paddingVertical: theme.spacing.xs, opacity: pressed ? 0.6 : 1 })}
94
- >
95
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: theme.spacing.sm }}>
96
- <Badge label={c.sourceLabel} variant="outline" />
97
- <Text variant="caption">{c.dateLabel}</Text>
98
- </View>
99
- <Text style={{ color: theme.colors.primary, fontWeight: '600' }}>{c.title}</Text>
100
- {c.quote ? <Text variant="muted" style={{ fontStyle: 'italic' }} numberOfLines={3}>{`“${c.quote}”`}</Text> : null}
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, Spinner, Text, useTheme } from '@startsimpli/ui-native';
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.md } as const;
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 = <Spinner />;
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
- <Text variant="heading">Your token: copy it now</Text>
37
- <View style={{ gap: 2 }}>
38
- <Text variant="muted">This connection reads</Text>
39
- <Text>{m.foundry}{m.acting_as.email ? ` as ${m.acting_as.email}` : ''}{m.acting_as.role ? ` (${m.acting_as.role})` : ''}</Text>
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
- <View style={{ gap: theme.spacing.sm }}>
45
- <Text variant="muted">Run this in your terminal:</Text>
46
- <Text selectable testID="connect-claude-command" style={{ fontFamily: 'Menlo', fontSize: theme.fontSizes.xs }}>{m.claude_code_command}</Text>
47
- <Button testID="connect-claude-share-command" title={s.shared === 'command' ? 'Shared' : 'Copy or share command'} onPress={() => { void controller.share('command'); }} />
48
- </View>
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
- <View style={{ gap: theme.spacing.sm }}>
51
- <Text variant="muted">Just the token:</Text>
52
- <Text selectable testID="connect-claude-token-text" style={{ fontFamily: 'Menlo', fontSize: theme.fontSizes.xs }}>{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>
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
- <Select
63
- label="Which workspace?"
64
- testID="connect-claude-workspace"
65
- options={s.foundries.map((f) => ({ value: f.slug, label: f.name }))}
66
- value={s.selected || null}
67
- onChange={(v) => controller.select(v ?? '')}
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
- <View style={{ gap: theme.spacing.xs }}>
71
- <Text variant="heading" style={{ fontSize: theme.fontSizes.base }}>How long should it last?</Text>
72
- <Input
73
- testID="connect-claude-ttl"
74
- keyboardType="number-pad"
75
- placeholder={`${s.defaultTtl} days`}
76
- value={s.ttlDays === null ? '' : String(s.ttlDays)}
77
- onChangeText={(t) => controller.setTtlDays(t.trim() === '' || Number.isNaN(Number(t)) ? null : Number(t))}
78
- />
79
- <Text variant="muted">Up to {s.maxTtl} days. Shorter is safer.</Text>
80
- </View>
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 style={{ gap: theme.spacing.sm }} testID="connect-claude-issued">
87
- <Text variant="heading" style={{ fontSize: theme.fontSizes.base }}>Tokens you made earlier</Text>
88
- {s.tokens.length === 0 ? <Text variant="muted">None yet.</Text> : null}
89
- {s.tokens.map((t) => (
90
- <View key={t.jti} style={{ gap: 2 }} testID={`connect-claude-token-${t.jti}`}>
91
- <Text>{t.foundry}</Text>
92
- <Text variant="muted">
93
- {t.status === 'revoked' ? 'Revoked' : t.status === 'expired' ? `Expired ${readableDate(t.expires_at)}` : `Expires ${readableDate(t.expires_at)}`}
94
- </Text>
95
- {t.status === 'active' ? (
96
- <Button
97
- testID={`connect-claude-revoke-${t.jti}`}
98
- title={s.revoking === t.jti ? 'Revoking...' : 'Revoke'}
99
- variant="outline"
100
- disabled={s.revoking !== ''}
101
- onPress={() => { void controller.revoke(t.jti); }}
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
- ) : null}
104
- </View>
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.spacing.lg }} keyboardShouldPersistTaps="handled">{body}</ScrollView>
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
  }