diff --git a/src/features/store-admin/SetupChecklist.tsx b/src/features/store-admin/SetupChecklist.tsx index e0bd88b..387d208 100644 --- a/src/features/store-admin/SetupChecklist.tsx +++ b/src/features/store-admin/SetupChecklist.tsx @@ -1,110 +1,184 @@ /** - * Getting a new shop from "signed in" to "on sale", on the page they land on. + * Walking a new merchant from "signed in" to "on sale", one step at a time. * - * There was no onboarding of any kind in this console — no checklist, no tour, - * no first-run anything. A brand-new merchant landed on a dashboard showing - * four KPI cards reading ₹0 and a line saying "No branches yet" with nothing to - * click, which reads as *everything is fine* rather than *nothing is set up*. + * It began as a plain checklist and that was not enough: seven lines all + * demanding attention equally is a list of homework, not guidance. Somebody who + * has never used the console does not need to be told there are seven things — + * they need to be told the ONE thing to do now, with a button that does it. * - * Kmart is the argument for this screen: one branch, two products, both - * unpriced, so nothing had ever been sellable — stuck since July with no - * screen anywhere saying which step they were on. + * So one step is in front of you at a time, with a real action and a way past + * it. The rest are a progress rail: visible, so nobody feels tricked about how + * far there is to go, but quiet. * - * Every tick is derived from live data, so the card cannot claim work that was - * not done, and it disappears entirely once the shop is trading. + * Every tick is derived from live data (see `setupSteps.ts`), so the card can + * never claim work that was not done. The only stored thing is what somebody + * chose to skip, and skipping never marks a step done — an unpriced catalogue + * does not start selling because a card was dismissed. */ +import { useMemo, useState } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { Button } from '@astryxdesign/core/Button'; import { Card } from '@astryxdesign/core/Card'; import { HStack } from '@astryxdesign/core/HStack'; import { Text } from '@astryxdesign/core/Text'; import { VStack } from '@astryxdesign/core/VStack'; -import { Link } from 'react-router-dom'; -import { Check, Circle } from 'lucide-react'; -import { setupSteps, currentStep, isSetupComplete, type SetupInput } from './setupSteps'; +import { ArrowRight, Check } from 'lucide-react'; +import { setupSteps, isSetupComplete, type SetupInput, type SetupStep } from './setupSteps'; +import { focusStep, isPaused, resumeAll, skipStep, skippedSteps } from './setupProgress'; -export function SetupChecklist(input: SetupInput) { - const steps = setupSteps(input); +export function SetupChecklist(input: SetupInput & { tenantid: number }) { + const { tenantid, ...data } = input; + const navigate = useNavigate(); + const [skipped, setSkipped] = useState(() => skippedSteps(tenantid)); - // Gone once the shop is trading. A checklist that lingers after it is - // finished becomes furniture, and stops being read the next time it matters. + const steps = useMemo(() => setupSteps(data), [data]); + const done = steps.filter((step) => step.done).length; + const focus = focusStep(steps, skipped); + const paused = isPaused(steps, skipped); + + // Gone once the shop is selling. A card that outlives its purpose becomes + // furniture and stops being read the next time it matters. if (isSetupComplete(steps)) return null; - const now = currentStep(steps); - const done = steps.filter((step) => step.done).length; + /* Everything outstanding was waved past. One quiet line rather than nothing: + the work is still undone, and a card that vanished entirely would leave no + way back to it. */ + if (paused || !focus) { + return ( + + + + Setup paused — {done} of {steps.length} done. + +