@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.
Files changed (50) hide show
  1. package/package.json +4 -4
  2. package/src/__tests__/focus-standings.test.tsx +119 -0
  3. package/src/components/pages/PlanningPage.tsx +16 -4
  4. package/src/corpus/client.ts +5 -0
  5. package/src/corpus/entity-query.ts +67 -4
  6. package/src/corpus/index.ts +4 -2
  7. package/src/corpus/standings.ts +75 -0
  8. package/src/corpus/types.ts +6 -0
  9. package/src/native/__tests__/design-screens.test.tsx +97 -0
  10. package/src/native/__tests__/ux-polish.test.tsx +4 -2
  11. package/src/native/app/FoundryApp.tsx +2 -2
  12. package/src/native/app/__tests__/launch.test.ts +4 -1
  13. package/src/native/app/entity/EntityTab.tsx +13 -18
  14. package/src/native/app/icon.tsx +6 -1
  15. package/src/native/app/launch.ts +4 -0
  16. package/src/native/app/screens/RecordScreen.tsx +37 -30
  17. package/src/native/app/screens/SignInScreen.tsx +4 -3
  18. package/src/native/components/FoundryTabsShell.tsx +8 -5
  19. package/src/native/components/MoreTabList.tsx +20 -25
  20. package/src/native/components/NoteDetailScreen.tsx +49 -57
  21. package/src/native/components/NotesListScreen.tsx +13 -19
  22. package/src/native/components/__tests__/notes-screens.test.tsx +7 -7
  23. package/src/native/corpus/__tests__/counts.test.ts +82 -0
  24. package/src/native/corpus/__tests__/display.test.ts +37 -0
  25. package/src/native/corpus/api.ts +35 -2
  26. package/src/native/corpus/counts.ts +16 -0
  27. package/src/native/corpus/display.ts +62 -0
  28. package/src/native/corpus/fake-counts.ts +59 -0
  29. package/src/native/corpus/fake-tenant.ts +31 -3
  30. package/src/native/home/HomeScreen.tsx +15 -12
  31. package/src/native/home/__tests__/controller.test.ts +24 -11
  32. package/src/native/home/controller.ts +23 -17
  33. package/src/native/index.ts +3 -1
  34. package/src/native/screens/ask/AskScreen.tsx +20 -22
  35. package/src/native/screens/connect-claude/ConnectClaudeScreen.tsx +68 -61
  36. package/src/native/screens/connections/ConnectionsScreens.tsx +46 -42
  37. package/src/native/screens/library/LibraryDetailScreen.tsx +35 -49
  38. package/src/native/screens/library/LibraryListScreen.tsx +13 -21
  39. package/src/native/screens/planning/PlanningScreens.tsx +49 -26
  40. package/src/native/screens/planning/__tests__/controller.test.ts +17 -23
  41. package/src/native/screens/planning/controller.ts +18 -26
  42. package/src/native/tracker/TodoGlyph.tsx +11 -0
  43. package/src/native/tracker/TrackerDetailScreen.tsx +34 -39
  44. package/src/native/tracker/TrackerListScreen.tsx +28 -19
  45. package/src/native/tracker/__tests__/detail.test.ts +17 -0
  46. package/src/native/tracker/__tests__/format.test.ts +3 -3
  47. package/src/native/tracker/detail.ts +32 -19
  48. package/src/native/tracker/format.ts +8 -7
  49. package/src/native/voice/format.ts +0 -3
  50. package/src/native/screens/shared/PressableCard.tsx +0 -14
@@ -1,7 +1,12 @@
1
1
  import { Text } from 'react-native';
2
+ import { ICON_PATHS, Icon, type IconName } from '@startsimpli/ui-native';
2
3
  import type { FoundryTab } from '../components/FoundryTabsShell';
3
4
 
