@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,298 @@
|
|
|
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 { useClock } from '~/hooks/use-clock'
|
|
9
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
10
|
+
import { nextReminder, parseInstant } from '~/kowalski/calculations'
|
|
11
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
12
|
+
import { FeatureDateTime } from '~/kowalski/date-time'
|
|
13
|
+
import { featureFields, replacement, store } from '~/kowalski/feature-schema'
|
|
14
|
+
import { format, resolveTimeZone } from '~/kowalski/format'
|
|
15
|
+
import {
|
|
16
|
+
FeatureAction,
|
|
17
|
+
FeatureEdit,
|
|
18
|
+
FeatureFacts,
|
|
19
|
+
FeatureFrame,
|
|
20
|
+
layout,
|
|
21
|
+
} from '~/kowalski/frame'
|
|
22
|
+
import { space } from '~/themes/scale.stylex'
|
|
23
|
+
import { roles } from '~/themes/shared'
|
|
24
|
+
|
|
25
|
+
const defaultId = 'KowalskiReminder'
|
|
26
|
+
const defaultScope = 'private'
|
|
27
|
+
|
|
28
|
+
export const ReminderData = /* @__PURE__ */ z
|
|
29
|
+
.strictObject({
|
|
30
|
+
dueAt: z
|
|
31
|
+
.string()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe(
|
|
34
|
+
'When it is due, as ISO 8601 with an offset, e.g. "2026-11-01T09:00:00-07:00". Omit if no time was given.'
|
|
35
|
+
),
|
|
36
|
+
recurrence: z
|
|
37
|
+
.enum(['none', 'daily', 'weekly'])
|
|
38
|
+
.optional()
|
|
39
|
+
.describe('How it repeats. Omit for "none".'),
|
|
40
|
+
timeZone: z
|
|
41
|
+
.string()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe(
|
|
44
|
+
'An IANA time zone, e.g. "America/New_York". Omit for the device’s time zone.'
|
|
45
|
+
),
|
|
46
|
+
title: z.string().describe('What to be reminded of.'),
|
|
47
|
+
})
|
|
48
|
+
.describe(
|
|
49
|
+
'Complete, reopen, and edit an in-app reminder. Does not schedule notifications.'
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
export type ReminderData = z.infer<typeof ReminderData>
|
|
53
|
+
|
|
54
|
+
export const ReminderProps = z.strictObject({
|
|
55
|
+
data: ReminderData,
|
|
56
|
+
...featureFields,
|
|
57
|
+
scope: featureFields.scope.default(defaultScope),
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
export type ReminderProps = z.input<typeof ReminderProps> & {
|
|
61
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const reminderStoreSchema = store({
|
|
65
|
+
completedAt: z.number().nullable().default(null),
|
|
66
|
+
dueAt: replacement(z.string().nullable().default(null)),
|
|
67
|
+
title: replacement(z.string().default('')),
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
export const createSchemas: CreateSchemas = ({
|
|
71
|
+
id = defaultId,
|
|
72
|
+
scope = defaultScope,
|
|
73
|
+
} = {}) => ({
|
|
74
|
+
[`stores/${scope}/${id}`]: reminderStoreSchema,
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
export function Reminder({
|
|
78
|
+
data,
|
|
79
|
+
id,
|
|
80
|
+
revision = 0,
|
|
81
|
+
scope = defaultScope,
|
|
82
|
+
style,
|
|
83
|
+
}: ReminderProps) {
|
|
84
|
+
const timeZone = resolveTimeZone(
|
|
85
|
+
data.timeZone,
|
|
86
|
+
Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
87
|
+
)
|
|
88
|
+
const recurrence = data.recurrence ?? 'none'
|
|
89
|
+
const schema = reminderStoreSchema
|
|
90
|
+
const store = useConfiguredFeature({
|
|
91
|
+
name: id ?? defaultId,
|
|
92
|
+
revision,
|
|
93
|
+
schema,
|
|
94
|
+
scope,
|
|
95
|
+
seed: schema.parse({ dueAt: { value: data.dueAt }, title: { value: data.title } }),
|
|
96
|
+
})
|
|
97
|
+
const [draft, setDraft] = useState<{ dueAt: string | null; title: string }>({
|
|
98
|
+
dueAt: data.dueAt ?? null,
|
|
99
|
+
title: data.title,
|
|
100
|
+
})
|
|
101
|
+
const [baseline, setBaseline] = useState<typeof draft | null>(null)
|
|
102
|
+
const [editingDate, setEditingDate] = useState(false)
|
|
103
|
+
const editing = baseline !== null
|
|
104
|
+
const done = store.value.completedAt !== null
|
|
105
|
+
const due = parseInstant(store.value.dueAt.value)
|
|
106
|
+
const now = useClock(due !== null)
|
|
107
|
+
const title = store.value.title.value.trim()
|
|
108
|
+
? store.value.title.value
|
|
109
|
+
: 'Untitled reminder'
|
|
110
|
+
const dateFormat = format.formatters.getDateTimeFormat(format.locale, {
|
|
111
|
+
day: 'numeric',
|
|
112
|
+
month: 'long',
|
|
113
|
+
timeZone,
|
|
114
|
+
weekday: 'short',
|
|
115
|
+
year: 'numeric',
|
|
116
|
+
})
|
|
117
|
+
const timeFormat = format.formatters.getDateTimeFormat(format.locale, {
|
|
118
|
+
fractionalSecondDigits: due !== null && due % 1000 !== 0 ? 3 : undefined,
|
|
119
|
+
hour: 'numeric',
|
|
120
|
+
hour12: true,
|
|
121
|
+
minute: '2-digit',
|
|
122
|
+
second: due !== null && due % 60_000 !== 0 ? '2-digit' : undefined,
|
|
123
|
+
timeZone,
|
|
124
|
+
})
|
|
125
|
+
const dueStatus =
|
|
126
|
+
due === null
|
|
127
|
+
? 'No due date'
|
|
128
|
+
: done
|
|
129
|
+
? 'Due date'
|
|
130
|
+
: due < now
|
|
131
|
+
? 'Overdue'
|
|
132
|
+
: dateFormat.format(due) === dateFormat.format(now)
|
|
133
|
+
? 'Due today'
|
|
134
|
+
: 'Upcoming'
|
|
135
|
+
const next = done ? nextReminder(store.value.dueAt.value, recurrence, now) : null
|
|
136
|
+
const validTitle = draft.title.trim().length > 0
|
|
137
|
+
const changed =
|
|
138
|
+
baseline && (draft.title !== baseline.title || draft.dueAt !== baseline.dueAt)
|
|
139
|
+
const edit = () => {
|
|
140
|
+
const values = { dueAt: store.value.dueAt.value, title: store.value.title.value }
|
|
141
|
+
setDraft(values)
|
|
142
|
+
setBaseline(values)
|
|
143
|
+
}
|
|
144
|
+
return (
|
|
145
|
+
<FeatureFrame
|
|
146
|
+
style={style}
|
|
147
|
+
onRetry={store.retry}
|
|
148
|
+
notice={store.error}
|
|
149
|
+
component="reminder"
|
|
150
|
+
title={title}
|
|
151
|
+
detail={
|
|
152
|
+
store.value.completedAt === null
|
|
153
|
+
? undefined
|
|
154
|
+
: `Completed ${format.formatters
|
|
155
|
+
.getDateTimeFormat(format.locale, {
|
|
156
|
+
dateStyle: 'medium',
|
|
157
|
+
hour12: true,
|
|
158
|
+
timeStyle: 'short',
|
|
159
|
+
timeZone,
|
|
160
|
+
})
|
|
161
|
+
.format(store.value.completedAt)}`
|
|
162
|
+
}
|
|
163
|
+
trailing={
|
|
164
|
+
!editing && (
|
|
165
|
+
<FeatureEdit disabled={!store.ready} label="Edit reminder" onClick={edit} />
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
>
|
|
169
|
+
{editing && store.saving ? (
|
|
170
|
+
<Text {...stylex.props(roles.muted)}>Saving changes…</Text>
|
|
171
|
+
) : editing ? (
|
|
172
|
+
<Flex {...stylex.props(reminderStyles.editor)}>
|
|
173
|
+
<Flex {...stylex.props(layout.field)}>
|
|
174
|
+
<Text {...stylex.props(roles.label, layout.fieldLabel)}>Reminder</Text>
|
|
175
|
+
<Input
|
|
176
|
+
placeholder="Reminder"
|
|
177
|
+
value={draft.title}
|
|
178
|
+
onChange={title => setDraft(current => ({ ...current, title }))}
|
|
179
|
+
style={[layout.input]}
|
|
180
|
+
/>
|
|
181
|
+
{!validTitle && (
|
|
182
|
+
<Text {...stylex.props(roles.muted)}>Add a reminder title.</Text>
|
|
183
|
+
)}
|
|
184
|
+
</Flex>
|
|
185
|
+
<FeatureDateTime
|
|
186
|
+
inline
|
|
187
|
+
clearable
|
|
188
|
+
component="reminder"
|
|
189
|
+
label="Due date & time"
|
|
190
|
+
onChange={dueAt => setDraft(current => ({ ...current, dueAt }))}
|
|
191
|
+
onEditingChange={setEditingDate}
|
|
192
|
+
ready={store.ready}
|
|
193
|
+
timeZone={timeZone}
|
|
194
|
+
value={draft.dueAt}
|
|
195
|
+
/>
|
|
196
|
+
<Flex {...stylex.props(layout.actions)}>
|
|
197
|
+
<FeatureAction component="reminder" onClick={() => setBaseline(null)}>
|
|
198
|
+
Cancel
|
|
199
|
+
</FeatureAction>
|
|
200
|
+
<FeatureAction
|
|
201
|
+
component="reminder"
|
|
202
|
+
disabled={
|
|
203
|
+
editingDate || store.saving || !store.ready || !changed || !validTitle
|
|
204
|
+
}
|
|
205
|
+
onClick={() => {
|
|
206
|
+
if (editingDate || !baseline || !changed || !validTitle) {
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
store.set(
|
|
210
|
+
current => ({
|
|
211
|
+
...(draft.title !== baseline.title &&
|
|
212
|
+
draft.title !== current.title.value && {
|
|
213
|
+
title: { value: draft.title },
|
|
214
|
+
}),
|
|
215
|
+
...(draft.dueAt !== baseline.dueAt &&
|
|
216
|
+
draft.dueAt !== current.dueAt.value && {
|
|
217
|
+
dueAt: { value: draft.dueAt },
|
|
218
|
+
}),
|
|
219
|
+
}),
|
|
220
|
+
() => setBaseline(null)
|
|
221
|
+
)
|
|
222
|
+
}}
|
|
223
|
+
variant="primary"
|
|
224
|
+
>
|
|
225
|
+
{store.saving ? 'Saving…' : 'Save changes'}
|
|
226
|
+
</FeatureAction>
|
|
227
|
+
</Flex>
|
|
228
|
+
</Flex>
|
|
229
|
+
) : (
|
|
230
|
+
<>
|
|
231
|
+
<FeatureFacts>
|
|
232
|
+
<List.Item
|
|
233
|
+
label={dueStatus}
|
|
234
|
+
trailing={due === null ? 'Not set' : dateFormat.format(due)}
|
|
235
|
+
/>
|
|
236
|
+
{due !== null && <List.Item label="Time" trailing={timeFormat.format(due)} />}
|
|
237
|
+
{recurrence !== 'none' && (
|
|
238
|
+
<List.Item
|
|
239
|
+
description={
|
|
240
|
+
due === null ? 'Add a due date to start repeating.' : undefined
|
|
241
|
+
}
|
|
242
|
+
label="Repeats"
|
|
243
|
+
trailing={recurrence === 'daily' ? 'Every 24 hours' : 'Every 7 days'}
|
|
244
|
+
/>
|
|
245
|
+
)}
|
|
246
|
+
{next && (
|
|
247
|
+
<List.Item
|
|
248
|
+
label="Next occurrence"
|
|
249
|
+
trailing={`${dateFormat.format(Date.parse(next))} · ${timeFormat.format(Date.parse(next))}`}
|
|
250
|
+
/>
|
|
251
|
+
)}
|
|
252
|
+
</FeatureFacts>
|
|
253
|
+
<Flex {...stylex.props(layout.actions)}>
|
|
254
|
+
{next && (
|
|
255
|
+
<FeatureAction
|
|
256
|
+
component="reminder"
|
|
257
|
+
disabled={!store.ready}
|
|
258
|
+
icon="arrow.right"
|
|
259
|
+
onClick={() =>
|
|
260
|
+
store.set(current => {
|
|
261
|
+
const dueAt = nextReminder(
|
|
262
|
+
current.dueAt.value,
|
|
263
|
+
recurrence,
|
|
264
|
+
Date.now()
|
|
265
|
+
)
|
|
266
|
+
return current.completedAt !== null && dueAt
|
|
267
|
+
? { completedAt: null, dueAt: { value: dueAt } }
|
|
268
|
+
: {}
|
|
269
|
+
})
|
|
270
|
+
}
|
|
271
|
+
variant="primary"
|
|
272
|
+
>
|
|
273
|
+
Start next reminder
|
|
274
|
+
</FeatureAction>
|
|
275
|
+
)}
|
|
276
|
+
<FeatureAction
|
|
277
|
+
component="reminder"
|
|
278
|
+
disabled={!store.ready}
|
|
279
|
+
icon={done ? 'arrow.uturn.backward' : 'checkmark'}
|
|
280
|
+
onClick={() =>
|
|
281
|
+
store.set(current => ({
|
|
282
|
+
completedAt: current.completedAt === null ? Date.now() : null,
|
|
283
|
+
}))
|
|
284
|
+
}
|
|
285
|
+
variant={next ? 'secondary' : 'primary'}
|
|
286
|
+
>
|
|
287
|
+
{done ? 'Reopen' : 'Complete'}
|
|
288
|
+
</FeatureAction>
|
|
289
|
+
</Flex>
|
|
290
|
+
</>
|
|
291
|
+
)}
|
|
292
|
+
</FeatureFrame>
|
|
293
|
+
)
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const reminderStyles = /* @__PURE__ */ stylex.create({
|
|
297
|
+
editor: { gap: space[5] },
|
|
298
|
+
})
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Flex, Text } from '@flickfyi/core'
|
|
2
|
+
import { Field, List } from '@flickfyi/core/molecules'
|
|
3
|
+
import * as stylex from '@stylexjs/stylex'
|
|
4
|
+
import { z } from 'zod/v4'
|
|
5
|
+
|
|
6
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
7
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
8
|
+
import { everydayStyles } from '~/kowalski/everyday'
|
|
9
|
+
import { featureFields, store } from '~/kowalski/feature-schema'
|
|
10
|
+
import { format } from '~/kowalski/format'
|
|
11
|
+
import {
|
|
12
|
+
FeatureAction,
|
|
13
|
+
FeatureFacts,
|
|
14
|
+
FeatureFrame,
|
|
15
|
+
FeatureWell,
|
|
16
|
+
layout,
|
|
17
|
+
} from '~/kowalski/frame'
|
|
18
|
+
import { appearance, roles } from '~/themes/shared'
|
|
19
|
+
|
|
20
|
+
const defaultId = 'KowalskiRotation'
|
|
21
|
+
const defaultScope = 'private'
|
|
22
|
+
|
|
23
|
+
export const RotationData = /* @__PURE__ */ z
|
|
24
|
+
.strictObject({
|
|
25
|
+
people: z
|
|
26
|
+
.array(
|
|
27
|
+
z.strictObject({
|
|
28
|
+
id: z.string().describe('A short ID, unique within this list, e.g. "tent".'),
|
|
29
|
+
label: z.string().describe('A person’s name.'),
|
|
30
|
+
})
|
|
31
|
+
)
|
|
32
|
+
.describe('Everyone taking turns, in order.'),
|
|
33
|
+
task: z.string().describe('The chore or turn, e.g. "Take out the trash".'),
|
|
34
|
+
title: z.string().optional().describe('A short heading. Omit for "Whose turn".'),
|
|
35
|
+
})
|
|
36
|
+
.describe('Take turns through a fixed group in order and pass the turn on when done.')
|
|
37
|
+
|
|
38
|
+
export type RotationData = z.infer<typeof RotationData>
|
|
39
|
+
|
|
40
|
+
export const RotationProps = z.strictObject({
|
|
41
|
+
data: RotationData,
|
|
42
|
+
...featureFields,
|
|
43
|
+
scope: featureFields.scope.default(defaultScope),
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
export type RotationProps = z.input<typeof RotationProps> & {
|
|
47
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const rotationStoreSchema = store({
|
|
51
|
+
completed: z.number().default(0),
|
|
52
|
+
turn: z.string().nullable().default(null),
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
export const createSchemas: CreateSchemas = ({
|
|
56
|
+
id = defaultId,
|
|
57
|
+
scope = defaultScope,
|
|
58
|
+
} = {}) => ({
|
|
59
|
+
[`stores/${scope}/${id}`]: rotationStoreSchema,
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
export function Rotation({
|
|
63
|
+
data,
|
|
64
|
+
id,
|
|
65
|
+
revision = 0,
|
|
66
|
+
scope = defaultScope,
|
|
67
|
+
style,
|
|
68
|
+
}: RotationProps) {
|
|
69
|
+
const people = data.people.length > 0 ? data.people : [{ id: 'you', label: 'You' }]
|
|
70
|
+
const schema = rotationStoreSchema
|
|
71
|
+
const store = useConfiguredFeature({
|
|
72
|
+
name: id ?? defaultId,
|
|
73
|
+
revision,
|
|
74
|
+
schema,
|
|
75
|
+
scope,
|
|
76
|
+
seed: schema.parse({}),
|
|
77
|
+
})
|
|
78
|
+
// A saved turn for someone no longer in the group falls back to the first person.
|
|
79
|
+
const position = (turn: string | null) =>
|
|
80
|
+
Math.max(
|
|
81
|
+
0,
|
|
82
|
+
people.findIndex(person => person.id === turn)
|
|
83
|
+
)
|
|
84
|
+
const current = people[position(store.value.turn)]
|
|
85
|
+
const pass = (completed: boolean) =>
|
|
86
|
+
store.set(state => ({
|
|
87
|
+
completed: state.completed + (completed ? 1 : 0),
|
|
88
|
+
turn: people[(position(state.turn) + 1) % people.length].id,
|
|
89
|
+
}))
|
|
90
|
+
return (
|
|
91
|
+
<FeatureFrame
|
|
92
|
+
style={style}
|
|
93
|
+
onRetry={store.retry}
|
|
94
|
+
notice={store.error}
|
|
95
|
+
component="rotation"
|
|
96
|
+
title={data.title ?? 'Whose turn'}
|
|
97
|
+
detail={data.task}
|
|
98
|
+
>
|
|
99
|
+
<Field
|
|
100
|
+
label={
|
|
101
|
+
store.value.completed > 0
|
|
102
|
+
? `Order · ${format.formatNumber(store.value.completed)} done so far`
|
|
103
|
+
: 'Order'
|
|
104
|
+
}
|
|
105
|
+
>
|
|
106
|
+
<FeatureFacts>
|
|
107
|
+
{people.map(person => (
|
|
108
|
+
<List.Item
|
|
109
|
+
key={person.id}
|
|
110
|
+
label={person.label}
|
|
111
|
+
trailing={
|
|
112
|
+
person.id === current.id ? (
|
|
113
|
+
<Text {...stylex.props(roles.muted, appearance.accent)}>Now</Text>
|
|
114
|
+
) : undefined
|
|
115
|
+
}
|
|
116
|
+
/>
|
|
117
|
+
))}
|
|
118
|
+
</FeatureFacts>
|
|
119
|
+
</Field>
|
|
120
|
+
<FeatureWell style={everydayStyles.centered}>
|
|
121
|
+
<Text {...stylex.props(roles.label, layout.fieldLabel)}>Up now</Text>
|
|
122
|
+
<Text {...stylex.props(roles.h1)}>{current.label}</Text>
|
|
123
|
+
</FeatureWell>
|
|
124
|
+
<Flex {...stylex.props(layout.actions)}>
|
|
125
|
+
<FeatureAction
|
|
126
|
+
component="rotation"
|
|
127
|
+
disabled={!store.ready}
|
|
128
|
+
size="lg"
|
|
129
|
+
onClick={() => pass(false)}
|
|
130
|
+
>
|
|
131
|
+
Skip
|
|
132
|
+
</FeatureAction>
|
|
133
|
+
<FeatureAction
|
|
134
|
+
component="rotation"
|
|
135
|
+
disabled={!store.ready}
|
|
136
|
+
icon="checkmark"
|
|
137
|
+
size="lg"
|
|
138
|
+
variant="primary"
|
|
139
|
+
onClick={() => pass(true)}
|
|
140
|
+
>
|
|
141
|
+
Done
|
|
142
|
+
</FeatureAction>
|
|
143
|
+
</Flex>
|
|
144
|
+
</FeatureFrame>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Text } from '@flickfyi/core'
|
|
2
|
+
import { List, Stepper } from '@flickfyi/core/molecules'
|
|
3
|
+
import * as stylex from '@stylexjs/stylex'
|
|
4
|
+
import { z } from 'zod/v4'
|
|
5
|
+
|
|
6
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
7
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
8
|
+
import { everydayStyles } from '~/kowalski/everyday'
|
|
9
|
+
import { entries, featureFields } from '~/kowalski/feature-schema'
|
|
10
|
+
import { format } from '~/kowalski/format'
|
|
11
|
+
import { FeatureAction, FeatureFacts, FeatureFrame } from '~/kowalski/frame'
|
|
12
|
+
import { appearance, roles } from '~/themes/shared'
|
|
13
|
+
|
|
14
|
+
const defaultId = 'KowalskiScoreboard'
|
|
15
|
+
const defaultScope = 'private'
|
|
16
|
+
|
|
17
|
+
export const ScoreboardData = /* @__PURE__ */ z
|
|
18
|
+
.strictObject({
|
|
19
|
+
players: z
|
|
20
|
+
.array(
|
|
21
|
+
z.strictObject({
|
|
22
|
+
id: z.string().describe('A short ID, unique within this list, e.g. "tent".'),
|
|
23
|
+
label: z.string().describe('A player or team name.'),
|
|
24
|
+
})
|
|
25
|
+
)
|
|
26
|
+
.describe('Everyone keeping score.'),
|
|
27
|
+
step: z.number().optional().describe('Points per tap. Omit for 1.'),
|
|
28
|
+
title: z.string().optional().describe('A short heading. Omit for "Scores".'),
|
|
29
|
+
})
|
|
30
|
+
.describe(
|
|
31
|
+
'Keep score for a few players with a fixed step. Not a distributed counter or a league.'
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
export type ScoreboardData = z.infer<typeof ScoreboardData>
|
|
35
|
+
|
|
36
|
+
export const ScoreboardProps = z.strictObject({
|
|
37
|
+
data: ScoreboardData,
|
|
38
|
+
...featureFields,
|
|
39
|
+
scope: featureFields.scope.default(defaultScope),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
export type ScoreboardProps = z.input<typeof ScoreboardProps> & {
|
|
43
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const scoreboardStoreSchema = entries('score_', z.number(), {})
|
|
47
|
+
|
|
48
|
+
export const createSchemas: CreateSchemas = ({
|
|
49
|
+
id = defaultId,
|
|
50
|
+
scope = defaultScope,
|
|
51
|
+
} = {}) => ({
|
|
52
|
+
[`stores/${scope}/${id}`]: scoreboardStoreSchema,
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
export function Scoreboard({
|
|
56
|
+
data,
|
|
57
|
+
id,
|
|
58
|
+
revision = 0,
|
|
59
|
+
scope = defaultScope,
|
|
60
|
+
style,
|
|
61
|
+
}: ScoreboardProps) {
|
|
62
|
+
const players = data.players
|
|
63
|
+
const schema = scoreboardStoreSchema
|
|
64
|
+
const store = useConfiguredFeature({
|
|
65
|
+
name: id ?? defaultId,
|
|
66
|
+
revision,
|
|
67
|
+
schema,
|
|
68
|
+
scope,
|
|
69
|
+
seed: schema.parse({}),
|
|
70
|
+
})
|
|
71
|
+
const scoreOf = (id: string) => store.value[`score_${id}`] ?? 0
|
|
72
|
+
const best = Math.max(...players.map(player => scoreOf(player.id)))
|
|
73
|
+
const leaders = players.filter(player => scoreOf(player.id) === best)
|
|
74
|
+
const started = players.some(player => scoreOf(player.id) !== 0)
|
|
75
|
+
const change = (id: string, direction: -1 | 1) =>
|
|
76
|
+
store.set(current => ({
|
|
77
|
+
[`score_${id}`]: (current[`score_${id}`] ?? 0) + direction * (data.step ?? 1),
|
|
78
|
+
}))
|
|
79
|
+
return (
|
|
80
|
+
<FeatureFrame
|
|
81
|
+
style={style}
|
|
82
|
+
onRetry={store.retry}
|
|
83
|
+
notice={store.error}
|
|
84
|
+
component="scoreboard"
|
|
85
|
+
title={data.title ?? 'Scores'}
|
|
86
|
+
trailing={
|
|
87
|
+
<Text
|
|
88
|
+
{...stylex.props(
|
|
89
|
+
roles.muted,
|
|
90
|
+
started && leaders.length === 1 && appearance.accent
|
|
91
|
+
)}
|
|
92
|
+
>
|
|
93
|
+
{started
|
|
94
|
+
? leaders.length === 1
|
|
95
|
+
? `${leaders[0].label} leads`
|
|
96
|
+
: `Tied at ${format.formatNumber(best)}`
|
|
97
|
+
: 'No scores yet'}
|
|
98
|
+
</Text>
|
|
99
|
+
}
|
|
100
|
+
>
|
|
101
|
+
<FeatureFacts>
|
|
102
|
+
{players.map(player => (
|
|
103
|
+
<List.Item
|
|
104
|
+
key={player.id}
|
|
105
|
+
label={player.label}
|
|
106
|
+
trailing={
|
|
107
|
+
<Stepper
|
|
108
|
+
decrementDisabled={!store.ready}
|
|
109
|
+
decrementLabel={`Lower ${player.label}`}
|
|
110
|
+
incrementDisabled={!store.ready}
|
|
111
|
+
incrementLabel={`Raise ${player.label}`}
|
|
112
|
+
onDecrement={() => change(player.id, -1)}
|
|
113
|
+
onIncrement={() => change(player.id, 1)}
|
|
114
|
+
>
|
|
115
|
+
<Text {...stylex.props(roles.h2, everydayStyles.score)}>
|
|
116
|
+
{format.formatNumber(scoreOf(player.id))}
|
|
117
|
+
</Text>
|
|
118
|
+
</Stepper>
|
|
119
|
+
}
|
|
120
|
+
/>
|
|
121
|
+
))}
|
|
122
|
+
</FeatureFacts>
|
|
123
|
+
{started && (
|
|
124
|
+
<FeatureAction
|
|
125
|
+
component="scoreboard"
|
|
126
|
+
disabled={!store.ready}
|
|
127
|
+
icon="arrow.counterclockwise"
|
|
128
|
+
onClick={() =>
|
|
129
|
+
store.set(() =>
|
|
130
|
+
Object.fromEntries(players.map(player => [`score_${player.id}`, 0]))
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
>
|
|
134
|
+
New game
|
|
135
|
+
</FeatureAction>
|
|
136
|
+
)}
|
|
137
|
+
</FeatureFrame>
|
|
138
|
+
)
|
|
139
|
+
}
|