@agimon-ai/po-native 0.0.1-alpha.77 → 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/App.tsx +28 -5
- package/src/screens/AppearanceScreen.tsx +1 -25
- package/src/screens/HostedOnboardingDesign.stories.tsx +4 -1
- package/src/screens/LanguageScreen.tsx +48 -0
- package/src/screens/SettingsScreen.stories.tsx +20 -2
- package/src/screens/SettingsScreen.tsx +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-native",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.78",
|
|
4
4
|
"description": "Po for iOS and Android",
|
|
5
5
|
"homepage": "https://agimon.ai",
|
|
6
6
|
"bugs": {
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
33
|
-
"@agimon-ai/po-expo-signing": "0.0.1-alpha.
|
|
34
|
-
"@agimon-ai/po-identity": "0.0.2-alpha.
|
|
35
|
-
"@agimon-ai/po-native-components": "0.0.0-alpha.
|
|
36
|
-
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.
|
|
37
|
-
"@agimon-ai/po-template-advanced": "0.0.0-alpha.
|
|
38
|
-
"@agimon-ai/po-template-elegant": "0.0.0-alpha.
|
|
39
|
-
"@agimon-ai/po-voice": "0.0.0-alpha.
|
|
40
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
41
|
-
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.
|
|
42
|
-
"@agimon-ai/po-web-security": "0.0.0-alpha.
|
|
32
|
+
"@agimon-ai/po-core": "0.0.0-alpha.198",
|
|
33
|
+
"@agimon-ai/po-expo-signing": "0.0.1-alpha.78",
|
|
34
|
+
"@agimon-ai/po-identity": "0.0.2-alpha.145",
|
|
35
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.198",
|
|
36
|
+
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.70",
|
|
37
|
+
"@agimon-ai/po-template-advanced": "0.0.0-alpha.198",
|
|
38
|
+
"@agimon-ai/po-template-elegant": "0.0.0-alpha.198",
|
|
39
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.198",
|
|
40
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.198",
|
|
41
|
+
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.198",
|
|
42
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.198",
|
|
43
43
|
"@better-auth/expo": "1.7.12",
|
|
44
44
|
"@config-plugins/react-native-webrtc": "15.0.2",
|
|
45
45
|
"@earendil-works/chord": "1.6.1",
|
package/src/app/App.tsx
CHANGED
|
@@ -201,6 +201,7 @@ import { HomeAppsSection, HomeAttentionScreen, HomeScreen, type HomeView } from
|
|
|
201
201
|
import { HostDrawer, HostMenuButton } from '../screens/HostDrawer';
|
|
202
202
|
import { FirstSessionWelcome } from '../screens/HostedOnboarding';
|
|
203
203
|
import { ImagesScreen, imagesSummary, useImageSettings } from '../screens/ImagesScreen';
|
|
204
|
+
import { LanguageScreen, languageLabel } from '../screens/LanguageScreen';
|
|
204
205
|
import { pluginPageOf } from '../screens/localPlugins';
|
|
205
206
|
import { McpServersScreen, mcpServersSummary, useMcpServers } from '../screens/McpServersScreen';
|
|
206
207
|
import { MetricsScreen, useMetrics } from '../screens/MetricsScreen';
|
|
@@ -341,6 +342,7 @@ type Routes = {
|
|
|
341
342
|
SettingsPresets: { hostId?: string } | undefined;
|
|
342
343
|
SettingsMetrics: { hostId?: string } | undefined;
|
|
343
344
|
SettingsAppearance: undefined;
|
|
345
|
+
SettingsLanguage: undefined;
|
|
344
346
|
SettingsAccount: undefined;
|
|
345
347
|
SettingsTeam: undefined;
|
|
346
348
|
SettingsPanel: { id: string; title: string; hostId?: string };
|
|
@@ -1610,6 +1612,7 @@ function SettingsRoute(
|
|
|
1610
1612
|
}, [reloadSummary, reloadImages, reloadSections, reloadTeam]),
|
|
1611
1613
|
);
|
|
1612
1614
|
const appearance = useStore(appearanceStore, (state) => state);
|
|
1615
|
+
const locale = useStore(localeStore, (pick) => pick);
|
|
1613
1616
|
const teamName = hostedTeamName.data;
|
|
1614
1617
|
const openPanel = (id: string) => {
|
|
1615
1618
|
const computer = props.computers?.find((candidate) => candidate.id === settingsHost);
|
|
@@ -1656,6 +1659,7 @@ function SettingsRoute(
|
|
|
1656
1659
|
{...(mcpServers ? { mcpServers } : {})}
|
|
1657
1660
|
{...(remote ? { remote } : {})}
|
|
1658
1661
|
appearance={appearanceLabel(appearance)}
|
|
1662
|
+
language={languageLabel(locale, nativeLocales())}
|
|
1659
1663
|
{...(teamName ? { team: teamName } : {})}
|
|
1660
1664
|
{...(images ? { images } : {})}
|
|
1661
1665
|
plugins={t('native.app.pluginsInstalled', '{count} installed', { count: plugins })}
|
|
@@ -1678,7 +1682,12 @@ function SettingsRoute(
|
|
|
1678
1682
|
}}
|
|
1679
1683
|
{...((props.error ?? loadError) ? { error: props.error ?? loadError } : {})}
|
|
1680
1684
|
onOpen={(section: SettingsSection) => {
|
|
1681
|
-
if (
|
|
1685
|
+
if (
|
|
1686
|
+
section === 'SettingsAppearance' ||
|
|
1687
|
+
section === 'SettingsLanguage' ||
|
|
1688
|
+
section === 'SettingsAccount' ||
|
|
1689
|
+
section === 'SettingsTeam'
|
|
1690
|
+
) {
|
|
1682
1691
|
navigation.navigate(section);
|
|
1683
1692
|
return;
|
|
1684
1693
|
}
|
|
@@ -2067,6 +2076,15 @@ function ContributedSection({
|
|
|
2067
2076
|
);
|
|
2068
2077
|
}
|
|
2069
2078
|
|
|
2079
|
+
/** The language Po uses on this phone. Packs arrive with computers, so the list follows the registry. */
|
|
2080
|
+
function LanguageRoute() {
|
|
2081
|
+
useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
|
|
2082
|
+
const locale = useStore(localeStore, (pick) => pick);
|
|
2083
|
+
return (
|
|
2084
|
+
<LanguageScreen {...(locale === undefined ? {} : { locale })} locales={nativeLocales()} onLocale={setLocalePick} />
|
|
2085
|
+
);
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2070
2088
|
/** Theme is this phone's; the layout is `native.template` on the computer whose template the app draws. */
|
|
2071
2089
|
function AppearanceRoute() {
|
|
2072
2090
|
const theme = useStore(appearanceStore, (state) => state);
|
|
@@ -2092,7 +2110,6 @@ function AppearanceRoute() {
|
|
|
2092
2110
|
hostId,
|
|
2093
2111
|
);
|
|
2094
2112
|
useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
|
|
2095
|
-
const locale = useStore(localeStore, (pick) => pick);
|
|
2096
2113
|
const mount =
|
|
2097
2114
|
model.target === 'global'
|
|
2098
2115
|
? ({ scope: 'host' } as const)
|
|
@@ -2106,9 +2123,6 @@ function AppearanceRoute() {
|
|
|
2106
2123
|
<AppearanceScreen
|
|
2107
2124
|
theme={theme}
|
|
2108
2125
|
onTheme={setAppearance}
|
|
2109
|
-
{...(locale === undefined ? {} : { locale })}
|
|
2110
|
-
locales={nativeLocales()}
|
|
2111
|
-
onLocale={setLocalePick}
|
|
2112
2126
|
repositories={repositories}
|
|
2113
2127
|
templates={catalog.templates.map(({ id, label, description, pluginId, translateCopy }) => ({
|
|
2114
2128
|
translateCopy,
|
|
@@ -4202,6 +4216,15 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
|
|
|
4202
4216
|
headerBackButtonDisplayMode: 'default',
|
|
4203
4217
|
}}
|
|
4204
4218
|
/>
|
|
4219
|
+
<Stack.Screen
|
|
4220
|
+
name="SettingsLanguage"
|
|
4221
|
+
component={LanguageRoute}
|
|
4222
|
+
options={{
|
|
4223
|
+
title: t('native.settings.language', 'Language'),
|
|
4224
|
+
headerBackTitle: settingsBack(),
|
|
4225
|
+
headerBackButtonDisplayMode: 'default',
|
|
4226
|
+
}}
|
|
4227
|
+
/>
|
|
4205
4228
|
<Stack.Screen
|
|
4206
4229
|
name="SettingsPanel"
|
|
4207
4230
|
component={SettingsPanelRoute}
|
|
@@ -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';
|
|
@@ -53,11 +53,6 @@ export interface AppearanceTemplate {
|
|
|
53
53
|
export interface AppearanceScreenProps {
|
|
54
54
|
theme: Appearance;
|
|
55
55
|
onTheme: (theme: Appearance) => void;
|
|
56
|
-
/** The picked language; absent follows the phone. */
|
|
57
|
-
locale?: LocaleTag;
|
|
58
|
-
/** Language packs the person's computers contribute; English is always offered. */
|
|
59
|
-
locales: readonly { readonly name: LocaleTag; readonly nativeLabel: string }[];
|
|
60
|
-
onLocale: (locale: LocaleTag | undefined) => void;
|
|
61
56
|
/** `host`, or the workspace id whose layout this page edits. */
|
|
62
57
|
target: string;
|
|
63
58
|
repositories: readonly SettingsRepository[];
|
|
@@ -136,25 +131,6 @@ export function AppearanceScreen(props: AppearanceScreenProps) {
|
|
|
136
131
|
</Group>
|
|
137
132
|
<PluginThemes theme={theme} onTheme={props.onTheme} />
|
|
138
133
|
|
|
139
|
-
<Group
|
|
140
|
-
label={t('native.appearance.language', 'Language')}
|
|
141
|
-
hint={t('native.appearance.language.hint', 'Applied at once and remembered on this phone.')}
|
|
142
|
-
>
|
|
143
|
-
{[
|
|
144
|
-
{ name: undefined, title: t('native.appearance.language.system', 'Use the phone language') },
|
|
145
|
-
{ name: DEFAULT_LOCALE, title: 'English' },
|
|
146
|
-
...props.locales.map((locale) => ({ name: locale.name, title: locale.nativeLabel })),
|
|
147
|
-
].map((option, index, all) => (
|
|
148
|
-
<CardOption
|
|
149
|
-
key={option.name ?? 'system'}
|
|
150
|
-
title={option.title}
|
|
151
|
-
selected={option.name === props.locale}
|
|
152
|
-
onPress={() => props.onLocale(option.name)}
|
|
153
|
-
last={index === all.length - 1}
|
|
154
|
-
/>
|
|
155
|
-
))}
|
|
156
|
-
</Group>
|
|
157
|
-
|
|
158
134
|
<Group
|
|
159
135
|
label={t('native.appearance.layout', 'Phone layout')}
|
|
160
136
|
hint={t(
|
|
@@ -26,7 +26,10 @@ const INTERESTS = 'Shipping my side project, TypeScript, running.';
|
|
|
26
26
|
const noop = (): void => undefined;
|
|
27
27
|
/** Packs arrive with the person's computers, so before sign-in English is the only language offered. */
|
|
28
28
|
const NO_PACKS: readonly { name: string; nativeLabel: string }[] = [];
|
|
29
|
-
const LOCALES = [
|
|
29
|
+
const LOCALES = [
|
|
30
|
+
{ name: 'vi', nativeLabel: 'Tiếng Việt' },
|
|
31
|
+
{ name: 'zh-CN', nativeLabel: '简体中文' },
|
|
32
|
+
];
|
|
30
33
|
|
|
31
34
|
type SignInStep = 'welcome' | 'email' | 'code' | 'team';
|
|
32
35
|
|
|
@@ -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
|
+
}
|
|
@@ -12,6 +12,7 @@ import { StyleSheet, UnistylesRuntime } from 'react-native-unistyles';
|
|
|
12
12
|
|
|
13
13
|
import type { Appearance } from '../app/appearance';
|
|
14
14
|
import { AppearanceScreen } from './AppearanceScreen';
|
|
15
|
+
import { LanguageScreen } from './LanguageScreen';
|
|
15
16
|
import { ProvidersScreen } from './ProvidersScreen';
|
|
16
17
|
import { RemoteControlScreen } from './RemoteControlScreen';
|
|
17
18
|
import { CardBody, GlobalSettingsView, Group, NavRow, SettingsScreen } from './SettingsScreen';
|
|
@@ -158,8 +159,6 @@ function AppearanceStory({ scheme, initial }: { scheme: 'light' | 'dark'; initia
|
|
|
158
159
|
<AppearanceScreen
|
|
159
160
|
theme={theme}
|
|
160
161
|
onTheme={setTheme}
|
|
161
|
-
locales={[{ name: 'zh-CN', nativeLabel: '简体中文' }]}
|
|
162
|
-
onLocale={() => undefined}
|
|
163
162
|
target="global"
|
|
164
163
|
repositories={REPOSITORIES}
|
|
165
164
|
templates={TEMPLATES}
|
|
@@ -268,6 +267,25 @@ export const GlobalProfileDark = { render: () => <GlobalProfileStory scheme="dar
|
|
|
268
267
|
export const AppearanceLight = { render: () => <AppearanceStory scheme="light" initial="system" /> };
|
|
269
268
|
export const AppearanceDark = { render: () => <AppearanceStory scheme="dark" initial="dark" /> };
|
|
270
269
|
|
|
270
|
+
/** Language packs a computer contributes, named in their own language. */
|
|
271
|
+
const LOCALES = [
|
|
272
|
+
{ name: 'vi', nativeLabel: 'Tiếng Việt' },
|
|
273
|
+
{ name: 'zh-CN', nativeLabel: '简体中文' },
|
|
274
|
+
];
|
|
275
|
+
|
|
276
|
+
function LanguageStory({ scheme }: { scheme: 'light' | 'dark' }) {
|
|
277
|
+
const [locale, setLocale] = useState<string | undefined>(undefined);
|
|
278
|
+
return (
|
|
279
|
+
<Phone scheme={scheme}>
|
|
280
|
+
<LanguageScreen {...(locale === undefined ? {} : { locale })} locales={LOCALES} onLocale={setLocale} />
|
|
281
|
+
</Phone>
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** Its own screen under This phone: the language belongs to the phone, not to how Po looks. */
|
|
286
|
+
export const LanguageLight = { render: () => <LanguageStory scheme="light" /> };
|
|
287
|
+
export const LanguageDark = { render: () => <LanguageStory scheme="dark" /> };
|
|
288
|
+
|
|
271
289
|
const REPOSITORIES: SettingsRepository[] = [
|
|
272
290
|
{ id: 'r1', name: 'po-internal', path: '/Users/dev/workspace/po-internal', active: true },
|
|
273
291
|
{ id: 'r2', name: 'notes', path: '/Users/dev/.po/workspace/notes', active: false },
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
fontOf,
|
|
11
11
|
type IconProps,
|
|
12
12
|
InfoStrip,
|
|
13
|
+
LanguagesIcon,
|
|
13
14
|
LockIcon,
|
|
14
15
|
MessageIcon,
|
|
15
16
|
MonitorIcon,
|
|
@@ -151,6 +152,7 @@ export type SettingsSection =
|
|
|
151
152
|
| 'SettingsPlugins'
|
|
152
153
|
| 'SettingsMetrics'
|
|
153
154
|
| 'SettingsAppearance'
|
|
155
|
+
| 'SettingsLanguage'
|
|
154
156
|
| 'SettingsAccount'
|
|
155
157
|
| 'SettingsTeam';
|
|
156
158
|
|
|
@@ -171,6 +173,8 @@ export interface SettingsScreenProps {
|
|
|
171
173
|
remote?: RemoteAccessStateView;
|
|
172
174
|
/** How the app looks on this phone, as the Appearance screen names it. */
|
|
173
175
|
appearance?: string;
|
|
176
|
+
/** The language this phone uses, as the Language screen names it. */
|
|
177
|
+
language?: string;
|
|
174
178
|
/** "Resize to 2000 px"; absent until read. */
|
|
175
179
|
images?: string;
|
|
176
180
|
/** "14 installed". */
|
|
@@ -234,6 +238,7 @@ export function SettingsScreen({
|
|
|
234
238
|
mcpServers,
|
|
235
239
|
remote,
|
|
236
240
|
appearance,
|
|
241
|
+
language,
|
|
237
242
|
images,
|
|
238
243
|
plugins,
|
|
239
244
|
sections = [],
|
|
@@ -414,6 +419,12 @@ export function SettingsScreen({
|
|
|
414
419
|
title={t('native.settings.appearance', 'Appearance')}
|
|
415
420
|
value={appearance}
|
|
416
421
|
onPress={() => onOpen('SettingsAppearance')}
|
|
422
|
+
/>
|
|
423
|
+
<NavRow
|
|
424
|
+
Icon={LanguagesIcon}
|
|
425
|
+
title={t('native.settings.language', 'Language')}
|
|
426
|
+
value={language}
|
|
427
|
+
onPress={() => onOpen('SettingsLanguage')}
|
|
417
428
|
last
|
|
418
429
|
/>
|
|
419
430
|
</Group>
|