{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "waitlist-how",
  "title": "Waitlist: How the line moves",
  "description": "How the line moves, shown as a sample referral page in a full frame: the link, the place, friends joined, places moved and the distance to the next wave, over a table of every friend with how far each moved the place, all counted from the friend list.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://eased.dev/r/eased-tokens.json",
    "https://eased.dev/r/eased-motion.json",
    "https://eased.dev/r/waitlist-core.json"
  ],
  "files": [
    {
      "path": "src/registry/eased/templates/waitlist/how.tsx",
      "content": "import { how, queue } from \"./content\";\nimport { COLUMN, formatPlace, LABEL, Mark, Reveal, TITLE } from \"./kit\";\n\n/**\n * How the line moves, shown rather than told: a sample person's referrals a week in, in a full\n * frame, titled as theirs so it never stands in for the template's own Your place page. Their place, their link, the totals, and every friend who joined from it with how\n * far each one moved them. Every number is counted from `how.friends`: a confirmed friend moves\n * the place up `queue.credit`, never past #1, and one who hasn't confirmed moves nothing.\n */\n\n/** Each friend with the places they moved the sample person and the place after. */\nconst ROWS = how.friends.reduce<{ name: string; joined: string; via: string; confirmed: boolean; moved: number; after: number }[]>((rows, f) => {\n  const before = rows.at(-1)?.after ?? how.joinedAt;\n  const after = f.confirmed ? Math.max(1, before - queue.credit) : before;\n  return [...rows, { ...f, moved: before - after, after }];\n}, []);\nconst PLACE = ROWS.at(-1)?.after ?? how.joinedAt;\nconst CONFIRMED = how.friends.filter((f) => f.confirmed).length;\nconst TO_GO = Math.max(0, PLACE - how.wave);\n\nconst STATS = [\n  { label: how.stats.place, value: formatPlace(PLACE), note: how.stats.from(formatPlace(how.joinedAt)), brand: true },\n  { label: how.stats.friends, value: String(how.friends.length), note: how.stats.confirmed(CONFIRMED) },\n  { label: how.stats.moved, value: String(how.joinedAt - PLACE), note: how.stats.per(queue.credit) },\n  { label: how.stats.wave, value: String(TO_GO), note: how.stats.toGo(TO_GO, formatPlace(how.wave)) },\n];\n\nexport function How() {\n  return (\n    <section aria-labelledby=\"how-title\" className={`${COLUMN} flex flex-col gap-group py-section`}>\n      <Reveal className=\"grid gap-pad-md lg:grid-cols-[minmax(0,6fr)_minmax(0,5fr)] lg:items-end lg:gap-group-lg\">\n        <div className=\"flex flex-col gap-pad-sm\">\n          <p className={LABEL}>{how.label}</p>\n          <h2 id=\"how-title\" className={TITLE}>\n            {how.title}\n          </h2>\n        </div>\n        <p className=\"max-w-xl text-ui-md text-pretty text-text-secondary sm:text-ui-lg\">{how.lead}</p>\n      </Reveal>\n      <Reveal index={1}>\n        <figure className=\"flex flex-col gap-pad-sm\">\n          <div className=\"min-w-0 overflow-hidden rounded-surface bg-surface shadow-floating\">\n            <Top />\n            <div className=\"flex flex-col gap-pad-md p-pad-base sm:p-pad-lg\">\n              <Head />\n              <Stats />\n              <Friends />\n            </div>\n          </div>\n          <figcaption className=\"text-ui-sm text-text-muted\">{how.caption}</figcaption>\n        </figure>\n      </Reveal>\n    </section>\n  );\n}\n\n/** The page's own top bar: the mark and the signed-in sample person. */\nfunction Top() {\n  return (\n    <div className=\"flex items-center justify-between gap-pad-base border-b border-line-subtle px-pad-base py-2.5 sm:px-pad-lg\">\n      <span className=\"flex items-center gap-2 text-ui-sm font-semibold tracking-display text-text\">\n        <Mark className=\"size-4 text-brand\" />\n        {how.page}\n      </span>\n      <span className=\"flex items-center gap-2 text-ui-sm text-text-secondary\">\n        {how.person.name}\n        <span aria-hidden className=\"grid size-7 place-items-center rounded-full bg-brand-subtle font-mono text-ui-2xs text-brand-text\">\n          {how.person.initials}\n        </span>\n      </span>\n    </div>\n  );\n}\n\n/** The link, as the page shows it. A picture of the button: the template's own copy lives in the hero. */\nfunction Head() {\n  return (\n    <div className=\"flex min-w-0 items-center gap-2\">\n      <span className=\"flex h-control-md min-w-0 flex-1 items-center rounded-control border border-line bg-bg px-3 font-mono text-ui-sm text-text sm:max-w-md\">\n        <span className=\"truncate\">{how.link}</span>\n      </span>\n      <span aria-hidden className=\"inline-flex h-control-md shrink-0 items-center rounded-control bg-brand px-3.5 text-ui-sm font-medium text-text-on-brand\">\n        {how.copy}\n      </span>\n    </div>\n  );\n}\n\n/** The totals, one cell each, the place first and in the brand. */\nfunction Stats() {\n  return (\n    <dl className=\"grid grid-cols-2 overflow-hidden rounded-panel border border-line-subtle md:grid-cols-4\">\n      {STATS.map((s, i) => (\n        <div\n          key={s.label}\n          className={`flex min-w-0 flex-col gap-1 p-pad-base ${s.brand ? \"bg-brand-subtle\" : \"\"} ${i % 2 ? \"border-s border-line-subtle\" : \"\"} ${i > 1 ? \"max-md:border-t max-md:border-line-subtle\" : \"\"} ${i === 2 ? \"md:border-s md:border-line-subtle\" : \"\"}`}\n        >\n          <dt className={`text-ui-sm ${s.brand ? \"text-brand-text\" : \"text-text-muted\"}`}>{s.label}</dt>\n          <dd className=\"font-serif text-display-2xl leading-none tracking-display text-text tabular-nums sm:text-display-3xl\">{s.value}</dd>\n          <dd className=\"text-ui-sm text-text-secondary\">{s.note}</dd>\n        </div>\n      ))}\n    </dl>\n  );\n}\n\n/** Every friend in the order they joined, what they moved and where it left the place. */\nfunction Friends() {\n  const { columns } = how.table;\n  const head = \"py-2 pe-pad-sm text-left text-ui-sm font-normal text-text-muted\";\n  const cell = \"py-2.5 pe-pad-sm text-ui-md tabular-nums\";\n  return (\n    <table className=\"w-full border-collapse\">\n      <caption className=\"sr-only\">{how.table.caption}</caption>\n      <thead>\n        <tr className=\"border-b border-line\">\n          <th scope=\"col\" className={head}>\n            {columns.friend}\n          </th>\n          <th scope=\"col\" className={`${head} max-md:hidden`}>\n            {columns.joined}\n          </th>\n          <th scope=\"col\" className={`${head} max-lg:hidden`}>\n            {columns.via}\n          </th>\n          <th scope=\"col\" className={head}>\n            <span className=\"max-sm:sr-only\">{columns.status}</span>\n          </th>\n          <th scope=\"col\" className={`${head} text-right`}>\n            {columns.moved}\n          </th>\n          <th scope=\"col\" className={`${head} pe-0 text-right`}>\n            {columns.place}\n          </th>\n        </tr>\n      </thead>\n      <tbody>\n        {ROWS.map((r) => (\n          <tr key={r.name} className=\"border-b border-line-subtle last:border-0\">\n            <th scope=\"row\" className={`${cell} text-left font-normal text-text`}>\n              {r.name}\n            </th>\n            <td className={`${cell} text-text-secondary max-md:hidden`}>{r.joined}</td>\n            <td className={`${cell} text-text-secondary max-lg:hidden`}>{r.via}</td>\n            <td className={cell}>\n              <span className={`inline-flex items-center gap-1.5 text-ui-sm ${r.confirmed ? \"text-text\" : \"text-text-muted\"}`}>\n                <span aria-hidden className={`size-1.5 rounded-full ${r.confirmed ? \"bg-brand\" : \"shadow-[inset_0_0_0_1px_var(--eased-line-strong)]\"}`} />\n                <span className=\"max-sm:sr-only\">{r.confirmed ? how.table.confirmed : how.table.waiting}</span>\n              </span>\n            </td>\n            <td className={`${cell} text-right ${r.moved ? \"text-text\" : \"text-text-muted\"}`}>{r.moved ? `+${r.moved}` : \"0\"}</td>\n            <td className={`${cell} pe-0 text-right font-medium text-text`}>{formatPlace(r.after)}</td>\n          </tr>\n        ))}\n      </tbody>\n    </table>\n  );\n}\n",
      "type": "registry:component",
      "target": "@components/eased/templates/waitlist/how.tsx"
    }
  ],
  "meta": {
    "template": "waitlist",
    "kind": "template-section",
    "industries": [
      "saas"
    ]
  },
  "type": "registry:block"
}