@marktiderman/genesis-cli 1.13.2 → 1.15.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 +158 -11
- package/dist/cli.js +2441 -701
- package/dist/cli.js.map +1 -1
- package/dist/{config-4MhgqkFT.d.ts → config-DewJ3DR6.d.ts} +119 -1
- package/dist/doctor.d.ts +100 -6
- package/dist/doctor.js +2330 -391
- package/dist/doctor.js.map +1 -1
- package/dist/expo.d.ts +2 -2
- package/dist/expo.js.map +1 -1
- package/dist/genesis-catalog.json +27 -299
- package/dist/index.d.ts +8 -1
- package/dist/index.js +3533 -1934
- package/dist/index.js.map +1 -1
- package/dist/starter/README.md +1 -1
- package/dist/starter/__tests__/components/links.test.ts +3 -3
- package/dist/starter/__tests__/components/messages.test.tsx +3 -3
- package/dist/starter/__tests__/starter.test.ts +13 -0
- package/dist/starter/src/app/(app)/(home)/check-in.tsx +1 -1
- package/dist/starter/src/app/(app)/(home)/index.tsx +2 -2
- package/dist/starter/src/copy.ts +1 -1
- package/dist/starter/src/forms/check-in.json +253 -65
- package/dist/starter/src/lib/check-in-screen.tsx +3 -3
- package/dist/starter/src/lib/check-in.ts +3 -3
- package/dist/starter/src/lib/links.ts +1 -1
- package/dist/vite.js +2291 -394
- package/dist/vite.js.map +1 -1
- package/package.json +11 -5
package/dist/starter/README.md
CHANGED
|
@@ -125,7 +125,7 @@ LogBox.
|
|
|
125
125
|
| unset or `production` | Genesis Starter | `com.example.genesisstarter` | `genesis-starter://` |
|
|
126
126
|
|
|
127
127
|
All three install side by side, and each registers its own scheme, so a link opens the build it
|
|
128
|
-
names (`genesis-starter-dev://check-in?
|
|
128
|
+
names (`genesis-starter-dev://check-in?location=hilltop` in a development build). `src/lib/links.ts`
|
|
129
129
|
accepts every variant's scheme (the OS only delivers the one the build registered). Redirect URLs
|
|
130
130
|
that use the scheme (Supabase Auth, OAuth clients) need each variant's. Any other value fails the
|
|
131
131
|
build. Set it per EAS environment so
|
|
@@ -4,8 +4,8 @@ import { normalizeLink } from "@marktiderman/genesis-native";
|
|
|
4
4
|
import { appSchemes, links } from "@/lib/links";
|
|
5
5
|
|
|
6
6
|
describe("deep links", () => {
|
|
7
|
-
it("opens the check-in from its documented link,
|
|
8
|
-
expect(normalizeLink("genesis-starter://check-in?
|
|
7
|
+
it("opens the check-in from its documented link, location and all", () => {
|
|
8
|
+
expect(normalizeLink("genesis-starter://check-in?location=hilltop", links)).toBe("/check-in?location=hilltop");
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
it("answers to every variant's scheme, whatever config Metro served", () => {
|
|
@@ -15,7 +15,7 @@ describe("deep links", () => {
|
|
|
15
15
|
expect(appSchemes("genesis-starter", ["genesis-starter-preview"])).toEqual(all);
|
|
16
16
|
expect(appSchemes("genesis-starter", "custom")).toEqual([...all, "custom"]);
|
|
17
17
|
// The app's own map, as built in this test (no APP_VARIANT): a development build's link still opens.
|
|
18
|
-
expect(normalizeLink("genesis-starter-dev://check-in?
|
|
18
|
+
expect(normalizeLink("genesis-starter-dev://check-in?location=hilltop", links)).toBe("/check-in?location=hilltop");
|
|
19
19
|
expect(normalizeLink("genesis-starter-preview://settings", links)).toBe("/settings");
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -5,7 +5,7 @@ import { copy } from "@/copy";
|
|
|
5
5
|
import { attachmentKinds, kindAllowsTopics } from "@/lib/chat";
|
|
6
6
|
import { expectPathname, renderApp } from "./render-app";
|
|
7
7
|
|
|
8
|
-
const checkIn = { id: "a1", kind: "check_in", ref: { title: "Hilltop
|
|
8
|
+
const checkIn = { id: "a1", kind: "check_in", ref: { title: "Hilltop office" } } as unknown as ChatAttachment;
|
|
9
9
|
|
|
10
10
|
describe("Messages", () => {
|
|
11
11
|
it("opens a check-in from a conversation inside the Messages stack, so Back returns to it", async () => {
|
|
@@ -19,8 +19,8 @@ describe("Messages", () => {
|
|
|
19
19
|
const call = <R,>(fn: unknown, mine: boolean) => (fn as (a: ChatAttachment, ctx: { mine: boolean }) => R)(checkIn, { mine });
|
|
20
20
|
expect(call<{ label: string } | null>(kind.action, false)?.label).toBe(copy.messages.checkInAnswer);
|
|
21
21
|
expect(call(kind.action, true)).toBeNull();
|
|
22
|
-
expect(call(kind.subtitle, true)).toBe(`${copy.messages.checkInSent} · Hilltop
|
|
23
|
-
expect(call(kind.subtitle, false)).toBe("Hilltop
|
|
22
|
+
expect(call(kind.subtitle, true)).toBe(`${copy.messages.checkInSent} · Hilltop office`);
|
|
23
|
+
expect(call(kind.subtitle, false)).toBe("Hilltop office");
|
|
24
24
|
expect(kind.title(checkIn)).toBe(copy.messages.checkInCard);
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -463,3 +463,16 @@ describe("metro", () => {
|
|
|
463
463
|
for (const name of genesis) expect(names, name).toContain(name);
|
|
464
464
|
});
|
|
465
465
|
});
|
|
466
|
+
|
|
467
|
+
describe("the sample check-in", () => {
|
|
468
|
+
// Answers are stored by field id and carried between versions by key: a renamed
|
|
469
|
+
// question gets a new id and key, so old answers never read as the new question.
|
|
470
|
+
it("names each question's id and key after what it asks", () => {
|
|
471
|
+
const form = JSON.parse(read("src/forms/check-in.json")) as { definition: { blocks: { kind: string; id: string; key?: string; label?: string }[] } };
|
|
472
|
+
const fields = form.definition.blocks.filter((b) => b.kind === "field");
|
|
473
|
+
for (const f of fields) expect(f.key, f.id).toBe(f.id);
|
|
474
|
+
const ids = fields.map((f) => f.id);
|
|
475
|
+
expect(ids).toEqual(expect.arrayContaining(["location", "member", "mood", "daysOnPlan", "tookBreaks"]));
|
|
476
|
+
for (const old of ["gym", "coach", "sessions", "slept", "energy", "class"]) expect(ids).not.toContain(old);
|
|
477
|
+
});
|
|
478
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { copy } from "@/copy";
|
|
2
2
|
import { CheckInScreen } from "@/lib/check-in-screen";
|
|
3
3
|
|
|
4
|
-
/** The check-in from Home (and its link, `genesis-starter://check-in?
|
|
4
|
+
/** The check-in from Home (and its link, `genesis-starter://check-in?location=hilltop`). */
|
|
5
5
|
export default function HomeCheckIn() {
|
|
6
6
|
return <CheckInScreen backTitle={copy.home.title} />;
|
|
7
7
|
}
|
|
@@ -10,9 +10,9 @@ export default function HomeScreen() {
|
|
|
10
10
|
{copy.home.checkIn}
|
|
11
11
|
</NativeButton>
|
|
12
12
|
) : null;
|
|
13
|
-
// The same form opened from a link that fills in the
|
|
13
|
+
// The same form opened from a link that fills in the location, so that question is skipped.
|
|
14
14
|
const fromLink = starter.features.checkIn ? (
|
|
15
|
-
<NativeButton testID="home-check-in-link" variant="outline" onPress={() => router.push("/check-in?
|
|
15
|
+
<NativeButton testID="home-check-in-link" variant="outline" onPress={() => router.push("/check-in?location=hilltop")}>
|
|
16
16
|
{copy.home.checkInFromLink}
|
|
17
17
|
</NativeButton>
|
|
18
18
|
) : null;
|
package/dist/starter/src/copy.ts
CHANGED
|
@@ -42,7 +42,7 @@ const en = {
|
|
|
42
42
|
emptyTitle: "Your app starts here",
|
|
43
43
|
emptyBody: "This is the first tab. Replace this screen with your own.",
|
|
44
44
|
checkIn: "Try the check-in",
|
|
45
|
-
checkInFromLink: "Check in
|
|
45
|
+
checkInFromLink: "Check in from the Hilltop office",
|
|
46
46
|
},
|
|
47
47
|
checkIn: {
|
|
48
48
|
done: "Done",
|
|
@@ -3,59 +3,125 @@
|
|
|
3
3
|
"schemaVersion": 1,
|
|
4
4
|
"id": "weekly-check-in",
|
|
5
5
|
"title": "Weekly check-in",
|
|
6
|
-
"description": "About two minutes. Your
|
|
7
|
-
"layout": {
|
|
8
|
-
|
|
6
|
+
"description": "About two minutes. Your team lead reads every answer.",
|
|
7
|
+
"layout": {
|
|
8
|
+
"mode": "focus"
|
|
9
|
+
},
|
|
10
|
+
"settings": {
|
|
11
|
+
"saveProgress": true
|
|
12
|
+
},
|
|
9
13
|
"blocks": [
|
|
10
|
-
{
|
|
11
|
-
|
|
14
|
+
{
|
|
15
|
+
"kind": "content",
|
|
16
|
+
"id": "welcome",
|
|
17
|
+
"type": "heading",
|
|
18
|
+
"text": "How was your week?"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "content",
|
|
22
|
+
"id": "intro",
|
|
23
|
+
"type": "text",
|
|
24
|
+
"text": "One question at a time. You can go back, and your answers are kept on this phone until you send them."
|
|
25
|
+
},
|
|
12
26
|
{
|
|
13
27
|
"kind": "field",
|
|
14
|
-
"id": "
|
|
15
|
-
"key": "
|
|
28
|
+
"id": "location",
|
|
29
|
+
"key": "location",
|
|
16
30
|
"type": "single-choice",
|
|
17
|
-
"label": "Which
|
|
31
|
+
"label": "Which office do you work from?",
|
|
18
32
|
"required": true,
|
|
19
33
|
"props": {
|
|
20
34
|
"options": [
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
{
|
|
36
|
+
"value": "riverside",
|
|
37
|
+
"label": "Riverside",
|
|
38
|
+
"description": "12 Mill Lane"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"value": "hilltop",
|
|
42
|
+
"label": "Hilltop",
|
|
43
|
+
"description": "3 Summit Road"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"value": "harbour",
|
|
47
|
+
"label": "Harbour",
|
|
48
|
+
"description": "Pier 4"
|
|
49
|
+
}
|
|
24
50
|
],
|
|
25
|
-
"prefill": {
|
|
51
|
+
"prefill": {
|
|
52
|
+
"param": "location",
|
|
53
|
+
"hideWhenPrefilled": true
|
|
54
|
+
}
|
|
26
55
|
}
|
|
27
56
|
},
|
|
28
57
|
{
|
|
29
58
|
"kind": "field",
|
|
30
|
-
"id": "
|
|
31
|
-
"key": "
|
|
59
|
+
"id": "member",
|
|
60
|
+
"key": "member",
|
|
32
61
|
"type": "single-choice",
|
|
33
|
-
"label": "Who
|
|
34
|
-
"description": "Only the
|
|
62
|
+
"label": "Who did you work with most this week?",
|
|
63
|
+
"description": "Only the people at your location are listed.",
|
|
35
64
|
"required": true,
|
|
36
|
-
"props": {
|
|
65
|
+
"props": {
|
|
66
|
+
"optionsFrom": {
|
|
67
|
+
"source": "host",
|
|
68
|
+
"key": "members",
|
|
69
|
+
"filter": {
|
|
70
|
+
"attribute": "location",
|
|
71
|
+
"field": "location"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
37
75
|
},
|
|
38
|
-
{ "kind": "field", "id": "name", "key": "name", "type": "short-text", "label": "What should we call you?", "required": true },
|
|
39
76
|
{
|
|
40
77
|
"kind": "field",
|
|
41
|
-
"id": "
|
|
42
|
-
"key": "
|
|
43
|
-
"type": "
|
|
44
|
-
"label": "How
|
|
78
|
+
"id": "mood",
|
|
79
|
+
"key": "mood",
|
|
80
|
+
"type": "rating",
|
|
81
|
+
"label": "How do you feel about this week?",
|
|
45
82
|
"required": true,
|
|
46
|
-
"props": {
|
|
83
|
+
"props": {
|
|
84
|
+
"max": 5,
|
|
85
|
+
"display": "stars",
|
|
86
|
+
"lowLabel": "Rough",
|
|
87
|
+
"highLabel": "Great"
|
|
88
|
+
}
|
|
47
89
|
},
|
|
48
|
-
{ "kind": "field", "id": "started", "key": "started", "type": "date", "label": "When did your current programme start?" },
|
|
49
90
|
{
|
|
50
91
|
"kind": "field",
|
|
51
|
-
"id": "
|
|
52
|
-
"key": "
|
|
53
|
-
"type": "
|
|
54
|
-
"label": "
|
|
92
|
+
"id": "name",
|
|
93
|
+
"key": "name",
|
|
94
|
+
"type": "short-text",
|
|
95
|
+
"label": "What should we call you?",
|
|
96
|
+
"required": true
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"kind": "field",
|
|
100
|
+
"id": "daysOnPlan",
|
|
101
|
+
"key": "daysOnPlan",
|
|
102
|
+
"type": "number",
|
|
103
|
+
"label": "How many days did you get through your plan, {{field:name}}?",
|
|
55
104
|
"required": true,
|
|
56
|
-
"props": {
|
|
105
|
+
"props": {
|
|
106
|
+
"min": 0,
|
|
107
|
+
"max": 7,
|
|
108
|
+
"step": 1
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"kind": "field",
|
|
113
|
+
"id": "started",
|
|
114
|
+
"key": "started",
|
|
115
|
+
"type": "date",
|
|
116
|
+
"label": "When did your current project start?"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"kind": "field",
|
|
120
|
+
"id": "tookBreaks",
|
|
121
|
+
"key": "tookBreaks",
|
|
122
|
+
"type": "yes-no",
|
|
123
|
+
"label": "Did you take a proper break most days?"
|
|
57
124
|
},
|
|
58
|
-
{ "kind": "field", "id": "slept", "key": "slept", "type": "yes-no", "label": "Did you sleep seven hours most nights?" },
|
|
59
125
|
{
|
|
60
126
|
"kind": "field",
|
|
61
127
|
"id": "focus",
|
|
@@ -64,34 +130,84 @@
|
|
|
64
130
|
"label": "What did you work on?",
|
|
65
131
|
"props": {
|
|
66
132
|
"options": [
|
|
67
|
-
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
133
|
+
{
|
|
134
|
+
"value": "planning",
|
|
135
|
+
"label": "Planning"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"value": "building",
|
|
139
|
+
"label": "Building"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"value": "meetings",
|
|
143
|
+
"label": "Meetings"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"value": "learning",
|
|
147
|
+
"label": "Learning"
|
|
148
|
+
}
|
|
71
149
|
],
|
|
72
|
-
"other": {
|
|
150
|
+
"other": {
|
|
151
|
+
"label": "Something else"
|
|
152
|
+
}
|
|
73
153
|
}
|
|
74
154
|
},
|
|
75
155
|
{
|
|
76
156
|
"kind": "field",
|
|
77
|
-
"id": "
|
|
78
|
-
"key": "
|
|
157
|
+
"id": "highlight",
|
|
158
|
+
"key": "highlight",
|
|
79
159
|
"type": "single-choice",
|
|
80
|
-
"label": "Which
|
|
160
|
+
"label": "Which part of the week went best?",
|
|
81
161
|
"props": {
|
|
82
162
|
"options": [
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
163
|
+
{
|
|
164
|
+
"value": "h01",
|
|
165
|
+
"label": "Monday stand-up"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"value": "h02",
|
|
169
|
+
"label": "Planning session"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"value": "h03",
|
|
173
|
+
"label": "Design review"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"value": "h04",
|
|
177
|
+
"label": "Pairing"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"value": "h05",
|
|
181
|
+
"label": "Customer call"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"value": "h06",
|
|
185
|
+
"label": "Demo day"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"value": "h07",
|
|
189
|
+
"label": "Retrospective"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"value": "h08",
|
|
193
|
+
"label": "Focus time"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"value": "h09",
|
|
197
|
+
"label": "Team lunch"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"value": "h10",
|
|
201
|
+
"label": "Training"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"value": "h11",
|
|
205
|
+
"label": "Workshop"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"value": "h12",
|
|
209
|
+
"label": "Friday wrap-up"
|
|
210
|
+
}
|
|
95
211
|
],
|
|
96
212
|
"other": true
|
|
97
213
|
}
|
|
@@ -100,22 +216,94 @@
|
|
|
100
216
|
"kind": "content",
|
|
101
217
|
"id": "tip",
|
|
102
218
|
"type": "callout",
|
|
103
|
-
"text": "Nearly done. The next questions help
|
|
104
|
-
"props": {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
{
|
|
110
|
-
|
|
219
|
+
"text": "Nearly done. The next questions help plan next week.",
|
|
220
|
+
"props": {
|
|
221
|
+
"title": "Almost there",
|
|
222
|
+
"tone": "success"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"kind": "field",
|
|
227
|
+
"id": "recommend",
|
|
228
|
+
"key": "recommend",
|
|
229
|
+
"type": "nps",
|
|
230
|
+
"label": "How likely are you to recommend us to a friend?"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"kind": "field",
|
|
234
|
+
"id": "email",
|
|
235
|
+
"key": "email",
|
|
236
|
+
"type": "email",
|
|
237
|
+
"label": "Email for your weekly summary"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"kind": "field",
|
|
241
|
+
"id": "phone",
|
|
242
|
+
"key": "phone",
|
|
243
|
+
"type": "phone",
|
|
244
|
+
"label": "A phone number we can text"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"kind": "field",
|
|
248
|
+
"id": "photo",
|
|
249
|
+
"key": "photo",
|
|
250
|
+
"type": "photo",
|
|
251
|
+
"label": "A photo from your week, if you like"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"kind": "field",
|
|
255
|
+
"id": "notes",
|
|
256
|
+
"key": "notes",
|
|
257
|
+
"type": "long-text",
|
|
258
|
+
"label": "Anything else we should know?"
|
|
259
|
+
}
|
|
111
260
|
],
|
|
112
|
-
"endings": [
|
|
261
|
+
"endings": [
|
|
262
|
+
{
|
|
263
|
+
"id": "done",
|
|
264
|
+
"title": "Thanks, {{field:name}}",
|
|
265
|
+
"description": "Your team lead will reply before next week."
|
|
266
|
+
}
|
|
267
|
+
]
|
|
113
268
|
},
|
|
114
|
-
"contentTypes": [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
269
|
+
"contentTypes": [
|
|
270
|
+
{
|
|
271
|
+
"type": "callout",
|
|
272
|
+
"label": "Callout"
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
"members": [
|
|
276
|
+
{
|
|
277
|
+
"value": "ada",
|
|
278
|
+
"label": "Ada Park",
|
|
279
|
+
"description": "Design",
|
|
280
|
+
"attributes": {
|
|
281
|
+
"location": "riverside"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"value": "grace",
|
|
286
|
+
"label": "Grace Okafor",
|
|
287
|
+
"description": "Engineering",
|
|
288
|
+
"attributes": {
|
|
289
|
+
"location": ["riverside", "hilltop"]
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"value": "alan",
|
|
294
|
+
"label": "Alan Reyes",
|
|
295
|
+
"description": "Operations",
|
|
296
|
+
"attributes": {
|
|
297
|
+
"location": "hilltop"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"value": "mina",
|
|
302
|
+
"label": "Mina Sato",
|
|
303
|
+
"description": "Support",
|
|
304
|
+
"attributes": {
|
|
305
|
+
"location": "harbour"
|
|
306
|
+
}
|
|
307
|
+
}
|
|
120
308
|
]
|
|
121
309
|
}
|
|
@@ -11,18 +11,18 @@ import { checkInDrafts, checkInForm, checkInHaptics, checkInHostOptions, checkIn
|
|
|
11
11
|
/**
|
|
12
12
|
* The check-in example (`features.checkIn`): one question per screen, the title in the native
|
|
13
13
|
* header, a draft per signed-in user and the offline outbox. Open it with a link to fill in the
|
|
14
|
-
*
|
|
14
|
+
* location: `genesis-starter://check-in?location=hilltop`. The Home tab shows it at `/check-in`; a check-in
|
|
15
15
|
* card in a conversation opens it in the Messages stack (`/messages/check-in`), so Back returns
|
|
16
16
|
* to the conversation. `backTitle` names the screen under it (left out, iOS uses that screen's title).
|
|
17
17
|
*/
|
|
18
18
|
export function CheckInScreen({ backTitle }: { backTitle?: string }) {
|
|
19
|
-
const params = useLocalSearchParams<{
|
|
19
|
+
const params = useLocalSearchParams<{ location?: string }>();
|
|
20
20
|
const { session } = useSession<Session>();
|
|
21
21
|
const draft = useFormDraft(checkInForm, {
|
|
22
22
|
store: checkInDrafts,
|
|
23
23
|
respondent: session?.user.id ?? "signed-out",
|
|
24
24
|
hostOptions: checkInHostOptions,
|
|
25
|
-
linkParams: params.
|
|
25
|
+
linkParams: params.location ? { location: params.location } : undefined,
|
|
26
26
|
});
|
|
27
27
|
if (!starter.features.checkIn) return <Redirect href="/" />;
|
|
28
28
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The check-in example (`features.checkIn`): a sample form in focus layout, with every check-in
|
|
3
3
|
* field type, an "Other" answer, a list filtered by an earlier answer, a searchable list, a
|
|
4
|
-
* question a link can fill in (`?
|
|
4
|
+
* question a link can fill in (`?location=hilltop`) and content steps. Drafts and the submit outbox
|
|
5
5
|
* keep their data in AsyncStorage, so a check-in survives the app closing and waits offline.
|
|
6
6
|
*
|
|
7
7
|
* Submissions go to a stub `send` that answers like `submitResponse` would. Point it at your own
|
|
@@ -46,8 +46,8 @@ function load(raw: unknown): FormDefinition {
|
|
|
46
46
|
/** The sample check-in, checked once when the app loads. */
|
|
47
47
|
export const checkInForm: FormDefinition = load(sample.definition);
|
|
48
48
|
|
|
49
|
-
/** The
|
|
50
|
-
export const checkInHostOptions: Readonly<Record<string, readonly ChoiceOption[]>> = {
|
|
49
|
+
/** The people the app supplies for the filtered question (`optionsFrom: { source: "host", key: "members" }`). */
|
|
50
|
+
export const checkInHostOptions: Readonly<Record<string, readonly ChoiceOption[]>> = { members: sample.members };
|
|
51
51
|
|
|
52
52
|
/** Where check-in drafts are kept, by form and respondent. */
|
|
53
53
|
export const checkInDrafts = createDraftStore(AsyncStorage);
|
|
@@ -29,7 +29,7 @@ export const links: LinkOptions = {
|
|
|
29
29
|
hosts: genesisConfig.links.hosts,
|
|
30
30
|
map: {
|
|
31
31
|
...(starter.features.notifications ? { "/notifications": "/notifications" } : {}),
|
|
32
|
-
// The check-in example's link (`genesis-starter://check-in?
|
|
32
|
+
// The check-in example's link (`genesis-starter://check-in?location=hilltop` fills in the location; `genesis-starter-dev://` in a development build).
|
|
33
33
|
...(starter.features.checkIn ? { "/check-in": "/check-in" } : {}),
|
|
34
34
|
// A message's push opens its thread (`data.url` = `/messages/<conversation>`).
|
|
35
35
|
...(starter.features.chat ? { "/messages": "/messages", "/messages/:id": "/messages/:id" } : {}),
|