@monimesl/dot-cli 0.1.0-alpha.9 → 1.0.0-beta.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/README.md +72 -59
- package/dist/cli.js +530 -339
- package/dist/cli.js.map +1 -1
- package/dist/{server-BfPAnsSf.js → server-DMnWDdJ6.js} +570 -478
- package/dist/server-DMnWDdJ6.js.map +1 -0
- package/dist/templates/showcase/dot.ts +53 -16
- package/dist/templates/showcase/pages/basics/bars/controller.ts +47 -0
- package/dist/templates/showcase/pages/basics/bars/state.ts +7 -0
- package/dist/templates/showcase/pages/basics/bars/view.dml +36 -0
- package/dist/templates/showcase/pages/{text → basics/bindings}/controller.ts +5 -0
- package/dist/templates/showcase/pages/basics/bindings/state.ts +14 -0
- package/dist/templates/showcase/pages/basics/bindings/view.dml +41 -0
- package/dist/templates/showcase/pages/basics/colors/controller.ts +112 -0
- package/dist/templates/showcase/pages/basics/colors/palette.ts +52 -0
- package/dist/templates/showcase/pages/basics/colors/state.ts +17 -0
- package/dist/templates/showcase/pages/basics/colors/view.dml +142 -0
- package/dist/templates/showcase/pages/basics/concert/controller.ts +16 -0
- package/dist/templates/showcase/pages/basics/concert/state.ts +7 -0
- package/dist/templates/showcase/pages/basics/concert/view.dml +20 -0
- package/dist/templates/showcase/pages/basics/control-flow/controller.ts +18 -0
- package/dist/templates/showcase/pages/basics/control-flow/state.ts +16 -0
- package/dist/templates/showcase/pages/basics/control-flow/view.dml +55 -0
- package/dist/templates/showcase/pages/basics/events/controller.ts +43 -0
- package/dist/templates/showcase/pages/basics/events/state.ts +11 -0
- package/dist/templates/showcase/pages/basics/events/view.dml +51 -0
- package/dist/templates/showcase/pages/basics/hooks/controller.ts +43 -0
- package/dist/templates/showcase/pages/basics/hooks/state.ts +10 -0
- package/dist/templates/showcase/pages/basics/hooks/view.dml +37 -0
- package/dist/templates/showcase/pages/basics/navigation/controller.ts +41 -0
- package/dist/templates/showcase/pages/basics/navigation/state.ts +11 -0
- package/dist/templates/showcase/pages/basics/navigation/view.dml +48 -0
- package/dist/templates/showcase/pages/basics/pick-genre/controller.ts +18 -0
- package/dist/templates/showcase/pages/basics/pick-genre/state.ts +3 -0
- package/dist/templates/showcase/pages/basics/pick-genre/view.dml +10 -0
- package/dist/templates/showcase/pages/basics/share/concerts.ts +31 -0
- package/dist/templates/showcase/pages/basics/share/controller.ts +12 -0
- package/dist/templates/showcase/pages/basics/share/state.ts +5 -0
- package/dist/templates/showcase/pages/basics/share/view.dml +21 -0
- package/dist/templates/showcase/pages/{state → basics/state}/controller.ts +1 -0
- package/dist/templates/showcase/pages/basics/state/view.dml +46 -0
- package/dist/templates/showcase/pages/{carousel → components/carousel}/controller.ts +2 -1
- package/dist/templates/showcase/pages/{carousel → components/carousel}/state.ts +5 -5
- package/dist/templates/showcase/pages/{carousel → components/carousel}/view.dml +7 -5
- package/dist/templates/showcase/pages/{feedback → components/feedback}/controller.ts +13 -2
- package/dist/templates/showcase/pages/components/feedback/state.ts +41 -0
- package/dist/templates/showcase/pages/{feedback → components/feedback}/view.dml +38 -9
- package/dist/templates/showcase/pages/{forms → components/forms}/controller.ts +23 -19
- package/dist/templates/showcase/pages/{forms → components/forms}/state.ts +6 -3
- package/dist/templates/showcase/pages/components/forms/view.dml +97 -0
- package/dist/templates/showcase/pages/components/icons/controller.ts +15 -0
- package/dist/templates/showcase/pages/components/icons/state.ts +75 -0
- package/dist/templates/showcase/pages/components/icons/view.dml +36 -0
- package/dist/templates/showcase/pages/{images → components/images}/controller.ts +4 -1
- package/dist/templates/showcase/pages/components/images/view.dml +83 -0
- package/dist/templates/showcase/pages/{layout → components/layout}/controller.ts +3 -2
- package/dist/templates/showcase/pages/components/layout/view.dml +143 -0
- package/dist/templates/showcase/pages/components/lists/controller.ts +18 -0
- package/dist/templates/showcase/pages/{lists → components/lists}/state.ts +43 -30
- package/dist/templates/showcase/pages/components/lists/view.dml +88 -0
- package/dist/templates/showcase/pages/{payments → components/money}/controller.ts +7 -8
- package/dist/templates/showcase/pages/components/money/view.dml +54 -0
- package/dist/templates/showcase/pages/components/reading/controller.ts +6 -0
- package/dist/templates/showcase/pages/components/reading/state.ts +23 -0
- package/dist/templates/showcase/pages/components/reading/view.dml +42 -0
- package/dist/templates/showcase/pages/{lists → components/sheets}/controller.ts +10 -11
- package/dist/templates/showcase/pages/components/sheets/state.ts +26 -0
- package/dist/templates/showcase/pages/components/sheets/view.dml +38 -0
- package/dist/templates/showcase/pages/components/styles/controller.ts +6 -0
- package/dist/templates/showcase/pages/components/styles/state.ts +3 -0
- package/dist/templates/showcase/pages/components/styles/view.dml +101 -0
- package/dist/templates/showcase/pages/components/tabs/controller.ts +41 -0
- package/dist/templates/showcase/pages/{filters → components/tabs}/state.ts +32 -23
- package/dist/templates/showcase/pages/components/tabs/view.dml +57 -0
- package/dist/templates/showcase/pages/components/text/controller.ts +10 -0
- package/dist/templates/showcase/pages/components/text/state.ts +3 -0
- package/dist/templates/showcase/pages/components/text/view.dml +95 -0
- package/dist/templates/showcase/pages/dash/account/controller.ts +32 -0
- package/dist/templates/showcase/pages/dash/account/state.ts +9 -0
- package/dist/templates/showcase/pages/dash/account/view.dml +33 -0
- package/dist/templates/showcase/pages/{cache → dash/cache}/controller.ts +9 -4
- package/dist/templates/showcase/pages/dash/cache/view.dml +48 -0
- package/dist/templates/showcase/pages/dash/calls/controller.ts +67 -0
- package/dist/templates/showcase/pages/dash/calls/state.ts +9 -0
- package/dist/templates/showcase/pages/dash/calls/view.dml +69 -0
- package/dist/templates/showcase/pages/dash/contacts/controller.ts +30 -0
- package/dist/templates/showcase/pages/dash/contacts/state.ts +6 -0
- package/dist/templates/showcase/pages/dash/contacts/view.dml +33 -0
- package/dist/templates/showcase/pages/dash/crypto/controller.ts +38 -0
- package/dist/templates/showcase/pages/dash/crypto/state.ts +10 -0
- package/dist/templates/showcase/pages/dash/crypto/view.dml +48 -0
- package/dist/templates/showcase/pages/{files → dash/files}/controller.ts +7 -2
- package/dist/templates/showcase/pages/{files → dash/files}/state.ts +4 -0
- package/dist/templates/showcase/pages/dash/files/view.dml +78 -0
- package/dist/templates/showcase/pages/dash/media/controller.ts +65 -0
- package/dist/templates/showcase/pages/dash/media/state.ts +12 -0
- package/dist/templates/showcase/pages/dash/media/view.dml +53 -0
- package/dist/templates/showcase/pages/{network → dash/network}/controller.ts +84 -20
- package/dist/templates/showcase/pages/{network → dash/network}/state.ts +14 -1
- package/dist/templates/showcase/pages/dash/network/view.dml +108 -0
- package/dist/templates/showcase/pages/dash/payments/cases.ts +445 -0
- package/dist/templates/showcase/pages/dash/payments/controller.ts +149 -0
- package/dist/templates/showcase/pages/dash/payments/state.ts +33 -0
- package/dist/templates/showcase/pages/dash/payments/view.dml +71 -0
- package/dist/templates/showcase/pages/{secrets → dash/secrets}/controller.ts +2 -1
- package/dist/templates/showcase/pages/dash/secrets/view.dml +26 -0
- package/dist/templates/showcase/pages/dash/system/controller.ts +89 -0
- package/dist/templates/showcase/pages/dash/system/state.ts +13 -0
- package/dist/templates/showcase/pages/dash/system/view.dml +96 -0
- package/dist/templates/showcase/pages/dash/ui/controller.ts +70 -0
- package/dist/templates/showcase/pages/dash/ui/state.ts +8 -0
- package/dist/templates/showcase/pages/dash/ui/view.dml +31 -0
- package/dist/templates/showcase/pages/index/controller.ts +1 -1
- package/dist/templates/showcase/pages/index/state.ts +175 -60
- package/dist/templates/showcase/pages/index/view.dml +6 -3
- package/package.json +6 -6
- package/dist/server-BfPAnsSf.js.map +0 -1
- package/dist/templates/showcase/pages/cache/view.dml +0 -36
- package/dist/templates/showcase/pages/device/controller.ts +0 -80
- package/dist/templates/showcase/pages/device/state.ts +0 -7
- package/dist/templates/showcase/pages/device/view.dml +0 -49
- package/dist/templates/showcase/pages/feedback/state.ts +0 -8
- package/dist/templates/showcase/pages/files/view.dml +0 -50
- package/dist/templates/showcase/pages/filters/controller.ts +0 -27
- package/dist/templates/showcase/pages/filters/view.dml +0 -44
- package/dist/templates/showcase/pages/forms/view.dml +0 -49
- package/dist/templates/showcase/pages/images/view.dml +0 -53
- package/dist/templates/showcase/pages/layout/view.dml +0 -103
- package/dist/templates/showcase/pages/lists/view.dml +0 -59
- package/dist/templates/showcase/pages/navigation/controller.ts +0 -65
- package/dist/templates/showcase/pages/navigation/state.ts +0 -17
- package/dist/templates/showcase/pages/navigation/view.dml +0 -34
- package/dist/templates/showcase/pages/network/view.dml +0 -67
- package/dist/templates/showcase/pages/payments/view.dml +0 -45
- package/dist/templates/showcase/pages/secrets/view.dml +0 -24
- package/dist/templates/showcase/pages/state/view.dml +0 -33
- package/dist/templates/showcase/pages/text/state.ts +0 -8
- package/dist/templates/showcase/pages/text/view.dml +0 -58
- /package/dist/templates/showcase/pages/{state → basics/state}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{images → components/images}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{layout → components/layout}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{payments → components/money}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{cache → dash/cache}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{secrets → dash/secrets}/state.ts +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<View>
|
|
2
|
-
<Text variant="title">Cache</Text>
|
|
3
|
-
<Text>The cache saves small values by name. A value can expire after a set time, or stay until it is removed.</Text>
|
|
4
|
-
|
|
5
|
-
<Text variant="caption" tone="muted">Tap an artist. It is remembered for 30 seconds.</Text>
|
|
6
|
-
<List>
|
|
7
|
-
<For each="{{ artists }}" item="artist" key="id">
|
|
8
|
-
<ListItem icon="microphone" title="{{ artist.name }}" data-id="{{ artist.id }}" data-name="{{ artist.name }}" onTap="view" />
|
|
9
|
-
</For>
|
|
10
|
-
</List>
|
|
11
|
-
<View variant="card" gap="small">
|
|
12
|
-
<If condition="{{ recent.length > 0 }}">
|
|
13
|
-
<For each="{{ recent }}" item="name" key="name">
|
|
14
|
-
<Text>{{ name }}</Text>
|
|
15
|
-
</For>
|
|
16
|
-
</If>
|
|
17
|
-
<Else>
|
|
18
|
-
<Text variant="caption" tone="muted">No artists viewed in the last 30 seconds</Text>
|
|
19
|
-
</Else>
|
|
20
|
-
<Button variant="secondary" onClick="refresh">Check again</Button>
|
|
21
|
-
</View>
|
|
22
|
-
|
|
23
|
-
<Text variant="caption" tone="muted">Your favourite genre. It stays until you clear the cache.</Text>
|
|
24
|
-
<View variant="card">
|
|
25
|
-
<Select label="Genre" placeholder="Choose a genre" value="{{ genre }}" onChange="setGenre">
|
|
26
|
-
<Option value="Afropop" label="Afropop" />
|
|
27
|
-
<Option value="Palm-wine" label="Palm-wine" />
|
|
28
|
-
<Option value="Gumbe" label="Gumbe" />
|
|
29
|
-
</Select>
|
|
30
|
-
</View>
|
|
31
|
-
|
|
32
|
-
<View variant="card" gap="small">
|
|
33
|
-
<Text variant="caption" tone="muted">Keys in the cache: {{ keys || 'none' }}</Text>
|
|
34
|
-
<Button variant="secondary" onClick="clear" disabled="{{ !keys }}">Clear the cache</Button>
|
|
35
|
-
</View>
|
|
36
|
-
</View>
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import state from './state';
|
|
2
|
-
|
|
3
|
-
export default definePage({
|
|
4
|
-
initialState: state,
|
|
5
|
-
mutations: {
|
|
6
|
-
clearToast: () => ({ toast: '' }),
|
|
7
|
-
},
|
|
8
|
-
actions: {
|
|
9
|
-
async greet() {
|
|
10
|
-
try {
|
|
11
|
-
const { action } = await this.dash.ui.alert({
|
|
12
|
-
title: 'Kushé',
|
|
13
|
-
message: env.GREETING,
|
|
14
|
-
actions: [
|
|
15
|
-
{ id: 'tenki', label: 'Tenki' },
|
|
16
|
-
{ id: 'close', label: 'Close', role: 'cancel' },
|
|
17
|
-
],
|
|
18
|
-
});
|
|
19
|
-
this.setState({ choice: action });
|
|
20
|
-
} catch (error) {
|
|
21
|
-
this.setState({ note: (error as Error).message });
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
async confirmDelete() {
|
|
25
|
-
try {
|
|
26
|
-
const { action } = await this.dash.ui.alert({
|
|
27
|
-
title: 'Remove this song from your library?',
|
|
28
|
-
message: 'Its download goes too.',
|
|
29
|
-
actions: [
|
|
30
|
-
{ id: 'keep', label: 'Keep', role: 'cancel' },
|
|
31
|
-
{ id: 'remove', label: 'Remove', role: 'destructive' },
|
|
32
|
-
],
|
|
33
|
-
});
|
|
34
|
-
this.setState({ choice: action });
|
|
35
|
-
} catch (error) {
|
|
36
|
-
this.setState({ note: (error as Error).message });
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
async vibrate(_state, event: DotEvent<unknown, { style: 'light' | 'success' | 'error' }>) {
|
|
40
|
-
await this.dash.system.vibrate({ style: event.data.style });
|
|
41
|
-
},
|
|
42
|
-
async copySong() {
|
|
43
|
-
await this.dash.system.copyText('Exodus, by Drizilik');
|
|
44
|
-
this.setState({ toast: 'Song copied' });
|
|
45
|
-
},
|
|
46
|
-
async shareLink() {
|
|
47
|
-
try {
|
|
48
|
-
await this.dash.system.share({
|
|
49
|
-
title: 'Music of Sierra Leone',
|
|
50
|
-
url: 'https://en.wikipedia.org/wiki/Music_of_Sierra_Leone',
|
|
51
|
-
});
|
|
52
|
-
} catch (error) {
|
|
53
|
-
this.setState({ note: (error as Error).message });
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
async openDrizilik() {
|
|
57
|
-
try {
|
|
58
|
-
await this.dash.system.openUrl('https://drizilik.com/');
|
|
59
|
-
} catch (error) {
|
|
60
|
-
this.setState({ note: (error as Error).message });
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
async countDown() {
|
|
64
|
-
for (let seconds = 10; seconds > 0; seconds--) {
|
|
65
|
-
this.setState({ showIn: seconds });
|
|
66
|
-
await this.dash.system.delay(1000);
|
|
67
|
-
}
|
|
68
|
-
this.setState({ showIn: 0, toast: "It's showtime" });
|
|
69
|
-
},
|
|
70
|
-
async toggleTorch(state) {
|
|
71
|
-
const next = state.torch === 'on' ? 'off' : 'on';
|
|
72
|
-
try {
|
|
73
|
-
await this.dash.system.torch(next);
|
|
74
|
-
this.setState({ torch: next, note: '' });
|
|
75
|
-
} catch (error) {
|
|
76
|
-
this.setState({ note: (error as Error).message });
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<View>
|
|
2
|
-
<Text variant="title">Alerts and device</Text>
|
|
3
|
-
<Text>Dash shows these, not the dot. The dot asks for them through dash.</Text>
|
|
4
|
-
|
|
5
|
-
<Text variant="caption" tone="muted">dash.ui.alert</Text>
|
|
6
|
-
<View variant="card" gap="small">
|
|
7
|
-
<View direction="row" wrap gap="small">
|
|
8
|
-
<Button onClick="greet">Say kushé</Button>
|
|
9
|
-
<Button variant="secondary" onClick="confirmDelete">Remove a song</Button>
|
|
10
|
-
</View>
|
|
11
|
-
<If condition="{{ choice }}">
|
|
12
|
-
<Text>You chose "{{ choice }}"</Text>
|
|
13
|
-
</If>
|
|
14
|
-
<Text variant="caption" tone="muted">Kushé means hello in Krio, and tenki means thanks. The message comes from GREETING in the .env file.</Text>
|
|
15
|
-
</View>
|
|
16
|
-
|
|
17
|
-
<Text variant="caption" tone="muted">dash.system.vibrate</Text>
|
|
18
|
-
<View variant="card" direction="row" wrap gap="small">
|
|
19
|
-
<Button variant="secondary" data-style="light" onClick="vibrate">Light</Button>
|
|
20
|
-
<Button variant="secondary" data-style="success" onClick="vibrate">Success</Button>
|
|
21
|
-
<Button variant="secondary" data-style="error" onClick="vibrate">Error</Button>
|
|
22
|
-
</View>
|
|
23
|
-
|
|
24
|
-
<Text variant="caption" tone="muted">dash.system.copyText and dash.system.share</Text>
|
|
25
|
-
<View variant="card" direction="row" wrap gap="small">
|
|
26
|
-
<Button variant="secondary" onClick="copySong">Copy a song</Button>
|
|
27
|
-
<Button variant="secondary" onClick="shareLink">Share Sierra Leone's music</Button>
|
|
28
|
-
</View>
|
|
29
|
-
|
|
30
|
-
<Text variant="caption" tone="muted">dash.system.openUrl opens a web page in the phone's browser</Text>
|
|
31
|
-
<View variant="card">
|
|
32
|
-
<Button variant="secondary" onClick="openDrizilik">Open Drizilik's website</Button>
|
|
33
|
-
</View>
|
|
34
|
-
|
|
35
|
-
<Text variant="caption" tone="muted">dash.system.delay</Text>
|
|
36
|
-
<View variant="card">
|
|
37
|
-
<Button variant="secondary" onClick="countDown" disabled="{{ showIn > 0 }}">{{ showIn > 0 ? 'Showtime in ' + showIn + 's' : 'Count down to showtime' }}</Button>
|
|
38
|
-
</View>
|
|
39
|
-
|
|
40
|
-
<Text variant="caption" tone="muted">dash.system.torch</Text>
|
|
41
|
-
<View variant="card" gap="small">
|
|
42
|
-
<Button variant="secondary" onClick="toggleTorch">{{ torch === 'on' ? 'Turn the torch off' : 'Lights up for the slow song' }}</Button>
|
|
43
|
-
<If condition="{{ note }}">
|
|
44
|
-
<Text variant="caption" tone="muted">{{ note }}</Text>
|
|
45
|
-
</If>
|
|
46
|
-
</View>
|
|
47
|
-
|
|
48
|
-
<Toast message="{{ toast }}" tone="success" onHide="clearToast" />
|
|
49
|
-
</View>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<View>
|
|
2
|
-
<Text variant="title">Files</Text>
|
|
3
|
-
<Text>Each dot has its own folder. Other dots can't see it. Files stay after the dot closes.</Text>
|
|
4
|
-
|
|
5
|
-
<Text variant="caption" tone="muted">A setlist. Each song is a text file.</Text>
|
|
6
|
-
<View variant="card" gap="small">
|
|
7
|
-
<Input label="Song" placeholder="Exodus, by Drizilik" value="{{ draft }}" maxLength="80" onChange="setDraft" onSubmit="save" />
|
|
8
|
-
<View direction="row" gap="small" wrap>
|
|
9
|
-
<Button onClick="save" disabled="{{ !draft }}">Add to the setlist</Button>
|
|
10
|
-
<Button variant="secondary" onClick="archive" disabled="{{ songs.length === 0 }}">Archive it</Button>
|
|
11
|
-
<Button variant="secondary" onClick="clearSetlist" disabled="{{ songs.length === 0 }}">Clear it</Button>
|
|
12
|
-
</View>
|
|
13
|
-
<For each="{{ songs }}" item="song" key="path">
|
|
14
|
-
<View gap="none">
|
|
15
|
-
<Text>{{ song.text }}</Text>
|
|
16
|
-
<Text variant="caption" tone="muted">{{ song.path }}</Text>
|
|
17
|
-
</View>
|
|
18
|
-
</For>
|
|
19
|
-
<If condition="{{ songs.length === 0 }}">
|
|
20
|
-
<Text variant="caption" tone="muted">No songs yet. Add some, then close and reopen the dot. They are still here.</Text>
|
|
21
|
-
</If>
|
|
22
|
-
</View>
|
|
23
|
-
|
|
24
|
-
<Text variant="caption" tone="muted">Archived setlists. Each one is a folder you can copy back.</Text>
|
|
25
|
-
<View variant="card" gap="small">
|
|
26
|
-
<If condition="{{ archives.length > 0 }}">
|
|
27
|
-
<List>
|
|
28
|
-
<For each="{{ archives }}" item="archive" key="path">
|
|
29
|
-
<ListItem icon="playlist" title="Archived at {{ archive.time }}" subtitle="{{ archive.path }}" value="Copy back" data-path="{{ archive.path }}" onTap="copyBack" />
|
|
30
|
-
</For>
|
|
31
|
-
</List>
|
|
32
|
-
</If>
|
|
33
|
-
<Else>
|
|
34
|
-
<Text variant="caption" tone="muted">None yet. Add songs, then archive the setlist.</Text>
|
|
35
|
-
</Else>
|
|
36
|
-
</View>
|
|
37
|
-
|
|
38
|
-
<Text variant="caption" tone="muted">Artwork saved from the Network page</Text>
|
|
39
|
-
<View variant="card" gap="small">
|
|
40
|
-
<If condition="{{ picture }}">
|
|
41
|
-
<Image src="{{ picture }}" alt="Kept artwork" width="64" height="64" />
|
|
42
|
-
<Button variant="secondary" onClick="forgetPicture">Forget it</Button>
|
|
43
|
-
</If>
|
|
44
|
-
<Else>
|
|
45
|
-
<Text variant="caption" tone="muted">None yet. On the Network page, search, download the artwork and tap Keep.</Text>
|
|
46
|
-
</Else>
|
|
47
|
-
</View>
|
|
48
|
-
|
|
49
|
-
<Text variant="caption" tone="muted">{{ usage }}</Text>
|
|
50
|
-
</View>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Release } from './state';
|
|
2
|
-
import state from './state';
|
|
3
|
-
|
|
4
|
-
type Chosen = DotEvent<{ value: string }>;
|
|
5
|
-
|
|
6
|
-
export default definePage({
|
|
7
|
-
initialState: state,
|
|
8
|
-
mutations: {
|
|
9
|
-
chooseTab: (state, event: Chosen) => {
|
|
10
|
-
const tab = event.detail.value;
|
|
11
|
-
return { tab, shown: filter(state.releases, tab, state.genre) };
|
|
12
|
-
},
|
|
13
|
-
chooseGenre: (state, event: DotEvent<unknown, { genre: string }>) => {
|
|
14
|
-
const { genre } = event.data;
|
|
15
|
-
return { genre, shown: filter(state.releases, state.tab, genre) };
|
|
16
|
-
},
|
|
17
|
-
clearFilters: (state) => ({ tab: 'all', genre: 'All', shown: state.releases }),
|
|
18
|
-
chooseWhere: (_state, event: Chosen) => ({ where: event.detail.value }),
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
function filter(releases: readonly Release[], tab: string, genre: string): Release[] {
|
|
23
|
-
return releases.filter(
|
|
24
|
-
(release) =>
|
|
25
|
-
(tab === 'all' || release.kind === tab) && (genre === 'All' || release.genre === genre),
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<View>
|
|
2
|
-
<Text variant="title">Tabs and filters</Text>
|
|
3
|
-
<Text>Tabs change what the page shows. Chips narrow it down. An empty state shows when nothing matches. Try Songs with Palm-wine.</Text>
|
|
4
|
-
|
|
5
|
-
<Tabs value="{{ tab }}" onChange="chooseTab">
|
|
6
|
-
<Tab value="all" label="All" />
|
|
7
|
-
<Tab value="album" label="Albums" badge="{{ albums }}" />
|
|
8
|
-
<Tab value="song" label="Songs" badge="{{ songs }}" />
|
|
9
|
-
</Tabs>
|
|
10
|
-
|
|
11
|
-
<View direction="row" gap="small" wrap>
|
|
12
|
-
<For each="{{ genres }}" item="option" key="*this">
|
|
13
|
-
<Chip label="{{ option }}" selected="{{ option === genre }}" data-genre="{{ option }}" onTap="chooseGenre" />
|
|
14
|
-
</For>
|
|
15
|
-
</View>
|
|
16
|
-
|
|
17
|
-
<If condition="{{ shown.length > 0 }}">
|
|
18
|
-
<List>
|
|
19
|
-
<For each="{{ shown }}" item="release" key="id">
|
|
20
|
-
<ListItem icon="{{ release.kind === 'album' ? 'playlist' : 'music' }}" title="{{ release.title }}" subtitle="{{ release.artist }} · {{ release.genre }}">
|
|
21
|
-
<Badge>{{ release.year }}</Badge>
|
|
22
|
-
</ListItem>
|
|
23
|
-
</For>
|
|
24
|
-
</List>
|
|
25
|
-
</If>
|
|
26
|
-
<Else>
|
|
27
|
-
<EmptyState icon="search" title="Nothing here" text="No release matches this tab and genre.">
|
|
28
|
-
<Button variant="secondary" onClick="clearFilters">Clear filters</Button>
|
|
29
|
-
</EmptyState>
|
|
30
|
-
</Else>
|
|
31
|
-
|
|
32
|
-
<View gap="small">
|
|
33
|
-
<Text variant="caption" tone="muted">Segmented tabs, for a few short choices. Gen Z shows at home and abroad.</Text>
|
|
34
|
-
<Tabs variant="segmented" value="{{ where }}" onChange="chooseWhere">
|
|
35
|
-
<Tab value="home" label="Sierra Leone" />
|
|
36
|
-
<Tab value="abroad" label="Abroad" />
|
|
37
|
-
</Tabs>
|
|
38
|
-
<List>
|
|
39
|
-
<For each="{{ where === 'home' ? home : abroad }}" item="show" key="id">
|
|
40
|
-
<ListItem icon="ticket" title="{{ show.title }}" subtitle="{{ show.place }} · {{ show.date }}" value="{{ show.city }}" />
|
|
41
|
-
</For>
|
|
42
|
-
</List>
|
|
43
|
-
</View>
|
|
44
|
-
</View>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<View>
|
|
2
|
-
<Text variant="title">Forms</Text>
|
|
3
|
-
<Text>Buy tickets for a show. The page checks the form when you send it. Some fields turn off based on your choices.</Text>
|
|
4
|
-
|
|
5
|
-
<View variant="card">
|
|
6
|
-
<Select label="Show" placeholder="Choose a show" hint="Every show has the same prices" value="{{ show }}" error="{{ errors.show }}" disabled="{{ sending }}" onChange="setShow">
|
|
7
|
-
<Option value="freetown" label="Salone Sounds Live · Freetown" />
|
|
8
|
-
<Option value="bo" label="Palm-wine evening · Bo" />
|
|
9
|
-
<Option value="kenema" label="Gospel night · Kenema" />
|
|
10
|
-
</Select>
|
|
11
|
-
<Input label="Name" placeholder="Mariama Kamara" value="{{ name }}" maxLength="40" onChange="setName" />
|
|
12
|
-
<Input label="Email" type="email" placeholder="mariama@example.com" hint="{{ eTickets ? 'For the e-tickets' : 'Turn on e-tickets below to use it' }}" value="{{ email }}" disabled="{{ !eTickets }}" onChange="setEmail" />
|
|
13
|
-
<Input label="Phone" type="phone" prefix="+232" placeholder="76 123456" value="{{ phone }}" error="{{ errors.phone }}" onChange="setPhone" />
|
|
14
|
-
<Input label="Tickets" type="number" placeholder="2" suffix="at most 10" value="{{ tickets }}" error="{{ errors.tickets }}" onChange="setTickets" />
|
|
15
|
-
<TextArea label="Shout-out" placeholder="A message for the band, read out on the night" rows="3" maxLength="140" hint="{{ ticket === 'regular' ? 'Shout-outs come with VIP and table tickets' : shoutOut.length + ' of 140' }}" value="{{ shoutOut }}" error="{{ errors.shoutOut }}" disabled="{{ ticket === 'regular' }}" onChange="setShoutOut" />
|
|
16
|
-
</View>
|
|
17
|
-
|
|
18
|
-
<View variant="card">
|
|
19
|
-
<RadioGroup label="Ticket" value="{{ ticket }}" onChange="setTicket">
|
|
20
|
-
<Radio value="regular" label="Regular · Le 150" />
|
|
21
|
-
<Radio value="vip" label="VIP, near the stage · Le 400" />
|
|
22
|
-
<Radio value="table" label="Table for four · Le 1,200" />
|
|
23
|
-
</RadioGroup>
|
|
24
|
-
<Divider />
|
|
25
|
-
<Switch label="Email me the e-tickets" checked="{{ eTickets }}" onChange="setETickets" />
|
|
26
|
-
<Checkbox label="I agree to the terms" checked="{{ agreed }}" onChange="setAgreed" />
|
|
27
|
-
</View>
|
|
28
|
-
|
|
29
|
-
<Text variant="caption" tone="muted">Your order</Text>
|
|
30
|
-
<View variant="card" gap="none">
|
|
31
|
-
<DetailRow label="Show" value="{{ showName }}" />
|
|
32
|
-
<DetailRow label="Ticket" value="{{ ticketName }}" />
|
|
33
|
-
<DetailRow label="How many" value="{{ tickets || '0' }}" />
|
|
34
|
-
<Divider />
|
|
35
|
-
<DetailRow label="Total" value="{{ total }}" weight="bold" paddingTop="medium" />
|
|
36
|
-
<DetailRow label="Paid" value="{{ sent ? 'Yes' : 'Not yet' }}" tone="{{ sent ? 'success' : 'warning' }}" />
|
|
37
|
-
</View>
|
|
38
|
-
|
|
39
|
-
<If condition="{{ sent }}">
|
|
40
|
-
<Notice tone="success" title="Booked">{{ sent }}</Notice>
|
|
41
|
-
</If>
|
|
42
|
-
<If condition="{{ failure }}">
|
|
43
|
-
<Notice tone="danger" title="Not booked">{{ failure }}</Notice>
|
|
44
|
-
</If>
|
|
45
|
-
|
|
46
|
-
<Footer>
|
|
47
|
-
<Button onClick="send" loading="{{ sending }}" disabled="{{ !agreed }}">Buy tickets</Button>
|
|
48
|
-
</Footer>
|
|
49
|
-
</View>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<View>
|
|
2
|
-
<Text variant="title">Images</Text>
|
|
3
|
-
<Text>Pictures in the statics/ folder come with the dot, and the build checks each one. Pictures from the web load from their address.</Text>
|
|
4
|
-
|
|
5
|
-
<View variant="card" direction="row" align="end" gap="large">
|
|
6
|
-
<Image src="statics/logo.png" alt="Small logo" width="24" height="24" />
|
|
7
|
-
<Image src="statics/logo.png" alt="Medium logo" width="48" height="48" />
|
|
8
|
-
<Image src="statics/logo.png" alt="Large logo" width="96" height="96" />
|
|
9
|
-
</View>
|
|
10
|
-
|
|
11
|
-
<Text variant="caption" tone="muted">From the web: the cover of Drizilik's album AUDACITY. With aspect="1:1" and no width, it fills the card.</Text>
|
|
12
|
-
<View variant="card" gap="small">
|
|
13
|
-
<If condition="{{ cover }}">
|
|
14
|
-
<Image src="{{ cover }}" alt="The cover of AUDACITY, by Drizilik" aspect="1:1" />
|
|
15
|
-
<Text weight="medium">AUDACITY</Text>
|
|
16
|
-
<Text variant="caption" tone="muted">Drizilik raps mostly in Krio, in a style called Kriofusion. He won Best Male Artist at the 2026 SLeDU awards.</Text>
|
|
17
|
-
</If>
|
|
18
|
-
<ElseIf condition="{{ coverNote }}">
|
|
19
|
-
<Text variant="caption" tone="muted">{{ coverNote }}</Text>
|
|
20
|
-
</ElseIf>
|
|
21
|
-
<Else>
|
|
22
|
-
<Skeleton shape="box" height="280" />
|
|
23
|
-
</Else>
|
|
24
|
-
</View>
|
|
25
|
-
|
|
26
|
-
<Text variant="caption" tone="muted">Shapes, and how a picture fills its space</Text>
|
|
27
|
-
<View variant="card" direction="row" align="center" gap="large">
|
|
28
|
-
<Image src="statics/logo.png" alt="Rounded" width="56" height="56" />
|
|
29
|
-
<Image src="statics/logo.png" alt="Square" width="56" height="56" shape="square" />
|
|
30
|
-
<Image src="statics/logo.png" alt="Circle" width="56" height="56" shape="circle" />
|
|
31
|
-
<Image src="statics/logo.png" alt="Contained" width="96" height="56" fit="contain" />
|
|
32
|
-
</View>
|
|
33
|
-
|
|
34
|
-
<Text variant="caption" tone="muted">Sizes can come from state</Text>
|
|
35
|
-
<View variant="card" gap="small">
|
|
36
|
-
<Image src="statics/logo.png" alt="Logo" width="{{ size }}" height="{{ size }}" onLoad="logoLoaded" />
|
|
37
|
-
<Text>{{ size }} × {{ size }} on screen, {{ loaded }} in the file</Text>
|
|
38
|
-
<View direction="row" gap="small">
|
|
39
|
-
<Button variant="secondary" onClick="shrink" disabled="{{ size <= 16 }}">Smaller</Button>
|
|
40
|
-
<Button variant="secondary" onClick="grow" disabled="{{ size >= 128 }}">Bigger</Button>
|
|
41
|
-
</View>
|
|
42
|
-
</View>
|
|
43
|
-
|
|
44
|
-
<Text variant="caption" tone="muted">A broken image shows why it failed</Text>
|
|
45
|
-
<View variant="card">
|
|
46
|
-
<If condition="{{ failure }}">
|
|
47
|
-
<Text>{{ failure }}</Text>
|
|
48
|
-
</If>
|
|
49
|
-
<Else>
|
|
50
|
-
<Image src="{{ missing }}" alt="" width="48" height="48" onError="missingFailed" />
|
|
51
|
-
</Else>
|
|
52
|
-
</View>
|
|
53
|
-
</View>
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<View>
|
|
2
|
-
<Text variant="title">Layout</Text>
|
|
3
|
-
<Text>A View puts its items in a column or a row. Change the one below.</Text>
|
|
4
|
-
|
|
5
|
-
<View variant="card" direction="{{ direction }}" justify="{{ justify }}" align="{{ align }}" gap="{{ gap }}" wrap="{{ wrap }}">
|
|
6
|
-
<Button variant="secondary">Palm-wine</Button>
|
|
7
|
-
<Button variant="secondary">Gumbe</Button>
|
|
8
|
-
<Text variant="title">Afropop</Text>
|
|
9
|
-
<Button variant="secondary">Bubu</Button>
|
|
10
|
-
<Text variant="caption" tone="muted">Milo jazz</Text>
|
|
11
|
-
</View>
|
|
12
|
-
|
|
13
|
-
<View gap="small">
|
|
14
|
-
<View direction="row" align="center">
|
|
15
|
-
<Text>direction="{{ direction }}"</Text>
|
|
16
|
-
<View grow />
|
|
17
|
-
<Button variant="secondary" onClick="nextDirection">Change</Button>
|
|
18
|
-
</View>
|
|
19
|
-
<View direction="row" align="center">
|
|
20
|
-
<Text>justify="{{ justify }}"</Text>
|
|
21
|
-
<View grow />
|
|
22
|
-
<Button variant="secondary" onClick="nextJustify">Change</Button>
|
|
23
|
-
</View>
|
|
24
|
-
<View direction="row" align="center">
|
|
25
|
-
<Text>align="{{ align }}"</Text>
|
|
26
|
-
<View grow />
|
|
27
|
-
<Button variant="secondary" onClick="nextAlign">Change</Button>
|
|
28
|
-
</View>
|
|
29
|
-
<View direction="row" align="center">
|
|
30
|
-
<Text>gap="{{ gap }}"</Text>
|
|
31
|
-
<View grow />
|
|
32
|
-
<Button variant="secondary" onClick="nextGap">Change</Button>
|
|
33
|
-
</View>
|
|
34
|
-
<View direction="row" align="center">
|
|
35
|
-
<Text>wrap="{{ wrap }}"</Text>
|
|
36
|
-
<View grow />
|
|
37
|
-
<Button variant="secondary" onClick="toggleWrap">Change</Button>
|
|
38
|
-
</View>
|
|
39
|
-
</View>
|
|
40
|
-
|
|
41
|
-
<Text variant="caption" tone="muted">grow fills the space left over: the song grows, the year does not. Tap the song: a View can be tapped.</Text>
|
|
42
|
-
<View direction="row" gap="small">
|
|
43
|
-
<View variant="card" grow onTap="playSong">
|
|
44
|
-
<Text>{{ playing ? 'Playing Exodus, by Drizilik' : 'Exodus, by Drizilik' }}</Text>
|
|
45
|
-
</View>
|
|
46
|
-
<View variant="card">
|
|
47
|
-
<Text>2021</Text>
|
|
48
|
-
</View>
|
|
49
|
-
</View>
|
|
50
|
-
|
|
51
|
-
<Text variant="caption" tone="muted">A Scroll moves a row sideways. It stops at the start of each release. The buttons scroll it too.</Text>
|
|
52
|
-
<Scroll gap="medium" snap="start" index="{{ first }}" onChange="showFirst">
|
|
53
|
-
<For each="{{ releases }}" item="release" key="id">
|
|
54
|
-
<View gap="small">
|
|
55
|
-
<If condition="{{ release.cover }}">
|
|
56
|
-
<Image src="{{ release.cover }}" alt="{{ release.title }}" width="128" height="128" />
|
|
57
|
-
</If>
|
|
58
|
-
<Else>
|
|
59
|
-
<Skeleton shape="box" height="128" />
|
|
60
|
-
</Else>
|
|
61
|
-
<Text weight="medium" maxLines="2">{{ release.title }}</Text>
|
|
62
|
-
<Text variant="caption" tone="muted">{{ release.year }}</Text>
|
|
63
|
-
</View>
|
|
64
|
-
</For>
|
|
65
|
-
</Scroll>
|
|
66
|
-
<Text tone="muted">First on the shelf: {{ releases[first].title }}</Text>
|
|
67
|
-
<View direction="row" gap="small">
|
|
68
|
-
<Button variant="secondary" onClick="shelfStart" disabled="{{ first === 0 }}">To the start</Button>
|
|
69
|
-
<Button variant="secondary" onClick="shelfEnd" disabled="{{ first === releases.length - 1 }}">To the end</Button>
|
|
70
|
-
</View>
|
|
71
|
-
|
|
72
|
-
<Text variant="caption" tone="muted">padding, on every side or on one side</Text>
|
|
73
|
-
<View direction="row" gap="small">
|
|
74
|
-
<View variant="card" padding="small">
|
|
75
|
-
<Text>small</Text>
|
|
76
|
-
</View>
|
|
77
|
-
<View variant="card" padding="large">
|
|
78
|
-
<Text>large</Text>
|
|
79
|
-
</View>
|
|
80
|
-
<View variant="card" padding="small" paddingStart="large">
|
|
81
|
-
<Text>start</Text>
|
|
82
|
-
</View>
|
|
83
|
-
</View>
|
|
84
|
-
<Text variant="caption" tone="muted">Text, List, Notice and Grid take padding too</Text>
|
|
85
|
-
<Notice title="Heads up" paddingTop="large" paddingBottom="large">This notice has large padding above and below.</Notice>
|
|
86
|
-
|
|
87
|
-
<Text variant="caption" tone="muted">A Grid keeps its columns the same width</Text>
|
|
88
|
-
<View variant="card" gap="medium">
|
|
89
|
-
<Grid columns="4">
|
|
90
|
-
<GridItem icon="microphone" label="Artists" data-name="Artists" onTap="openSection" />
|
|
91
|
-
<GridItem icon="music" label="Albums" data-name="Albums" onTap="openSection" />
|
|
92
|
-
<GridItem icon="playlist" label="Playlists" data-name="Playlists" onTap="openSection" />
|
|
93
|
-
<GridItem icon="star" label="Charts" badge="New" data-name="Charts" onTap="openSection" />
|
|
94
|
-
<GridItem icon="calendar" label="Shows" data-name="Shows" onTap="openSection" />
|
|
95
|
-
<GridItem icon="ticket" label="Tickets" data-name="Tickets" onTap="openSection" />
|
|
96
|
-
<GridItem icon="headphones" label="Library" data-name="Library" onTap="openSection" />
|
|
97
|
-
<GridItem image="statics/logo.png" label="Salone" data-name="Salone" onTap="openSection" />
|
|
98
|
-
</Grid>
|
|
99
|
-
<If condition="{{ section }}">
|
|
100
|
-
<Text tone="muted">You tapped {{ section }}</Text>
|
|
101
|
-
</If>
|
|
102
|
-
</View>
|
|
103
|
-
</View>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<View>
|
|
2
|
-
<Text variant="title">Lists and icons</Text>
|
|
3
|
-
<Text>A List shows rows in a card. Small lists are compact, and medium lists have more room. A row can show an icon or a picture, a value at its end, and an arrow when you can tap it.</Text>
|
|
4
|
-
|
|
5
|
-
<View gap="small">
|
|
6
|
-
<Text variant="caption" tone="muted">Artists in a small list. Tap one: its data- attributes tell the page which one.</Text>
|
|
7
|
-
<List>
|
|
8
|
-
<For each="{{ artists }}" item="artist" key="id">
|
|
9
|
-
<ListItem icon="{{ artist.icon }}" title="{{ artist.name }}" subtitle="{{ artist.song }}" value="{{ artist.genre }}" data-id="{{ artist.id }}" onTap="choose" />
|
|
10
|
-
</For>
|
|
11
|
-
</List>
|
|
12
|
-
<If condition="{{ chosen }}">
|
|
13
|
-
<Text>You chose {{ chosen }}</Text>
|
|
14
|
-
</If>
|
|
15
|
-
</View>
|
|
16
|
-
|
|
17
|
-
<View gap="small">
|
|
18
|
-
<Text variant="caption" tone="muted">Famous records in a medium list, each with a badge. Tap one to see its actions.</Text>
|
|
19
|
-
<List size="md">
|
|
20
|
-
<For each="{{ releases }}" item="release" key="id">
|
|
21
|
-
<ListItem title="{{ release.title }}" subtitle="{{ release.artist }} · {{ release.year }}" data-id="{{ release.id }}" onTap="openRelease">
|
|
22
|
-
<Badge tone="{{ release.tone }}">{{ release.note }}</Badge>
|
|
23
|
-
</ListItem>
|
|
24
|
-
</For>
|
|
25
|
-
</List>
|
|
26
|
-
</View>
|
|
27
|
-
|
|
28
|
-
<View gap="small">
|
|
29
|
-
<Text variant="caption" tone="muted">Icons by name, in any tone, including music icons</Text>
|
|
30
|
-
<View variant="card" direction="row" wrap gap="large">
|
|
31
|
-
<For each="{{ icons }}" item="icon" key="*this">
|
|
32
|
-
<Icon name="{{ icon }}" />
|
|
33
|
-
</For>
|
|
34
|
-
</View>
|
|
35
|
-
<View variant="card" direction="row" wrap gap="large" align="center">
|
|
36
|
-
<Icon name="info" tone="info" size="small" />
|
|
37
|
-
<Icon name="success" tone="success" />
|
|
38
|
-
<Icon name="warning" tone="warning" size="large" />
|
|
39
|
-
<Icon name="error" tone="danger" size="large" />
|
|
40
|
-
<Icon name="star" tone="muted" />
|
|
41
|
-
</View>
|
|
42
|
-
</View>
|
|
43
|
-
|
|
44
|
-
<View gap="small">
|
|
45
|
-
<Text variant="caption" tone="muted">A divider</Text>
|
|
46
|
-
<View variant="card">
|
|
47
|
-
<Text>Side A</Text>
|
|
48
|
-
<Divider />
|
|
49
|
-
<Text>Side B</Text>
|
|
50
|
-
</View>
|
|
51
|
-
</View>
|
|
52
|
-
|
|
53
|
-
<Sheet open="{{ selected !== null }}" title="{{ selected.title }} · {{ selected.year }}" showCloseIcon onClose="closeSheet">
|
|
54
|
-
<Button variant="secondary" onClick="copyTitle">Copy the title</Button>
|
|
55
|
-
<Button variant="secondary" onClick="shareRelease">Share it</Button>
|
|
56
|
-
<Button onClick="closeSheet">Cancel</Button>
|
|
57
|
-
</Sheet>
|
|
58
|
-
<Toast message="{{ toast }}" tone="success" onHide="clearToast" />
|
|
59
|
-
</View>
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { HookRun } from './state';
|
|
2
|
-
import state from './state';
|
|
3
|
-
|
|
4
|
-
export default definePage({
|
|
5
|
-
initialState: state,
|
|
6
|
-
// What Dash's navigation bar shows until the page changes it.
|
|
7
|
-
configs: { navigationBar: { title: 'Navigation' } },
|
|
8
|
-
hooks: {
|
|
9
|
-
// Options come from the page that opened this one, as strings.
|
|
10
|
-
onLoad(options) {
|
|
11
|
-
const depth = Number(options.depth ?? '1') + 1;
|
|
12
|
-
const from = options.trail ?? 'Home';
|
|
13
|
-
this.setState({ depth, from, trail: `${from} › ${depth}` });
|
|
14
|
-
this.setNavigationBar({ title: `Page ${depth}` });
|
|
15
|
-
this.setState((current) => ({ hooks: ran(current.hooks, 'onLoad') }));
|
|
16
|
-
},
|
|
17
|
-
onShow() {
|
|
18
|
-
this.setState((current) => ({ hooks: ran(current.hooks, 'onShow') }));
|
|
19
|
-
},
|
|
20
|
-
onHide() {
|
|
21
|
-
this.setState((current) => ({ hooks: ran(current.hooks, 'onHide') }));
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
actions: {
|
|
25
|
-
openAnother(state) {
|
|
26
|
-
this.navigation.push('navigation', { depth: String(state.depth), trail: state.trail });
|
|
27
|
-
},
|
|
28
|
-
replaceThis(state) {
|
|
29
|
-
this.navigation.replace('navigation', { depth: String(state.depth - 1), trail: state.from });
|
|
30
|
-
},
|
|
31
|
-
back() {
|
|
32
|
-
this.navigation.back();
|
|
33
|
-
},
|
|
34
|
-
backTwo() {
|
|
35
|
-
this.navigation.back(2);
|
|
36
|
-
},
|
|
37
|
-
home() {
|
|
38
|
-
this.navigation.reset('index');
|
|
39
|
-
},
|
|
40
|
-
toggleColors(state) {
|
|
41
|
-
const colored = !state.colored;
|
|
42
|
-
// Undefined puts Dash's own colors back.
|
|
43
|
-
this.setNavigationBar({
|
|
44
|
-
// The green of Sierra Leone's flag.
|
|
45
|
-
backgroundColor: colored ? '#1EB53A' : undefined,
|
|
46
|
-
textColor: colored ? '#FFFFFF' : undefined,
|
|
47
|
-
});
|
|
48
|
-
this.setState({ colored });
|
|
49
|
-
},
|
|
50
|
-
toggleNavigationBar(state) {
|
|
51
|
-
const navigationBarHidden = !state.navigationBarHidden;
|
|
52
|
-
this.setNavigationBar({ hidden: navigationBarHidden });
|
|
53
|
-
this.setState({ navigationBarHidden });
|
|
54
|
-
},
|
|
55
|
-
toggleTabBar(state) {
|
|
56
|
-
const tabBarHidden = !state.tabBarHidden;
|
|
57
|
-
this.setTabBar({ hidden: tabBarHidden });
|
|
58
|
-
this.setState({ tabBarHidden });
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
function ran(hooks: readonly HookRun[], hook: string): HookRun[] {
|
|
64
|
-
return [...hooks, { id: hooks.length + 1, hook }];
|
|
65
|
-
}
|