Redesign the setup flow and consolidate the CSS into one primitives layer
Onboarding asks explicitly for one or two parents and shows one card per parent for balances; the balance form is per parent with inline validation; the partner can be filled from the FK deduction or added from it. Settings and Dashboard reuse the same form. CSS: bare buttons carry no colour any more; buttons, cards, choice cards, fields, alerts, badges, eyebrow and modal chrome are defined once in primitives.css. Media queries live only in responsive.css. A style guard test blocks hex, !important and stray media queries. Bilingual fixes: calendar selects size by content, header no longer wraps. Vitest is capped at four workers. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import * as api from '@/services/api'
|
||||
import { useLatestRequest } from './useLatestRequest'
|
||||
import { useWorkspace } from '@/context'
|
||||
import type { DayOverride, DayOverrideCreateRequest } from '@/types'
|
||||
|
||||
interface UseDayOverridesResult {
|
||||
@@ -16,6 +17,7 @@ export function useDayOverrides(workspaceId: string): UseDayOverridesResult {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const { start, isCurrent } = useLatestRequest()
|
||||
const { bumpPlanVersion } = useWorkspace()
|
||||
|
||||
const fetch = useCallback(async () => {
|
||||
const requestId = start()
|
||||
@@ -42,16 +44,22 @@ export function useDayOverrides(workspaceId: string): UseDayOverridesResult {
|
||||
async (req: DayOverrideCreateRequest) => {
|
||||
await api.upsertDayOverride(req)
|
||||
await fetch()
|
||||
// An override changes which days count as free/working, which feeds
|
||||
// the at-risk-days analytics — bump the shared invalidation counter
|
||||
// so other hook instances (e.g. useAnalytics) refetch. See
|
||||
// `WorkspaceContext.planVersion`.
|
||||
bumpPlanVersion()
|
||||
},
|
||||
[fetch],
|
||||
[fetch, bumpPlanVersion],
|
||||
)
|
||||
|
||||
const remove = useCallback(
|
||||
async (id: string) => {
|
||||
await api.deleteDayOverride(id)
|
||||
await fetch()
|
||||
bumpPlanVersion()
|
||||
},
|
||||
[fetch],
|
||||
[fetch, bumpPlanVersion],
|
||||
)
|
||||
|
||||
return { data, isLoading, error, upsert, remove }
|
||||
|
||||
Reference in New Issue
Block a user