{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "help-center-02",
  "title": "Help article",
  "description": "A help article with breadcrumbs, numbered steps, a note, related articles and a person to write to: answer Was this helpful and the question turns into a thank-you in the same place, after a short field for what was missing when the answer is No.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/breadcrumb.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/company-mark.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/recipes.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/status-orb.json",
    "https://ui.ndekocode.dev/r/textarea.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-kept-height.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/help-center/help-center-02/index.tsx",
      "content": "'use client';\n\nimport { useId } from 'react';\n\nimport { useKeptHeight } from '@/registry/ndeko/hooks/use-kept-height';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport { ChevronRightIcon, InfoIcon } from '@/registry/ndeko/lib/icons';\nimport { FOCUS_RING } from '@/registry/ndeko/lib/recipes';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport {\n  Breadcrumb,\n  BreadcrumbItem,\n  BreadcrumbLink,\n  BreadcrumbList,\n  BreadcrumbPage,\n  BreadcrumbSeparator,\n} from '@/registry/ndeko/ui/breadcrumb';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\nimport {\n  ARTICLE,\n  CONTACT,\n  RELATED,\n  SECTIONS,\n  SITE,\n  type ArticleBlock,\n} from './data';\nimport { FeedbackCard } from './feedback-card';\nimport {\n  INITIAL,\n  LOOP_AFTER_MS,\n  reducer,\n  RESTING,\n  SCRIPT,\n  type FeedbackAction,\n} from './session';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\nconst CARD =\n  'bg-card hairline-ring ring-border dark:bg-foreground/[0.03] rounded-xl shadow-[0_1px_2px_rgb(0_0_0/0.04)]';\n\nfunction Block({ block }: { block: ArticleBlock }) {\n  if (block.kind === 'steps') {\n    return (\n      <ol className='flex flex-col gap-3'>\n        {block.items.map((item, index) => (\n          <li key={item} className='flex items-start gap-3'>\n            <span className='keycap-3d text-muted-foreground flex size-6 shrink-0 items-center justify-center rounded-md text-xs font-medium tabular-nums'>\n              {index + 1}\n            </span>\n            <span className='pt-0.5 text-[15px] leading-6 text-pretty'>\n              {item}\n            </span>\n          </li>\n        ))}\n      </ol>\n    );\n  }\n  if (block.kind === 'note') {\n    return (\n      <p className='bg-info/10 flex items-start gap-3 rounded-xl px-4 py-3 text-[13px] leading-5'>\n        <InfoIcon className='text-info-foreground mt-px size-4 shrink-0' />\n        <span>\n          {block.text}{' '}\n          <a\n            href={block.href}\n            className={cn(\n              'text-primary-ink rounded-sm font-medium underline-offset-4 hover:underline',\n              FOCUS_RING\n            )}\n          >\n            {block.linkLabel}\n          </a>\n        </span>\n      </p>\n    );\n  }\n  return <p className='text-[15px] leading-7 text-pretty'>{block.text}</p>;\n}\n\nexport default function HelpCenter02() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  const relatedId = useId();\n  const message = spokenUnless(isAutoplaying, state.spoken);\n  const canReplay = isFinished && !isAutoplaying;\n  useKeptHeight(ref);\n\n  function focusLater(selector: string) {\n    requestAnimationFrame(() => {\n      const target = ref.current?.querySelector<HTMLElement>(selector);\n      target?.focus();\n    });\n  }\n\n  /** The controls a person used leave with the question, so the focus follows to what replaced them. */\n  function actAndFollow(action: FeedbackAction, selector: string) {\n    act(action);\n    focusLater(selector);\n  }\n\n  function answer(choice: 'yes' | 'no') {\n    if (choice === 'no') {\n      actAndFollow({ type: 'answered', answer: 'no' }, '[data-reason]');\n      return;\n    }\n    actAndFollow({ type: 'answered', answer: 'yes' }, '[data-thanks]');\n  }\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-background text-foreground @container min-h-dvh w-full'\n      >\n        <div className='mx-auto flex max-w-5xl flex-col gap-6 px-4 py-6 @2xl:px-8 @2xl:py-8'>\n          <header className='flex min-h-8 items-center gap-2'>\n            <a\n              href={SITE.homeHref}\n              className={cn(\n                'flex items-center gap-2 rounded-md text-sm font-semibold',\n                FOCUS_RING\n              )}\n            >\n              <CompanyMark seed={SITE.name} size='lg' />\n              {SITE.name}\n            </a>\n            <span className='text-muted-foreground text-sm'>Help</span>\n            <span className='flex-1' />\n            <ReplayButton\n              isShown={canReplay}\n              onReplay={restart}\n              label='Replay'\n            />\n          </header>\n\n          <Breadcrumb>\n            <BreadcrumbList>\n              <BreadcrumbItem>\n                <BreadcrumbLink href={SITE.helpHref}>\n                  Help center\n                </BreadcrumbLink>\n              </BreadcrumbItem>\n              <BreadcrumbSeparator />\n              <BreadcrumbItem>\n                <BreadcrumbLink href={SITE.topicHref}>\n                  {ARTICLE.topic}\n                </BreadcrumbLink>\n              </BreadcrumbItem>\n              <BreadcrumbSeparator />\n              <BreadcrumbItem className='min-w-0'>\n                <BreadcrumbPage className='truncate'>\n                  {ARTICLE.title}\n                </BreadcrumbPage>\n              </BreadcrumbItem>\n            </BreadcrumbList>\n          </Breadcrumb>\n\n          <div className='grid gap-10 @3xl:grid-cols-[minmax(0,1fr)_18rem] @3xl:gap-12'>\n            <div className='flex min-w-0 flex-col gap-10'>\n              <article className='flex flex-col gap-8'>\n                <header className='flex flex-col gap-3'>\n                  <h1 className='text-2xl font-semibold text-balance @sm:text-3xl'>\n                    {ARTICLE.title}\n                  </h1>\n                  <p className='text-muted-foreground text-xs tabular-nums'>\n                    {ARTICLE.updated} · {ARTICLE.minutes} min read\n                  </p>\n                  <p className='text-muted-foreground text-base leading-7 text-pretty'>\n                    {ARTICLE.lead}\n                  </p>\n                </header>\n                {SECTIONS.map((section) => (\n                  <section key={section.id} className='flex flex-col gap-4'>\n                    <h2 className='text-lg font-semibold text-balance'>\n                      {section.title}\n                    </h2>\n                    {section.blocks.map((block, index) => (\n                      <Block key={`${section.id}-${index}`} block={block} />\n                    ))}\n                  </section>\n                ))}\n              </article>\n\n              <FeedbackCard\n                state={state}\n                pressed={pressed}\n                onAnswer={answer}\n                onType={(value) => act({ type: 'typed', value })}\n                onSend={() => actAndFollow({ type: 'sent' }, '[data-thanks]')}\n                onSkip={() =>\n                  actAndFollow({ type: 'skipped' }, '[data-thanks]')\n                }\n                onChange={() =>\n                  actAndFollow({ type: 'changed' }, '[data-answer-yes]')\n                }\n              />\n            </div>\n\n            <aside className='flex flex-col gap-8'>\n              <section\n                aria-labelledby={relatedId}\n                className='flex flex-col gap-2'\n              >\n                <h2 id={relatedId} className='px-1 text-[13px] font-medium'>\n                  Related articles\n                </h2>\n                <ul className='flex flex-col'>\n                  {RELATED.map((related) => (\n                    <li key={related.id}>\n                      <a\n                        href={related.href}\n                        className={cn(\n                          'group hover:bg-foreground/[0.03] flex items-center gap-2 rounded-lg px-2 py-2 text-[13px] transition-colors duration-100',\n                          FOCUS_RING\n                        )}\n                      >\n                        <span className='min-w-0 flex-1 text-pretty'>\n                          {related.title}\n                        </span>\n                        <ChevronRightIcon className='text-muted-foreground size-4 shrink-0 transition-transform duration-100 group-hover:translate-x-0.5' />\n                      </a>\n                    </li>\n                  ))}\n                </ul>\n              </section>\n\n              <section\n                aria-label='Contact support'\n                className={cn(CARD, 'flex flex-col gap-4 p-5')}\n              >\n                <div className='flex items-center gap-3'>\n                  <Avatar seed={CONTACT.person} className='size-9' />\n                  <div className='flex min-w-0 flex-col'>\n                    <p className='text-[13px] font-medium'>Still stuck?</p>\n                    <p className='text-muted-foreground text-xs'>\n                      {CONTACT.person}, {CONTACT.role}\n                    </p>\n                  </div>\n                </div>\n                <p className='text-muted-foreground text-[13px] text-pretty'>\n                  {CONTACT.lead}\n                </p>\n                <div className='flex flex-wrap gap-2'>\n                  <Button\n                    size='sm'\n                    nativeButton={false}\n                    render={<a href={CONTACT.chatHref} />}\n                  >\n                    Start a chat\n                  </Button>\n                  <Button\n                    size='sm'\n                    variant='outline'\n                    nativeButton={false}\n                    render={<a href={CONTACT.emailHref} />}\n                  >\n                    Email us\n                  </Button>\n                </div>\n              </section>\n            </aside>\n          </div>\n        </div>\n        <LiveRegion message={message} />\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/help-center-02/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/help-center/help-center-02/feedback-card.tsx",
      "content": "'use client';\n\nimport { useId } from 'react';\n\nimport {\n  pressedQuietOf,\n  pressedSolidOf,\n} from '@/registry/ndeko/lib/demonstration';\nimport { ThumbsDownIcon, ThumbsUpIcon } from '@/registry/ndeko/lib/icons';\nimport { FOCUS_RING } from '@/registry/ndeko/lib/recipes';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Fold } from '@/registry/ndeko/ui/chat-motion';\nimport { StatusOrb } from '@/registry/ndeko/ui/status-orb';\nimport { Textarea } from '@/registry/ndeko/ui/textarea';\n\nimport type { FeedbackState } from './session';\n\nconst REASON_LIMIT = 280;\n\nfunction thanksLineOf(hasNote: boolean) {\n  if (hasNote) {\n    return 'Your note goes to the team that writes these articles, and someone reads every one.';\n  }\n  return 'Your answer helps us decide which articles to rewrite first.';\n}\n\ntype FeedbackCardProps = {\n  state: FeedbackState;\n  pressed: string | null;\n  onAnswer: (answer: 'yes' | 'no') => void;\n  onType: (value: string) => void;\n  onSend: () => void;\n  onSkip: () => void;\n  onChange: () => void;\n};\n\nexport function FeedbackCard({\n  state,\n  pressed,\n  onAnswer,\n  onType,\n  onSend,\n  onSkip,\n  onChange,\n}: FeedbackCardProps) {\n  const questionId = useId();\n  const reasonId = useId();\n  const isThanked = state.status === 'thanked';\n  const isExplaining = state.status === 'explaining';\n  const canSend = state.reason.trim() !== '';\n\n  function send(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    if (canSend) {\n      onSend();\n    }\n  }\n\n  return (\n    <section\n      aria-labelledby={questionId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] rounded-xl p-5 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <AnimatedSize>\n        {!isThanked && (\n          <div className='flex flex-col gap-4'>\n            <div className='flex flex-wrap items-center gap-3'>\n              <h2 id={questionId} className='flex-1 text-sm font-medium'>\n                Was this article helpful?\n              </h2>\n              <div className='flex items-center gap-2'>\n                <Button\n                  type='button'\n                  variant='outline'\n                  size='sm'\n                  data-answer-yes\n                  onClick={() => onAnswer('yes')}\n                  className={pressedQuietOf(pressed === 'answer-yes')}\n                >\n                  <ThumbsUpIcon className='size-3.5' />\n                  Yes\n                </Button>\n                <Button\n                  type='button'\n                  variant='outline'\n                  size='sm'\n                  aria-pressed={isExplaining}\n                  onClick={() => onAnswer('no')}\n                  className={cn(\n                    'aria-pressed:bg-foreground/[0.06]',\n                    pressedQuietOf(pressed === 'answer-no')\n                  )}\n                >\n                  <ThumbsDownIcon className='size-3.5' />\n                  No\n                </Button>\n              </div>\n            </div>\n            <Fold open={isExplaining}>\n              <form onSubmit={send} className='flex flex-col gap-2 pb-0.5'>\n                <label htmlFor={reasonId} className='text-[13px] font-medium'>\n                  What was missing or wrong?\n                </label>\n                <Textarea\n                  id={reasonId}\n                  data-reason\n                  rows={2}\n                  maxLength={REASON_LIMIT}\n                  placeholder='A sentence is enough'\n                  value={state.reason}\n                  onChange={(event) => onType(event.target.value)}\n                />\n                <div className='flex items-center gap-2'>\n                  <Button\n                    type='submit'\n                    size='sm'\n                    disabled={!canSend}\n                    className={pressedSolidOf(pressed === 'send')}\n                  >\n                    Send\n                  </Button>\n                  <Button\n                    type='button'\n                    variant='ghost'\n                    size='sm'\n                    onClick={onSkip}\n                  >\n                    Skip\n                  </Button>\n                </div>\n              </form>\n            </Fold>\n          </div>\n        )}\n        {isThanked && (\n          <div className='flex items-start gap-3 transition-opacity duration-200 starting:opacity-0'>\n            <StatusOrb tone='success' size='sm' />\n            <div className='flex min-w-0 flex-col items-start gap-1'>\n              <h2\n                id={questionId}\n                data-thanks\n                tabIndex={-1}\n                className={cn('rounded-sm text-sm font-medium', FOCUS_RING)}\n              >\n                Thanks for telling us\n              </h2>\n              <p className='text-muted-foreground text-[13px] text-pretty'>\n                {thanksLineOf(state.hasNote)}\n              </p>\n              <button\n                type='button'\n                onClick={onChange}\n                className={cn(\n                  'text-primary-ink mt-1 rounded-sm text-xs font-medium underline-offset-4 hover:underline',\n                  FOCUS_RING\n                )}\n              >\n                Change my answer\n              </button>\n            </div>\n          </div>\n        )}\n      </AnimatedSize>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/help-center-02/feedback-card.tsx"
    },
    {
      "path": "registry/ndeko/blocks/help-center/help-center-02/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\nimport { keyDelayOf, prefixesOf } from '@/registry/ndeko/lib/demonstration';\n\nexport type Answer = 'none' | 'yes' | 'no';\n\nexport type FeedbackStatus = 'asking' | 'explaining' | 'thanked';\n\nexport type FeedbackState = {\n  answer: Answer;\n  status: FeedbackStatus;\n  reason: string;\n  /** True once a reason went out with the answer. */\n  hasNote: boolean;\n  spoken: string;\n};\n\nexport type FeedbackAction =\n  | { type: 'answered'; answer: 'yes' | 'no' }\n  | { type: 'typed'; value: string }\n  | { type: 'sent' }\n  | { type: 'skipped' }\n  | { type: 'changed' };\n\ntype Step = SessionStep<FeedbackState, FeedbackAction>;\n\nexport const INITIAL: FeedbackState = {\n  answer: 'none',\n  status: 'asking',\n  reason: '',\n  hasNote: false,\n  spoken: '',\n};\n\nfunction answered(state: FeedbackState, answer: 'yes' | 'no'): FeedbackState {\n  if (state.status === 'thanked') {\n    return state;\n  }\n  if (answer === 'yes') {\n    return {\n      ...state,\n      answer,\n      status: 'thanked',\n      hasNote: false,\n      spoken: 'Thanks for letting us know',\n    };\n  }\n  return { ...state, answer, status: 'explaining', spoken: '' };\n}\n\nfunction sent(state: FeedbackState): FeedbackState {\n  if (state.status !== 'explaining') {\n    return state;\n  }\n  const hasNote = state.reason.trim() !== '';\n  if (!hasNote) {\n    return state;\n  }\n  return {\n    ...state,\n    status: 'thanked',\n    hasNote,\n    spoken: 'Thanks, your note was sent to the team that writes these articles',\n  };\n}\n\nfunction skipped(state: FeedbackState): FeedbackState {\n  if (state.status !== 'explaining') {\n    return state;\n  }\n  return {\n    ...state,\n    status: 'thanked',\n    reason: '',\n    hasNote: false,\n    spoken: 'Thanks for letting us know',\n  };\n}\n\nexport function reducer(\n  state: FeedbackState,\n  action: FeedbackAction\n): FeedbackState {\n  switch (action.type) {\n    case 'answered':\n      return answered(state, action.answer);\n    case 'typed':\n      return { ...state, reason: action.value };\n    case 'sent':\n      return sent(state);\n    case 'skipped':\n      return skipped(state);\n    case 'changed':\n      return { ...INITIAL, spoken: 'Was this article helpful?' };\n  }\n}\n\nconst REASON = 'The steps for someone who already left are missing';\n\nconst KEY_MS = 40;\n\nfunction typing(text: string, startAfter: number): Step[] {\n  const prefixes = prefixesOf(text);\n  return prefixes.map((value, index) => ({\n    after: keyDelayOf(index, startAfter, KEY_MS),\n    by: 'demo',\n    action: { type: 'typed', value },\n  }));\n}\n\n/** A reader answers No, says what was missing and sends it; the question turns into a thank-you. */\nexport const SCRIPT: Step[] = [\n  {\n    after: 1800,\n    by: 'demo',\n    press: 'answer-no',\n    action: { type: 'answered', answer: 'no' },\n  },\n  ...typing(REASON, 1100),\n  { after: 700, by: 'demo', press: 'send', action: { type: 'sent' } },\n];\n\n/** Under reduced motion the reader has said what was missing and the thank-you stands in place. */\nexport const RESTING: FeedbackState = {\n  answer: 'no',\n  status: 'thanked',\n  reason: REASON,\n  hasNote: true,\n  spoken: '',\n};\n\nexport const LOOP_AFTER_MS = 3400;\n",
      "type": "registry:component",
      "target": "components/blocks/help-center-02/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/help-center/help-center-02/data.ts",
      "content": "export type ArticleBlock =\n  | { kind: 'paragraph'; text: string }\n  | { kind: 'steps'; items: string[] }\n  | { kind: 'note'; text: string; linkLabel: string; href: string };\n\nexport type ArticleSection = {\n  id: string;\n  title: string;\n  blocks: ArticleBlock[];\n};\n\nexport type RelatedArticle = {\n  id: string;\n  title: string;\n  href: string;\n};\n\nexport const SITE = {\n  name: 'Pennywort',\n  homeHref: '#',\n  helpHref: '#help',\n  topicHref: '#running-payroll',\n};\n\nexport const ARTICLE = {\n  title: 'Correct a payslip after it was sent',\n  topic: 'Running payroll',\n  updated: 'Updated 3 Nov 2026',\n  minutes: 4,\n  lead: 'A payslip that has gone out cannot be edited, but you can correct it on the next run or with a short correction run of its own. Both keep the history your accountant needs.',\n};\n\nexport const SECTIONS: ArticleSection[] = [\n  {\n    id: 'before',\n    title: 'Before you start',\n    blocks: [\n      {\n        kind: 'paragraph',\n        text: 'Check whether payday has passed. If the money has not left your bank yet, it is quicker to undo the run and run it again with the right figures.',\n      },\n      {\n        kind: 'note',\n        text: 'Payday has not passed yet?',\n        linkLabel: 'Undo a payroll run before payday',\n        href: '#undo-run',\n      },\n    ],\n  },\n  {\n    id: 'next-run',\n    title: 'Correct it on the next run',\n    blocks: [\n      {\n        kind: 'steps',\n        items: [\n          'Open Payroll and choose the next run.',\n          'Select the employee, then choose Add a correction.',\n          'Enter the amount that was missing, or the amount paid too much as a negative figure.',\n          'Add a note. It is printed on the payslip, so write it for the employee.',\n          'Approve the run as usual.',\n        ],\n      },\n    ],\n  },\n  {\n    id: 'pay-now',\n    title: 'Pay the difference now',\n    blocks: [\n      {\n        kind: 'paragraph',\n        text: 'When someone cannot wait for the next payday, start a correction run from the payslip itself. It pays only the difference, files it with the tax office and sends a short payslip that points to the original.',\n      },\n    ],\n  },\n  {\n    id: 'employee-view',\n    title: 'What the employee sees',\n    blocks: [\n      {\n        kind: 'paragraph',\n        text: 'The original payslip stays as it was. The correction appears on the next payslip, or as a payslip of its own, with your note beside the amount.',\n      },\n    ],\n  },\n];\n\nexport const RELATED: RelatedArticle[] = [\n  {\n    id: 'undo-run',\n    title: 'Undo a payroll run before payday',\n    href: '#undo-run',\n  },\n  {\n    id: 'overpayment',\n    title: 'Recover an overpayment',\n    href: '#overpayment',\n  },\n  {\n    id: 'pay-bonus',\n    title: 'Pay a bonus outside the usual run',\n    href: '#pay-bonus',\n  },\n  {\n    id: 'preview-payslips',\n    title: 'Preview payslips before you approve a run',\n    href: '#preview-payslips',\n  },\n];\n\nexport const CONTACT = {\n  person: 'Dana Whitfield',\n  role: 'Support lead',\n  lead: 'Dana and the support team answer within one working day.',\n  chatHref: '#chat',\n  emailHref: 'mailto:help@pennywort.example',\n};\n",
      "type": "registry:component",
      "target": "components/blocks/help-center-02/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "help-center"
  ],
  "type": "registry:block"
}