4
- /** A tab icon from a glyph string (an emoji or symbol in the config), drawn in the bar's active/inactive colour. */
5
+ /**
6
+ * A tab icon from the config's `icon`: a name from the shared icon set (`"mic"`, `"link"`), else a glyph string (an
7
+ * emoji or symbol), drawn in the bar's active/inactive colour.
8
+ */
5
9
  export function glyphIcon(glyph: string): NonNullable<FoundryTab['icon']> {
10
+ if (glyph in ICON_PATHS) return ({ color, active }) => <Icon name={glyph as IconName} size={24} color={color} strokeWidth={active ? 2.3 : 1.9} />;
6
11
  return ({ color }) => <Text style={{ color, fontSize: 20, lineHeight: 24 }}>{glyph}</Text>;
7
12
  }
@@ -11,12 +11,15 @@ import type { FoundryAppConfig } from './config/types';
11
11
  * -tgTab <key> -tgDetail <id> open a tab, optionally on one record
12
12
  * -tgNote <id> open that note (device, real data)
13
13
  * -tgAutostop N start a timed recording after sign-in
14
+ * -tgScheme light|dark override the config's theme mode (simulator checks of the light theme)
14
15
  */
15
16
  export interface LaunchArgs {
16
17
  fake: boolean;
17
18
  scenario: FakeScenario;
18
19
  target: TabLink | null;
19
20
  autostop: number | null;
21
+ /** Overrides `config.theme.mode`. */
22
+ scheme: 'light' | 'dark' | null;
20
23
  }
21
24
 
22
25
  export function readLaunch(get: (key: string) => unknown, config: Pick<FoundryAppConfig, 'tabs'>): LaunchArgs {
@@ -38,5 +41,6 @@ export function readLaunch(get: (key: string) => unknown, config: Pick<FoundryAp
38
41
  scenario: readFakeScenario((k) => str(k)),
39
42
  target,
40
43
  autostop: Number.isFinite(n) && n > 0 ? n : null,
44
+ scheme: str('tgScheme') === 'light' ? 'light' : str('tgScheme') === 'dark' ? 'dark' : null,
41
45
  };
42
46
  }
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
2
  import { Pressable, View } from 'react-native';
3
- import { Alert, Badge, Button, ListRow, Progress, Screen, Text, useTheme } from '@startsimpli/ui-native';
3
+ import { Alert, Button, Header, IconTile, ListRow, RecordButton, Screen, SectionHeader, StatusChip, Text, typeStyle, useTheme } from '@startsimpli/ui-native';
4
4
  import type { VoiceNote } from '../../../corpus/voice';
5
5
  import { noteSections } from '../../voice/sections';
6
6
  import { meterFraction } from '../../recording/levels';
