@agimon-ai/po-native 0.0.1-alpha.28 → 0.0.1-alpha.29
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 +15 -10
- package/src/app/useHome.ts +42 -9
- package/src/screens/HomeComputers.stories.tsx +54 -45
- package/src/screens/HomeDesign.stories.tsx +305 -0
- package/src/screens/HomeScreen.stories.tsx +17 -161
- package/src/screens/HomeScreen.tsx +230 -222
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.29",
|
|
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.149",
|
|
33
|
+
"@agimon-ai/po-expo-signing": "0.0.1-alpha.29",
|
|
34
|
+
"@agimon-ai/po-identity": "0.0.2-alpha.96",
|
|
35
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.149",
|
|
36
|
+
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.21",
|
|
37
|
+
"@agimon-ai/po-template-advanced": "0.0.0-alpha.149",
|
|
38
|
+
"@agimon-ai/po-template-elegant": "0.0.0-alpha.149",
|
|
39
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.149",
|
|
40
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.149",
|
|
41
|
+
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.149",
|
|
42
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.149",
|
|
43
43
|
"@better-auth/expo": "1.7.12",
|
|
44
44
|
"@config-plugins/react-native-webrtc": "15.0.2",
|
|
45
45
|
"@earendil-works/chord": "1.5.1",
|
package/src/app/App.tsx
CHANGED
|
@@ -99,6 +99,7 @@ import {
|
|
|
99
99
|
webPluginDiagnostics,
|
|
100
100
|
nativeTemplateCatalog,
|
|
101
101
|
settingsKeyOf,
|
|
102
|
+
homeActivity,
|
|
102
103
|
} from '@agimon-ai/po-web-dashboard/core';
|
|
103
104
|
import { NATIVE_PAIRING_LINK_PREFIX, type SettingsRepository } from '@agimon-ai/po-web-dashboard/types';
|
|
104
105
|
import { type BottomTabBarProps, createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
|
@@ -2066,7 +2067,7 @@ function homeHosts(hostStates: readonly HostRuntimeState[]) {
|
|
|
2066
2067
|
function useOpenAttention() {
|
|
2067
2068
|
const navigation = useNavigation<NativeStackNavigationProp<Routes>>();
|
|
2068
2069
|
return useCallback(
|
|
2069
|
-
(row: HomeAttentionRow) => {
|
|
2070
|
+
(row: Pick<HomeAttentionRow, 'sessionId' | 'destination'>) => {
|
|
2070
2071
|
if (!row.sessionId) return;
|
|
2071
2072
|
const session = sessionsStore.state.byId[row.sessionId]?.summary;
|
|
2072
2073
|
if (!session) {
|
|
@@ -2106,33 +2107,37 @@ function HomeRoute({
|
|
|
2106
2107
|
const hosts = useMemo(() => (multi ? homeHosts(hostStates) : []), [multi, hostStates]);
|
|
2107
2108
|
const single = useHome(multi ? undefined : runtime, {}, hostId);
|
|
2108
2109
|
const homes = useHomes(hosts);
|
|
2109
|
-
const {
|
|
2110
|
+
const { workspaces, refresh, reads, sessions } = multi ? homes : single;
|
|
2111
|
+
const [showEarlier, setShowEarlier] = useState(false);
|
|
2112
|
+
const signedOut = connect !== undefined || restore !== undefined;
|
|
2113
|
+
// ponytail: clocks such as "Running · 8m" age when Home re-renders on a store change, not every minute.
|
|
2114
|
+
const activity = homeActivity({ now: Date.now(), sessions, hosts: reads, showEarlier, place: 'on this computer' });
|
|
2115
|
+
const loading = sessions.length === 0 && reads.some((read) => read.loading && read.snapshot === undefined);
|
|
2110
2116
|
const [view] = useState(
|
|
2111
2117
|
() =>
|
|
2112
2118
|
new Store<HomeView>({
|
|
2113
|
-
|
|
2119
|
+
...(signedOut ? {} : { activity, loading }),
|
|
2114
2120
|
workspaces: connect ? [] : workspaces,
|
|
2115
2121
|
}),
|
|
2116
2122
|
);
|
|
2117
2123
|
useLayoutEffect(() => {
|
|
2118
2124
|
const next = keepEqual(view.state, {
|
|
2119
|
-
|
|
2125
|
+
...(signedOut ? {} : { activity, loading }),
|
|
2120
2126
|
workspaces: connect ? [] : workspaces,
|
|
2121
2127
|
});
|
|
2122
2128
|
if (next !== view.state) view.setState(() => next);
|
|
2123
|
-
}, [view,
|
|
2129
|
+
}, [view, activity, loading, workspaces, connect, signedOut]);
|
|
2124
2130
|
// Only a pull the person made shows the spinner. Background reads after every revision would
|
|
2125
2131
|
// otherwise flash the iOS refresh indicator and push the whole Home down and back.
|
|
2126
2132
|
const [refreshing, setRefreshing] = useState(false);
|
|
2127
2133
|
const sentFromPhone = useStore(sentFromPhoneStore, (value) => value);
|
|
2128
2134
|
const onOpenSession = useOpenSession();
|
|
2129
|
-
const
|
|
2130
|
-
const navigation = useNavigation<NativeStackNavigationProp<Routes>>();
|
|
2135
|
+
const onOpenTarget = useOpenAttention();
|
|
2131
2136
|
const onRefresh = useCallback(() => {
|
|
2132
2137
|
setRefreshing(true);
|
|
2133
2138
|
void refresh().finally(() => setRefreshing(false));
|
|
2134
2139
|
}, [refresh]);
|
|
2135
|
-
const
|
|
2140
|
+
const onShowEarlier = useCallback(() => setShowEarlier(true), []);
|
|
2136
2141
|
const appsSlot = useMemo(() => <HomeTiles hostStates={hostStates} />, [hostStates]);
|
|
2137
2142
|
const attentionSlot = useMemo(() => <HomeAttentionFills hostStates={hostStates} />, [hostStates]);
|
|
2138
2143
|
const grantNotices = useMemo(() => <GrantNotices />, []);
|
|
@@ -2151,8 +2156,8 @@ function HomeRoute({
|
|
|
2151
2156
|
onOpenSession={onOpenSession}
|
|
2152
2157
|
refreshing={refreshing}
|
|
2153
2158
|
onRefresh={onRefresh}
|
|
2154
|
-
|
|
2155
|
-
|
|
2159
|
+
onOpenTarget={onOpenTarget}
|
|
2160
|
+
onShowEarlier={onShowEarlier}
|
|
2156
2161
|
connect={connection}
|
|
2157
2162
|
restore={restore}
|
|
2158
2163
|
/>
|
package/src/app/useHome.ts
CHANGED
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
subscribeWebPluginRegistry,
|
|
8
8
|
useRailEntries,
|
|
9
9
|
webPluginRegistryForHost,
|
|
10
|
+
type HomeHostRead,
|
|
11
|
+
type HomeSessionInput,
|
|
12
|
+
type InstalledHomeContribution,
|
|
10
13
|
} from '@agimon-ai/po-web-dashboard/core';
|
|
11
14
|
import { useFocusEffect } from '@react-navigation/native';
|
|
12
15
|
import { useStore } from '@tanstack/react-store';
|
|
@@ -21,6 +24,23 @@ import { useRailWorkspaces } from './railWorkspaces';
|
|
|
21
24
|
|
|
22
25
|
const disconnected = new Store<HomeReadState>({ supported: null, loading: false });
|
|
23
26
|
|
|
27
|
+
/** One computer's read, as the cockpit's Home model takes it. The reader already qualifies ids. */
|
|
28
|
+
function hostRead(
|
|
29
|
+
state: HomeReadState,
|
|
30
|
+
label: string,
|
|
31
|
+
contributions: readonly InstalledHomeContribution[],
|
|
32
|
+
hostId?: string,
|
|
33
|
+
): HomeHostRead {
|
|
34
|
+
return {
|
|
35
|
+
...(hostId === undefined ? {} : { hostId }),
|
|
36
|
+
label,
|
|
37
|
+
loading: state.loading,
|
|
38
|
+
...(state.snapshot === undefined ? {} : { snapshot: state.snapshot }),
|
|
39
|
+
...(state.error === undefined ? {} : { error: state.error }),
|
|
40
|
+
contributions,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
24
44
|
/** Home reads compact summaries only while its route is visible and the app is active. */
|
|
25
45
|
export function useHome(
|
|
26
46
|
runtime?: LiveRuntime,
|
|
@@ -101,6 +121,10 @@ export function useHome(
|
|
|
101
121
|
sources,
|
|
102
122
|
refresh,
|
|
103
123
|
loadMore,
|
|
124
|
+
reads: [hostRead(state, 'This computer', contributions, hostId)],
|
|
125
|
+
sessions: (runtime && state.supported !== null ? Object.entries(byId) : []).map(
|
|
126
|
+
([id, entry]): HomeSessionInput => ({ id, entry }),
|
|
127
|
+
),
|
|
104
128
|
};
|
|
105
129
|
}
|
|
106
130
|
|
|
@@ -191,23 +215,30 @@ export function useHomes(
|
|
|
191
215
|
const state = reader?.store.state ?? disconnected.state;
|
|
192
216
|
const own = workspaces.filter((workspace) => splitHostId(workspace.id)?.hostId === hostId);
|
|
193
217
|
const contributions = [
|
|
194
|
-
...
|
|
195
|
-
|
|
218
|
+
...new Map(
|
|
219
|
+
[
|
|
220
|
+
...webPluginRegistryForHost(hostId).pluginHomeContributions({ scope: 'host' }),
|
|
221
|
+
...own.flatMap((workspace) => pluginHomeContributions({ scope: 'workspace', workspaceId: workspace.id })),
|
|
222
|
+
].map((item) => [JSON.stringify([item.pluginId, item.id, item.mount]), item]),
|
|
223
|
+
).values(),
|
|
196
224
|
];
|
|
197
|
-
const
|
|
225
|
+
const entries =
|
|
198
226
|
runtime && state.supported !== null
|
|
199
|
-
? Object.entries(byId)
|
|
200
|
-
.filter(([id]) => splitHostId(id)?.hostId === hostId)
|
|
201
|
-
.map(([, entry]) => entry.summary)
|
|
227
|
+
? Object.entries(byId).filter(([id]) => splitHostId(id)?.hostId === hostId)
|
|
202
228
|
: [];
|
|
203
229
|
return {
|
|
204
230
|
hostId,
|
|
205
231
|
label,
|
|
206
232
|
online: runtime !== undefined,
|
|
207
233
|
loading: state.loading,
|
|
208
|
-
overview: homeOverview(
|
|
209
|
-
|
|
210
|
-
|
|
234
|
+
overview: homeOverview(
|
|
235
|
+
state,
|
|
236
|
+
entries.map(([, entry]) => entry.summary),
|
|
237
|
+
runtime ? own : [],
|
|
238
|
+
contributions,
|
|
239
|
+
),
|
|
240
|
+
read: hostRead(state, label, contributions, hostId),
|
|
241
|
+
sessions: entries.map(([id, entry]): HomeSessionInput => ({ id, entry })),
|
|
211
242
|
};
|
|
212
243
|
});
|
|
213
244
|
void registryVersion;
|
|
@@ -229,5 +260,7 @@ export function useHomes(
|
|
|
229
260
|
// Each computer pages its own list; one more page from every computer that has one.
|
|
230
261
|
hasMore: readers.some(({ reader }) => reader?.store.state.snapshot?.nextOffset !== undefined),
|
|
231
262
|
loadMore,
|
|
263
|
+
reads: parts.map((part) => part.read),
|
|
264
|
+
sessions: parts.flatMap((part) => part.sessions),
|
|
232
265
|
};
|
|
233
266
|
}
|
|
@@ -1,72 +1,83 @@
|
|
|
1
1
|
import { defaultRailWorkspaces } from '@agimon-ai/po-core/webTesting';
|
|
2
|
+
import { WorkflowIcon } from '@agimon-ai/po-native-components';
|
|
3
|
+
import type { HomeActivityItem, HomeActivityModel } from '@agimon-ai/po-web-dashboard/core';
|
|
2
4
|
|
|
3
5
|
import { PhoneFrame, type DesignScheme } from './designFrame';
|
|
4
|
-
import type { HomeOverview } from './homeModel';
|
|
5
6
|
import { HomeScreen } from './HomeScreen';
|
|
6
7
|
import { HostMenuButton } from './HostDrawer';
|
|
7
8
|
|
|
8
9
|
const noop = () => undefined;
|
|
9
|
-
const UPDATED = '2026-10-25T09:38:00Z';
|
|
10
10
|
|
|
11
11
|
/** Two paired computers: one Home, each row tagged with the computer it came from. */
|
|
12
|
-
function
|
|
13
|
-
const
|
|
12
|
+
function activity(offline: boolean): HomeActivityModel {
|
|
13
|
+
const today: HomeActivityItem[] = [
|
|
14
14
|
{
|
|
15
|
-
id: '
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
id: 'notes',
|
|
16
|
+
at: '09:52',
|
|
17
|
+
name: 'notes',
|
|
18
|
+
outcome: 'Waiting for your input',
|
|
19
|
+
tone: 'magenta',
|
|
20
|
+
actor: { name: 'Ponytail' },
|
|
21
|
+
branch: 'main',
|
|
22
|
+
host: 'MacBook Pro',
|
|
23
|
+
target: { sessionId: 'mbp/notes' },
|
|
21
24
|
},
|
|
22
25
|
{
|
|
23
|
-
id: '
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
title: 'Review notes two',
|
|
33
|
-
detail: 'notes · Waiting for your input',
|
|
34
|
-
kind: 'attention',
|
|
35
|
-
updatedAt: UPDATED,
|
|
36
|
-
hostLabel: 'MacBook Pro',
|
|
26
|
+
id: 'nightly',
|
|
27
|
+
at: '09:38',
|
|
28
|
+
name: 'Nightly build',
|
|
29
|
+
outcome: 'Failed: the test step exited with code 1',
|
|
30
|
+
tone: 'red',
|
|
31
|
+
icon: WorkflowIcon as unknown as HomeActivityItem['icon'],
|
|
32
|
+
source: 'Workflows',
|
|
33
|
+
host: 'Studio Mac',
|
|
34
|
+
target: { sessionId: 'studio/garden', destination: 'workflows' },
|
|
37
35
|
},
|
|
38
36
|
];
|
|
39
37
|
return {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
summary: offline
|
|
39
|
+
? 'Po is working on one thing. One thing would like your eye, whenever you are ready.'
|
|
40
|
+
: 'Po is working on one thing. 2 things would like your eye, whenever you are ready.',
|
|
41
|
+
activity: offline ? today.slice(0, 1) : today,
|
|
42
|
+
earlier: false,
|
|
43
|
+
waiting: [
|
|
44
|
+
{
|
|
45
|
+
id: 'notes',
|
|
46
|
+
name: 'notes',
|
|
47
|
+
detail: 'Waiting for your input',
|
|
48
|
+
actor: { name: 'Ponytail' },
|
|
49
|
+
host: 'MacBook Pro',
|
|
50
|
+
target: { sessionId: 'mbp/notes' },
|
|
51
|
+
},
|
|
52
|
+
...(offline
|
|
53
|
+
? []
|
|
54
|
+
: [
|
|
55
|
+
{
|
|
56
|
+
id: 'nightly',
|
|
57
|
+
name: 'Nightly build',
|
|
58
|
+
detail: 'Workflows · the test step exited with code 1',
|
|
59
|
+
failed: true,
|
|
60
|
+
host: 'Studio Mac',
|
|
61
|
+
target: { sessionId: 'studio/garden', destination: 'workflows' },
|
|
62
|
+
},
|
|
63
|
+
]),
|
|
64
|
+
],
|
|
43
65
|
coverage: offline
|
|
44
|
-
? 'MacBook Pro
|
|
45
|
-
: 'MacBook Pro
|
|
46
|
-
complete: !offline,
|
|
47
|
-
working: [{ label: 'Agents', running: 3, queued: 0 }],
|
|
66
|
+
? 'Each item shows its latest state. MacBook Pro: Checked 2 of 2 sources at 09:41. Studio Mac: Tasks and Workflows could not be read. Sessions are still shown.'
|
|
67
|
+
: 'Each item shows its latest state. MacBook Pro: Checked 2 of 2 sources at 09:41. Studio Mac: Checked 2 of 2 sources at 09:41.',
|
|
48
68
|
};
|
|
49
69
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
offline = false,
|
|
53
|
-
sheet = false,
|
|
54
|
-
}: {
|
|
55
|
-
scheme?: DesignScheme;
|
|
56
|
-
offline?: boolean;
|
|
57
|
-
sheet?: boolean;
|
|
58
|
-
}) {
|
|
70
|
+
|
|
71
|
+
function Target({ scheme = 'light', offline = false }: { scheme?: DesignScheme; offline?: boolean }) {
|
|
59
72
|
return (
|
|
60
73
|
<PhoneFrame scheme={scheme}>
|
|
61
74
|
<HomeScreen
|
|
62
75
|
workspaces={defaultRailWorkspaces()}
|
|
63
76
|
sentFromPhone
|
|
64
77
|
onOpenSession={noop}
|
|
65
|
-
|
|
78
|
+
activity={activity(offline)}
|
|
66
79
|
onRefresh={noop}
|
|
67
|
-
onOpenAttention={noop}
|
|
68
80
|
hostMenu={<HostMenuButton label="All hosts" onPress={noop} />}
|
|
69
|
-
initialAttentionOpen={sheet}
|
|
70
81
|
/>
|
|
71
82
|
</PhoneFrame>
|
|
72
83
|
);
|
|
@@ -75,8 +86,6 @@ export const Playground = { render: () => <Target /> };
|
|
|
75
86
|
export const TwoComputersLight = Playground;
|
|
76
87
|
export const TwoComputersDark = { render: () => <Target scheme="dark" /> };
|
|
77
88
|
export const OneComputerOffline = { render: () => <Target offline /> };
|
|
78
|
-
export const NeedsYourEyeSheetLight = { render: () => <Target sheet /> };
|
|
79
|
-
export const NeedsYourEyeSheetDark = { render: () => <Target sheet scheme="dark" /> };
|
|
80
89
|
export const homeComputersMeta = {
|
|
81
90
|
title: 'Native/Design/Home computers',
|
|
82
91
|
tags: ['style-system', 'mockup', 'native'],
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Design target for the phone's Home: the cockpit's Home activity timeline (web story
|
|
3
|
+
* `HomeActivity` in po-web-dashboard) on one column, rendered by the real HomeScreen.
|
|
4
|
+
* Waiting on you comes first, as on the cockpit's narrow layout; then Coming up, then Today.
|
|
5
|
+
* Approved baselines: .build/style-review/approved/native/home/. Runtime code never imports this file.
|
|
6
|
+
*/
|
|
7
|
+
import type { WebTemplateRailWorkspace } from '@agimon-ai/po-core/native';
|
|
8
|
+
import { defaultRailWorkspaces } from '@agimon-ai/po-core/webTesting';
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
fontOf,
|
|
12
|
+
GearIcon,
|
|
13
|
+
HomeIcon,
|
|
14
|
+
MessageIcon,
|
|
15
|
+
TaskIcon,
|
|
16
|
+
WorkflowIcon,
|
|
17
|
+
} from '@agimon-ai/po-native-components';
|
|
18
|
+
import type { HomeActivityItem, HomeActivityModel, HomeWaitingItem } from '@agimon-ai/po-web-dashboard/core';
|
|
19
|
+
import { Text, View } from 'react-native';
|
|
20
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
21
|
+
|
|
22
|
+
import { DashboardTiles } from '../components/DashboardTiles';
|
|
23
|
+
import { TabBar, type TabBarItem } from '../components/TabBar';
|
|
24
|
+
import { PhoneFrame, type DesignScheme } from './designFrame';
|
|
25
|
+
import { HomeScreen } from './HomeScreen';
|
|
26
|
+
|
|
27
|
+
const noop = () => {};
|
|
28
|
+
// The model carries each host's own icon component; the phone's are native icons.
|
|
29
|
+
const icon = (glyph: typeof TaskIcon) => glyph as unknown as HomeActivityItem['icon'];
|
|
30
|
+
const ponytail = { name: 'Ponytail' };
|
|
31
|
+
const polo = { name: 'Polo' };
|
|
32
|
+
|
|
33
|
+
const today: HomeActivityItem[] = [
|
|
34
|
+
{
|
|
35
|
+
id: 'ui',
|
|
36
|
+
at: '09:58',
|
|
37
|
+
name: 'ui-update',
|
|
38
|
+
outcome: 'Done · waiting for you',
|
|
39
|
+
tone: 'green',
|
|
40
|
+
actor: ponytail,
|
|
41
|
+
branch: 'main',
|
|
42
|
+
target: { sessionId: 'ui' },
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'ios',
|
|
46
|
+
at: '09:54',
|
|
47
|
+
name: 'ios',
|
|
48
|
+
outcome: 'Done · waiting for you',
|
|
49
|
+
tone: 'green',
|
|
50
|
+
actor: ponytail,
|
|
51
|
+
branch: 'main',
|
|
52
|
+
target: { sessionId: 'ios' },
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'desktop',
|
|
56
|
+
at: '09:51',
|
|
57
|
+
name: 'desktop',
|
|
58
|
+
outcome: 'Running · 8m',
|
|
59
|
+
tone: 'green',
|
|
60
|
+
actor: ponytail,
|
|
61
|
+
branch: 'main',
|
|
62
|
+
target: { sessionId: 'desktop' },
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'polo',
|
|
66
|
+
at: '09:49',
|
|
67
|
+
name: 'polo',
|
|
68
|
+
outcome: 'Done · waiting for you',
|
|
69
|
+
tone: 'green',
|
|
70
|
+
actor: polo,
|
|
71
|
+
branch: 'main',
|
|
72
|
+
target: { sessionId: 'polo' },
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'notes',
|
|
76
|
+
at: '09:40',
|
|
77
|
+
name: 'Update release notes',
|
|
78
|
+
outcome: 'Finished',
|
|
79
|
+
tone: 'green',
|
|
80
|
+
icon: icon(TaskIcon),
|
|
81
|
+
source: 'Tasks',
|
|
82
|
+
target: { sessionId: 'ios', destination: 'tasks' },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'deploy',
|
|
86
|
+
at: '09:30',
|
|
87
|
+
name: 'Preview deploy',
|
|
88
|
+
outcome: 'Failed: the test step exited with code 1',
|
|
89
|
+
tone: 'red',
|
|
90
|
+
icon: icon(WorkflowIcon),
|
|
91
|
+
source: 'Workflows',
|
|
92
|
+
target: { sessionId: 'desktop', destination: 'workflows' },
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
const waiting: HomeWaitingItem[] = [
|
|
97
|
+
{
|
|
98
|
+
id: 'deploy',
|
|
99
|
+
name: 'Preview deploy',
|
|
100
|
+
detail: 'Workflows · the test step exited with code 1',
|
|
101
|
+
failed: true,
|
|
102
|
+
target: { sessionId: 'desktop', destination: 'workflows' },
|
|
103
|
+
},
|
|
104
|
+
{ id: 'polo', name: 'polo', detail: 'Done, waiting for you · 10m', actor: polo, target: { sessionId: 'polo' } },
|
|
105
|
+
{ id: 'ios', name: 'ios', detail: 'Done, waiting for you · 5m', actor: ponytail, target: { sessionId: 'ios' } },
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
const upcoming = [
|
|
109
|
+
{ id: 'review', at: '11:00', title: 'Review changes' },
|
|
110
|
+
{ id: 'ship', at: 'Thu 14:30', title: 'Ship release notes' },
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
const CHECKED = 'Each item shows its latest state. Checked 3 of 3 sources on this computer at 09:59.';
|
|
114
|
+
|
|
115
|
+
function tabs(badge: number): TabBarItem[] {
|
|
116
|
+
return [
|
|
117
|
+
{ key: 'home', label: 'Home', Icon: HomeIcon, badge },
|
|
118
|
+
{ key: 'sessions', label: 'Sessions', Icon: MessageIcon },
|
|
119
|
+
{ key: 'settings', label: 'Settings', Icon: GearIcon },
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Stands in for the Calendar plugin's body-only card, framed by Home's tile layout as in production. */
|
|
124
|
+
function ComingUp({ rows }: { rows: readonly { id: string; at: string; title: string }[] }) {
|
|
125
|
+
return (
|
|
126
|
+
<DashboardTiles
|
|
127
|
+
tiles={[
|
|
128
|
+
{
|
|
129
|
+
key: 'calendar',
|
|
130
|
+
title: 'Coming up',
|
|
131
|
+
size: 'wide',
|
|
132
|
+
body: (
|
|
133
|
+
<View style={styles.upcoming}>
|
|
134
|
+
{rows.length === 0 ? <Text style={styles.quietBase}>Nothing scheduled.</Text> : null}
|
|
135
|
+
{rows.map((row) => (
|
|
136
|
+
<View key={row.id} style={styles.event}>
|
|
137
|
+
<Text style={styles.eventTime}>{row.at}</Text>
|
|
138
|
+
<Text style={styles.eventTitle}>{row.title}</Text>
|
|
139
|
+
</View>
|
|
140
|
+
))}
|
|
141
|
+
<Button variant="ghost" size="sm" onPress={noop} style={styles.openCalendar}>
|
|
142
|
+
Open Calendar
|
|
143
|
+
</Button>
|
|
144
|
+
</View>
|
|
145
|
+
),
|
|
146
|
+
},
|
|
147
|
+
]}
|
|
148
|
+
/>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function Home({
|
|
153
|
+
scheme,
|
|
154
|
+
activity,
|
|
155
|
+
loading = false,
|
|
156
|
+
events = upcoming,
|
|
157
|
+
workspaces = defaultRailWorkspaces(),
|
|
158
|
+
sentFromPhone = true,
|
|
159
|
+
height,
|
|
160
|
+
}: {
|
|
161
|
+
scheme: DesignScheme;
|
|
162
|
+
activity: HomeActivityModel;
|
|
163
|
+
loading?: boolean;
|
|
164
|
+
events?: readonly { id: string; at: string; title: string }[];
|
|
165
|
+
workspaces?: WebTemplateRailWorkspace[];
|
|
166
|
+
sentFromPhone?: boolean;
|
|
167
|
+
/** A taller phone, so a story can show what sits below the fold. */
|
|
168
|
+
height?: number;
|
|
169
|
+
}) {
|
|
170
|
+
return (
|
|
171
|
+
<PhoneFrame scheme={scheme} {...(height === undefined ? {} : { height })}>
|
|
172
|
+
<HomeScreen
|
|
173
|
+
activity={activity}
|
|
174
|
+
loading={loading}
|
|
175
|
+
workspaces={workspaces}
|
|
176
|
+
sentFromPhone={sentFromPhone}
|
|
177
|
+
appsSlot={<ComingUp rows={events} />}
|
|
178
|
+
onOpenSession={noop}
|
|
179
|
+
onOpenTarget={noop}
|
|
180
|
+
onShowEarlier={noop}
|
|
181
|
+
/>
|
|
182
|
+
<TabBar items={tabs(activity.waiting.length)} activeKey="home" onSelect={noop} />
|
|
183
|
+
</PhoneFrame>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const populated: HomeActivityModel = {
|
|
188
|
+
summary: 'Po finished 3 things today. 3 things would like your eye, whenever you are ready.',
|
|
189
|
+
activity: today,
|
|
190
|
+
earlier: true,
|
|
191
|
+
waiting,
|
|
192
|
+
coverage: CHECKED,
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export const meta = {
|
|
196
|
+
title: 'Native/Design/Home',
|
|
197
|
+
component: HomeScreen,
|
|
198
|
+
tags: ['style-system', 'mockup', 'native'],
|
|
199
|
+
};
|
|
200
|
+
export default meta;
|
|
201
|
+
|
|
202
|
+
export const Playground = { render: () => <Home scheme="dark" activity={populated} /> };
|
|
203
|
+
export const Light = { render: () => <Home scheme="light" activity={populated} /> };
|
|
204
|
+
export const AllCaughtUp = {
|
|
205
|
+
render: () => (
|
|
206
|
+
<Home
|
|
207
|
+
scheme="light"
|
|
208
|
+
events={[]}
|
|
209
|
+
activity={{
|
|
210
|
+
summary: 'Po has things in hand. Nothing needs you right now.',
|
|
211
|
+
activity: today
|
|
212
|
+
.filter((row) => row.tone !== 'red' && !row.outcome.startsWith('Running'))
|
|
213
|
+
.map((row) => ({ ...row, outcome: row.actor ? 'Done · waiting for you' : 'Finished' })),
|
|
214
|
+
earlier: false,
|
|
215
|
+
waiting: [],
|
|
216
|
+
coverage: CHECKED,
|
|
217
|
+
}}
|
|
218
|
+
/>
|
|
219
|
+
),
|
|
220
|
+
};
|
|
221
|
+
export const FirstDay = {
|
|
222
|
+
render: () => (
|
|
223
|
+
<Home
|
|
224
|
+
scheme="light"
|
|
225
|
+
events={[]}
|
|
226
|
+
workspaces={[]}
|
|
227
|
+
sentFromPhone={false}
|
|
228
|
+
activity={{
|
|
229
|
+
summary: 'Start a session and Po will keep track of it here.',
|
|
230
|
+
activity: [],
|
|
231
|
+
earlier: false,
|
|
232
|
+
waiting: [],
|
|
233
|
+
coverage: CHECKED,
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
|
+
),
|
|
237
|
+
};
|
|
238
|
+
export const PartialCoverage = {
|
|
239
|
+
render: () => (
|
|
240
|
+
<Home
|
|
241
|
+
scheme="dark"
|
|
242
|
+
activity={{
|
|
243
|
+
summary: 'Po finished 3 things today. 2 things would like your eye, whenever you are ready.',
|
|
244
|
+
activity: today.slice(0, 5),
|
|
245
|
+
earlier: false,
|
|
246
|
+
waiting: waiting.slice(1),
|
|
247
|
+
coverage:
|
|
248
|
+
'Each item shows its latest state. Checked 2 of 3 sources on this computer at 09:59. Workflows could not be read, so its items may be missing.',
|
|
249
|
+
}}
|
|
250
|
+
/>
|
|
251
|
+
),
|
|
252
|
+
};
|
|
253
|
+
export const Loading = {
|
|
254
|
+
render: () => (
|
|
255
|
+
<Home
|
|
256
|
+
scheme="dark"
|
|
257
|
+
loading
|
|
258
|
+
activity={{ summary: '', activity: [], earlier: false, waiting: [], coverage: 'Checking sources.' }}
|
|
259
|
+
/>
|
|
260
|
+
),
|
|
261
|
+
};
|
|
262
|
+
/** A busy day: 19 rows, so Today shows its first page of 8 and the pager. */
|
|
263
|
+
export const BusyDay = {
|
|
264
|
+
render: () => (
|
|
265
|
+
<Home
|
|
266
|
+
scheme="dark"
|
|
267
|
+
height={1500}
|
|
268
|
+
activity={{
|
|
269
|
+
...populated,
|
|
270
|
+
summary: 'Po finished 19 things today. One thing would like your eye, whenever you are ready.',
|
|
271
|
+
activity: [
|
|
272
|
+
today[0]!,
|
|
273
|
+
...Array.from({ length: 18 }, (_, index): HomeActivityItem => ({
|
|
274
|
+
id: `review-${String(index)}`,
|
|
275
|
+
at: `09:${String(50 - index * 2).padStart(2, '0')}`,
|
|
276
|
+
name: 'You are a code reviewer. Review code against the provided rules and return violations as JSON',
|
|
277
|
+
outcome: 'Finished',
|
|
278
|
+
tone: 'green',
|
|
279
|
+
source: 'Team',
|
|
280
|
+
target: { sessionId: `review-${String(index)}` },
|
|
281
|
+
})),
|
|
282
|
+
],
|
|
283
|
+
waiting: waiting.slice(0, 1),
|
|
284
|
+
}}
|
|
285
|
+
/>
|
|
286
|
+
),
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const styles = StyleSheet.create((theme) => {
|
|
290
|
+
const sans = fontOf(theme.fontFamily.sans);
|
|
291
|
+
const text = { fontFamily: sans, fontSize: theme.fontSize.sm, lineHeight: theme.lineHeightRelaxed.sm };
|
|
292
|
+
return {
|
|
293
|
+
upcoming: { gap: theme.spacing(2) },
|
|
294
|
+
event: { flexDirection: 'row', gap: theme.spacing(3) },
|
|
295
|
+
eventTime: { ...text, width: 72, color: theme.colors.dim, fontVariant: ['tabular-nums'] },
|
|
296
|
+
eventTitle: { ...text, flex: 1, fontSize: theme.fontSize.base, color: theme.colors.text },
|
|
297
|
+
quietBase: {
|
|
298
|
+
fontFamily: sans,
|
|
299
|
+
fontSize: theme.fontSize.base,
|
|
300
|
+
lineHeight: theme.lineHeightRelaxed.base,
|
|
301
|
+
color: theme.colors.dim,
|
|
302
|
+
},
|
|
303
|
+
openCalendar: { alignSelf: 'flex-start', marginLeft: -theme.spacing(2.5) },
|
|
304
|
+
};
|
|
305
|
+
});
|