create-foldkit-app 0.32.0 → 0.32.1
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/dist/commands/create.js +9 -7
- package/dist/templates/base/FOLDKIT.md +22 -6
- package/dist/templates/examples/api-cache/src/data.ts +14 -14
- package/dist/templates/examples/api-cache/src/main.ts +42 -39
- package/dist/templates/examples/auth/src/command.ts +3 -3
- package/dist/templates/examples/auth/src/domain/session.ts +8 -6
- package/dist/templates/examples/auth/src/main.ts +11 -11
- package/dist/templates/examples/auth/src/message.ts +3 -3
- package/dist/templates/examples/auth/src/model.ts +2 -2
- package/dist/templates/examples/auth/src/page/loggedIn/index.ts +1 -1
- package/dist/templates/examples/auth/src/page/loggedIn/view.ts +3 -3
- package/dist/templates/examples/auth/src/page/loggedOut/index.ts +1 -1
- package/dist/templates/examples/auth/src/page/loggedOut/page/login.ts +9 -17
- package/dist/templates/examples/auth/src/page/loggedOut/update.ts +4 -6
- package/dist/templates/examples/auth/src/page/loggedOut/view.ts +3 -3
- package/dist/templates/examples/auth/src/route.ts +2 -2
- package/dist/templates/examples/auth/src/update.ts +37 -40
- package/dist/templates/examples/auth/src/view.ts +6 -6
- package/dist/templates/examples/canvas-art/src/main.ts +22 -30
- package/dist/templates/examples/charting/src/command.ts +3 -3
- package/dist/templates/examples/charting/src/domain.ts +53 -48
- package/dist/templates/examples/charting/src/echarts.ts +6 -6
- package/dist/templates/examples/charting/src/githubApi.ts +33 -34
- package/dist/templates/examples/charting/src/http.ts +7 -7
- package/dist/templates/examples/charting/src/message.ts +6 -6
- package/dist/templates/examples/charting/src/model.ts +6 -6
- package/dist/templates/examples/charting/src/npmApi.ts +19 -15
- package/dist/templates/examples/charting/src/subscription.ts +5 -5
- package/dist/templates/examples/charting/src/telemetry.test.ts +18 -12
- package/dist/templates/examples/charting/src/telemetry.ts +11 -18
- package/dist/templates/examples/charting/src/update.ts +17 -23
- package/dist/templates/examples/charting/src/view/chart.ts +2 -2
- package/dist/templates/examples/counter/src/main.ts +2 -2
- package/dist/templates/examples/counters/src/counter.ts +2 -2
- package/dist/templates/examples/counters/src/main.ts +8 -8
- package/dist/templates/examples/embedding/src/main.ts +10 -7
- package/dist/templates/examples/form/src/main.ts +18 -14
- package/dist/templates/examples/generative-art/src/command.ts +7 -2
- package/dist/templates/examples/generative-art/src/message.ts +14 -14
- package/dist/templates/examples/generative-art/src/model.ts +21 -21
- package/dist/templates/examples/generative-art/src/update.ts +15 -17
- package/dist/templates/examples/interrupting-commands/src/main.ts +30 -27
- package/dist/templates/examples/job-application/src/domain/proficiencyLevel.ts +2 -2
- package/dist/templates/examples/job-application/src/domain/pronounOption.ts +2 -2
- package/dist/templates/examples/job-application/src/domain/step.ts +11 -11
- package/dist/templates/examples/job-application/src/main.ts +5 -5
- package/dist/templates/examples/job-application/src/message.ts +2 -2
- package/dist/templates/examples/job-application/src/model.ts +5 -5
- package/dist/templates/examples/job-application/src/step/attachments.ts +32 -34
- package/dist/templates/examples/job-application/src/step/coverLetter.ts +4 -4
- package/dist/templates/examples/job-application/src/step/education/education.ts +11 -14
- package/dist/templates/examples/job-application/src/step/education/entry.ts +21 -22
- package/dist/templates/examples/job-application/src/step/personalInfo.ts +44 -54
- package/dist/templates/examples/job-application/src/step/skills/entry.ts +12 -14
- package/dist/templates/examples/job-application/src/step/skills/skills.ts +11 -14
- package/dist/templates/examples/job-application/src/step/workHistory/entry.ts +43 -45
- package/dist/templates/examples/job-application/src/step/workHistory/workHistory.ts +11 -14
- package/dist/templates/examples/job-application/src/update.ts +17 -17
- package/dist/templates/examples/job-application/src/view/attachments.ts +5 -5
- package/dist/templates/examples/job-application/src/view/datePicker.ts +3 -3
- package/dist/templates/examples/job-application/src/view/field.ts +5 -5
- package/dist/templates/examples/job-application/src/view/index.ts +28 -22
- package/dist/templates/examples/kanban/src/command.ts +4 -4
- package/dist/templates/examples/kanban/src/domain/card.ts +6 -6
- package/dist/templates/examples/kanban/src/domain/column.ts +9 -9
- package/dist/templates/examples/kanban/src/main.ts +4 -4
- package/dist/templates/examples/kanban/src/message.ts +6 -6
- package/dist/templates/examples/kanban/src/model.ts +11 -9
- package/dist/templates/examples/kanban/src/update.ts +5 -5
- package/dist/templates/examples/managed-resource-layer/src/main.ts +20 -20
- package/dist/templates/examples/map/src/locations.ts +7 -7
- package/dist/templates/examples/map/src/main.ts +83 -44
- package/dist/templates/examples/map/src/mount.test.ts +127 -0
- package/dist/templates/examples/pixel-art/src/command.ts +12 -5
- package/dist/templates/examples/pixel-art/src/main.ts +4 -4
- package/dist/templates/examples/pixel-art/src/message.ts +7 -7
- package/dist/templates/examples/pixel-art/src/model.ts +34 -29
- package/dist/templates/examples/pixel-art/src/subscription.ts +2 -2
- package/dist/templates/examples/pixel-art/src/update.ts +79 -86
- package/dist/templates/examples/query-sync/src/main.ts +106 -102
- package/dist/templates/examples/route-transitions/src/data.ts +6 -6
- package/dist/templates/examples/route-transitions/src/main.ts +23 -29
- package/dist/templates/examples/route-transitions/src/route.ts +3 -3
- package/dist/templates/examples/routing/src/fileTree.ts +10 -8
- package/dist/templates/examples/routing/src/main.ts +23 -21
- package/dist/templates/examples/routing/src/page/people.ts +14 -22
- package/dist/templates/examples/routing/src/route.ts +7 -7
- package/dist/templates/examples/shopping-cart/src/main.ts +30 -31
- package/dist/templates/examples/shopping-cart/src/page/products.ts +10 -10
- package/dist/templates/examples/shopping-cart/src/route.ts +6 -4
- package/dist/templates/examples/slow-warnings/src/main.ts +35 -43
- package/dist/templates/examples/snake/src/domain/snake.ts +2 -2
- package/dist/templates/examples/snake/src/main.ts +39 -47
- package/dist/templates/examples/ssg/src/main.ts +5 -5
- package/dist/templates/examples/ssg/src/route.ts +2 -2
- package/dist/templates/examples/ssr/src/cookie.ts +3 -3
- package/dist/templates/examples/ssr/src/main.ts +10 -10
- package/dist/templates/examples/state-machine/src/main.ts +55 -53
- package/dist/templates/examples/state-machine/src/view.ts +7 -7
- package/dist/templates/examples/stopwatch/src/main.ts +10 -10
- package/dist/templates/examples/todo/src/main.ts +41 -34
- package/dist/templates/examples/ui-showcase/src/main.ts +54 -42
- package/dist/templates/examples/ui-showcase/src/scene.test.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/init.ts +1 -2
- package/dist/templates/examples/ui-showcase/src/ui/message.ts +17 -18
- package/dist/templates/examples/ui-showcase/src/ui/model.ts +47 -44
- package/dist/templates/examples/ui-showcase/src/ui/subscriptions.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/toast.ts +4 -4
- package/dist/templates/examples/ui-showcase/src/ui/update.ts +287 -298
- package/dist/templates/examples/ui-showcase/src/ui/view/animation.ts +2 -2
- package/dist/templates/examples/ui-showcase/src/ui/view/button.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/calendar.ts +4 -4
- package/dist/templates/examples/ui-showcase/src/ui/view/checkbox.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/combobox.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/datePicker.ts +4 -4
- package/dist/templates/examples/ui-showcase/src/ui/view/dialog.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/disclosure.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/dragAndDrop.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/fieldset.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/fileDrop.ts +6 -6
- package/dist/templates/examples/ui-showcase/src/ui/view/hoverIntent.ts +9 -20
- package/dist/templates/examples/ui-showcase/src/ui/view/input.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/listbox.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/menu.ts +15 -15
- package/dist/templates/examples/ui-showcase/src/ui/view/popover.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/radioGroup.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/select.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/slider.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/switch.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/tabs.ts +7 -7
- package/dist/templates/examples/ui-showcase/src/ui/view/textarea.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/toast.ts +8 -8
- package/dist/templates/examples/ui-showcase/src/ui/view/tooltip.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/virtualList.ts +7 -7
- package/dist/templates/examples/view-transitions/src/artwork.ts +7 -7
- package/dist/templates/examples/view-transitions/src/main.ts +6 -6
- package/dist/templates/examples/view-transitions/src/route.ts +3 -3
- package/dist/templates/examples/weather/src/main.ts +42 -42
- package/dist/templates/examples/weather/src/story.test.ts +5 -5
- package/dist/templates/examples/web-components/src/main.ts +16 -16
- package/dist/templates/examples/websocket-chat/src/main.ts +30 -30
- package/dist/templates/release.json +13 -13
- package/dist/templates/rendering/ssg/src/main.ts +5 -5
- package/dist/templates/rendering/ssg/src/route.ts +2 -2
- package/dist/templates/rendering/ssr/server/main.ts +15 -15
- package/dist/templates/rendering/ssr/src/cookie.ts +3 -3
- package/dist/templates/rendering/ssr/src/main.ts +10 -10
- package/dist/utils/packages.js +17 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array,
|
|
1
|
+
import { Array, Number, Option, Result } from 'effect'
|
|
2
2
|
import { Command, Update } from 'foldkit'
|
|
3
3
|
import { evo } from 'foldkit/struct'
|
|
4
4
|
|
|
@@ -223,14 +223,13 @@ const appendGeneratedParticle =
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
const foldFlowStrengthSliderOutMessage =
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
)
|
|
226
|
+
const foldFlowStrengthSliderOutMessage = Slider.OutMessage.match<
|
|
227
|
+
Update.Step<Model, Message>
|
|
228
|
+
>({
|
|
229
|
+
ChangedValue:
|
|
230
|
+
({ value }) =>
|
|
231
|
+
model => ({ model: evo(model, { flowStrength: () => value }) }),
|
|
232
|
+
})
|
|
234
233
|
|
|
235
234
|
const foldFlowStrengthSlider = Update.foldChild({
|
|
236
235
|
update: Slider.update,
|
|
@@ -241,14 +240,13 @@ const foldFlowStrengthSlider = Update.foldChild({
|
|
|
241
240
|
foldOutMessage: foldFlowStrengthSliderOutMessage,
|
|
242
241
|
})
|
|
243
242
|
|
|
244
|
-
const foldNoiseScaleSliderOutMessage =
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
)
|
|
243
|
+
const foldNoiseScaleSliderOutMessage = Slider.OutMessage.match<
|
|
244
|
+
Update.Step<Model, Message>
|
|
245
|
+
>({
|
|
246
|
+
ChangedValue:
|
|
247
|
+
({ value }) =>
|
|
248
|
+
model => ({ model: evo(model, { noiseScale: () => value }) }),
|
|
249
|
+
})
|
|
252
250
|
|
|
253
251
|
const foldNoiseScaleSlider = Update.foldChild({
|
|
254
252
|
update: Slider.update,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
Array,
|
|
4
4
|
Duration,
|
|
5
5
|
Effect,
|
|
6
|
-
Match
|
|
6
|
+
Match,
|
|
7
7
|
Number,
|
|
8
8
|
Option,
|
|
9
|
-
Schema
|
|
9
|
+
Schema,
|
|
10
10
|
pipe,
|
|
11
11
|
} from 'effect'
|
|
12
12
|
import { Command, Runtime, type Update } from 'foldkit'
|
|
@@ -16,20 +16,20 @@ import { evo } from 'foldkit/struct'
|
|
|
16
16
|
|
|
17
17
|
// MODEL
|
|
18
18
|
|
|
19
|
-
export const UploadStatus =
|
|
19
|
+
export const UploadStatus = Schema.Literals(['Uploading', 'Done', 'Cancelled'])
|
|
20
20
|
export type UploadStatus = typeof UploadStatus.Type
|
|
21
21
|
|
|
22
|
-
export const Upload =
|
|
23
|
-
id:
|
|
24
|
-
fileName:
|
|
25
|
-
sizeMegabytes:
|
|
22
|
+
export const Upload = Schema.Struct({
|
|
23
|
+
id: Schema.Number,
|
|
24
|
+
fileName: Schema.String,
|
|
25
|
+
sizeMegabytes: Schema.Number,
|
|
26
26
|
status: UploadStatus,
|
|
27
27
|
})
|
|
28
28
|
export type Upload = typeof Upload.Type
|
|
29
29
|
|
|
30
|
-
export const Model =
|
|
31
|
-
uploadId:
|
|
32
|
-
uploads:
|
|
30
|
+
export const Model = Schema.Struct({
|
|
31
|
+
uploadId: Schema.Number,
|
|
32
|
+
uploads: Schema.Array(Upload),
|
|
33
33
|
})
|
|
34
34
|
export type Model = typeof Model.Type
|
|
35
35
|
|
|
@@ -37,12 +37,12 @@ export type Model = typeof Model.Type
|
|
|
37
37
|
|
|
38
38
|
export const Message = defineMessageUnion({
|
|
39
39
|
ClickedStartUpload: {},
|
|
40
|
-
ClickedCancelUpload: { uploadId:
|
|
40
|
+
ClickedCancelUpload: { uploadId: Schema.Number },
|
|
41
41
|
ClickedCancelAllUploads: {},
|
|
42
|
-
ClickedRestartUpload: { uploadId:
|
|
43
|
-
SucceededUploadFile: { uploadId:
|
|
42
|
+
ClickedRestartUpload: { uploadId: Schema.Number },
|
|
43
|
+
SucceededUploadFile: { uploadId: Schema.Number },
|
|
44
44
|
CompletedCancelUploadFile: {
|
|
45
|
-
uploadId:
|
|
45
|
+
uploadId: Schema.Number,
|
|
46
46
|
outcome: Command.Interruptible.Outcome,
|
|
47
47
|
},
|
|
48
48
|
})
|
|
@@ -62,7 +62,10 @@ export const init: Runtime.ApplicationInit<Model, Message> = () => ({
|
|
|
62
62
|
|
|
63
63
|
// FAKE FILES
|
|
64
64
|
|
|
65
|
-
export const FakeFile =
|
|
65
|
+
export const FakeFile = Schema.Struct({
|
|
66
|
+
name: Schema.String,
|
|
67
|
+
sizeMegabytes: Schema.Number,
|
|
68
|
+
})
|
|
66
69
|
export type FakeFile = typeof FakeFile.Type
|
|
67
70
|
|
|
68
71
|
export const FAKE_FILES: Array.NonEmptyReadonlyArray<FakeFile> = [
|
|
@@ -84,11 +87,11 @@ const fakeFileForUpload = (uploadId: number): FakeFile =>
|
|
|
84
87
|
|
|
85
88
|
const MILLISECONDS_PER_MEGABYTE = 100
|
|
86
89
|
|
|
87
|
-
export const UploadKey =
|
|
90
|
+
export const UploadKey = Schema.Struct({ uploadId: Schema.Number })
|
|
88
91
|
export type UploadKey = typeof UploadKey.Type
|
|
89
92
|
|
|
90
93
|
export const UploadFile = Command.define('UploadFile', {
|
|
91
|
-
args: { ...UploadKey.fields, sizeMegabytes:
|
|
94
|
+
args: { ...UploadKey.fields, sizeMegabytes: Schema.Number },
|
|
92
95
|
messages: [Message.SucceededUploadFile],
|
|
93
96
|
interrupt: {
|
|
94
97
|
keyFields: ['uploadId'],
|
|
@@ -194,19 +197,19 @@ export const update = (model: Model, message: Message) =>
|
|
|
194
197
|
// VIEW
|
|
195
198
|
|
|
196
199
|
const badgeClass = (status: UploadStatus): string =>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
Match.value(status).pipe(
|
|
201
|
+
Match.when('Uploading', () => 'bg-blue-100 text-blue-700'),
|
|
202
|
+
Match.when('Done', () => 'bg-green-100 text-green-700'),
|
|
203
|
+
Match.when('Cancelled', () => 'bg-gray-200 text-gray-600'),
|
|
204
|
+
Match.exhaustive,
|
|
202
205
|
)
|
|
203
206
|
|
|
204
207
|
const ACTION_BUTTON_CLASS =
|
|
205
208
|
'px-3 py-1 text-sm font-medium rounded-md border transition'
|
|
206
209
|
|
|
207
210
|
const uploadActionView = (upload: Upload, h: HtmlBuilder<Message>): Html =>
|
|
208
|
-
|
|
209
|
-
|
|
211
|
+
Match.value(upload.status).pipe(
|
|
212
|
+
Match.when('Uploading', () =>
|
|
210
213
|
h.keyed('button')(
|
|
211
214
|
'Uploading',
|
|
212
215
|
[
|
|
@@ -222,7 +225,7 @@ const uploadActionView = (upload: Upload, h: HtmlBuilder<Message>): Html =>
|
|
|
222
225
|
['Cancel'],
|
|
223
226
|
),
|
|
224
227
|
),
|
|
225
|
-
|
|
228
|
+
Match.when('Cancelled', () =>
|
|
226
229
|
h.keyed('button')(
|
|
227
230
|
'Cancelled',
|
|
228
231
|
[
|
|
@@ -238,8 +241,8 @@ const uploadActionView = (upload: Upload, h: HtmlBuilder<Message>): Html =>
|
|
|
238
241
|
['Restart'],
|
|
239
242
|
),
|
|
240
243
|
),
|
|
241
|
-
|
|
242
|
-
|
|
244
|
+
Match.when('Done', () => h.empty),
|
|
245
|
+
Match.exhaustive,
|
|
243
246
|
)
|
|
244
247
|
|
|
245
248
|
const uploadView = (upload: Upload, h: HtmlBuilder<Message>): Html =>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Match
|
|
1
|
+
import { Match, Schema } from 'effect'
|
|
2
2
|
|
|
3
|
-
export const Step =
|
|
3
|
+
export const Step = Schema.Literals([
|
|
4
4
|
'PersonalInfo',
|
|
5
5
|
'WorkHistory',
|
|
6
6
|
'Education',
|
|
@@ -16,13 +16,13 @@ export const all = Step.literals
|
|
|
16
16
|
export const indexOf = (step: Step): number => all.indexOf(step)
|
|
17
17
|
|
|
18
18
|
export const show = (step: Step): string =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
Match.value(step).pipe(
|
|
20
|
+
Match.when('PersonalInfo', () => 'Personal Info'),
|
|
21
|
+
Match.when('WorkHistory', () => 'Work History'),
|
|
22
|
+
Match.when('Education', () => 'Education'),
|
|
23
|
+
Match.when('Skills', () => 'Skills'),
|
|
24
|
+
Match.when('CoverLetter', () => 'Cover Letter'),
|
|
25
|
+
Match.when('Attachments', () => 'Attachments'),
|
|
26
|
+
Match.when('Review', () => 'Review'),
|
|
27
|
+
Match.exhaustive,
|
|
28
28
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Crypto, Effect, Schema
|
|
1
|
+
import { Crypto, Effect, Schema } from 'effect'
|
|
2
2
|
import { Calendar, Runtime } from 'foldkit'
|
|
3
3
|
|
|
4
4
|
import { BrowserCrypto } from '@effect/platform-browser'
|
|
@@ -19,11 +19,11 @@ import { view } from './view'
|
|
|
19
19
|
|
|
20
20
|
// FLAGS
|
|
21
21
|
|
|
22
|
-
export const Flags =
|
|
22
|
+
export const Flags = Schema.Struct({
|
|
23
23
|
today: Calendar.CalendarDate,
|
|
24
|
-
initialWorkHistoryEntryId:
|
|
25
|
-
initialEducationEntryId:
|
|
26
|
-
initialSkillsEntryId:
|
|
24
|
+
initialWorkHistoryEntryId: Schema.String,
|
|
25
|
+
initialEducationEntryId: Schema.String,
|
|
26
|
+
initialSkillsEntryId: Schema.String,
|
|
27
27
|
})
|
|
28
28
|
export type Flags = typeof Flags.Type
|
|
29
29
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema
|
|
1
|
+
import { Schema } from 'effect'
|
|
2
2
|
import { defineMessageUnion } from 'foldkit/message'
|
|
3
3
|
|
|
4
4
|
import { Menu, Tabs } from '@foldkit/ui'
|
|
@@ -38,7 +38,7 @@ export const Message = defineMessageUnion({
|
|
|
38
38
|
ToggledPreview: {},
|
|
39
39
|
ClickedSubmit: {},
|
|
40
40
|
SucceededSubmitApplication: {},
|
|
41
|
-
FailedSubmitApplication: { error:
|
|
41
|
+
FailedSubmitApplication: { error: Schema.String },
|
|
42
42
|
})
|
|
43
43
|
|
|
44
44
|
export type Message = typeof Message.Type
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema
|
|
1
|
+
import { Schema } from 'effect'
|
|
2
2
|
import { defineTaggedUnion } from 'foldkit/schema'
|
|
3
3
|
|
|
4
4
|
import { Menu, Tabs } from '@foldkit/ui'
|
|
@@ -19,13 +19,13 @@ export const Submission = defineTaggedUnion({
|
|
|
19
19
|
NotSubmitted: {},
|
|
20
20
|
Submitting: {},
|
|
21
21
|
SubmitSuccess: {},
|
|
22
|
-
SubmitError: { error:
|
|
22
|
+
SubmitError: { error: Schema.String },
|
|
23
23
|
})
|
|
24
24
|
export type Submission = typeof Submission.Type
|
|
25
25
|
|
|
26
26
|
// MODEL
|
|
27
27
|
|
|
28
|
-
export const Model =
|
|
28
|
+
export const Model = Schema.Struct({
|
|
29
29
|
currentStep: Step.Step,
|
|
30
30
|
personalInfo: PersonalInfo.Model,
|
|
31
31
|
workHistory: WorkHistory.Model,
|
|
@@ -33,10 +33,10 @@ export const Model = S.Struct({
|
|
|
33
33
|
skills: Skills.Model,
|
|
34
34
|
coverLetter: CoverLetter.Model,
|
|
35
35
|
attachments: Attachments.Model,
|
|
36
|
-
isPreviewVisible:
|
|
36
|
+
isPreviewVisible: Schema.Boolean,
|
|
37
37
|
submission: Submission,
|
|
38
38
|
stepMenu: Menu.Model,
|
|
39
39
|
stepTabs: Tabs.Model,
|
|
40
|
-
isSubmitAttempted:
|
|
40
|
+
isSubmitAttempted: Schema.Boolean,
|
|
41
41
|
})
|
|
42
42
|
export type Model = typeof Model.Type
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array,
|
|
1
|
+
import { Array, Option, Schema, pipe } from 'effect'
|
|
2
2
|
import { File, Update } from 'foldkit'
|
|
3
3
|
import { defineMessageUnion } from 'foldkit/message'
|
|
4
4
|
import { evo } from 'foldkit/struct'
|
|
@@ -7,11 +7,11 @@ import { FileDrop } from '@foldkit/ui'
|
|
|
7
7
|
|
|
8
8
|
// MODEL
|
|
9
9
|
|
|
10
|
-
export const Model =
|
|
10
|
+
export const Model = Schema.Struct({
|
|
11
11
|
resumeDrop: FileDrop.Model,
|
|
12
|
-
maybeResume:
|
|
12
|
+
maybeResume: Schema.Option(File.File),
|
|
13
13
|
additionalFilesDrop: FileDrop.Model,
|
|
14
|
-
additionalFiles:
|
|
14
|
+
additionalFiles: Schema.Array(File.File),
|
|
15
15
|
})
|
|
16
16
|
export type Model = typeof Model.Type
|
|
17
17
|
|
|
@@ -21,7 +21,7 @@ export const Message = defineMessageUnion({
|
|
|
21
21
|
GotResumeDropMessage: { message: FileDrop.Message },
|
|
22
22
|
GotAdditionalFilesDropMessage: { message: FileDrop.Message },
|
|
23
23
|
RemovedResume: {},
|
|
24
|
-
RemovedAdditionalFile: { fileIndex:
|
|
24
|
+
RemovedAdditionalFile: { fileIndex: Schema.Number },
|
|
25
25
|
})
|
|
26
26
|
|
|
27
27
|
export type Message = typeof Message.Type
|
|
@@ -37,24 +37,23 @@ export const init = (): Model => ({
|
|
|
37
37
|
|
|
38
38
|
// UPDATE
|
|
39
39
|
|
|
40
|
-
const foldResumeDropOutMessage =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}),
|
|
40
|
+
const foldResumeDropOutMessage = FileDrop.OutMessage.match<
|
|
41
|
+
Update.Step<Model, Message>
|
|
42
|
+
>({
|
|
43
|
+
ReceivedFiles:
|
|
44
|
+
({ files }) =>
|
|
45
|
+
model => ({
|
|
46
|
+
model: evo(model, {
|
|
47
|
+
maybeResume: () =>
|
|
48
|
+
pipe(
|
|
49
|
+
files,
|
|
50
|
+
Array.head,
|
|
51
|
+
Option.orElse(() => model.maybeResume),
|
|
52
|
+
),
|
|
54
53
|
}),
|
|
55
|
-
|
|
56
|
-
}),
|
|
57
|
-
)
|
|
54
|
+
}),
|
|
55
|
+
RejectedNonFiles: () => model => ({ model }),
|
|
56
|
+
})
|
|
58
57
|
|
|
59
58
|
const foldResumeDrop = Update.foldChild({
|
|
60
59
|
update: FileDrop.update,
|
|
@@ -65,19 +64,18 @@ const foldResumeDrop = Update.foldChild({
|
|
|
65
64
|
foldOutMessage: foldResumeDropOutMessage,
|
|
66
65
|
})
|
|
67
66
|
|
|
68
|
-
const foldAdditionalFilesDropOutMessage =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}),
|
|
67
|
+
const foldAdditionalFilesDropOutMessage = FileDrop.OutMessage.match<
|
|
68
|
+
Update.Step<Model, Message>
|
|
69
|
+
>({
|
|
70
|
+
ReceivedFiles:
|
|
71
|
+
({ files }) =>
|
|
72
|
+
model => ({
|
|
73
|
+
model: evo(model, {
|
|
74
|
+
additionalFiles: Array.appendAll(files),
|
|
77
75
|
}),
|
|
78
|
-
|
|
79
|
-
}),
|
|
80
|
-
)
|
|
76
|
+
}),
|
|
77
|
+
RejectedNonFiles: () => model => ({ model }),
|
|
78
|
+
})
|
|
81
79
|
|
|
82
80
|
const foldAdditionalFilesDrop = Update.foldChild({
|
|
83
81
|
update: FileDrop.update,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Schema
|
|
1
|
+
import { Schema } from 'effect'
|
|
2
2
|
import { type Update } from 'foldkit'
|
|
3
3
|
import { defineMessageUnion } from 'foldkit/message'
|
|
4
4
|
import { evo } from 'foldkit/struct'
|
|
5
5
|
|
|
6
6
|
// MODEL
|
|
7
7
|
|
|
8
|
-
export const Model =
|
|
9
|
-
content:
|
|
8
|
+
export const Model = Schema.Struct({
|
|
9
|
+
content: Schema.String,
|
|
10
10
|
})
|
|
11
11
|
export type Model = typeof Model.Type
|
|
12
12
|
|
|
13
13
|
// MESSAGE
|
|
14
14
|
|
|
15
15
|
export const Message = defineMessageUnion({
|
|
16
|
-
UpdatedContent: { value:
|
|
16
|
+
UpdatedContent: { value: Schema.String },
|
|
17
17
|
})
|
|
18
18
|
|
|
19
19
|
export type Message = typeof Message.Type
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array, Crypto, Effect,
|
|
1
|
+
import { Array, Crypto, Effect, Schema } from 'effect'
|
|
2
2
|
import { Calendar, Command, Update } from 'foldkit'
|
|
3
3
|
import { type CalendarDate } from 'foldkit/calendar'
|
|
4
4
|
import { defineMessageUnion } from 'foldkit/message'
|
|
@@ -10,8 +10,8 @@ import * as Entry from './entry'
|
|
|
10
10
|
|
|
11
11
|
// MODEL
|
|
12
12
|
|
|
13
|
-
export const Model =
|
|
14
|
-
entries:
|
|
13
|
+
export const Model = Schema.Struct({
|
|
14
|
+
entries: Schema.Array(Entry.Model),
|
|
15
15
|
today: Calendar.CalendarDate,
|
|
16
16
|
})
|
|
17
17
|
export type Model = typeof Model.Type
|
|
@@ -20,11 +20,11 @@ export type Model = typeof Model.Type
|
|
|
20
20
|
|
|
21
21
|
export const Message = defineMessageUnion({
|
|
22
22
|
ClickedAddEntry: {},
|
|
23
|
-
SucceededGenerateEntryId: { entryId:
|
|
23
|
+
SucceededGenerateEntryId: { entryId: Schema.String },
|
|
24
24
|
FailedGenerateEntryId: {},
|
|
25
|
-
RemovedEntry: { entryId:
|
|
25
|
+
RemovedEntry: { entryId: Schema.String },
|
|
26
26
|
GotEntryMessage: {
|
|
27
|
-
entryId:
|
|
27
|
+
entryId: Schema.String,
|
|
28
28
|
message: Entry.Message,
|
|
29
29
|
},
|
|
30
30
|
})
|
|
@@ -57,16 +57,13 @@ export const GenerateEntryId = Command.define('GenerateEntryId', {
|
|
|
57
57
|
const foldEntryOutMessage: (
|
|
58
58
|
entryId: string,
|
|
59
59
|
) => (outMessage: Entry.OutMessage) => Update.Step<Model, Message> = entryId =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
model: evo(model, {
|
|
65
|
-
entries: Array.filter(entry => entry.id !== entryId),
|
|
66
|
-
}),
|
|
60
|
+
Entry.OutMessage.match<Update.Step<Model, Message>>({
|
|
61
|
+
Removed: () => model => ({
|
|
62
|
+
model: evo(model, {
|
|
63
|
+
entries: Array.filter(entry => entry.id !== entryId),
|
|
67
64
|
}),
|
|
68
65
|
}),
|
|
69
|
-
)
|
|
66
|
+
})
|
|
70
67
|
|
|
71
68
|
const foldEntry = (entryId: string) =>
|
|
72
69
|
Update.foldChild({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Option, Schema } from 'effect'
|
|
2
2
|
import { Update } from 'foldkit'
|
|
3
3
|
import {
|
|
4
4
|
Field,
|
|
@@ -35,14 +35,14 @@ const validateFieldOfStudy = validate(fieldOfStudyRules)
|
|
|
35
35
|
|
|
36
36
|
// MODEL
|
|
37
37
|
|
|
38
|
-
export const Model =
|
|
39
|
-
id:
|
|
40
|
-
school: Field(
|
|
41
|
-
degree: Field(
|
|
42
|
-
fieldOfStudy: Field(
|
|
43
|
-
maybeGraduationYear:
|
|
38
|
+
export const Model = Schema.Struct({
|
|
39
|
+
id: Schema.String,
|
|
40
|
+
school: Field(Schema.String),
|
|
41
|
+
degree: Field(Schema.String),
|
|
42
|
+
fieldOfStudy: Field(Schema.String),
|
|
43
|
+
maybeGraduationYear: Schema.Option(Schema.String),
|
|
44
44
|
graduationYearListbox: Listbox.Model,
|
|
45
|
-
isCurrentlyEnrolled:
|
|
45
|
+
isCurrentlyEnrolled: Schema.Boolean,
|
|
46
46
|
})
|
|
47
47
|
export type Model = typeof Model.Type
|
|
48
48
|
|
|
@@ -51,11 +51,11 @@ const GraduationYearListbox = Listbox.create<string>()
|
|
|
51
51
|
// MESSAGE
|
|
52
52
|
|
|
53
53
|
export const Message = defineMessageUnion({
|
|
54
|
-
UpdatedSchool: { value:
|
|
55
|
-
UpdatedDegree: { value:
|
|
56
|
-
UpdatedFieldOfStudy: { value:
|
|
54
|
+
UpdatedSchool: { value: Schema.String },
|
|
55
|
+
UpdatedDegree: { value: Schema.String },
|
|
56
|
+
UpdatedFieldOfStudy: { value: Schema.String },
|
|
57
57
|
GotGraduationYearListboxMessage: { message: Listbox.Message },
|
|
58
|
-
ToggledCurrentlyEnrolled: { isChecked:
|
|
58
|
+
ToggledCurrentlyEnrolled: { isChecked: Schema.Boolean },
|
|
59
59
|
ClickedRemoveSelf: {},
|
|
60
60
|
})
|
|
61
61
|
|
|
@@ -87,16 +87,15 @@ export const init = (entryId: string): Model => ({
|
|
|
87
87
|
|
|
88
88
|
// UPDATE
|
|
89
89
|
|
|
90
|
-
const foldGraduationYearListboxOutMessage =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
90
|
+
const foldGraduationYearListboxOutMessage = Listbox.OutMessage.match<
|
|
91
|
+
Update.Step<Model, Message>
|
|
92
|
+
>({
|
|
93
|
+
Selected:
|
|
94
|
+
({ value }) =>
|
|
95
|
+
model => ({
|
|
96
|
+
model: evo(model, { maybeGraduationYear: () => Option.some(value) }),
|
|
97
|
+
}),
|
|
98
|
+
})
|
|
100
99
|
|
|
101
100
|
const foldGraduationYearListbox = Update.foldChild({
|
|
102
101
|
update: GraduationYearListbox.update,
|