@flickfyi/flkr 0.0.182 → 0.0.185
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/{api-client-CAg1b8Bh.js → api-client-nn4U_Vfn.js} +1 -1
- package/dist/{app-DpM5nhb9.js → app-COXGJhrt.js} +3 -3
- package/dist/{bundler-DNrDcqyk.js → bundler-CW4YC73e.js} +4 -2
- package/dist/cli.js +11 -11
- package/dist/{delegate-DcVye0KE.js → delegate-aUVluBjB.js} +2 -2
- package/dist/{generate-B1l1z_FZ.js → generate-BeL1QPDi.js} +1 -1
- package/dist/{preview-Dqn_Tq6K.js → preview-DTVM8Csb.js} +2 -2
- package/dist/{publish-BmDqO1xU.js → publish-BJG-s-w5.js} +4 -4
- package/dist/{pull-CO80DMn8.js → pull-B_Yfjpi2.js} +1 -1
- package/dist/{save-8crfOeo1.js → save-UrfgmK2-.js} +2 -2
- package/dist/{sdk-app-BXWrf_pf.js → sdk-app-BAxznAf9.js} +3 -3
- package/dist/{sdk-deploy-CaEonlvx.js → sdk-deploy-D1wgQxse.js} +3 -3
- package/dist/{sdk-generation-CF8ATbrL.js → sdk-generation-CLQ-QrVM.js} +1 -1
- package/dist/{sdk-project-CKV3U3u9.js → sdk-project-BaO0fqhW.js} +1 -1
- package/dist/{use-auth-B6nwU2rp.js → use-auth-CtM4_BAY.js} +1 -1
- package/node_modules/@flickfyi/biscuit/.turbo/turbo-build.log +4 -4
- package/node_modules/@flickfyi/core/README.md +19 -9
- package/node_modules/@flickfyi/core/dist/chunks/{default-CuxDsQoM.js → default-BTmKidHV.js} +1 -1
- package/node_modules/@flickfyi/core/dist/chunks/{default-BB6YexEH.cjs → default-JhTq5I_y.cjs} +1 -1
- package/node_modules/@flickfyi/core/dist/chunks/{define-CUJRqVKY.cjs → define-BKCRhpuY.cjs} +1 -1
- package/node_modules/@flickfyi/core/dist/chunks/{define-e_VqSs4M.js → define-DZXgUsy7.js} +5 -5
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.js +728 -549
- package/node_modules/@flickfyi/core/dist/kowalski/index.cjs +5 -5
- package/node_modules/@flickfyi/core/dist/kowalski/index.js +4297 -3700
- package/node_modules/@flickfyi/core/dist/kowalski/schemas.cjs +1 -0
- package/node_modules/@flickfyi/core/dist/kowalski/schemas.js +637 -0
- package/node_modules/@flickfyi/core/dist/kowalski-catalog.css +516 -0
- package/node_modules/@flickfyi/core/dist/kowalski.css +10 -0
- package/node_modules/@flickfyi/core/dist/themes/athletic/athletic.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/athletic/athletic.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/compact/compact.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/compact/compact.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/default/default.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/default/default.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/editorial/editorial.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/editorial/editorial.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/handwritten/handwritten.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/handwritten/handwritten.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/index.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/index.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/kids/kids.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/kids/kids.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/rounded/rounded.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/rounded/rounded.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/technical/technical.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/technical/technical.js +1 -1
- package/node_modules/@flickfyi/core/dist-types/hooks/use-feature-store/index.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/calculations.d.ts +57 -3
- package/node_modules/@flickfyi/core/dist-types/kowalski/calculator.d.ts +7 -6
- package/node_modules/@flickfyi/core/dist-types/kowalski/catalog.d.cts +524 -809
- package/node_modules/@flickfyi/core/dist-types/kowalski/catalog.d.ts +524 -809
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/bill-split.d.ts +38 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/bookmark.d.ts +48 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/budget.d.ts +39 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/calculator.d.ts +62 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/checklist.d.ts +35 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/color-palette.d.ts +32 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/contact.d.ts +41 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/countdown.d.ts +34 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/event.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/expense.d.ts +40 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/goal.d.ts +36 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/habit.d.ts +57 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/ledger.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/note.d.ts +35 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/poll.d.ts +41 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/random-picker.d.ts +69 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/rating.d.ts +33 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/reminder.d.ts +48 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/rotation.d.ts +39 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/scoreboard.d.ts +37 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/shopping-list.d.ts +41 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/task-board.d.ts +39 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/time-zone.d.ts +34 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/timer.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/trip.d.ts +61 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/unit-converter.d.ts +106 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/create-schemas.d.ts +6 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/date-time.d.ts +1 -1
- package/node_modules/@flickfyi/core/dist-types/kowalski/everyday.d.ts +28 -8
- package/node_modules/@flickfyi/core/dist-types/kowalski/feature-schema.d.ts +65 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/format.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/fortune.d.ts +21 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/frame.d.ts +4 -4
- package/node_modules/@flickfyi/core/dist-types/kowalski/index.d.cts +31 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/index.d.ts +31 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/lesson.d.ts +89 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/recipe.d.ts +129 -8
- package/node_modules/@flickfyi/core/dist-types/kowalski/schemas.d.cts +4 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/schemas.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/time-since.d.ts +34 -0
- package/node_modules/@flickfyi/core/examples/example-metadata.ts +19 -2
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.stories.tsx +25 -6
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.tsx +6 -12
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.tsx +6 -21
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.tsx +6 -19
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.stories.tsx +25 -5
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.tsx +6 -21
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.stories.tsx +19 -6
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.tsx +6 -17
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.stories.tsx +30 -5
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.stories.tsx +23 -5
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.tsx +6 -19
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.stories.tsx +23 -5
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/fortune/fortune.stories.tsx +61 -0
- package/node_modules/@flickfyi/core/examples/kowalski/fortune/fortune.tsx +11 -0
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.tsx +3 -19
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.stories.tsx +25 -5
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.tsx +6 -20
- package/node_modules/@flickfyi/core/examples/kowalski/lesson/lesson.stories.tsx +99 -0
- package/node_modules/@flickfyi/core/examples/kowalski/lesson/lesson.tsx +11 -0
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.stories.tsx +21 -5
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.tsx +3 -17
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.tsx +3 -21
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.stories.tsx +37 -6
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.tsx +6 -14
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.stories.tsx +117 -5
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.tsx +6 -115
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.tsx +6 -22
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.tsx +6 -21
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.stories.tsx +28 -6
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.tsx +6 -22
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.stories.tsx +27 -6
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.tsx +6 -22
- package/node_modules/@flickfyi/core/examples/kowalski/time-since/time-since.stories.tsx +33 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-since/time-since.tsx +12 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.stories.tsx +22 -6
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.tsx +6 -17
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.stories.tsx +25 -5
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.tsx +3 -21
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.stories.tsx +19 -6
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.tsx +6 -19
- package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.tsx +2 -13
- package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/counter/counter.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/counter/counter.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/grid/grid.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/grid/grid.tsx +4 -9
- package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/list/list.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/list/list.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/log/log.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/log/log.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/timer/timer.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/timer/timer.tsx +0 -8
- package/node_modules/@flickfyi/core/package.json +16 -3
- package/node_modules/@flickfyi/core/src/{kowalski/use-configured-feature.ts → hooks/use-configured-feature/index.ts} +1 -1
- package/node_modules/@flickfyi/core/src/{kowalski/use-feature-store.ts → hooks/use-feature-store/index.ts} +37 -12
- package/node_modules/@flickfyi/core/src/kowalski/README.md +13 -0
- package/node_modules/@flickfyi/core/src/kowalski/calculations.ts +36 -8
- package/node_modules/@flickfyi/core/src/kowalski/calculator.ts +15 -7
- package/node_modules/@flickfyi/core/src/kowalski/catalog.ts +110 -704
- package/node_modules/@flickfyi/core/src/kowalski/components/bill-split.tsx +284 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/bookmark.tsx +347 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/budget.tsx +169 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/calculator.tsx +202 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/checklist.tsx +119 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/color-palette.tsx +302 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/contact.tsx +247 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/countdown.tsx +173 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/event.tsx +260 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/expense.tsx +257 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/goal.tsx +182 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/habit.tsx +272 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/ledger.tsx +211 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/note.tsx +188 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/poll.tsx +242 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/random-picker.tsx +308 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/rating.tsx +112 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/reminder.tsx +298 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/rotation.tsx +146 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/scoreboard.tsx +139 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/shopping-list.tsx +144 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/task-board.tsx +146 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/time-zone.tsx +240 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/timer.tsx +225 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/trip.tsx +338 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/unit-converter.tsx +285 -0
- package/node_modules/@flickfyi/core/src/kowalski/create-schemas.ts +8 -0
- package/node_modules/@flickfyi/core/src/kowalski/date-time.tsx +1 -1
- package/node_modules/@flickfyi/core/src/kowalski/everyday.tsx +1 -640
- package/node_modules/@flickfyi/core/src/kowalski/feature-schema.ts +84 -0
- package/node_modules/@flickfyi/core/src/kowalski/format.ts +29 -3
- package/node_modules/@flickfyi/core/src/kowalski/fortune.tsx +67 -0
- package/node_modules/@flickfyi/core/src/kowalski/frame.tsx +5 -6
- package/node_modules/@flickfyi/core/src/kowalski/index.ts +31 -22
- package/node_modules/@flickfyi/core/src/kowalski/lesson.tsx +564 -0
- package/node_modules/@flickfyi/core/src/kowalski/recipe.tsx +78 -37
- package/node_modules/@flickfyi/core/src/kowalski/schemas.ts +67 -0
- package/node_modules/@flickfyi/core/src/kowalski/stories/composition.tsx +22 -20
- package/node_modules/@flickfyi/core/src/kowalski/time-since.tsx +145 -0
- package/node_modules/@flickfyi/core/src/molecules/progress/progress.tsx +4 -1
- package/node_modules/@flickfyi/core/src/oklch.ts +1 -6
- package/node_modules/@flickfyi/core/src/parrott/theme.ts +3 -1
- package/node_modules/@flickfyi/core/src/themes/editorial/editorial.ts +6 -1
- package/node_modules/@flickfyi/core/src/themes/palette.ts +5 -5
- package/node_modules/@flickfyi/core/src/themes/stories/composition.tsx +11 -9
- package/node_modules/@flickfyi/core/src/themes/stories/gallery.tsx +7 -11
- package/node_modules/@flickfyi/core/tsgo.bun.lock +7 -7
- package/node_modules/@flickfyi/core/tsgo.package.json +1 -1
- package/package.json +2 -2
- package/node_modules/@flickfyi/core/dist-types/kowalski/clocks.d.ts +0 -4
- package/node_modules/@flickfyi/core/dist-types/kowalski/details.d.ts +0 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/productivity.d.ts +0 -5
- package/node_modules/@flickfyi/core/dist-types/kowalski/tools.d.ts +0 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/use-feature-store.d.ts +0 -15
- package/node_modules/@flickfyi/core/src/kowalski/clocks.tsx +0 -464
- package/node_modules/@flickfyi/core/src/kowalski/details.tsx +0 -1387
- package/node_modules/@flickfyi/core/src/kowalski/productivity.tsx +0 -575
- package/node_modules/@flickfyi/core/src/kowalski/tools.tsx +0 -1213
- /package/node_modules/@flickfyi/core/dist-types/{kowalski/use-clock.d.ts → hooks/use-clock/index.d.ts} +0 -0
- /package/node_modules/@flickfyi/core/dist-types/{kowalski/use-configured-feature.d.ts → hooks/use-configured-feature/index.d.ts} +0 -0
- /package/node_modules/@flickfyi/core/src/{kowalski/use-clock.ts → hooks/use-clock/index.ts} +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { Flex, Text } from '@flickfyi/core'
|
|
2
|
+
import * as stylex from '@stylexjs/stylex'
|
|
3
|
+
import { Duration } from 'luxon'
|
|
4
|
+
import { z } from 'zod/v4'
|
|
5
|
+
|
|
6
|
+
import { useClock } from '~/hooks/use-clock'
|
|
7
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
8
|
+
import { elapsedSeconds } from '~/kowalski/calculations'
|
|
9
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
10
|
+
import { featureFields, store } from '~/kowalski/feature-schema'
|
|
11
|
+
import { format } from '~/kowalski/format'
|
|
12
|
+
import {
|
|
13
|
+
FeatureAction,
|
|
14
|
+
FeatureFrame,
|
|
15
|
+
FeatureProgress,
|
|
16
|
+
FeatureWell,
|
|
17
|
+
layout,
|
|
18
|
+
} from '~/kowalski/frame'
|
|
19
|
+
import { space, text } from '~/themes/scale.stylex'
|
|
20
|
+
import { appearance, roles } from '~/themes/shared'
|
|
21
|
+
import { font } from '~/themes/tokens.stylex'
|
|
22
|
+
|
|
23
|
+
const defaultId = 'KowalskiTimer'
|
|
24
|
+
const defaultScope = 'private'
|
|
25
|
+
|
|
26
|
+
export const TimerData = /* @__PURE__ */ z
|
|
27
|
+
.strictObject({
|
|
28
|
+
durationSeconds: z
|
|
29
|
+
.number()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe('Countdown length in seconds, e.g. 1500 for 25 minutes. Omit for 300.'),
|
|
32
|
+
mode: z
|
|
33
|
+
.enum(['countdown', 'focus', 'break', 'stopwatch'])
|
|
34
|
+
.optional()
|
|
35
|
+
.describe('Omit for "countdown".'),
|
|
36
|
+
title: z.string().optional().describe('A short heading. Omit for "Timer".'),
|
|
37
|
+
})
|
|
38
|
+
.describe(
|
|
39
|
+
'Countdown, focus, break, or stopwatch. Start, pause, resume, reset; no background alarm.'
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
export type TimerData = z.infer<typeof TimerData>
|
|
43
|
+
|
|
44
|
+
export const TimerProps = z.strictObject({
|
|
45
|
+
data: TimerData,
|
|
46
|
+
...featureFields,
|
|
47
|
+
scope: featureFields.scope.default(defaultScope),
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
export type TimerProps = z.input<typeof TimerProps> & {
|
|
51
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const timerStoreSchema = store({
|
|
55
|
+
elapsedSeconds: z.number().default(0),
|
|
56
|
+
startedAt: z.number().nullable().default(null),
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export const createSchemas: CreateSchemas = ({
|
|
60
|
+
id = defaultId,
|
|
61
|
+
scope = defaultScope,
|
|
62
|
+
} = {}) => ({
|
|
63
|
+
[`stores/${scope}/${id}`]: timerStoreSchema,
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
export function Timer({
|
|
67
|
+
data,
|
|
68
|
+
id,
|
|
69
|
+
revision = 0,
|
|
70
|
+
scope = defaultScope,
|
|
71
|
+
style,
|
|
72
|
+
}: TimerProps) {
|
|
73
|
+
const schema = timerStoreSchema
|
|
74
|
+
const store = useConfiguredFeature({
|
|
75
|
+
name: id ?? defaultId,
|
|
76
|
+
revision,
|
|
77
|
+
schema,
|
|
78
|
+
scope,
|
|
79
|
+
seed: schema.parse({}),
|
|
80
|
+
})
|
|
81
|
+
const { durationSeconds = 300, mode = 'countdown', title = 'Timer' } = data
|
|
82
|
+
const stopwatch = mode === 'stopwatch'
|
|
83
|
+
const complete =
|
|
84
|
+
!stopwatch && elapsedSeconds(store.value, Date.now()) >= durationSeconds
|
|
85
|
+
const now = useClock(store.value.startedAt !== null && !complete)
|
|
86
|
+
const elapsed = complete ? durationSeconds : elapsedSeconds(store.value, now)
|
|
87
|
+
const remaining = Math.max(0, durationSeconds - elapsed)
|
|
88
|
+
const running = store.value.startedAt !== null && !complete
|
|
89
|
+
const clockSeconds = stopwatch ? Math.floor(elapsed) : Math.ceil(remaining)
|
|
90
|
+
const showHours = (stopwatch ? clockSeconds : durationSeconds) >= 3600
|
|
91
|
+
// Older JavaScriptCore versions misplace separators when Intl hides zero hours.
|
|
92
|
+
const clockParts = format.formatDurationToParts(
|
|
93
|
+
Duration.fromObject({ seconds: clockSeconds })
|
|
94
|
+
.shiftTo('hours', 'minutes', 'seconds')
|
|
95
|
+
.toObject(),
|
|
96
|
+
{
|
|
97
|
+
hours: '2-digit',
|
|
98
|
+
hoursDisplay: 'always',
|
|
99
|
+
minutes: '2-digit',
|
|
100
|
+
minutesDisplay: 'always',
|
|
101
|
+
seconds: '2-digit',
|
|
102
|
+
secondsDisplay: 'always',
|
|
103
|
+
style: 'digital',
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
const clock = clockParts
|
|
107
|
+
.slice(showHours ? 0 : clockParts.findIndex(part => part.unit === 'minute'))
|
|
108
|
+
.map(part => part.value)
|
|
109
|
+
.join('')
|
|
110
|
+
const modeLabel =
|
|
111
|
+
mode === 'focus'
|
|
112
|
+
? 'Focus session'
|
|
113
|
+
: mode === 'break'
|
|
114
|
+
? 'Break time'
|
|
115
|
+
: stopwatch
|
|
116
|
+
? 'Stopwatch'
|
|
117
|
+
: 'Countdown timer'
|
|
118
|
+
const status = store.saving
|
|
119
|
+
? 'Saving…'
|
|
120
|
+
: !store.ready && !store.error
|
|
121
|
+
? 'Loading…'
|
|
122
|
+
: complete
|
|
123
|
+
? 'Complete'
|
|
124
|
+
: running
|
|
125
|
+
? 'Running'
|
|
126
|
+
: elapsed > 0
|
|
127
|
+
? 'Paused'
|
|
128
|
+
: 'Ready'
|
|
129
|
+
return (
|
|
130
|
+
<FeatureFrame
|
|
131
|
+
style={style}
|
|
132
|
+
onRetry={store.retry}
|
|
133
|
+
notice={store.error}
|
|
134
|
+
component="timer"
|
|
135
|
+
title={title}
|
|
136
|
+
detail={modeLabel}
|
|
137
|
+
trailing={
|
|
138
|
+
<Text {...stylex.props(roles.muted, (running || complete) && appearance.accent)}>
|
|
139
|
+
{status}
|
|
140
|
+
</Text>
|
|
141
|
+
}
|
|
142
|
+
>
|
|
143
|
+
<FeatureWell style={timerStyles.clock}>
|
|
144
|
+
<Text
|
|
145
|
+
animated={running ? 'numeric' : undefined}
|
|
146
|
+
{...stylex.props(roles.display, timerStyles.digits(clock.length))}
|
|
147
|
+
>
|
|
148
|
+
{clock}
|
|
149
|
+
</Text>
|
|
150
|
+
<Text {...stylex.props(roles.muted)}>
|
|
151
|
+
{complete ? 'Time’s up' : stopwatch ? 'Time elapsed' : 'Time remaining'}
|
|
152
|
+
</Text>
|
|
153
|
+
{!stopwatch && (
|
|
154
|
+
<FeatureProgress component="timer" value={elapsed / durationSeconds} />
|
|
155
|
+
)}
|
|
156
|
+
</FeatureWell>
|
|
157
|
+
<Flex {...stylex.props(layout.actions)}>
|
|
158
|
+
<Flex {...stylex.props(timerStyles.primary)}>
|
|
159
|
+
<FeatureAction
|
|
160
|
+
component="timer"
|
|
161
|
+
icon={complete ? 'arrow.counterclockwise' : running ? 'pause' : 'play'}
|
|
162
|
+
variant="primary"
|
|
163
|
+
disabled={!store.ready}
|
|
164
|
+
onClick={() =>
|
|
165
|
+
store.set(current => {
|
|
166
|
+
const instant = Date.now()
|
|
167
|
+
if (complete) {
|
|
168
|
+
return { elapsedSeconds: 0, startedAt: instant }
|
|
169
|
+
}
|
|
170
|
+
const currentElapsed = elapsedSeconds(current, instant)
|
|
171
|
+
return current.startedAt === null
|
|
172
|
+
? { startedAt: instant }
|
|
173
|
+
: {
|
|
174
|
+
elapsedSeconds: stopwatch
|
|
175
|
+
? currentElapsed
|
|
176
|
+
: Math.min(durationSeconds, currentElapsed),
|
|
177
|
+
startedAt: null,
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
>
|
|
182
|
+
{complete
|
|
183
|
+
? 'Start again'
|
|
184
|
+
: running
|
|
185
|
+
? 'Pause'
|
|
186
|
+
: elapsed > 0
|
|
187
|
+
? 'Resume'
|
|
188
|
+
: 'Start'}
|
|
189
|
+
</FeatureAction>
|
|
190
|
+
</Flex>
|
|
191
|
+
<FeatureAction
|
|
192
|
+
component="timer"
|
|
193
|
+
variant="quiet"
|
|
194
|
+
disabled={!store.ready || (elapsed === 0 && store.value.startedAt === null)}
|
|
195
|
+
onClick={() => store.set(() => ({ elapsedSeconds: 0, startedAt: null }))}
|
|
196
|
+
>
|
|
197
|
+
Reset
|
|
198
|
+
</FeatureAction>
|
|
199
|
+
</Flex>
|
|
200
|
+
</FeatureFrame>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const timerStyles = /* @__PURE__ */ stylex.create({
|
|
205
|
+
clock: { alignItems: 'stretch', gap: space[3], textAlign: 'center' },
|
|
206
|
+
digits: (length: number) => ({
|
|
207
|
+
fontSize:
|
|
208
|
+
length > 11
|
|
209
|
+
? text['3xl']
|
|
210
|
+
: length > 8
|
|
211
|
+
? text['4xl']
|
|
212
|
+
: length > 5
|
|
213
|
+
? text['5xl']
|
|
214
|
+
: font.displaySize,
|
|
215
|
+
lineHeight:
|
|
216
|
+
length > 11
|
|
217
|
+
? text['3xlLeading']
|
|
218
|
+
: length > 8
|
|
219
|
+
? text['4xlLeading']
|
|
220
|
+
: length > 5
|
|
221
|
+
? text['5xlLeading']
|
|
222
|
+
: font.displayLeading,
|
|
223
|
+
}),
|
|
224
|
+
primary: { flexBasis: 0, flexGrow: 1, minWidth: 0 },
|
|
225
|
+
})
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { Flex, Text } from '@flickfyi/core'
|
|
2
|
+
import { Input } from '@flickfyi/core/atoms'
|
|
3
|
+
import { List } from '@flickfyi/core/molecules'
|
|
4
|
+
import * as stylex from '@stylexjs/stylex'
|
|
5
|
+
import { useState } from 'react'
|
|
6
|
+
import { z } from 'zod/v4'
|
|
7
|
+
|
|
8
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
9
|
+
import { parseInstant } from '~/kowalski/calculations'
|
|
10
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
11
|
+
import { FeatureDate } from '~/kowalski/date-time'
|
|
12
|
+
import { featureFields, replacement, store } from '~/kowalski/feature-schema'
|
|
13
|
+
import { format } from '~/kowalski/format'
|
|
14
|
+
import { FeatureAction, FeatureFacts, FeatureFrame, layout } from '~/kowalski/frame'
|
|
15
|
+
import { space } from '~/themes/scale.stylex'
|
|
16
|
+
import { roles } from '~/themes/shared'
|
|
17
|
+
|
|
18
|
+
const defaultId = 'KowalskiTrip'
|
|
19
|
+
const defaultScope = 'private'
|
|
20
|
+
|
|
21
|
+
export const TripData = /* @__PURE__ */ z
|
|
22
|
+
.strictObject({
|
|
23
|
+
destination: z.string().describe('Where the trip goes.'),
|
|
24
|
+
endDate: z
|
|
25
|
+
.string()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe('The last day as YYYY-MM-DD. Omit if unknown.'),
|
|
28
|
+
origin: z.string().describe('Where the trip starts.'),
|
|
29
|
+
startDate: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe('The first day as YYYY-MM-DD. Omit if unknown.'),
|
|
33
|
+
title: z.string().optional().describe('A short heading. Omit for "Trip".'),
|
|
34
|
+
transport: z
|
|
35
|
+
.enum(['car', 'train', 'plane', 'walk', 'other'])
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('How the trip is made. Omit for "other".'),
|
|
38
|
+
})
|
|
39
|
+
.describe('Edit and retain trip details. No bookings or itinerary retrieval.')
|
|
40
|
+
|
|
41
|
+
export type TripData = z.infer<typeof TripData>
|
|
42
|
+
|
|
43
|
+
export const TripProps = z.strictObject({
|
|
44
|
+
data: TripData,
|
|
45
|
+
...featureFields,
|
|
46
|
+
scope: featureFields.scope.default(defaultScope),
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
export type TripProps = z.input<typeof TripProps> & {
|
|
50
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const tripStoreSchema = store({
|
|
54
|
+
destination: replacement(z.string().default('')),
|
|
55
|
+
endDate: replacement(z.string().nullable().default(null)),
|
|
56
|
+
origin: replacement(z.string().default('')),
|
|
57
|
+
startDate: replacement(z.string().nullable().default(null)),
|
|
58
|
+
}).refine(
|
|
59
|
+
value =>
|
|
60
|
+
!value.startDate.value ||
|
|
61
|
+
!value.endDate.value ||
|
|
62
|
+
value.endDate.value >= value.startDate.value,
|
|
63
|
+
'The trip cannot end before it starts.'
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
export const createSchemas: CreateSchemas = ({
|
|
67
|
+
id = defaultId,
|
|
68
|
+
scope = defaultScope,
|
|
69
|
+
} = {}) => ({
|
|
70
|
+
[`stores/${scope}/${id}`]: tripStoreSchema,
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
export function Trip({ data, id, revision = 0, scope = defaultScope, style }: TripProps) {
|
|
74
|
+
const schema = tripStoreSchema
|
|
75
|
+
const store = useConfiguredFeature({
|
|
76
|
+
name: id ?? defaultId,
|
|
77
|
+
revision,
|
|
78
|
+
schema,
|
|
79
|
+
scope,
|
|
80
|
+
seed: schema.parse({
|
|
81
|
+
destination: { value: data.destination },
|
|
82
|
+
endDate: { value: data.endDate },
|
|
83
|
+
origin: { value: data.origin },
|
|
84
|
+
startDate: { value: data.startDate },
|
|
85
|
+
}),
|
|
86
|
+
})
|
|
87
|
+
const [draft, setDraft] = useState<{
|
|
88
|
+
destination: string
|
|
89
|
+
endDate: string | null
|
|
90
|
+
origin: string
|
|
91
|
+
startDate: string | null
|
|
92
|
+
}>({
|
|
93
|
+
destination: data.destination,
|
|
94
|
+
endDate: data.endDate ?? null,
|
|
95
|
+
origin: data.origin,
|
|
96
|
+
startDate: data.startDate ?? null,
|
|
97
|
+
})
|
|
98
|
+
const [baseline, setBaseline] = useState<typeof draft | null>(null)
|
|
99
|
+
const [editingEndDate, setEditingEndDate] = useState(false)
|
|
100
|
+
const [editingStartDate, setEditingStartDate] = useState(false)
|
|
101
|
+
const [saveError, setSaveError] = useState(false)
|
|
102
|
+
const editing = baseline !== null
|
|
103
|
+
const transport = {
|
|
104
|
+
car: { icon: 'car.fill', label: 'By car' },
|
|
105
|
+
other: { icon: 'suitcase.fill', label: 'Travel plans' },
|
|
106
|
+
plane: { icon: 'airplane', label: 'By plane' },
|
|
107
|
+
train: { icon: 'tram.fill', label: 'By train' },
|
|
108
|
+
walk: { icon: 'figure.walk', label: 'On foot' },
|
|
109
|
+
}[data.transport ?? 'other']
|
|
110
|
+
const start = store.value.startDate.value
|
|
111
|
+
const end = store.value.endDate.value
|
|
112
|
+
const dateFormat = format.formatters.getDateTimeFormat(format.locale, {
|
|
113
|
+
day: 'numeric',
|
|
114
|
+
era: start?.startsWith('0000-') || end?.startsWith('0000-') ? 'short' : undefined,
|
|
115
|
+
month: 'short',
|
|
116
|
+
timeZone: 'UTC',
|
|
117
|
+
year: 'numeric',
|
|
118
|
+
})
|
|
119
|
+
const startInstant = parseInstant(start && `${start}T12:00:00Z`)
|
|
120
|
+
const endInstant = parseInstant(end && `${end}T12:00:00Z`)
|
|
121
|
+
const nights =
|
|
122
|
+
startInstant !== null && endInstant !== null
|
|
123
|
+
? Math.round((endInstant - startInstant) / 86_400_000)
|
|
124
|
+
: null
|
|
125
|
+
const dates =
|
|
126
|
+
startInstant !== null && endInstant !== null
|
|
127
|
+
? start === end
|
|
128
|
+
? dateFormat.format(startInstant)
|
|
129
|
+
: `${dateFormat.format(startInstant)} – ${dateFormat.format(endInstant)}`
|
|
130
|
+
: startInstant === null
|
|
131
|
+
? endInstant === null
|
|
132
|
+
? 'Dates open'
|
|
133
|
+
: `Until ${dateFormat.format(endInstant)}`
|
|
134
|
+
: `From ${dateFormat.format(startInstant)}`
|
|
135
|
+
const duration =
|
|
136
|
+
nights === null
|
|
137
|
+
? start
|
|
138
|
+
? 'End date to be decided'
|
|
139
|
+
: end
|
|
140
|
+
? 'Start date to be decided'
|
|
141
|
+
: 'Set dates when you’re ready'
|
|
142
|
+
: nights === 0
|
|
143
|
+
? 'Day trip'
|
|
144
|
+
: format.formatMessage(
|
|
145
|
+
{
|
|
146
|
+
defaultMessage:
|
|
147
|
+
'{days, number} days · {nights, plural, one {# night} other {# nights}}',
|
|
148
|
+
id: 'kowalski.trip.duration',
|
|
149
|
+
},
|
|
150
|
+
{ days: nights + 1, nights }
|
|
151
|
+
)
|
|
152
|
+
const changed =
|
|
153
|
+
baseline &&
|
|
154
|
+
(draft.destination !== baseline.destination ||
|
|
155
|
+
draft.endDate !== baseline.endDate ||
|
|
156
|
+
draft.origin !== baseline.origin ||
|
|
157
|
+
draft.startDate !== baseline.startDate)
|
|
158
|
+
const nextStart =
|
|
159
|
+
baseline && draft.startDate !== baseline.startDate ? draft.startDate : start
|
|
160
|
+
const nextEnd = baseline && draft.endDate !== baseline.endDate ? draft.endDate : end
|
|
161
|
+
const validDates = !nextStart || !nextEnd || nextStart <= nextEnd
|
|
162
|
+
return (
|
|
163
|
+
<FeatureFrame
|
|
164
|
+
style={style}
|
|
165
|
+
onRetry={store.retry}
|
|
166
|
+
notice={store.error}
|
|
167
|
+
component="trip"
|
|
168
|
+
title={data.title ?? 'Trip'}
|
|
169
|
+
detail={transport.label}
|
|
170
|
+
>
|
|
171
|
+
{editing && store.saving ? (
|
|
172
|
+
<Text {...stylex.props(roles.muted)}>Saving changes…</Text>
|
|
173
|
+
) : editing ? (
|
|
174
|
+
<Flex {...stylex.props(tripStyles.editor)}>
|
|
175
|
+
<Flex {...stylex.props(layout.field)}>
|
|
176
|
+
<Text {...stylex.props(roles.label, layout.fieldLabel)}>From</Text>
|
|
177
|
+
<Input
|
|
178
|
+
placeholder="From"
|
|
179
|
+
value={draft.origin}
|
|
180
|
+
onChange={origin => setDraft(current => ({ ...current, origin }))}
|
|
181
|
+
style={[layout.input]}
|
|
182
|
+
/>
|
|
183
|
+
</Flex>
|
|
184
|
+
<Flex {...stylex.props(layout.field)}>
|
|
185
|
+
<Text {...stylex.props(roles.label, layout.fieldLabel)}>To</Text>
|
|
186
|
+
<Input
|
|
187
|
+
placeholder="To"
|
|
188
|
+
value={draft.destination}
|
|
189
|
+
onChange={destination => setDraft(current => ({ ...current, destination }))}
|
|
190
|
+
style={[layout.input]}
|
|
191
|
+
/>
|
|
192
|
+
</Flex>
|
|
193
|
+
<FeatureDate
|
|
194
|
+
inline
|
|
195
|
+
clearable
|
|
196
|
+
component="trip"
|
|
197
|
+
label="Start date"
|
|
198
|
+
onChange={startDate => {
|
|
199
|
+
setDraft(current => ({ ...current, startDate }))
|
|
200
|
+
setSaveError(false)
|
|
201
|
+
}}
|
|
202
|
+
onEditingChange={setEditingStartDate}
|
|
203
|
+
ready={store.ready}
|
|
204
|
+
value={draft.startDate}
|
|
205
|
+
/>
|
|
206
|
+
<FeatureDate
|
|
207
|
+
inline
|
|
208
|
+
clearable
|
|
209
|
+
component="trip"
|
|
210
|
+
label="End date"
|
|
211
|
+
onChange={endDate => {
|
|
212
|
+
setDraft(current => ({ ...current, endDate }))
|
|
213
|
+
setSaveError(false)
|
|
214
|
+
}}
|
|
215
|
+
onEditingChange={setEditingEndDate}
|
|
216
|
+
ready={store.ready}
|
|
217
|
+
value={draft.endDate}
|
|
218
|
+
/>
|
|
219
|
+
{(!validDates || saveError) && (
|
|
220
|
+
<Text {...stylex.props(roles.muted)}>
|
|
221
|
+
The trip cannot end before it starts. Adjust either date before saving.
|
|
222
|
+
</Text>
|
|
223
|
+
)}
|
|
224
|
+
<Flex {...stylex.props(layout.actions)}>
|
|
225
|
+
<FeatureAction
|
|
226
|
+
component="trip"
|
|
227
|
+
onClick={() => {
|
|
228
|
+
setBaseline(null)
|
|
229
|
+
setEditingEndDate(false)
|
|
230
|
+
setEditingStartDate(false)
|
|
231
|
+
}}
|
|
232
|
+
>
|
|
233
|
+
Cancel
|
|
234
|
+
</FeatureAction>
|
|
235
|
+
<FeatureAction
|
|
236
|
+
component="trip"
|
|
237
|
+
disabled={
|
|
238
|
+
store.saving ||
|
|
239
|
+
!store.ready ||
|
|
240
|
+
editingEndDate ||
|
|
241
|
+
editingStartDate ||
|
|
242
|
+
!changed ||
|
|
243
|
+
!validDates
|
|
244
|
+
}
|
|
245
|
+
onClick={() => {
|
|
246
|
+
if (
|
|
247
|
+
store.saving ||
|
|
248
|
+
!store.ready ||
|
|
249
|
+
editingEndDate ||
|
|
250
|
+
editingStartDate ||
|
|
251
|
+
!baseline ||
|
|
252
|
+
!changed ||
|
|
253
|
+
!validDates
|
|
254
|
+
) {
|
|
255
|
+
return
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
store.set(
|
|
259
|
+
current => ({
|
|
260
|
+
...(draft.destination !== baseline.destination &&
|
|
261
|
+
draft.destination !== current.destination.value && {
|
|
262
|
+
destination: { value: draft.destination },
|
|
263
|
+
}),
|
|
264
|
+
...(draft.endDate !== baseline.endDate &&
|
|
265
|
+
draft.endDate !== current.endDate.value && {
|
|
266
|
+
endDate: { value: draft.endDate },
|
|
267
|
+
}),
|
|
268
|
+
...(draft.origin !== baseline.origin &&
|
|
269
|
+
draft.origin !== current.origin.value && {
|
|
270
|
+
origin: { value: draft.origin },
|
|
271
|
+
}),
|
|
272
|
+
...(draft.startDate !== baseline.startDate &&
|
|
273
|
+
draft.startDate !== current.startDate.value && {
|
|
274
|
+
startDate: { value: draft.startDate },
|
|
275
|
+
}),
|
|
276
|
+
}),
|
|
277
|
+
() => setBaseline(null)
|
|
278
|
+
)
|
|
279
|
+
} catch {
|
|
280
|
+
setSaveError(true)
|
|
281
|
+
}
|
|
282
|
+
}}
|
|
283
|
+
variant="primary"
|
|
284
|
+
>
|
|
285
|
+
{store.saving ? 'Saving…' : 'Save changes'}
|
|
286
|
+
</FeatureAction>
|
|
287
|
+
</Flex>
|
|
288
|
+
</Flex>
|
|
289
|
+
) : (
|
|
290
|
+
<>
|
|
291
|
+
<FeatureFacts>
|
|
292
|
+
<List.Item
|
|
293
|
+
label="From"
|
|
294
|
+
trailing={
|
|
295
|
+
store.value.origin.value.trim()
|
|
296
|
+
? store.value.origin.value
|
|
297
|
+
: 'To be decided'
|
|
298
|
+
}
|
|
299
|
+
/>
|
|
300
|
+
<List.Item
|
|
301
|
+
label="To"
|
|
302
|
+
trailing={
|
|
303
|
+
store.value.destination.value.trim()
|
|
304
|
+
? store.value.destination.value
|
|
305
|
+
: 'To be decided'
|
|
306
|
+
}
|
|
307
|
+
/>
|
|
308
|
+
<List.Item description={duration} label="Dates" trailing={dates} />
|
|
309
|
+
</FeatureFacts>
|
|
310
|
+
{!editing && (
|
|
311
|
+
<FeatureAction
|
|
312
|
+
component="trip"
|
|
313
|
+
disabled={!store.ready || store.saving}
|
|
314
|
+
icon="pencil"
|
|
315
|
+
onClick={() => {
|
|
316
|
+
const values = {
|
|
317
|
+
destination: store.value.destination.value,
|
|
318
|
+
endDate: store.value.endDate.value,
|
|
319
|
+
origin: store.value.origin.value,
|
|
320
|
+
startDate: store.value.startDate.value,
|
|
321
|
+
}
|
|
322
|
+
setDraft(values)
|
|
323
|
+
setBaseline(values)
|
|
324
|
+
setSaveError(false)
|
|
325
|
+
}}
|
|
326
|
+
>
|
|
327
|
+
Edit trip
|
|
328
|
+
</FeatureAction>
|
|
329
|
+
)}
|
|
330
|
+
</>
|
|
331
|
+
)}
|
|
332
|
+
</FeatureFrame>
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const tripStyles = /* @__PURE__ */ stylex.create({
|
|
337
|
+
editor: { gap: space[5] },
|
|
338
|
+
})
|