@agimon-ai/po-native 0.0.1-alpha.76 → 0.0.1-alpha.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -12
- package/src/app/AccountRoute.tsx +14 -5
- package/src/app/App.tsx +191 -68
- package/src/app/OnboardingRoute.tsx +51 -25
- package/src/components/ContextFace.tsx +2 -2
- package/src/screens/AppearanceScreen.tsx +4 -27
- package/src/screens/ContributedSettingsScreen.tsx +24 -4
- package/src/screens/HostedOnboarding.tsx +56 -2
- package/src/screens/HostedOnboardingDesign.stories.tsx +52 -11
- package/src/screens/LanguageScreen.tsx +48 -0
- package/src/screens/PluginCatalogScreen.tsx +2 -0
- package/src/screens/PluginDetailScreen.tsx +51 -41
- package/src/screens/PluginMarketplaceDesign.stories.tsx +20 -0
- package/src/screens/SettingsDirectory.stories.tsx +270 -0
- package/src/screens/SettingsScreen.stories.tsx +20 -8
- package/src/screens/SettingsScreen.tsx +14 -23
- package/src/screens/homeModel.ts +2 -1
- package/src/screens/localPlugins.ts +46 -0
- package/src/screens/usePluginMarketplace.ts +34 -14
- package/src/services/hostActions/index.ts +13 -8
- package/src/services/pairing/index.ts +26 -13
- package/src/services/sessionProfiles/index.ts +2 -1
|
@@ -1,22 +1,39 @@
|
|
|
1
|
-
import { encodeBase64, t } from '@agimon-ai/po-core/native';
|
|
1
|
+
import { encodeBase64, t, useLocale } from '@agimon-ai/po-core/native';
|
|
2
2
|
import {
|
|
3
3
|
createStarterProfile,
|
|
4
4
|
invokeModeAction,
|
|
5
5
|
saveStarterAboutYou,
|
|
6
6
|
STARTER_POS,
|
|
7
7
|
type StarterPo,
|
|
8
|
+
subscribeWebPluginRegistry,
|
|
8
9
|
waitForSession,
|
|
10
|
+
webPluginRegistryRevision,
|
|
9
11
|
whenSessionReady,
|
|
10
12
|
} from '@agimon-ai/po-web-dashboard/core';
|
|
11
13
|
import { useFocusEffect } from '@react-navigation/native';
|
|
12
|
-
import { useCallback, useState } from 'react';
|
|
13
|
-
import { Image } from 'react-native';
|
|
14
|
+
import { type ReactNode, useCallback, useState, useSyncExternalStore } from 'react';
|
|
15
|
+
import { Image, View } from 'react-native';
|
|
14
16
|
|
|
15
|
-
import { AboutYouStep, ChoosePoDeck, ConnectProviderStep, PO_ART } from '../screens/HostedOnboarding';
|
|
17
|
+
import { AboutYouStep, ChoosePoDeck, ConnectProviderStep, LanguagePicker, PO_ART } from '../screens/HostedOnboarding';
|
|
16
18
|
import { apiTransportForHost } from '../services/apiTransport';
|
|
17
19
|
import { openFirstSession } from '../services/hostActions';
|
|
18
20
|
import { listProviders } from '../services/settingsApi';
|
|
19
21
|
import { rememberFirstSessionWelcome } from './firstSteps';
|
|
22
|
+
import { nativeLocales, setLocalePick } from './locale';
|
|
23
|
+
|
|
24
|
+
const FILL = { flex: 1 } as const;
|
|
25
|
+
|
|
26
|
+
/** A first-run screen with the language switch over its top-right corner. Packs arrive with computers. */
|
|
27
|
+
export function WithOnboardingLanguage({ children }: { children: ReactNode }) {
|
|
28
|
+
useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
|
|
29
|
+
const locale = useLocale();
|
|
30
|
+
return (
|
|
31
|
+
<View style={FILL}>
|
|
32
|
+
{children}
|
|
33
|
+
<LanguagePicker locales={nativeLocales()} value={locale} onChange={setLocalePick} />
|
|
34
|
+
</View>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
20
37
|
|
|
21
38
|
/** Read when it is shown, so it follows the language. */
|
|
22
39
|
const notListed = () =>
|
|
@@ -117,30 +134,39 @@ export function OnboardingRoute({
|
|
|
117
134
|
};
|
|
118
135
|
|
|
119
136
|
if (provider === 'checking') return null;
|
|
120
|
-
if (provider === 'missing')
|
|
137
|
+
if (provider === 'missing')
|
|
138
|
+
return (
|
|
139
|
+
<WithOnboardingLanguage>
|
|
140
|
+
<ConnectProviderStep onConnect={onConnectProvider} />
|
|
141
|
+
</WithOnboardingLanguage>
|
|
142
|
+
);
|
|
121
143
|
if (po === null)
|
|
122
144
|
return (
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
<WithOnboardingLanguage>
|
|
146
|
+
<ChoosePoDeck
|
|
147
|
+
pos={STARTER_POS}
|
|
148
|
+
{...(settingUpId === undefined ? {} : { settingUpId })}
|
|
149
|
+
{...(failed === undefined ? {} : { failed })}
|
|
150
|
+
onChoose={(chosen) => void choose(chosen)}
|
|
151
|
+
/>
|
|
152
|
+
</WithOnboardingLanguage>
|
|
129
153
|
);
|
|
130
154
|
return (
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
155
|
+
<WithOnboardingLanguage>
|
|
156
|
+
<AboutYouStep
|
|
157
|
+
po={po}
|
|
158
|
+
name={name}
|
|
159
|
+
interests={interests}
|
|
160
|
+
busy={busy}
|
|
161
|
+
{...(error === '' ? {} : { error })}
|
|
162
|
+
onNameChange={setName}
|
|
163
|
+
onInterestsChange={setInterests}
|
|
164
|
+
onBack={() => {
|
|
165
|
+
setError('');
|
|
166
|
+
setPo(null);
|
|
167
|
+
}}
|
|
168
|
+
onContinue={() => void finish(po)}
|
|
169
|
+
/>
|
|
170
|
+
</WithOnboardingLanguage>
|
|
145
171
|
);
|
|
146
172
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t } from '@agimon-ai/po-core/native';
|
|
1
|
+
import { currentLocale, t } from '@agimon-ai/po-core/native';
|
|
2
2
|
import type { WebPluginSlotProps } from '@agimon-ai/po-core/web';
|
|
3
3
|
import {
|
|
4
4
|
Badge,
|
|
@@ -32,7 +32,7 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
32
32
|
import { contextRows, type ContextRow } from './contextRows';
|
|
33
33
|
/** The tilde is the whole caveat in one character: this is arithmetic, not a bill. */
|
|
34
34
|
function tokens(value: number | null): string {
|
|
35
|
-
return value === null ? '-' : `~${value.toLocaleString()}`;
|
|
35
|
+
return value === null ? '-' : `~${value.toLocaleString(currentLocale())}`;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function sentenceCase(name: string): string {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t } from '@agimon-ai/po-core/native';
|
|
2
2
|
import { Button, fontOf, type SelectOption } from '@agimon-ai/po-native-components';
|
|
3
3
|
import { BUILTIN_THEMES } from '@agimon-ai/po-web-components/theme';
|
|
4
4
|
import { subscribeWebPluginRegistry, webPluginRegistryRevision } from '@agimon-ai/po-web-dashboard/core';
|
|
@@ -46,17 +46,13 @@ export interface AppearanceTemplate {
|
|
|
46
46
|
id: string;
|
|
47
47
|
label: string;
|
|
48
48
|
description: string;
|
|
49
|
+
translateCopy?: (t: (key: string, fallback: string) => string) => { label: string; description: string };
|
|
49
50
|
pluginId: string;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export interface AppearanceScreenProps {
|
|
53
54
|
theme: Appearance;
|
|
54
55
|
onTheme: (theme: Appearance) => void;
|
|
55
|
-
/** The picked language; absent follows the phone. */
|
|
56
|
-
locale?: LocaleTag;
|
|
57
|
-
/** Language packs the person's computers contribute; English is always offered. */
|
|
58
|
-
locales: readonly { readonly name: LocaleTag; readonly nativeLabel: string }[];
|
|
59
|
-
onLocale: (locale: LocaleTag | undefined) => void;
|
|
60
56
|
/** `host`, or the workspace id whose layout this page edits. */
|
|
61
57
|
target: string;
|
|
62
58
|
repositories: readonly SettingsRepository[];
|
|
@@ -135,25 +131,6 @@ export function AppearanceScreen(props: AppearanceScreenProps) {
|
|
|
135
131
|
</Group>
|
|
136
132
|
<PluginThemes theme={theme} onTheme={props.onTheme} />
|
|
137
133
|
|
|
138
|
-
<Group
|
|
139
|
-
label={t('native.appearance.language', 'Language')}
|
|
140
|
-
hint={t('native.appearance.language.hint', 'Applied at once and remembered on this phone.')}
|
|
141
|
-
>
|
|
142
|
-
{[
|
|
143
|
-
{ name: undefined, title: t('native.appearance.language.system', 'Use the phone language') },
|
|
144
|
-
{ name: DEFAULT_LOCALE, title: 'English' },
|
|
145
|
-
...props.locales.map((locale) => ({ name: locale.name, title: locale.nativeLabel })),
|
|
146
|
-
].map((option, index, all) => (
|
|
147
|
-
<CardOption
|
|
148
|
-
key={option.name ?? 'system'}
|
|
149
|
-
title={option.title}
|
|
150
|
-
selected={option.name === props.locale}
|
|
151
|
-
onPress={() => props.onLocale(option.name)}
|
|
152
|
-
last={index === all.length - 1}
|
|
153
|
-
/>
|
|
154
|
-
))}
|
|
155
|
-
</Group>
|
|
156
|
-
|
|
157
134
|
<Group
|
|
158
135
|
label={t('native.appearance.layout', 'Phone layout')}
|
|
159
136
|
hint={t(
|
|
@@ -173,10 +150,10 @@ export function AppearanceScreen(props: AppearanceScreenProps) {
|
|
|
173
150
|
templates.map((template, index) => (
|
|
174
151
|
<CardOption
|
|
175
152
|
key={template.id}
|
|
176
|
-
title={template.label}
|
|
153
|
+
title={template.translateCopy?.(t).label ?? template.label}
|
|
177
154
|
detail={
|
|
178
155
|
<View style={styles.detail}>
|
|
179
|
-
<Text style={styles.dim}>{template.description}</Text>
|
|
156
|
+
<Text style={styles.dim}>{template.translateCopy?.(t).description ?? template.description}</Text>
|
|
180
157
|
<Mono>{template.pluginId}</Mono>
|
|
181
158
|
</View>
|
|
182
159
|
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
plannedSettingsWrites,
|
|
12
12
|
settingsKeyOf,
|
|
13
13
|
settingsLockedReason,
|
|
14
|
+
splitHostId,
|
|
14
15
|
subscribeWebPluginRegistry,
|
|
15
16
|
webPluginRegistryForHost,
|
|
16
17
|
type InstalledSettingsSection,
|
|
@@ -45,6 +46,23 @@ import { Group, Row, SectionPage, sentenceCase } from './SettingsScreen';
|
|
|
45
46
|
* cleared field removes the key, and one Save writes every edit atomically against the read hash.
|
|
46
47
|
*/
|
|
47
48
|
|
|
49
|
+
/** The same owner/id catalog identity as the web host, using only the native locale runtime. */
|
|
50
|
+
export function settingsContributionCopy(
|
|
51
|
+
contribution: {
|
|
52
|
+
pluginId: string;
|
|
53
|
+
id: string;
|
|
54
|
+
label: string;
|
|
55
|
+
detail: string;
|
|
56
|
+
translateCopy?: SettingsSectionContribution['translateCopy'];
|
|
57
|
+
},
|
|
58
|
+
surface: 'settingsSections' | 'settingsPanels',
|
|
59
|
+
): { label: string; detail: string } {
|
|
60
|
+
if (contribution.translateCopy) return contribution.translateCopy(t);
|
|
61
|
+
const owner = splitHostId(contribution.pluginId)?.localId ?? contribution.pluginId;
|
|
62
|
+
const prefix = `plugin.${owner}.${surface}.${contribution.id}`;
|
|
63
|
+
return { label: t(`${prefix}.label`, contribution.label), detail: t(`${prefix}.detail`, contribution.detail) };
|
|
64
|
+
}
|
|
65
|
+
|
|
48
66
|
/** Where a field's value came from, as one badge; silence means the default. */
|
|
49
67
|
export function originOf(
|
|
50
68
|
view: SettingsValueView | undefined,
|
|
@@ -306,7 +324,7 @@ export function ContributedSettingsScreen(props: ContributedSettingsScreenProps)
|
|
|
306
324
|
const dirty = section.fields.filter((field) => settingsKeyOf(field) in drafts).length;
|
|
307
325
|
return (
|
|
308
326
|
<SectionPage
|
|
309
|
-
lede={sentenceCase(section.detail)}
|
|
327
|
+
lede={sentenceCase(section.translateCopy?.(t).detail ?? section.detail)}
|
|
310
328
|
footer={
|
|
311
329
|
canSaveSettings({ dirty, scope, repoRoot }) ? (
|
|
312
330
|
<SaveBar count={dirty} busy={busy} onSave={props.onSave} onDiscard={props.onDiscard} />
|
|
@@ -342,9 +360,11 @@ export function ContributedSettingsScreen(props: ContributedSettingsScreenProps)
|
|
|
342
360
|
export function useSettingsSections(scope: 'host' | 'workspace', hostId?: string): readonly InstalledSettingsSection[] {
|
|
343
361
|
const [, setVersion] = useState(0);
|
|
344
362
|
useEffect(() => subscribeWebPluginRegistry(() => setVersion((value) => value + 1)), []);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
363
|
+
const sections =
|
|
364
|
+
hostId === undefined
|
|
365
|
+
? pluginSettingsSections(scope)
|
|
366
|
+
: webPluginRegistryForHost(hostId).pluginSettingsSections(scope);
|
|
367
|
+
return sections.map((section) => ({ ...section, ...settingsContributionCopy(section, 'settingsSections') }));
|
|
348
368
|
}
|
|
349
369
|
|
|
350
370
|
type Model = Omit<ContributedSettingsScreenProps, 'section' | 'scope' | 'repoRoot'>;
|
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
* the first session with Help mode on. The same five Pos and starters as the web (po-web-dashboard
|
|
4
4
|
* starterPos), drawn for a phone on ink-wash silk.
|
|
5
5
|
*/
|
|
6
|
-
import { t } from '@agimon-ai/po-core/native';
|
|
6
|
+
import { DEFAULT_LOCALE, type LocaleTag, t } from '@agimon-ai/po-core/native';
|
|
7
7
|
import {
|
|
8
8
|
Badge,
|
|
9
9
|
Button,
|
|
10
10
|
CheckIcon,
|
|
11
11
|
fontOf,
|
|
12
12
|
Input,
|
|
13
|
+
GlobeIcon,
|
|
13
14
|
Label,
|
|
14
15
|
SendIcon,
|
|
15
16
|
StepForwardIcon,
|
|
16
17
|
Spinner,
|
|
18
|
+
Select,
|
|
17
19
|
Textarea,
|
|
18
20
|
} from '@agimon-ai/po-native-components';
|
|
19
21
|
import { START_HERE, type StarterPo, startersFor } from '@agimon-ai/po-web-dashboard/core';
|
|
@@ -620,6 +622,41 @@ export function SignInFormStep(props: SignInFormStepProps) {
|
|
|
620
622
|
);
|
|
621
623
|
}
|
|
622
624
|
|
|
625
|
+
/**
|
|
626
|
+
* The language switch in the top-right corner of every first-run step. English is always offered
|
|
627
|
+
* beside the packs the person's computers contribute, so before sign-in it may be the only one.
|
|
628
|
+
*/
|
|
629
|
+
export function LanguagePicker({
|
|
630
|
+
locales,
|
|
631
|
+
value,
|
|
632
|
+
onChange,
|
|
633
|
+
defaultOpen,
|
|
634
|
+
}: {
|
|
635
|
+
locales: readonly { readonly name: LocaleTag; readonly nativeLabel: string }[];
|
|
636
|
+
value: LocaleTag;
|
|
637
|
+
onChange: (tag: LocaleTag) => void;
|
|
638
|
+
/** Start with the sheet up, as a story shows it. */
|
|
639
|
+
defaultOpen?: boolean | undefined;
|
|
640
|
+
}) {
|
|
641
|
+
const options = [
|
|
642
|
+
{ value: DEFAULT_LOCALE, label: 'English' },
|
|
643
|
+
...locales.map((locale) => ({ value: locale.name, label: locale.nativeLabel })),
|
|
644
|
+
];
|
|
645
|
+
return (
|
|
646
|
+
<View style={styles.language}>
|
|
647
|
+
<GlobeIcon size={14} color="dim" />
|
|
648
|
+
<Select
|
|
649
|
+
title={t('native.onboarding.language', 'Language')}
|
|
650
|
+
options={options}
|
|
651
|
+
value={value}
|
|
652
|
+
onValueChange={onChange}
|
|
653
|
+
{...(defaultOpen ? { defaultOpen } : {})}
|
|
654
|
+
style={styles.languageTrigger}
|
|
655
|
+
/>
|
|
656
|
+
</View>
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
|
|
623
660
|
function SignInMessages({ error, notice }: { error?: string | undefined; notice?: string | undefined }) {
|
|
624
661
|
if (error)
|
|
625
662
|
return (
|
|
@@ -646,7 +683,8 @@ const styles = StyleSheet.create((theme, rt) => {
|
|
|
646
683
|
flexGrow: 1,
|
|
647
684
|
gap: theme.spacing(5),
|
|
648
685
|
paddingHorizontal: theme.spacing(4),
|
|
649
|
-
|
|
686
|
+
// Clears the language switch pinned in the top-right corner.
|
|
687
|
+
paddingTop: theme.spacing(15) + rt.insets.top,
|
|
650
688
|
paddingBottom: theme.spacing(8) + rt.insets.bottom,
|
|
651
689
|
},
|
|
652
690
|
header: { gap: theme.spacing(2), alignItems: 'center' },
|
|
@@ -783,6 +821,22 @@ const styles = StyleSheet.create((theme, rt) => {
|
|
|
783
821
|
helpBadge: { alignSelf: 'center' },
|
|
784
822
|
welcomeArt: { width: '112%', height: 320, alignSelf: 'center' },
|
|
785
823
|
back: { alignSelf: 'flex-start' },
|
|
824
|
+
language: {
|
|
825
|
+
position: 'absolute',
|
|
826
|
+
top: theme.spacing(3) + rt.insets.top,
|
|
827
|
+
right: theme.spacing(4),
|
|
828
|
+
zIndex: 1,
|
|
829
|
+
flexDirection: 'row',
|
|
830
|
+
alignItems: 'center',
|
|
831
|
+
gap: theme.spacing(1.5),
|
|
832
|
+
paddingLeft: theme.spacing(3),
|
|
833
|
+
paddingRight: theme.spacing(2.5),
|
|
834
|
+
borderRadius: 999,
|
|
835
|
+
borderWidth: 1,
|
|
836
|
+
borderColor: theme.colors.border,
|
|
837
|
+
backgroundColor: theme.colors.panel,
|
|
838
|
+
},
|
|
839
|
+
languageTrigger: { minHeight: 36 },
|
|
786
840
|
codeInput: { textAlign: 'center', fontSize: 22, letterSpacing: 8, fontVariant: ['tabular-nums'] },
|
|
787
841
|
};
|
|
788
842
|
});
|
|
@@ -18,11 +18,18 @@ import {
|
|
|
18
18
|
SignInFormStep,
|
|
19
19
|
SignInWelcomeStep,
|
|
20
20
|
ConnectProviderStep,
|
|
21
|
+
LanguagePicker,
|
|
21
22
|
} from './HostedOnboarding';
|
|
22
23
|
|
|
23
24
|
const devPo: StarterPo = STARTER_POS.find((po) => po.id === 'coding') ?? STARTER_POS[0]!;
|
|
24
25
|
const INTERESTS = 'Shipping my side project, TypeScript, running.';
|
|
25
26
|
const noop = (): void => undefined;
|
|
27
|
+
/** Packs arrive with the person's computers, so before sign-in English is the only language offered. */
|
|
28
|
+
const NO_PACKS: readonly { name: string; nativeLabel: string }[] = [];
|
|
29
|
+
const LOCALES = [
|
|
30
|
+
{ name: 'vi', nativeLabel: 'Tiếng Việt' },
|
|
31
|
+
{ name: 'zh-CN', nativeLabel: '简体中文' },
|
|
32
|
+
];
|
|
26
33
|
|
|
27
34
|
type SignInStep = 'welcome' | 'email' | 'code' | 'team';
|
|
28
35
|
|
|
@@ -121,8 +128,26 @@ function FirstSession({ po, name, interests }: { po: StarterPo; name: string; in
|
|
|
121
128
|
);
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
function Phone({
|
|
125
|
-
|
|
131
|
+
function Phone({
|
|
132
|
+
scheme = 'light',
|
|
133
|
+
locales = LOCALES,
|
|
134
|
+
language = true,
|
|
135
|
+
languageOpen,
|
|
136
|
+
children,
|
|
137
|
+
}: {
|
|
138
|
+
scheme?: DesignScheme;
|
|
139
|
+
locales?: readonly { name: string; nativeLabel: string }[];
|
|
140
|
+
/** The first session is the ordinary session screen, so it has no language switch. */
|
|
141
|
+
language?: boolean;
|
|
142
|
+
languageOpen?: boolean;
|
|
143
|
+
children: ReactNode;
|
|
144
|
+
}) {
|
|
145
|
+
return (
|
|
146
|
+
<PhoneFrame scheme={scheme}>
|
|
147
|
+
{children}
|
|
148
|
+
{language ? <LanguagePicker locales={locales} value="en" onChange={noop} defaultOpen={languageOpen} /> : null}
|
|
149
|
+
</PhoneFrame>
|
|
150
|
+
);
|
|
126
151
|
}
|
|
127
152
|
|
|
128
153
|
export const meta = { title: 'Native/Design/Hosted onboarding', tags: ['style-system', 'mockup', 'native'] };
|
|
@@ -131,42 +156,50 @@ export default meta;
|
|
|
131
156
|
/** Sign-in on a phone: email or your own server only. */
|
|
132
157
|
export const SignInWelcome = {
|
|
133
158
|
render: () => (
|
|
134
|
-
<Phone>
|
|
159
|
+
<Phone locales={NO_PACKS}>
|
|
135
160
|
<SignIn step="welcome" />
|
|
136
161
|
</Phone>
|
|
137
162
|
),
|
|
138
163
|
};
|
|
139
164
|
export const SignInEmail = {
|
|
140
165
|
render: () => (
|
|
141
|
-
<Phone>
|
|
166
|
+
<Phone locales={NO_PACKS}>
|
|
142
167
|
<SignIn step="email" />
|
|
143
168
|
</Phone>
|
|
144
169
|
),
|
|
145
170
|
};
|
|
146
171
|
export const SignInCode = {
|
|
147
172
|
render: () => (
|
|
148
|
-
<Phone>
|
|
173
|
+
<Phone locales={NO_PACKS}>
|
|
149
174
|
<SignIn step="code" />
|
|
150
175
|
</Phone>
|
|
151
176
|
),
|
|
152
177
|
};
|
|
153
178
|
export const SignInCodeWrong = {
|
|
154
179
|
render: () => (
|
|
155
|
-
<Phone>
|
|
180
|
+
<Phone locales={NO_PACKS}>
|
|
156
181
|
<SignIn step="code" error="That code is wrong or expired. Send a new code to try again." />
|
|
157
182
|
</Phone>
|
|
158
183
|
),
|
|
159
184
|
};
|
|
160
185
|
export const SignInTeam = {
|
|
161
186
|
render: () => (
|
|
162
|
-
<Phone>
|
|
187
|
+
<Phone locales={NO_PACKS}>
|
|
163
188
|
<SignIn step="team" />
|
|
164
189
|
</Phone>
|
|
165
190
|
),
|
|
166
191
|
};
|
|
167
192
|
export const SignInWelcomeDark = {
|
|
168
193
|
render: () => (
|
|
169
|
-
<Phone scheme="dark">
|
|
194
|
+
<Phone scheme="dark" locales={NO_PACKS}>
|
|
195
|
+
<SignIn step="welcome" />
|
|
196
|
+
</Phone>
|
|
197
|
+
),
|
|
198
|
+
};
|
|
199
|
+
/** Before sign-in no computer has sent its packs yet, so the sheet offers English alone. */
|
|
200
|
+
export const SignInLanguageMenu = {
|
|
201
|
+
render: () => (
|
|
202
|
+
<Phone locales={NO_PACKS} languageOpen>
|
|
170
203
|
<SignIn step="welcome" />
|
|
171
204
|
</Phone>
|
|
172
205
|
),
|
|
@@ -186,6 +219,14 @@ export const ConnectProviderDark = {
|
|
|
186
219
|
</Phone>
|
|
187
220
|
),
|
|
188
221
|
};
|
|
222
|
+
/** Once a computer connects, its packs join English, each named in its own language. */
|
|
223
|
+
export const LanguageMenuOpen = {
|
|
224
|
+
render: () => (
|
|
225
|
+
<Phone languageOpen>
|
|
226
|
+
<ChooseBot />
|
|
227
|
+
</Phone>
|
|
228
|
+
),
|
|
229
|
+
};
|
|
189
230
|
/** Step 1 of 2, after Po Cloud sign-in and team. */
|
|
190
231
|
export const Playground = {
|
|
191
232
|
render: () => (
|
|
@@ -251,14 +292,14 @@ export const AboutYouFailed = {
|
|
|
251
292
|
};
|
|
252
293
|
export const FirstSessionWelcome = {
|
|
253
294
|
render: () => (
|
|
254
|
-
<Phone>
|
|
295
|
+
<Phone language={false}>
|
|
255
296
|
<FirstSession po={devPo} name="Alex" interests={INTERESTS} />
|
|
256
297
|
</Phone>
|
|
257
298
|
),
|
|
258
299
|
};
|
|
259
300
|
export const FirstSessionWithoutName = {
|
|
260
301
|
render: () => (
|
|
261
|
-
<Phone>
|
|
302
|
+
<Phone language={false}>
|
|
262
303
|
<FirstSession po={devPo} name="" interests="" />
|
|
263
304
|
</Phone>
|
|
264
305
|
),
|
|
@@ -279,7 +320,7 @@ export const AboutYouFilledDark = {
|
|
|
279
320
|
};
|
|
280
321
|
export const FirstSessionWelcomeDark = {
|
|
281
322
|
render: () => (
|
|
282
|
-
<Phone scheme="dark">
|
|
323
|
+
<Phone scheme="dark" language={false}>
|
|
283
324
|
<FirstSession po={devPo} name="Alex" interests={INTERESTS} />
|
|
284
325
|
</Phone>
|
|
285
326
|
),
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DEFAULT_LOCALE, type LocaleTag, t } from '@agimon-ai/po-core/native';
|
|
2
|
+
|
|
3
|
+
import { CardOption } from './SettingsFields';
|
|
4
|
+
import { Group, SectionPage } from './SettingsScreen';
|
|
5
|
+
|
|
6
|
+
export interface LanguageScreenProps {
|
|
7
|
+
/** The picked language; absent follows the phone. */
|
|
8
|
+
locale?: LocaleTag;
|
|
9
|
+
/** Language packs the person's computers contribute; English is always offered. */
|
|
10
|
+
locales: readonly { readonly name: LocaleTag; readonly nativeLabel: string }[];
|
|
11
|
+
onLocale: (locale: LocaleTag | undefined) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** The name the Settings list shows for the language this phone uses. */
|
|
15
|
+
export function languageLabel(locale: LocaleTag | undefined, locales: LanguageScreenProps['locales']): string {
|
|
16
|
+
if (locale === undefined) return t('native.language.system', 'Use the phone language');
|
|
17
|
+
if (locale === DEFAULT_LOCALE) return 'English';
|
|
18
|
+
return locales.find((option) => option.name === locale)?.nativeLabel ?? locale;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The language Po uses on this phone. It belongs to the phone, not to any computer. */
|
|
22
|
+
export function LanguageScreen({ locale, locales, onLocale }: LanguageScreenProps) {
|
|
23
|
+
const options = [
|
|
24
|
+
{ name: undefined, title: t('native.language.system', 'Use the phone language') },
|
|
25
|
+
{ name: DEFAULT_LOCALE, title: 'English' },
|
|
26
|
+
...locales.map((option) => ({ name: option.name, title: option.nativeLabel })),
|
|
27
|
+
];
|
|
28
|
+
return (
|
|
29
|
+
<SectionPage
|
|
30
|
+
lede={t('native.language.lede', 'The language Po uses on this phone. It applies at once and is remembered here.')}
|
|
31
|
+
>
|
|
32
|
+
<Group
|
|
33
|
+
label={t('native.language.title', 'Language')}
|
|
34
|
+
hint={t('native.language.hint', 'More languages arrive with the language plugins on your computers.')}
|
|
35
|
+
>
|
|
36
|
+
{options.map((option, index) => (
|
|
37
|
+
<CardOption
|
|
38
|
+
key={option.name ?? 'system'}
|
|
39
|
+
title={option.title}
|
|
40
|
+
selected={option.name === locale}
|
|
41
|
+
onPress={() => onLocale(option.name)}
|
|
42
|
+
last={index === options.length - 1}
|
|
43
|
+
/>
|
|
44
|
+
))}
|
|
45
|
+
</Group>
|
|
46
|
+
</SectionPage>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -238,6 +238,8 @@ function RowState({
|
|
|
238
238
|
onTurnOn,
|
|
239
239
|
}: { plugin: PluginEntry; offline?: boolean } & Pick<PluginCatalogScreenProps, 'onInstall' | 'onTurnOn'>) {
|
|
240
240
|
const t = useT();
|
|
241
|
+
// A private plugin has no layer to install or put in a preset; the row only opens its screen.
|
|
242
|
+
if (plugin.localPluginId !== undefined) return null;
|
|
241
243
|
if (plugin.source !== 'po') {
|
|
242
244
|
const off = plugin.domains !== 'everywhere' && !plugin.domains?.length;
|
|
243
245
|
return <StatusBadge tone={off ? 'neutral' : 'ok'}>{domainLabel(plugin)}</StatusBadge>;
|
|
@@ -38,6 +38,8 @@ export function PluginDetailScreen(props: PluginDetailScreenProps) {
|
|
|
38
38
|
const t = useT();
|
|
39
39
|
const { plugin } = props;
|
|
40
40
|
const external = plugin.source !== 'po';
|
|
41
|
+
// A local plugin has its settings pages and nothing else: no install, setup, presets or publisher.
|
|
42
|
+
const local = plugin.localPluginId !== undefined;
|
|
41
43
|
const installed = plugin.install === 'installed';
|
|
42
44
|
return (
|
|
43
45
|
<SectionPage>
|
|
@@ -56,39 +58,45 @@ export function PluginDetailScreen(props: PluginDetailScreenProps) {
|
|
|
56
58
|
: t('native.pluginDetail.codexOrClaude', 'Codex or Claude Code'),
|
|
57
59
|
publisher: plugin.publisher,
|
|
58
60
|
})
|
|
59
|
-
:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
: local
|
|
62
|
+
? plugin.category
|
|
63
|
+
: t('native.pluginDetail.byPublisher', 'By {publisher} · {category}', {
|
|
64
|
+
publisher: plugin.publisher,
|
|
65
|
+
category: plugin.category,
|
|
66
|
+
})}
|
|
63
67
|
</Text>
|
|
64
68
|
</View>
|
|
65
69
|
</View>
|
|
66
70
|
<Text style={styles.lede}>{plugin.description}</Text>
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
{local ? null : (
|
|
73
|
+
<Group
|
|
74
|
+
label={
|
|
75
|
+
external
|
|
76
|
+
? t('native.pluginDetail.whereItLoads', 'Where it loads')
|
|
77
|
+
: t('native.pluginDetail.status', 'Status')
|
|
78
|
+
}
|
|
79
|
+
>
|
|
80
|
+
{external ? (
|
|
81
|
+
<Row
|
|
82
|
+
title={domainLabel(plugin)}
|
|
83
|
+
description={t(
|
|
84
|
+
'native.pluginDetail.externalDomains',
|
|
85
|
+
'Codex and Claude Code plugins load through domains rather than presets.',
|
|
86
|
+
)}
|
|
87
|
+
last
|
|
88
|
+
>
|
|
89
|
+
<Button size="sm" onPress={props.onManageDomains}>
|
|
90
|
+
{t('native.pluginDetail.manage', 'Manage')}
|
|
91
|
+
</Button>
|
|
92
|
+
</Row>
|
|
93
|
+
) : (
|
|
94
|
+
<Activation {...props} />
|
|
95
|
+
)}
|
|
96
|
+
</Group>
|
|
97
|
+
)}
|
|
90
98
|
|
|
91
|
-
{!external && installed && plugin.setup !== 'none' ? (
|
|
99
|
+
{!external && !local && installed && plugin.setup !== 'none' ? (
|
|
92
100
|
<Group label={t('native.pluginDetail.setup', 'Setup')}>
|
|
93
101
|
<Setup {...props} />
|
|
94
102
|
</Group>
|
|
@@ -98,7 +106,7 @@ export function PluginDetailScreen(props: PluginDetailScreenProps) {
|
|
|
98
106
|
<Group label={t('native.pluginDetail.settings', 'Settings')}>{props.settings}</Group>
|
|
99
107
|
) : null}
|
|
100
108
|
|
|
101
|
-
{external ? null : (
|
|
109
|
+
{external || local ? null : (
|
|
102
110
|
<Group
|
|
103
111
|
label={t('native.pluginDetail.inPresets', 'In presets')}
|
|
104
112
|
hint={
|
|
@@ -135,19 +143,21 @@ export function PluginDetailScreen(props: PluginDetailScreenProps) {
|
|
|
135
143
|
</Group>
|
|
136
144
|
)}
|
|
137
145
|
|
|
138
|
-
|
|
139
|
-
{
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
{local ? null : (
|
|
147
|
+
<Group label={t('native.pluginDetail.about', 'About')}>
|
|
148
|
+
{props.adds.map((line) => (
|
|
149
|
+
<Row key={line} title={line} />
|
|
150
|
+
))}
|
|
151
|
+
<Row
|
|
152
|
+
title={t('native.pluginDetail.publisher', 'Publisher')}
|
|
153
|
+
description={plugin.publisher}
|
|
154
|
+
last={!props.version}
|
|
155
|
+
/>
|
|
156
|
+
{props.version ? (
|
|
157
|
+
<Row title={t('native.pluginDetail.version', 'Version')} description={props.version} last />
|
|
158
|
+
) : null}
|
|
159
|
+
</Group>
|
|
160
|
+
)}
|
|
151
161
|
</SectionPage>
|
|
152
162
|
);
|
|
153
163
|
}
|