@gemies/sdk 9.2.0 → 10.0.0
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/CHANGELOG.md +103 -0
- package/README.md +9 -6
- package/package.json +4 -11
- package/src/accounts.ts +7 -1
- package/src/ask-eager.ts +0 -2
- package/src/ask-text.ts +0 -1
- package/src/ask.ts +0 -1
- package/src/components/AmbientField.tsx +13 -2
- package/src/components/ComposerDropZone.tsx +20 -4
- package/src/components/ComposerSuggestions.tsx +9 -2
- package/src/components/GemieActivityLine.tsx +11 -5
- package/src/components/GemieBetweenGemies.tsx +23 -10
- package/src/components/GemieChatContent.tsx +46 -23
- package/src/components/GemieChatScreen.tsx +7 -4
- package/src/components/GemieChatSheet.tsx +6 -2
- package/src/components/GemieComposer.tsx +17 -7
- package/src/components/GemieGroupWelcome.tsx +16 -2
- package/src/components/GemieRecentConversations.tsx +13 -10
- package/src/components/GemieSharedConversation.tsx +38 -6
- package/src/components/GemieWelcomeMessage.tsx +23 -7
- package/src/components/IdentityMark.tsx +6 -12
- package/src/components/PlanPreviewCard.tsx +18 -7
- package/src/components/QuestionCard.tsx +6 -2
- package/src/components/ReplyMarkdown.tsx +32 -6
- package/src/components/RichBlocks.tsx +20 -15
- package/src/components/accounts/GemieAccountGrants.tsx +27 -10
- package/src/components/accounts/GemieConnectedAccounts.tsx +87 -51
- package/src/components/canvas/CanvasComponent.tsx +6 -2
- package/src/components/canvas/DashboardRenderer.tsx +25 -8
- package/src/components/canvas/DeckRenderer.tsx +23 -6
- package/src/components/canvas/FormRenderer.tsx +8 -3
- package/src/components/connectors/ConnectorLogo.tsx +15 -9
- package/src/components/connectors/GemieConnectedConnectors.tsx +51 -25
- package/src/components/connectors/GemieConnectorsStore.tsx +99 -41
- package/src/components/connectors/GrantSwitchRow.tsx +18 -5
- package/src/components/thought/ThoughtPanel.tsx +26 -12
- package/src/components/thought/ToolStep.tsx +14 -6
- package/src/components/thread/AgentResultCard.tsx +10 -4
- package/src/components/thread/AgentTaskCard.tsx +8 -3
- package/src/components/thread/ApprovalCard.tsx +6 -2
- package/src/components/thread/ChatBubble.tsx +66 -25
- package/src/components/thread/GemieThread.tsx +25 -8
- package/src/components/thread/ThreadRow.tsx +20 -15
- package/src/components/thread/ThreadSearch.tsx +27 -10
- package/src/components/thread/ThreadSkeleton.tsx +12 -6
- package/src/components/thread/ToolResultCard.tsx +10 -4
- package/src/components/thread/TurnAttachments.tsx +17 -8
- package/src/components/voice/VoiceControls.tsx +9 -6
- package/src/connectors.ts +15 -2
- package/src/hooks/useChatVoice.ts +2 -10
- package/src/hooks/useMessageReactions.ts +5 -5
- package/src/hooks/useThoughtScope.ts +9 -8
- package/src/index.ts +2 -3
- package/src/lib/tool-call-status.ts +1 -1
- package/src/lib/utils.ts +1 -8
- package/src/realtime/react.tsx +9 -9
- package/src/realtime/reread.ts +28 -0
- package/src/realtime/store.ts +123 -0
- package/src/runtime/agents.ts +46 -27
- package/src/runtime/collections.ts +35 -136
- package/src/runtime/connected-accounts.ts +175 -88
- package/src/runtime/connectors.ts +244 -127
- package/src/runtime/conversations.ts +181 -607
- package/src/runtime/data/answer.ts +76 -0
- package/src/runtime/data/collections.ts +168 -0
- package/src/runtime/data/conversations.ts +626 -0
- package/src/runtime/data/reactions.ts +29 -0
- package/src/runtime/data/read.ts +37 -0
- package/src/runtime/data/threads.ts +149 -0
- package/src/runtime/index.ts +72 -8
- package/src/runtime/model.ts +0 -2
- package/src/runtime/routes.ts +2 -2
- package/src/runtime/sharing.ts +69 -56
- package/src/runtime/types.ts +8 -16
- package/src/runtime/use-bound-action.ts +27 -0
- package/src/runtime/use-conversation-stream.ts +8 -31
- package/src/runtime/use-conversation-thread.ts +40 -51
- package/src/runtime/use-gemie-thread.ts +32 -43
- package/src/runtime/use-start-conversation.ts +14 -15
- package/src/runtime/use-thread-history.ts +26 -36
- package/src/runtime/use-thread-search.ts +29 -76
- package/src/text.ts +0 -1
- package/src/voice.ts +0 -1
- package/src/components/Image.tsx +0 -12
- package/src/realtime/cache.ts +0 -257
- package/src/runtime/conversation-dates.ts +0 -31
- package/src/runtime/query-keys.ts +0 -66
- package/src/runtime/reaction-cache.ts +0 -45
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from '../../runtime/connected-accounts';
|
|
11
11
|
import { GrantSwitchRow } from '../connectors/GrantSwitchRow';
|
|
12
12
|
import { K, PlatformMark, accountName, statusText } from './account-parts';
|
|
13
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
13
14
|
|
|
14
15
|
export interface GemieAccountGrantsProps {
|
|
15
16
|
/** The gemie whose grants these are (Alia's id for her locked editor). */
|
|
@@ -34,13 +35,15 @@ export function GemieAccountGrants({
|
|
|
34
35
|
onManage,
|
|
35
36
|
t = englishCopy,
|
|
36
37
|
}: GemieAccountGrantsProps) {
|
|
37
|
-
const
|
|
38
|
+
const styles = useStyles();
|
|
39
|
+
const { value: data, isLoading, status, isFetching, refresh } = useConnectedAccounts();
|
|
40
|
+
const isError = status === 'error';
|
|
38
41
|
const { grant } = useConnectedAccountMutations();
|
|
39
42
|
|
|
40
|
-
if (
|
|
43
|
+
if (isLoading) {
|
|
41
44
|
return (
|
|
42
45
|
<Skeleton.Region>
|
|
43
|
-
<View
|
|
46
|
+
<View style={styles.loading}>
|
|
44
47
|
<Skeleton.Box width={220} height={14} />
|
|
45
48
|
<Skeleton.Box width={160} height={14} />
|
|
46
49
|
</View>
|
|
@@ -50,8 +53,8 @@ export function GemieAccountGrants({
|
|
|
50
53
|
|
|
51
54
|
if (isError && data === undefined) {
|
|
52
55
|
return (
|
|
53
|
-
<View
|
|
54
|
-
<Text variant="body-2-regular"
|
|
56
|
+
<View style={styles.failure}>
|
|
57
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
55
58
|
{t(`${K}.loadFailed`)}
|
|
56
59
|
</Text>
|
|
57
60
|
<Button
|
|
@@ -59,7 +62,7 @@ export function GemieAccountGrants({
|
|
|
59
62
|
appearance="outline"
|
|
60
63
|
tone="neutral"
|
|
61
64
|
loading={isFetching}
|
|
62
|
-
onPress={() => void
|
|
65
|
+
onPress={() => void refresh()}
|
|
63
66
|
>
|
|
64
67
|
{t(`${K}.retry`)}
|
|
65
68
|
</Button>
|
|
@@ -72,7 +75,7 @@ export function GemieAccountGrants({
|
|
|
72
75
|
|
|
73
76
|
const setGranted = async (accountId: string, granted: boolean) => {
|
|
74
77
|
try {
|
|
75
|
-
await grant.
|
|
78
|
+
await grant.run(accountId, gemieId, granted);
|
|
76
79
|
} catch {
|
|
77
80
|
toast.error(t(`${K}.saveFailed`));
|
|
78
81
|
}
|
|
@@ -80,8 +83,8 @@ export function GemieAccountGrants({
|
|
|
80
83
|
|
|
81
84
|
return (
|
|
82
85
|
<View>
|
|
83
|
-
<View
|
|
84
|
-
<Text variant="body-2-regular"
|
|
86
|
+
<View style={styles.intro}>
|
|
87
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
85
88
|
{accounts.length === 0 ? t(`${K}.grants.empty`) : t(`${K}.grants.description`, { name })}
|
|
86
89
|
</Text>
|
|
87
90
|
</View>
|
|
@@ -107,7 +110,7 @@ export function GemieAccountGrants({
|
|
|
107
110
|
/>
|
|
108
111
|
);
|
|
109
112
|
})}
|
|
110
|
-
<View
|
|
113
|
+
<View style={styles.manageRow}>
|
|
111
114
|
<Button size="sm" appearance="outline" tone="neutral" onPress={onManage}>
|
|
112
115
|
{t(`${K}.grants.manage`)}
|
|
113
116
|
</Button>
|
|
@@ -115,3 +118,17 @@ export function GemieAccountGrants({
|
|
|
115
118
|
</View>
|
|
116
119
|
);
|
|
117
120
|
}
|
|
121
|
+
|
|
122
|
+
const useStyles = createTokenStyles((t) => ({
|
|
123
|
+
loading: { gap: 12, paddingVertical: 10 },
|
|
124
|
+
failure: { alignItems: 'flex-start', gap: 8, paddingVertical: 10, paddingInlineEnd: 10 },
|
|
125
|
+
muted: { color: t.mutedForeground },
|
|
126
|
+
intro: { paddingVertical: 10, paddingInlineEnd: 10 },
|
|
127
|
+
manageRow: {
|
|
128
|
+
flexDirection: 'row',
|
|
129
|
+
borderTopWidth: 1,
|
|
130
|
+
borderColor: t.border,
|
|
131
|
+
paddingVertical: 10,
|
|
132
|
+
paddingInlineEnd: 10,
|
|
133
|
+
},
|
|
134
|
+
}));
|
|
@@ -31,17 +31,15 @@ import {
|
|
|
31
31
|
} from '../../runtime/connected-accounts';
|
|
32
32
|
import { GrantSwitchRow } from '../connectors/GrantSwitchRow';
|
|
33
33
|
import { K, PLATFORM_LABELS, PlatformMark, accountName, statusText } from './account-parts';
|
|
34
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
34
35
|
|
|
35
36
|
/** The value the answering select gives "nobody answers on its own". */
|
|
36
37
|
const NOBODY = '';
|
|
37
38
|
|
|
38
39
|
/** One row of the list: the same rhythm as a settings row, a divider above all but the first. */
|
|
39
40
|
function Row({ children, first }: { children: React.ReactNode; first?: boolean }) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{children}
|
|
43
|
-
</View>
|
|
44
|
-
);
|
|
41
|
+
const styles = useStyles();
|
|
42
|
+
return <View style={[styles.listRow, !first && styles.divider]}>{children}</View>;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
function Choice<T extends string>({
|
|
@@ -57,9 +55,10 @@ function Choice<T extends string>({
|
|
|
57
55
|
disabled: boolean;
|
|
58
56
|
onChange: (value: T) => void;
|
|
59
57
|
}) {
|
|
58
|
+
const styles = useStyles();
|
|
60
59
|
return (
|
|
61
|
-
<View
|
|
62
|
-
<Text variant="body-2-regular"
|
|
60
|
+
<View style={styles.choice}>
|
|
61
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
63
62
|
{label}
|
|
64
63
|
</Text>
|
|
65
64
|
<Select
|
|
@@ -107,16 +106,17 @@ function Code({ value }: { value: string | null | undefined }) {
|
|
|
107
106
|
* second step is left.
|
|
108
107
|
*/
|
|
109
108
|
function TelegramSteps({ link, t }: { link: string | null; t: Translate }) {
|
|
109
|
+
const styles = useStyles();
|
|
110
110
|
return (
|
|
111
|
-
<View
|
|
112
|
-
<Text variant="body-2-regular"
|
|
111
|
+
<View style={styles.steps}>
|
|
112
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
113
113
|
{t(`${K}.telegram.note`)}
|
|
114
114
|
</Text>
|
|
115
115
|
{link ? (
|
|
116
116
|
<>
|
|
117
117
|
<Text variant="body-2-regular">{t(`${K}.telegram.step1`)}</Text>
|
|
118
118
|
<Text variant="body-2-regular">{t(`${K}.telegram.step2`)}</Text>
|
|
119
|
-
<View
|
|
119
|
+
<View style={styles.actions}>
|
|
120
120
|
<Button size="sm" onPress={() => void Linking.openURL(link)}>
|
|
121
121
|
{t(`${K}.telegram.open`)}
|
|
122
122
|
</Button>
|
|
@@ -147,7 +147,8 @@ function ConnectingAccount({
|
|
|
147
147
|
onDone: () => void;
|
|
148
148
|
onCancel: () => void;
|
|
149
149
|
}) {
|
|
150
|
-
const
|
|
150
|
+
const styles = useStyles();
|
|
151
|
+
const { value: data } = useConnectedAccountQr(link);
|
|
151
152
|
const status = data?.status ?? 'qr-pending';
|
|
152
153
|
const label = PLATFORM_LABELS[platform];
|
|
153
154
|
|
|
@@ -170,13 +171,13 @@ function ConnectingAccount({
|
|
|
170
171
|
) : (
|
|
171
172
|
<>
|
|
172
173
|
<Text variant="body-2-semibold">{t(`${K}.scanTitle`, { platform: label })}</Text>
|
|
173
|
-
<Text variant="body-2-regular"
|
|
174
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
174
175
|
{t(`${K}.scan.${platform}`)}
|
|
175
176
|
</Text>
|
|
176
177
|
<Code value={data?.qr} />
|
|
177
178
|
</>
|
|
178
179
|
)}
|
|
179
|
-
<View
|
|
180
|
+
<View style={styles.actions}>
|
|
180
181
|
<Button size="sm" appearance="outline" tone="neutral" onPress={onCancel}>
|
|
181
182
|
{t(`${K}.cancel`)}
|
|
182
183
|
</Button>
|
|
@@ -187,7 +188,7 @@ function ConnectingAccount({
|
|
|
187
188
|
|
|
188
189
|
/** A Telegram account the person left before finishing: its steps, kept until it is connected. */
|
|
189
190
|
function PendingTelegram({ account, t }: { account: ConnectedAccount; t: Translate }) {
|
|
190
|
-
const { data } = useConnectedAccountQr({ accountId: account._id, qr: null });
|
|
191
|
+
const { value: data } = useConnectedAccountQr({ accountId: account._id, qr: null });
|
|
191
192
|
return <TelegramSteps link={data?.qr ?? null} t={t} />;
|
|
192
193
|
}
|
|
193
194
|
|
|
@@ -203,12 +204,13 @@ function ChosenChats({
|
|
|
203
204
|
saving: boolean;
|
|
204
205
|
t: Translate;
|
|
205
206
|
}) {
|
|
206
|
-
const
|
|
207
|
+
const styles = useStyles();
|
|
208
|
+
const { value: chats, isLoading } = useConnectedAccountChats(account._id);
|
|
207
209
|
|
|
208
|
-
if (
|
|
210
|
+
if (isLoading) {
|
|
209
211
|
return (
|
|
210
212
|
<Skeleton.Region>
|
|
211
|
-
<View
|
|
213
|
+
<View style={styles.steps}>
|
|
212
214
|
{[0, 1, 2].map((row) => (
|
|
213
215
|
<Skeleton.Box key={row} width={180} height={14} />
|
|
214
216
|
))}
|
|
@@ -218,16 +220,16 @@ function ChosenChats({
|
|
|
218
220
|
}
|
|
219
221
|
if (!chats?.length) {
|
|
220
222
|
return (
|
|
221
|
-
<Text variant="body-2-regular"
|
|
223
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
222
224
|
{t(`${K}.noChats`)}
|
|
223
225
|
</Text>
|
|
224
226
|
);
|
|
225
227
|
}
|
|
226
228
|
return (
|
|
227
|
-
<View
|
|
229
|
+
<View style={styles.choice}>
|
|
228
230
|
{chats.map((chat) => (
|
|
229
|
-
<View key={chat.chatId}
|
|
230
|
-
<Text variant="body-2-regular" numberOfLines={1}
|
|
231
|
+
<View key={chat.chatId} style={styles.chat}>
|
|
232
|
+
<Text variant="body-2-regular" numberOfLines={1} style={styles.chatName}>
|
|
231
233
|
{chat.kind === 'group' ? t(`${K}.groupChat`, { name: chat.name }) : chat.name}
|
|
232
234
|
</Text>
|
|
233
235
|
<Switch
|
|
@@ -265,10 +267,11 @@ function Answering({
|
|
|
265
267
|
saving: boolean;
|
|
266
268
|
t: Translate;
|
|
267
269
|
}) {
|
|
270
|
+
const styles = useStyles();
|
|
268
271
|
const answering = gemies.find((gemie) => gemie.id === account.answeringGemieId) ?? null;
|
|
269
272
|
const telegram = account.platform === 'telegram';
|
|
270
273
|
return (
|
|
271
|
-
<View
|
|
274
|
+
<View style={styles.settings}>
|
|
272
275
|
<Choice
|
|
273
276
|
label={t(`${K}.answeringLabel`)}
|
|
274
277
|
value={answering?.id ?? NOBODY}
|
|
@@ -280,13 +283,13 @@ function Answering({
|
|
|
280
283
|
onChange={(id) => save({ answeringGemieId: id === NOBODY ? null : id })}
|
|
281
284
|
/>
|
|
282
285
|
{answering === null ? (
|
|
283
|
-
<Text variant="body-2-regular"
|
|
286
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
284
287
|
{t(`${K}.answeringNone`)}
|
|
285
288
|
</Text>
|
|
286
289
|
) : (
|
|
287
290
|
<>
|
|
288
291
|
{telegram && account.status === 'connected' && account.canReply === false ? (
|
|
289
|
-
<Text variant="body-2-regular"
|
|
292
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
290
293
|
{t(`${K}.telegram.cannotReply`, { name: answering.name })}
|
|
291
294
|
</Text>
|
|
292
295
|
) : null}
|
|
@@ -333,6 +336,7 @@ function AccountRow({
|
|
|
333
336
|
gemies: readonly GrantableGemie[];
|
|
334
337
|
t: Translate;
|
|
335
338
|
}) {
|
|
339
|
+
const styles = useStyles();
|
|
336
340
|
const { update, grant, remove } = useConnectedAccountMutations();
|
|
337
341
|
const platform = PLATFORM_LABELS[account.platform] ?? account.platform;
|
|
338
342
|
const name = accountName(account);
|
|
@@ -345,7 +349,7 @@ function AccountRow({
|
|
|
345
349
|
const save = useCallback(
|
|
346
350
|
async (patch: ConnectedAccountPatch) => {
|
|
347
351
|
try {
|
|
348
|
-
await update.
|
|
352
|
+
await update.run(account._id, patch);
|
|
349
353
|
} catch {
|
|
350
354
|
toast.error(t(`${K}.saveFailed`));
|
|
351
355
|
}
|
|
@@ -355,7 +359,7 @@ function AccountRow({
|
|
|
355
359
|
|
|
356
360
|
const setGranted = async (gemieId: string, granted: boolean) => {
|
|
357
361
|
try {
|
|
358
|
-
await grant.
|
|
362
|
+
await grant.run(account._id, gemieId, granted);
|
|
359
363
|
} catch {
|
|
360
364
|
toast.error(t(`${K}.saveFailed`));
|
|
361
365
|
}
|
|
@@ -373,7 +377,7 @@ function AccountRow({
|
|
|
373
377
|
});
|
|
374
378
|
if (!ok) return;
|
|
375
379
|
try {
|
|
376
|
-
await remove.
|
|
380
|
+
await remove.run(account._id);
|
|
377
381
|
toast.success(t(`${K}.removed`, { platform }));
|
|
378
382
|
} catch {
|
|
379
383
|
toast.error(t(`${K}.removeFailed`));
|
|
@@ -382,12 +386,12 @@ function AccountRow({
|
|
|
382
386
|
|
|
383
387
|
return (
|
|
384
388
|
<Row>
|
|
385
|
-
<View
|
|
389
|
+
<View style={styles.account}>
|
|
386
390
|
<PlatformMark platform={account.platform} size={28} />
|
|
387
|
-
<View
|
|
391
|
+
<View style={styles.accountText}>
|
|
388
392
|
<Text variant="body-2-semibold">{name}</Text>
|
|
389
393
|
<Text variant="body-2-regular">{statusText(account, t)}</Text>
|
|
390
|
-
<Text variant="body-2-regular"
|
|
394
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
391
395
|
{account.lastActiveAt
|
|
392
396
|
? t(`${K}.lastMessage`, { when: new Date(account.lastActiveAt).toLocaleString() })
|
|
393
397
|
: t(`${K}.noMessagesYet`)}
|
|
@@ -411,7 +415,7 @@ function AccountRow({
|
|
|
411
415
|
<>
|
|
412
416
|
<View>
|
|
413
417
|
<Text variant="body-2-semibold">{t(`${K}.usedBy`)}</Text>
|
|
414
|
-
<Text variant="body-2-regular"
|
|
418
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
415
419
|
{t(`${K}.usedByHint`)}
|
|
416
420
|
</Text>
|
|
417
421
|
{gemies.map((gemie, index) => (
|
|
@@ -454,7 +458,9 @@ export interface GemieConnectedAccountsProps {
|
|
|
454
458
|
* Alia apps draw this same panel. Only what this deployment can connect is offered.
|
|
455
459
|
*/
|
|
456
460
|
export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccountsProps) {
|
|
457
|
-
const
|
|
461
|
+
const styles = useStyles();
|
|
462
|
+
const { value: data, isLoading, status, isFetching, refresh } = useConnectedAccounts();
|
|
463
|
+
const isError = status === 'error';
|
|
458
464
|
const { connect, remove } = useConnectedAccountMutations();
|
|
459
465
|
const [connecting, setConnecting] = useState<{
|
|
460
466
|
platform: GemieAccountPlatform;
|
|
@@ -465,12 +471,14 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
|
|
|
465
471
|
platform: GemieAccountPlatform;
|
|
466
472
|
reason: string;
|
|
467
473
|
} | null>(null);
|
|
474
|
+
/** The platform the last connection asked for, whose button spins while it runs. */
|
|
475
|
+
const [asked, setAsked] = useState<GemieAccountPlatform | null>(null);
|
|
468
476
|
const finished = useCallback(() => setConnecting(null), []);
|
|
469
477
|
|
|
470
|
-
if (
|
|
478
|
+
if (isLoading) {
|
|
471
479
|
return (
|
|
472
480
|
<Skeleton.Region>
|
|
473
|
-
<View
|
|
481
|
+
<View style={styles.loading}>
|
|
474
482
|
<Skeleton.Box width={260} height={14} />
|
|
475
483
|
<Skeleton.Box width={160} height={14} />
|
|
476
484
|
</View>
|
|
@@ -481,7 +489,9 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
|
|
|
481
489
|
const handleConnect = async (platform: GemieAccountPlatform) => {
|
|
482
490
|
setConnectFailure(null);
|
|
483
491
|
try {
|
|
484
|
-
|
|
492
|
+
setAsked(platform);
|
|
493
|
+
const link = await connect.run(platform);
|
|
494
|
+
if (link) setConnecting({ platform, link });
|
|
485
495
|
} catch (error) {
|
|
486
496
|
setConnectFailure({ platform, reason: errorMessage(error, t(`${K}.tryAgain`)) });
|
|
487
497
|
}
|
|
@@ -490,7 +500,7 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
|
|
|
490
500
|
const handleCancel = async () => {
|
|
491
501
|
const pending = connecting;
|
|
492
502
|
setConnecting(null);
|
|
493
|
-
if (pending) await remove.
|
|
503
|
+
if (pending) await remove.run(pending.link.accountId).catch(() => {});
|
|
494
504
|
};
|
|
495
505
|
|
|
496
506
|
/**
|
|
@@ -502,16 +512,16 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
|
|
|
502
512
|
return (
|
|
503
513
|
<View>
|
|
504
514
|
<Row first>
|
|
505
|
-
<Text variant="body-2-regular"
|
|
515
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
506
516
|
{t(`${K}.loadFailed`)}
|
|
507
517
|
</Text>
|
|
508
|
-
<View
|
|
518
|
+
<View style={styles.actions}>
|
|
509
519
|
<Button
|
|
510
520
|
size="sm"
|
|
511
521
|
appearance="outline"
|
|
512
522
|
tone="neutral"
|
|
513
523
|
loading={isFetching}
|
|
514
|
-
onPress={() => void
|
|
524
|
+
onPress={() => void refresh()}
|
|
515
525
|
>
|
|
516
526
|
{t(`${K}.retry`)}
|
|
517
527
|
</Button>
|
|
@@ -531,7 +541,7 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
|
|
|
531
541
|
return (
|
|
532
542
|
<View>
|
|
533
543
|
<Row first>
|
|
534
|
-
<Text variant="body-2-regular"
|
|
544
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
535
545
|
{t(`${K}.description`)}
|
|
536
546
|
</Text>
|
|
537
547
|
</Row>
|
|
@@ -550,17 +560,17 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
|
|
|
550
560
|
<Row>
|
|
551
561
|
<Text variant="body-2-semibold">{t(`${K}.connect`)}</Text>
|
|
552
562
|
{platforms.length === 0 ? (
|
|
553
|
-
<Text variant="body-2-regular"
|
|
563
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
554
564
|
{t(`${K}.unavailable`)}
|
|
555
565
|
</Text>
|
|
556
566
|
) : null}
|
|
557
567
|
{platforms.includes('telegram') ? (
|
|
558
|
-
<Text variant="body-2-regular"
|
|
568
|
+
<Text variant="body-2-regular" style={styles.muted}>
|
|
559
569
|
{t(`${K}.telegram.note`)}
|
|
560
570
|
</Text>
|
|
561
571
|
) : null}
|
|
562
572
|
{platforms.length === 0 ? null : (
|
|
563
|
-
<View
|
|
573
|
+
<View style={styles.platforms}>
|
|
564
574
|
{platforms.map((platform) => (
|
|
565
575
|
<Button
|
|
566
576
|
key={platform}
|
|
@@ -570,7 +580,7 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
|
|
|
570
580
|
accessibilityLabel={t(`${K}.connectNamed`, {
|
|
571
581
|
platform: PLATFORM_LABELS[platform],
|
|
572
582
|
})}
|
|
573
|
-
loading={connect.isPending &&
|
|
583
|
+
loading={connect.isPending && asked === platform}
|
|
574
584
|
disabled={connect.isPending}
|
|
575
585
|
onPress={() => handleConnect(platform)}
|
|
576
586
|
>
|
|
@@ -580,18 +590,14 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
|
|
|
580
590
|
</View>
|
|
581
591
|
)}
|
|
582
592
|
{connectFailure ? (
|
|
583
|
-
<View
|
|
584
|
-
<Text
|
|
585
|
-
variant="body-2-regular"
|
|
586
|
-
className="text-error-primary"
|
|
587
|
-
accessibilityRole="alert"
|
|
588
|
-
>
|
|
593
|
+
<View style={styles.steps}>
|
|
594
|
+
<Text variant="body-2-regular" accessibilityRole="alert" style={styles.failure}>
|
|
589
595
|
{t(`${K}.connectFailed`, {
|
|
590
596
|
platform: PLATFORM_LABELS[connectFailure.platform],
|
|
591
597
|
reason: connectFailure.reason,
|
|
592
598
|
})}
|
|
593
599
|
</Text>
|
|
594
|
-
<View
|
|
600
|
+
<View style={styles.actions}>
|
|
595
601
|
<Button
|
|
596
602
|
size="sm"
|
|
597
603
|
appearance="outline"
|
|
@@ -609,3 +615,33 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
|
|
|
609
615
|
</View>
|
|
610
616
|
);
|
|
611
617
|
}
|
|
618
|
+
|
|
619
|
+
const useStyles = createTokenStyles((t) => ({
|
|
620
|
+
// A connect failure, in Bloom's error role.
|
|
621
|
+
failure: { color: t.destructive },
|
|
622
|
+
choice: { gap: 4 },
|
|
623
|
+
muted: { color: t.mutedForeground },
|
|
624
|
+
steps: { gap: 8 },
|
|
625
|
+
actions: { flexDirection: 'row' },
|
|
626
|
+
chat: {
|
|
627
|
+
flexDirection: 'row',
|
|
628
|
+
alignItems: 'center',
|
|
629
|
+
justifyContent: 'space-between',
|
|
630
|
+
gap: 12,
|
|
631
|
+
paddingVertical: 4,
|
|
632
|
+
},
|
|
633
|
+
chatName: { flexGrow: 1, flexShrink: 1, flexBasis: '0%' },
|
|
634
|
+
settings: { gap: 12 },
|
|
635
|
+
account: {
|
|
636
|
+
flexDirection: 'row',
|
|
637
|
+
flexWrap: 'wrap',
|
|
638
|
+
alignItems: 'center',
|
|
639
|
+
justifyContent: 'space-between',
|
|
640
|
+
gap: 12,
|
|
641
|
+
},
|
|
642
|
+
accountText: { flexGrow: 1, flexShrink: 1, flexBasis: '0%', gap: 2 },
|
|
643
|
+
loading: { gap: 12, paddingVertical: 10 },
|
|
644
|
+
platforms: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 },
|
|
645
|
+
listRow: { gap: 12, paddingVertical: 10, paddingInlineEnd: 10 },
|
|
646
|
+
divider: { borderTopWidth: 1, borderColor: t.border },
|
|
647
|
+
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLabels } from '../../lib/labels';
|
|
2
2
|
import { Muted, Text } from '@oxy.so/bloom/typography';
|
|
3
|
-
import { View } from 'react-native';
|
|
3
|
+
import { View, StyleSheet } from 'react-native';
|
|
4
4
|
import { ChartRenderer } from './ChartRenderer';
|
|
5
5
|
import { CodeRenderer } from './CodeRenderer';
|
|
6
6
|
import { DashboardRenderer } from './DashboardRenderer';
|
|
@@ -57,9 +57,13 @@ export function CanvasComponent({ component, onFormSubmit }: CanvasComponentProp
|
|
|
57
57
|
})();
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
|
-
<View
|
|
60
|
+
<View style={styles.component}>
|
|
61
61
|
<Text variant="body-semibold">{component.title}</Text>
|
|
62
62
|
{content}
|
|
63
63
|
</View>
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
const styles = StyleSheet.create({
|
|
68
|
+
component: { gap: 12 },
|
|
69
|
+
});
|
|
@@ -3,6 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
import { ChartRenderer } from './ChartRenderer';
|
|
4
4
|
import { MarkdownRenderer } from './MarkdownRenderer';
|
|
5
5
|
import { TableRenderer } from './TableRenderer';
|
|
6
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
6
7
|
|
|
7
8
|
export type DashboardWidget =
|
|
8
9
|
| { kind: 'stat'; label: string; value: string; delta?: string }
|
|
@@ -22,20 +23,18 @@ interface DashboardRendererProps {
|
|
|
22
23
|
|
|
23
24
|
/** A dashboard: its stats in a row, then its charts, tables and notes, each drawn by its own renderer. */
|
|
24
25
|
export function DashboardRenderer({ data }: DashboardRendererProps) {
|
|
26
|
+
const styles = useStyles();
|
|
25
27
|
const widgets = Array.isArray(data.widgets) ? data.widgets : [];
|
|
26
28
|
const stats = widgets.filter(
|
|
27
29
|
(w): w is Extract<DashboardWidget, { kind: 'stat' }> => w.kind === 'stat',
|
|
28
30
|
);
|
|
29
31
|
const rest = widgets.filter((w) => w.kind !== 'stat');
|
|
30
32
|
return (
|
|
31
|
-
<View
|
|
33
|
+
<View style={styles.dashboard}>
|
|
32
34
|
{stats.length > 0 && (
|
|
33
|
-
<View
|
|
35
|
+
<View style={styles.stats}>
|
|
34
36
|
{stats.map((stat, i) => (
|
|
35
|
-
<View
|
|
36
|
-
key={i}
|
|
37
|
-
className="min-w-36 flex-1 gap-1 rounded-2xl border border-border bg-background-tertiary-default p-3"
|
|
38
|
-
>
|
|
37
|
+
<View key={i} style={styles.stat}>
|
|
39
38
|
<Muted>{stat.label}</Muted>
|
|
40
39
|
<Text variant="headline-semibold">{stat.value}</Text>
|
|
41
40
|
{stat.delta ? <Muted>{stat.delta}</Muted> : null}
|
|
@@ -49,14 +48,14 @@ export function DashboardRenderer({ data }: DashboardRendererProps) {
|
|
|
49
48
|
return <ChartRenderer key={i} data={widget} title={widget.title} />;
|
|
50
49
|
case 'table':
|
|
51
50
|
return (
|
|
52
|
-
<View key={i}
|
|
51
|
+
<View key={i} style={styles.widget}>
|
|
53
52
|
{widget.title ? <Text variant="body-semibold">{widget.title}</Text> : null}
|
|
54
53
|
<TableRenderer data={widget} title={widget.title} />
|
|
55
54
|
</View>
|
|
56
55
|
);
|
|
57
56
|
case 'text':
|
|
58
57
|
return (
|
|
59
|
-
<View key={i}
|
|
58
|
+
<View key={i} style={styles.widget}>
|
|
60
59
|
{widget.title ? <Text variant="body-semibold">{widget.title}</Text> : null}
|
|
61
60
|
<MarkdownRenderer data={{ content: widget.content }} />
|
|
62
61
|
</View>
|
|
@@ -68,3 +67,21 @@ export function DashboardRenderer({ data }: DashboardRendererProps) {
|
|
|
68
67
|
</View>
|
|
69
68
|
);
|
|
70
69
|
}
|
|
70
|
+
|
|
71
|
+
const useStyles = createTokenStyles((t) => ({
|
|
72
|
+
dashboard: { gap: 12 },
|
|
73
|
+
stats: { flexDirection: 'row', flexWrap: 'wrap', gap: 12 },
|
|
74
|
+
stat: {
|
|
75
|
+
minWidth: 144,
|
|
76
|
+
flexGrow: 1,
|
|
77
|
+
flexShrink: 1,
|
|
78
|
+
flexBasis: '0%',
|
|
79
|
+
gap: 4,
|
|
80
|
+
borderRadius: 16,
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
borderColor: t.border,
|
|
83
|
+
backgroundColor: t.popover,
|
|
84
|
+
padding: 12,
|
|
85
|
+
},
|
|
86
|
+
widget: { gap: 8 },
|
|
87
|
+
}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Muted, Text } from '@oxy.so/bloom/typography';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { MarkdownRenderer } from './MarkdownRenderer';
|
|
4
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
4
5
|
|
|
5
6
|
interface DeckSlide {
|
|
6
7
|
title: string;
|
|
@@ -19,15 +20,13 @@ interface DeckRendererProps {
|
|
|
19
20
|
* (Astro opens a deck in a tab of its own); here it is read like a document.
|
|
20
21
|
*/
|
|
21
22
|
export function DeckRenderer({ data }: DeckRendererProps) {
|
|
23
|
+
const styles = useStyles();
|
|
22
24
|
const slides = Array.isArray(data.slides) ? data.slides : [];
|
|
23
25
|
return (
|
|
24
|
-
<View
|
|
26
|
+
<View style={styles.deck}>
|
|
25
27
|
{slides.map((slide, i) => (
|
|
26
|
-
<View
|
|
27
|
-
|
|
28
|
-
className="gap-2 rounded-2xl border border-border bg-background-tertiary-default p-4"
|
|
29
|
-
>
|
|
30
|
-
<View className="flex-row items-baseline justify-between gap-2">
|
|
28
|
+
<View key={i} style={styles.slide}>
|
|
29
|
+
<View style={styles.slideHeader}>
|
|
31
30
|
<Text variant="body-semibold">{slide.title}</Text>
|
|
32
31
|
<Muted>{i + 1}</Muted>
|
|
33
32
|
</View>
|
|
@@ -41,3 +40,21 @@ export function DeckRenderer({ data }: DeckRendererProps) {
|
|
|
41
40
|
</View>
|
|
42
41
|
);
|
|
43
42
|
}
|
|
43
|
+
|
|
44
|
+
const useStyles = createTokenStyles((t) => ({
|
|
45
|
+
deck: { gap: 12 },
|
|
46
|
+
slide: {
|
|
47
|
+
gap: 8,
|
|
48
|
+
borderRadius: 16,
|
|
49
|
+
borderWidth: 1,
|
|
50
|
+
borderColor: t.border,
|
|
51
|
+
backgroundColor: t.popover,
|
|
52
|
+
padding: 16,
|
|
53
|
+
},
|
|
54
|
+
slideHeader: {
|
|
55
|
+
flexDirection: 'row',
|
|
56
|
+
alignItems: 'baseline',
|
|
57
|
+
justifyContent: 'space-between',
|
|
58
|
+
gap: 8,
|
|
59
|
+
},
|
|
60
|
+
}));
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '@oxy.so/bloom/select';
|
|
15
15
|
import { TextFieldInput } from '@oxy.so/bloom/text-field';
|
|
16
16
|
import { useState } from 'react';
|
|
17
|
-
import { View } from 'react-native';
|
|
17
|
+
import { View, StyleSheet } from 'react-native';
|
|
18
18
|
|
|
19
19
|
interface FormField {
|
|
20
20
|
name: string;
|
|
@@ -43,7 +43,7 @@ export function FormRenderer({ data, onSubmit }: FormRendererProps) {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
|
-
<View
|
|
46
|
+
<View style={styles.fields}>
|
|
47
47
|
{fields.map((field, i) =>
|
|
48
48
|
field.type === 'checkbox' ? (
|
|
49
49
|
<Checkbox
|
|
@@ -92,10 +92,15 @@ export function FormRenderer({ data, onSubmit }: FormRendererProps) {
|
|
|
92
92
|
canvas without a path back into the conversation — and the button
|
|
93
93
|
used to render regardless, a Submit that did nothing (#608, rule 6). */}
|
|
94
94
|
{onSubmit === undefined ? null : (
|
|
95
|
-
<View
|
|
95
|
+
<View style={styles.submit}>
|
|
96
96
|
<Button onPress={() => onSubmit(formValues)}>{t('panels.form.submit')}</Button>
|
|
97
97
|
</View>
|
|
98
98
|
)}
|
|
99
99
|
</View>
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
const styles = StyleSheet.create({
|
|
104
|
+
fields: { gap: 16 },
|
|
105
|
+
submit: { marginTop: 8 },
|
|
106
|
+
});
|