@@ -49,45 +49,52 @@ export function RecordScreen({ recording, strings, onOpenDiagnostics, onSignOut
49
49
  const mm = String(Math.floor(elapsed / 60000)).padStart(2, '0');
50
50
  const ss = String(Math.floor(elapsed / 1000) % 60).padStart(2, '0');
51
51
  const isRecording = state.phase === 'recording';
52
- const big = { height: 220, borderRadius: 110, alignSelf: 'center' as const, width: 220, justifyContent: 'center' as const };
52
+ const phase = isRecording ? 'recording' : state.phase === 'uploading' ? 'busy' : 'idle';
53
53
 
54
54
  return (
55
- <Screen scroll>
56
- <Pressable onLongPress={onOpenDiagnostics} delayLongPress={600} testID="title" style={{ marginTop: 16 }}>
57
- <Text variant="heading">{strings.appName}</Text>
55
+ <Screen scroll contentContainerStyle={{ paddingHorizontal: 0 }}>
56
+ <Pressable onLongPress={onOpenDiagnostics} delayLongPress={600} testID="title">
57
+ <Header large title={strings.appName} titleTestID="go-title" />
58
58
  </Pressable>
59
59
 
60
- <View style={{ marginVertical: 28, gap: 14 }}>
61
- {isRecording ? (
62
- <>
63
- <Button title={strings.stop} variant="destructive" size="lg" style={big} onPress={() => { void recorder.stop(); }} testID="stop" />
64
- <Text variant="heading" style={{ textAlign: 'center' }} testID="timer">{mm}:{ss}</Text>
65
- <Progress value={meterFraction(state.levelDb ?? -160) * 100} />
66
- </>
67
- ) : (
68
- <Button title={strings.go} size="lg" style={big} disabled={state.phase === 'uploading'} onPress={() => { void recorder.go(); }} testID="go" />
69
- )}
60
+ <View style={{ paddingHorizontal: theme.layout.gutter, paddingVertical: theme.spacing.xl, gap: theme.spacing.md }}>
61
+ <RecordButton
62
+ testID={isRecording ? 'stop' : 'go'}
63
+ phase={phase}
64
+ label={strings.go}
65
+ stopLabel={strings.stop}
66
+ level={isRecording ? meterFraction(state.levelDb ?? -160) : 0}
67
+ onPress={() => { void (isRecording ? recorder.stop() : recorder.go()); }}
68
+ />
69
+ {isRecording ? <Text testID="timer" style={[typeStyle(theme, 'largeTitle'), { textAlign: 'center', fontVariant: ['tabular-nums'] }]}>{mm}:{ss}</Text> : null}
70
70
  {state.phase === 'uploading' ? <Text variant="muted" style={{ textAlign: 'center' }}>{strings.sending}</Text> : null}
71
71
  {state.phase === 'sent' ? <Text variant="muted" style={{ textAlign: 'center' }} testID="status">{strings.sent}</Text> : null}
72
72
  {state.phase === 'queued' ? <Text variant="muted" style={{ textAlign: 'center' }} testID="status">{strings.queued}</Text> : null}
73
73
  </View>
74
74
 
75
- {state.warning === 'no-audio' ? <Alert variant="destructive" style={{ marginBottom: 12 }}>{strings.noAudio}</Alert> : null}
76
- {state.permission === 'denied' ? (
77
- <Alert variant="destructive" style={{ marginBottom: 12 }}>
78
- <Text>{strings.micDenied}</Text>
79
- <Button title={strings.openSettings} variant="outline" onPress={() => { void permissions.openSettings(); }} testID="open-settings" />
80
- </Alert>
81
- ) : null}
82
- {state.error ? <Alert variant="destructive" style={{ marginBottom: 12 }}>{state.error}</Alert> : null}
75
+ <View style={{ paddingHorizontal: theme.layout.gutter, gap: theme.spacing.sm }}>
76
+ {state.warning === 'no-audio' ? <Alert variant="destructive">{strings.noAudio}</Alert> : null}
77
+ {state.permission === 'denied' ? (
78
+ <Alert variant="destructive">
79
+ <Text>{strings.micDenied}</Text>
80
+ <Button title={strings.openSettings} variant="outline" onPress={() => { void permissions.openSettings(); }} testID="open-settings" />
81
+ </Alert>
82
+ ) : null}
83
+ {state.error ? <Alert variant="destructive">{state.error}</Alert> : null}
83
84
 
84
- <Text style={{ marginTop: 16, fontWeight: '600', fontSize: 18 }}>{strings.recent}</Text>
85
- {notes.length === 0 ? <Text variant="muted">{strings.noNotes}</Text> : null}
86
- {notes.map((n) => (
87
- <ListRow key={n.id} title={n.title} subtitle={noteSections(n)[0]?.summary || undefined}
88
- trailing={<Badge label={statusLabel(n)} variant={n.status === 'ready' ? 'success' : n.status === 'failed' ? 'destructive' : 'secondary'} />} />
89
- ))}
90
- <Button title={strings.signOut} variant="outline" onPress={onSignOut} style={{ marginTop: theme.spacing.lg }} />
85
+ <SectionHeader title={strings.recent} />
86
+ {notes.length === 0 ? <Text variant="muted">{strings.noNotes}</Text> : null}
87
+ {notes.map((n) => (
88
+ <ListRow
89
+ key={n.id}
90
+ leading={<IconTile icon="mic" tone={n.status === 'failed' ? 'danger' : n.status === 'ready' ? 'neutral' : 'info'} />}
91
+ title={n.title}
92
+ subtitle={noteSections(n)[0]?.summary || undefined}
93
+ trailing={n.status === 'ready' ? undefined : <StatusChip status={n.status === 'failed' ? 'failed' : 'processing'} label={statusLabel(n)} />}
94
+ />
95
+ ))}
96
+ <Button title={strings.signOut} variant="outline" onPress={onSignOut} style={{ marginTop: theme.spacing.lg }} />
97
+ </View>
91
98
  </Screen>
92
99
  );
93
100
  }
@@ -1,9 +1,10 @@
1
1
  import { useState } from 'react';
2
2
  import { View } from 'react-native';
3
- import { Alert, Button, Input, Screen, Text } from '@startsimpli/ui-native';
3
+ import { Alert, Button, Input, Screen, Text, useTheme } from '@startsimpli/ui-native';
4
4
  import type { FoundryStrings } from '../strings';
5
5
 
6
6
  export function SignInScreen({ strings, notice, onSignIn }: { strings: FoundryStrings; /** Why the person is here again (session expired). */ notice?: string | null; onSignIn: (email: string, password: string) => Promise<void> }) {
7
+ const theme = useTheme();
7
8
  const [email, setEmail] = useState('');
8
9
  const [password, setPassword] = useState('');
9
10
  const [busy, setBusy] = useState(false);
@@ -22,8 +23,8 @@ export function SignInScreen({ strings, notice, onSignIn }: { strings: FoundrySt
22
23
  };
23
24
 
24
25
  return (
25
- <Screen style={{ justifyContent: 'center', gap: 12 }}>
26
- <Text variant="heading">{strings.signInTitle}</Text>
26
+ <Screen style={{ justifyContent: 'center', gap: theme.spacing.md }}>
27
+ <Text variant="largeTitle" style={{ marginBottom: theme.spacing.sm }}>{strings.signInTitle}</Text>
27
28
  {notice ? <View testID="session-expired"><Alert variant="default">{notice}</Alert></View> : null}
28
29
  <Input value={email} onChangeText={setEmail} placeholder={strings.email} autoCapitalize="none" keyboardType="email-address" autoCorrect={false} testID="email" />
29
30
  <Input value={password} onChangeText={setPassword} placeholder={strings.password} secureTextEntry testID="password" />
@@ -1,7 +1,7 @@
1
1
  import { useMemo, useState, useSyncExternalStore, type ReactNode } from 'react';
2
2
  import { Pressable, Text, View } from 'react-native';
3
3
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
- import { TabBar, useTheme, type TabItem } from '@startsimpli/ui-native';
4
+ import { Icon, TabBar, iconForTab, useTheme, type TabItem } from '@startsimpli/ui-native';
5
5
  import { createTabsNavigator, type Route, type TabsNavigator } from '../shell/navigator';
6
6
  import { DEFAULT_MAX_VISIBLE, MORE_KEY, planTabs } from '../shell/overflow';
7
7
  import { MoreTabList } from './MoreTabList';
@@ -89,8 +89,10 @@ export function FoundryTabsShell({ tabs, initialTab, initialDetail, navigator, m
89
89
  const choose = (key: string) => { setMoreAt(null); nav.select(key); };
90
90
  const inMore = moreOpen || overflowKeys.has(state.activeKey);
91
91
 
92
- const items: TabItem[] = primary.map(({ key, label, icon }) => ({ key, label, icon }));
93
- if (overflow.length) items.push({ key: MORE_KEY, label: moreLabel });
92
+ // A tab without its own icon gets the shared one for its key (a dot for an unknown key), so every bar has glyphs.
93
+ const defaultIcon = (key: string): TabItem['icon'] => ({ color, active }) => <Icon name={iconForTab(key)} size={24} color={color} strokeWidth={active ? 2.3 : 1.9} />;
94
+ const items: TabItem[] = primary.map(({ key, label, icon }) => ({ key, label, icon: icon ?? defaultIcon(key) }));
95
+ if (overflow.length) items.push({ key: MORE_KEY, label: moreLabel, icon: defaultIcon(MORE_KEY) });
94
96
 
95
97
  return (
96
98
  <View style={{ flex: 1, backgroundColor: theme.colors.background }}>
@@ -112,9 +114,10 @@ export function FoundryTabsShell({ tabs, initialTab, initialDetail, navigator, m
112
114
  {strip ? (
113
115
  <Pressable
114
116
  testID="more-back" accessibilityRole="button" accessibilityLabel={`Back to ${moreLabel}`} onPress={openMore}
115
- style={{ paddingTop: insets.top + theme.spacing.xs, paddingHorizontal: theme.spacing.md, paddingBottom: theme.spacing.xs }}
117
+ style={({ pressed }) => ({ paddingTop: insets.top + theme.spacing.xs, paddingHorizontal: theme.spacing.sm, minHeight: theme.layout.tapTarget + insets.top, flexDirection: 'row', alignItems: 'center', opacity: pressed ? 0.5 : 1 })}
116
118
  >
117
- <Text numberOfLines={1} style={{ color: theme.colors.primary, fontSize: theme.fontSizes.base }}>{`\u2039 ${moreLabel}`}</Text>
119
+ <Icon name="chevronLeft" size={22} strokeWidth={2.4} color={theme.colors.primary} />
120
+ <Text numberOfLines={1} style={{ color: theme.colors.primary, fontSize: theme.fontSizes.base }}>{moreLabel}</Text>
118
121
  </Pressable>
119
122
  ) : null}
120
123
  {t.render(ctx)}
@@ -1,34 +1,29 @@
1
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
2
- import { Pressable, ScrollView, Text, View } from 'react-native';
3
- import { useTheme } from '@startsimpli/ui-native';
1
+ import { ScrollView, View } from 'react-native';
2
+ import { Header, Icon, IconTile, ListRow, Section, iconForTab, useTheme } from '@startsimpli/ui-native';
4
3
  import type { FoundryTab } from './FoundryTabsShell';
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
5
 
6
- /** The list behind the More tab: one row per overflow tab (icon, label, optional description). */
6
+ /** The list behind the More tab: one grouped row per overflow tab (icon, label, optional description). */
7
7
  export function MoreTabList({ tabs, onOpen, title = 'More' }: { tabs: FoundryTab[]; onOpen(key: string): void; title?: string }) {
8
8
  const theme = useTheme();
9
9
  const insets = useSafeAreaInsets();
10
- const { colors, spacing, fontSizes } = theme;
11
10
  return (
12
- <View style={{ flex: 1, backgroundColor: colors.background }} testID="more-list">
13
- <Text accessibilityRole="header" style={{ color: colors.foreground, fontSize: fontSizes.xl, fontWeight: '700', padding: spacing.md, paddingTop: insets.top + spacing.md }}>{title}</Text>
14
- <ScrollView>
15
- {tabs.map((t) => (
16
- <Pressable
17
- key={t.key}
18
- testID={`more-row-${t.key}`}
19
- accessibilityRole="button"
20
- accessibilityLabel={t.label}
21
- onPress={() => onOpen(t.key)}
22
- style={{ flexDirection: 'row', alignItems: 'center', gap: spacing.md, paddingHorizontal: spacing.md, paddingVertical: spacing.md, borderTopWidth: 1, borderTopColor: colors.border }}
23
- >
24
- {t.icon ? <View style={{ width: 28, alignItems: 'center' }}>{t.icon({ active: false, color: colors.mutedForeground })}</View> : null}
25
- <View style={{ flex: 1 }}>
26
- <Text numberOfLines={1} style={{ color: colors.foreground, fontSize: fontSizes.base }}>{t.label}</Text>
27
- {t.description ? <Text numberOfLines={2} style={{ color: colors.mutedForeground, fontSize: fontSizes.sm }}>{t.description}</Text> : null}
28
- </View>
29
- <Text style={{ color: colors.mutedForeground, fontSize: fontSizes.lg }}>{'›'}</Text>
30
- </Pressable>
31
- ))}
11
+ <View style={{ flex: 1, backgroundColor: theme.surface.grouped, paddingTop: insets.top }} testID="more-list">
12
+ <Header large title={title} background={theme.surface.grouped} />
13
+ <ScrollView contentContainerStyle={{ paddingHorizontal: theme.layout.gutter, paddingBottom: theme.layout.sectionGap }}>
14
+ <Section>
15
+ {tabs.map((t) => (
16
+ <ListRow
17
+ key={t.key}
18
+ testID={`more-row-${t.key}`}
19
+ accessibilityLabel={t.label}
20
+ leading={<IconTile icon={t.icon ? t.icon({ active: true, color: theme.tones.info.fg }) : iconForTab(t.key)} tone="info" />}
21
+ title={t.label}
22
+ subtitle={t.description}
23
+ onPress={() => onOpen(t.key)}
24
+ />
25
+ ))}
26
+ </Section>
32
27
  </ScrollView>
33
28
  </View>
34
29
  );
@@ -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
  });
@@ -0,0 +1,82 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { countParams } from '../../../corpus/entity-query';
3
+ import { createFakeNativeCorpusApi } from '../fake';
4
+ import { countsBy } from '../counts';
5
+
6
+ describe('countParams: the grouped-count query spelled for the wire', () => {
7
+ it('spells group_by, edge targets and the shared list filters', () => {
8
+ expect(countParams({
9
+ type: 'commitment', groupBy: ['edge:in_focus', 'attr.status'], edgeTargets: ['f1', 'f2'],
10
+ attr: { status__in: ['open', 'blocked'] }, filters: { updatedAfter: '2026-11-01T00:00:00Z' },
11
+ })).toEqual({
12
+ type: 'commitment', group_by: 'edge:in_focus,attr.status', edge_targets: 'f1,f2',
13
+ 'attr.status__in': 'open,blocked', updated_after: '2026-11-01T00:00:00Z', page: 1,
14
+ });
15
+ });
16
+ it('refuses zero or more than two keys before it reaches the server', () => {
17
+ expect(() => countParams({ groupBy: [] })).toThrow(/one or two/);
18
+ expect(() => countParams({ groupBy: ['type', 'attr.a', 'attr.b'] })).toThrow(/one or two/);
19
+ });
20
+ it('typeIn rides as type__in', () => {
21
+ expect(countParams({ groupBy: ['type'], filters: { typeIn: ['a', 'b'] } })).toMatchObject({ type__in: 'a,b' });
22
+ });
23
+ });
24
+
25
+ describe('entities.counts over the fake tenant', () => {
26
+ it('rows arrive by position and are keyed by the tokens the caller asked for, in order', async () => {
27
+ const api = createFakeNativeCorpusApi();
28
+ const page = await api.entities.counts({ type: 'commitment', groupBy: ['edge:in_focus', 'attr.status'] });
29
+ const first = page.items[0];
30
+ expect(Object.keys(first.group)).toEqual(['edge:in_focus', 'attr.status']);
31
+ // the wire never keys data: a camelCasing client cannot break the lookup
32
+ const wire = await api.http.get<{ results: Array<Record<string, unknown>>; group_by: string[] }>('api/v1/entities/counts', { params: { type: 'commitment', group_by: 'edge:in_focus,attr.status' } });
33
+ expect(wire.group_by).toEqual(['edge:in_focus', 'attr.status']);
34
+ expect(Object.keys(wire.results[0]).sort()).toEqual(['count', 'values']);
35
+ });
36
+
37
+ it('one read gives the count per type', async () => {
38
+ const api = createFakeNativeCorpusApi();
39
+ const page = await api.entities.counts({ groupBy: ['type'] });
40
+ expect(countsBy(page.items, 'type')).toEqual({ commitment: 6, focus: 3, source_document: 3 });
41
+ expect(page.appliedFilters).toContain('group_by');
42
+ expect(api.tenant.requests.filter((r) => r.path.includes('counts'))).toHaveLength(1);
43
+ });
44
+ it('groups to-dos per project, keeping the unfiled bucket under null', async () => {
45
+ const api = createFakeNativeCorpusApi();
46
+ const page = await api.entities.counts({ type: 'commitment', groupBy: ['edge:in_focus'] });
47
+ expect(countsBy(page.items, 'edge:in_focus')).toEqual({ f287: 3, fma: 1, '': 2 });
48
+ });
49
+ it('edgeTargets bounds the answer to the ids asked', async () => {
50
+ const api = createFakeNativeCorpusApi();
51
+ const page = await api.entities.counts({ type: 'commitment', groupBy: ['edge:in_focus'], edgeTargets: ['fma'] });
52
+ expect(countsBy(page.items, 'edge:in_focus')).toEqual({ fma: 1 });
53
+ });
54
+ });
55
+
56
+ describe('entities.list: typeIn and updatedAfter', () => {
57
+ it('one read spans several types', async () => {
58
+ const api = createFakeNativeCorpusApi();
59
+ const page = await api.entities.list({ type: undefined as never, filters: { typeIn: ['commitment', 'focus'] }, order: 'recent' });
60
+ expect(new Set(page.items.map((e) => e.entity_type))).toEqual(new Set(['commitment', 'focus']));
61
+ expect(page.appliedFilters).toContain('type__in');
62
+ });
63
+ });
64
+
65
+ describe('standings: a page of project cards in two reads', () => {
66
+ it('total, done and overdue per project from grouped counts', async () => {
67
+ const api = createFakeNativeCorpusApi();
68
+ const before = api.tenant.requests.length;
69
+ const standings = await api.standings(['f287', 'fma', 'fdbg'], Date.parse('2026-11-05T00:00:00Z'));
70
+ expect(api.tenant.requests.length - before).toBe(2);
71
+ expect(standings).toEqual({
72
+ f287: { focusId: 'f287', total: 3, done: 0, overdue: 1 },
73
+ fma: { focusId: 'fma', total: 1, done: 0, overdue: 0 },
74
+ fdbg: { focusId: 'fdbg', total: 0, done: 0, overdue: 0 },
75
+ });
76
+ });
77
+ it('no ids, no requests', async () => {
78
+ const api = createFakeNativeCorpusApi();
79
+ expect(await api.standings([], 0)).toEqual({});
80
+ expect(api.tenant.requests).toHaveLength(0);
81
+ });
82
+ });
@@ -0,0 +1,37 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { displaysFrom, resolveDisplay } from '../display';
3
+ import { createFakeNativeCorpusApi } from '../fake';
4
+
5
+ const todo = { id: 't1', entity_type: 'todo', name: 'Call Megan', data: { owner: 'Quinn', due_at: '2026-11-05', status: 'blocked' } };
6
+ const config = { title: 'name', subtitle: 'owner', date: 'due_at', status: 'status', tones: { blocked: 'bad', done: 'good' }, icon: 'check-circle' } as const;
7
+
8
+ describe('resolveDisplay', () => {
9
+ it('reads title, subtitle, date, status tone and icon from the declaration', () => {
10
+ expect(resolveDisplay(config, todo)).toEqual({
11
+ title: 'Call Megan', subtitle: 'Quinn', date: '2026-11-05', status: { value: 'blocked', tone: 'bad' }, icon: 'check-circle',
12
+ });
13
+ });
14
+ it('a type that declares nothing reads as its name', () => {
15
+ expect(resolveDisplay(undefined, todo)).toEqual({ title: 'Call Megan', subtitle: null, date: null, status: null, icon: null });
16
+ });
17
+ it('an unmapped status is neutral and a missing attribute is null, never "undefined"', () => {
18
+ expect(resolveDisplay(config, { ...todo, data: { status: 'weird' } })).toMatchObject({ subtitle: null, date: null, status: { value: 'weird', tone: 'neutral' } });
19
+ });
20
+ it('falls back to the external id then the id for a nameless row', () => {
21
+ expect(resolveDisplay(undefined, { id: 'x', external_id: 'ext:1', name: '' }).title).toBe('ext:1');
22
+ expect(resolveDisplay(undefined, { id: 'x' }).title).toBe('x');
23
+ });
24
+ });
25
+
26
+ describe('displaysFrom / api.schema.displays', () => {
27
+ it('keeps only the types that declare a display', () => {
28
+ expect(displaysFrom([{ key: 'a', config: { display: { title: 'name' } } }, { key: 'b', config: {} }, { key: 'c' }])).toEqual({ a: { title: 'name' } });
29
+ });
30
+ it('reads the tenant schema once', async () => {
31
+ const api = createFakeNativeCorpusApi();
32
+ const first = await api.schema.displays();
33
+ expect(first.commitment).toMatchObject({ status: 'status' });
34
+ await api.schema.displays();
35
+ expect(api.tenant.requests.filter((r) => r.path.includes('schema/types'))).toHaveLength(1);
36
+ });
37
+ });