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 { ArrowRight, Boxes, Rocket, Store, type LucideIcon } from 'lucide-react'; /** * The first screen, and the only one whose job is not to collect anything. * * It exists to get somebody to begin, so it says what setup is worth and what * it costs, and nothing else. The temptation is to explain the whole product * here; a shopkeeper who has just signed in has no way to use any of it yet, * and a wall of text before the first field is what makes people close the tab. * * The one promise made in words is the one the state layer actually keeps: * progress is saved, so leaving is safe. */ /** One of the three cards under the greeting. */ export interface WelcomeBenefit { icon: LucideIcon; title: string; body: string; } export interface WelcomeStepProps { shopName?: string; done: number; total: number; isReturning: boolean; /** * What setup is worth, in three cards. * * Given by the caller because the two roles are promised different things: a * merchant is told about the catalogue and going on sale, a branch user about * their own account and their shelf. The SHAPE is shared — that is the point * of this component — and only the words differ. */ benefits?: readonly WelcomeBenefit[]; /** The greeting, when the default merchant wording is not the right one. */ greeting?: string; blurb?: string; onStart: () => void; } const BENEFITS = [ { icon: Rocket, title: 'Quick setup', body: 'Five short steps. Most shops are through it in a few minutes.', }, { icon: Boxes, title: 'Manage your catalogue', body: 'Upload a spreadsheet or add products one at a time — whichever you have.', }, { icon: Store, title: 'Ready for customers', body: 'Finish, and your products are on sale in the app.', }, ] as const; export function WelcomeStep({ shopName, done, total, isReturning, benefits = BENEFITS, greeting, blurb, onStart, }: WelcomeStepProps) { const pct = total === 0 ? 0 : Math.round((done / total) * 100); return ( {/* A mark rather than an illustration. A stock drawing would be the one thing on screen not drawn from the console's own design language. */} {isReturning ? 'Welcome back 👋' : (greeting ?? `Welcome${shopName ? ` to ${shopName}` : ''}! 👋`)} {isReturning ? `You have completed ${done} of ${total} setup steps. Pick up where you left off.` : (blurb ?? "Let's get your store ready to start selling.")}
{benefits.map(({ icon: Icon, title, body }) => ( {title} {body} ))}
{done} of {total} steps completed