{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "task-detail-02",
  "title": "Task page with a property rail",
  "description": "The same task as a page: a reading column beside a rail of folding sections for properties, time and details, which joins the column on narrow screens.",
  "dependencies": [
    "date-fns",
    "motion",
    "sonner"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/kbd.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/tabs.json",
    "https://ui.ndekocode.dev/r/textarea.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/tooltip.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/index.tsx",
      "content": "'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nimport { ChildIssues } from './child-issues';\nimport { CommentComposer } from './comment-composer';\nimport { TASKS, TEAM_NAME, type TaskDetail } from './data';\nimport { DescriptionBlock } from './description-block';\nimport {\n  nextNumberOf,\n  personOf,\n  shortDateOf,\n  timeOf,\n  toggledIds,\n  type FeedFilter,\n} from './detail-model';\nimport { PageBand } from './page-band';\nimport { PropertyRows } from './property-rows';\nimport { RailSection } from './rail-section';\nimport { commentOf, patchedTask, withComment } from './task-edits';\nimport { TaskFeed } from './task-feed';\nimport { TimeSummary } from './time-summary';\n\nconst IGNORED_KEY_TARGETS =\n  'input, textarea, select, [contenteditable=\"true\"], [role=\"menu\"]';\n\nconst COLUMN_PART = 'mx-auto w-full max-w-[46rem] px-4 @xl:px-8';\n\nfunction isIgnoredKey(event: KeyboardEvent) {\n  const isCommand = event.metaKey || event.ctrlKey;\n  if (isCommand || event.altKey) {\n    return true;\n  }\n  if (!(event.target instanceof HTMLElement)) {\n    return false;\n  }\n  return Boolean(event.target.closest(IGNORED_KEY_TARGETS));\n}\n\nfunction stepOfKey(key: string) {\n  const lowered = key.toLowerCase();\n  if (lowered === 'j') {\n    return 1;\n  }\n  if (lowered === 'k') {\n    return -1;\n  }\n  return 0;\n}\n\nfunction positionOf(tasks: TaskDetail[], taskId: string) {\n  const index = tasks.findIndex((task) => task.id === taskId);\n  return Math.max(0, index);\n}\n\nfunction replacedTask(\n  tasks: TaskDetail[],\n  taskId: string,\n  update: (task: TaskDetail) => TaskDetail\n) {\n  return tasks.map((task) => {\n    if (task.id !== taskId) {\n      return task;\n    }\n    return update(task);\n  });\n}\n\nfunction DetailRow({ label, value }: { label: string; value: string }) {\n  return (\n    <div className='flex min-h-8 items-center gap-2 text-[13px]'>\n      <span className='text-muted-foreground w-[6.75rem] shrink-0'>\n        {label}\n      </span>\n      <span className='min-w-0 truncate'>{value}</span>\n    </div>\n  );\n}\n\nexport default function TaskDetail02() {\n  const [tasks, setTasks] = useState<TaskDetail[]>(TASKS);\n  const [shownId, setShownId] = useState(TASKS[0].id);\n  const [feedFilter, setFeedFilter] = useState<FeedFilter>('all');\n  const [freshItemId, setFreshItemId] = useState<string | null>(null);\n  const [favouriteIds, setFavouriteIds] = useState<string[]>([]);\n  const position = positionOf(tasks, shownId);\n  const task = tasks[position];\n  const reporter = personOf(task.reporterId);\n  const isFavourite = favouriteIds.includes(task.id);\n\n  useEffect(() => {\n    function walk(event: KeyboardEvent) {\n      if (isIgnoredKey(event)) {\n        return;\n      }\n      const step = stepOfKey(event.key);\n      if (step === 0) {\n        return;\n      }\n      const next = tasks[position + step];\n      if (!next) {\n        return;\n      }\n      event.preventDefault();\n      setShownId(next.id);\n    }\n    document.addEventListener('keydown', walk);\n    return () => document.removeEventListener('keydown', walk);\n  }, [position, tasks]);\n\n  function step(delta: number) {\n    const next = tasks[position + delta];\n    if (next) {\n      setShownId(next.id);\n    }\n  }\n\n  function patch(changes: Partial<TaskDetail>) {\n    setTasks((current) =>\n      replacedTask(current, task.id, (item) => patchedTask(item, changes))\n    );\n  }\n\n  function postComment(body: string) {\n    const comment = commentOf(body);\n    setTasks((current) =>\n      replacedTask(current, task.id, (item) => withComment(item, comment))\n    );\n    setFreshItemId(comment.id);\n    if (feedFilter === 'history') {\n      setFeedFilter('all');\n    }\n  }\n\n  function toggleFavourite() {\n    setFavouriteIds((current) => toggledIds(current, task.id, !isFavourite));\n  }\n\n  return (\n    <div className='bg-background text-foreground @container flex h-svh min-h-[30rem] flex-col'>\n      <PageBand\n        task={task}\n        position={position + 1}\n        total={tasks.length}\n        isFavourite={isFavourite}\n        onToggleFavourite={toggleFavourite}\n        onPrevious={() => step(-1)}\n        onNext={() => step(1)}\n      />\n      <div\n        key={task.id}\n        className='flex min-h-0 flex-1 flex-col overflow-y-auto @5xl:grid @5xl:grid-cols-[minmax(0,1fr)_20rem] @5xl:grid-rows-[minmax(0,1fr)] @5xl:overflow-hidden @7xl:grid-cols-[minmax(0,1fr)_22rem]'\n      >\n        <div className='contents @5xl:block @5xl:min-h-0 @5xl:overflow-y-auto'>\n          <div className={cn(COLUMN_PART, 'order-1 pt-6 @5xl:pt-10')}>\n            <h1 className='text-[26px] leading-tight font-semibold text-balance'>\n              {task.title}\n            </h1>\n            <p className='text-muted-foreground mt-2 text-[13px]'>\n              Opened by {reporter.name} on {shortDateOf(task.createdAt)} ·\n              Updated {shortDateOf(task.updatedAt)} at {timeOf(task.updatedAt)}\n            </p>\n          </div>\n          <div\n            className={cn(\n              COLUMN_PART,\n              'order-3 flex flex-col gap-10 pt-8 pb-12'\n            )}\n          >\n            <DescriptionBlock\n              paragraphs={task.description}\n              onSave={(description) => patch({ description })}\n            />\n            <ChildIssues\n              items={task.children}\n              nextNumber={nextNumberOf(tasks)}\n              onChange={(children) => patch({ children })}\n            />\n            <TaskFeed\n              items={task.feed}\n              filter={feedFilter}\n              onFilterChange={setFeedFilter}\n              freshItemId={freshItemId}\n            >\n              <CommentComposer onSubmit={postComment} className='mt-5' />\n            </TaskFeed>\n          </div>\n        </div>\n        <aside\n          aria-label='Task properties'\n          className={cn(\n            COLUMN_PART,\n            '@5xl:hairline-l @5xl:border-border order-2 mt-6 @5xl:order-none @5xl:mx-0 @5xl:mt-0 @5xl:min-h-0 @5xl:max-w-none @5xl:overflow-y-auto @5xl:px-0'\n          )}\n        >\n          <RailSection title='Properties'>\n            <PropertyRows task={task} onPatch={patch} columns={1} />\n          </RailSection>\n          <RailSection title='Time'>\n            <TimeSummary task={task} />\n          </RailSection>\n          <RailSection title='Details'>\n            <DetailRow label='Team' value={TEAM_NAME} />\n            <DetailRow label='Reporter' value={reporter.name} />\n            <DetailRow label='Created' value={shortDateOf(task.createdAt)} />\n            <DetailRow label='Updated' value={shortDateOf(task.updatedAt)} />\n          </RailSection>\n        </aside>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/page-band.tsx",
      "content": "'use client';\n\nimport {\n  ArrowLeftIcon,\n  CheckIcon,\n  ChevronDownIcon,\n  ChevronUpIcon,\n  CopyIcon,\n  EllipsisIcon,\n  GitForkIcon,\n  LinkIcon,\n  StarIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\nimport { Kbd } from '@/registry/ndeko/ui/kbd';\nimport {\n  TOOLTIP_GLIDE_CLOSE_DELAY,\n  Tooltip,\n  TooltipContent,\n  TooltipTrigger,\n  useTooltipHandle,\n} from '@/registry/ndeko/ui/tooltip';\n\nimport type { TaskDetail } from './data';\nimport { currentUser, keyOf, taskUrlOf } from './detail-model';\nimport { Swap } from './motion-parts';\nimport { IssueTypeGem } from './task-glyphs';\nimport { copyWithToast, useCopied } from './use-copied';\n\ntype TaskStepHint = { label: string; shortcut: string };\n\nconst PREVIOUS_TASK_HINT: TaskStepHint = {\n  label: 'Previous task',\n  shortcut: 'K',\n};\n\nconst NEXT_TASK_HINT: TaskStepHint = { label: 'Next task', shortcut: 'J' };\n\nfunction TaskStepHintLabel({ hint }: { hint: TaskStepHint | undefined }) {\n  if (!hint) {\n    return null;\n  }\n  return (\n    <>\n      {hint.label} <Kbd>{hint.shortcut}</Kbd>\n    </>\n  );\n}\n\nfunction branchNameOf(task: TaskDetail) {\n  const owner = currentUser().id;\n  const key = keyOf(task.number).toLowerCase();\n  const words = task.title.toLowerCase().match(/[a-z0-9]+/g) ?? [];\n  const slug = words.slice(0, 5).join('-');\n  return `${owner}/${key}-${slug}`;\n}\n\nfunction NumberLabel({\n  isCopied,\n  label,\n}: {\n  isCopied: boolean;\n  label: string;\n}) {\n  return (\n    <AnimatedSize axis='width'>\n      <Swap swapKey={String(isCopied)}>\n        {isCopied && <span>Copied</span>}\n        {!isCopied && <span className='tabular-nums'>{label}</span>}\n      </Swap>\n    </AnimatedSize>\n  );\n}\n\nfunction favouriteLabelOf(isFavourite: boolean) {\n  if (isFavourite) {\n    return 'Remove from favourites';\n  }\n  return 'Add to favourites';\n}\n\nfunction starStrokeOf(isFavourite: boolean) {\n  if (isFavourite) {\n    return 2.25;\n  }\n  return 1.75;\n}\n\nfunction linkLabelOf(isCopied: boolean) {\n  if (isCopied) {\n    return 'Link copied';\n  }\n  return 'Copy link';\n}\n\ntype PageBandProps = {\n  task: TaskDetail;\n  position: number;\n  total: number;\n  isFavourite: boolean;\n  onToggleFavourite: () => void;\n  onPrevious: () => void;\n  onNext: () => void;\n};\n\nexport function PageBand({\n  task,\n  position,\n  total,\n  isFavourite,\n  onToggleFavourite,\n  onPrevious,\n  onNext,\n}: PageBandProps) {\n  const numberCopy = useCopied();\n  const linkCopy = useCopied();\n  const key = keyOf(task.number);\n  const link = taskUrlOf(task.number);\n  const isFirst = position <= 1;\n  const isLast = position >= total;\n  const stepHint = useTooltipHandle<TaskStepHint>();\n\n  return (\n    <div className='hairline-b border-border flex h-11 shrink-0 items-center gap-1 px-2 sm:px-3'>\n      <Button\n        variant='ghost'\n        size='icon-sm'\n        aria-label='Back to tasks'\n        nativeButton={false}\n        render={<a href='#' />}\n      >\n        <ArrowLeftIcon />\n      </Button>\n      <IssueTypeGem type={task.type} className='ms-1' />\n      <Button\n        variant='ghost'\n        size='sm'\n        aria-label={`Copy ${key}`}\n        onClick={() => numberCopy.copy(key)}\n        className='px-2 text-[13px]'\n      >\n        <NumberLabel isCopied={numberCopy.isCopied} label={key} />\n      </Button>\n      {task.parent && (\n        <span className='text-muted-foreground hidden min-w-0 items-center gap-1.5 text-[13px] @2xl:flex'>\n          <span aria-hidden='true'>/</span>\n          <span className='shrink-0 tabular-nums'>\n            {keyOf(task.parent.number)}\n          </span>\n          <span className='truncate'>{task.parent.title}</span>\n        </span>\n      )}\n      <div className='ms-auto flex shrink-0 items-center gap-1'>\n        <span className='text-muted-foreground me-1 text-xs tabular-nums'>\n          {position} / {total}\n        </span>\n        <TooltipTrigger\n          handle={stepHint}\n          payload={PREVIOUS_TASK_HINT}\n          closeDelay={TOOLTIP_GLIDE_CLOSE_DELAY}\n          render={\n            <Button\n              variant='ghost'\n              size='icon-sm'\n              aria-label='Previous task'\n              disabled={isFirst}\n              onClick={onPrevious}\n            />\n          }\n        >\n          <ChevronUpIcon />\n        </TooltipTrigger>\n        <TooltipTrigger\n          handle={stepHint}\n          payload={NEXT_TASK_HINT}\n          closeDelay={TOOLTIP_GLIDE_CLOSE_DELAY}\n          render={\n            <Button\n              variant='ghost'\n              size='icon-sm'\n              aria-label='Next task'\n              disabled={isLast}\n              onClick={onNext}\n            />\n          }\n        >\n          <ChevronDownIcon />\n        </TooltipTrigger>\n        <Tooltip handle={stepHint}>\n          {({ payload }) => (\n            <TooltipContent glide>\n              <TaskStepHintLabel hint={payload} />\n            </TooltipContent>\n          )}\n        </Tooltip>\n        <Button\n          variant='ghost'\n          size='icon-sm'\n          aria-label={favouriteLabelOf(isFavourite)}\n          aria-pressed={isFavourite}\n          onClick={onToggleFavourite}\n        >\n          <Swap swapKey={String(isFavourite)}>\n            <StarIcon\n              className={cn(isFavourite && 'text-warning')}\n              strokeWidth={starStrokeOf(isFavourite)}\n            />\n          </Swap>\n        </Button>\n        <Button\n          variant='ghost'\n          size='icon-sm'\n          aria-label={linkLabelOf(linkCopy.isCopied)}\n          onClick={() => linkCopy.copy(link)}\n        >\n          <Swap swapKey={String(linkCopy.isCopied)}>\n            {linkCopy.isCopied && (\n              <CheckIcon className='text-success-foreground' />\n            )}\n            {!linkCopy.isCopied && <LinkIcon />}\n          </Swap>\n        </Button>\n        <DropdownMenu>\n          <DropdownMenuTrigger\n            render={\n              <Button\n                variant='ghost'\n                size='icon-sm'\n                aria-label='More actions'\n              />\n            }\n          >\n            <EllipsisIcon />\n          </DropdownMenuTrigger>\n          <DropdownMenuContent align='end' className='w-52'>\n            <DropdownMenuItem\n              onClick={() => copyWithToast(key, `${key} copied`)}\n            >\n              <CopyIcon />\n              Copy ID\n            </DropdownMenuItem>\n            <DropdownMenuItem\n              onClick={() => copyWithToast(link, 'Link copied')}\n            >\n              <LinkIcon />\n              Copy link\n            </DropdownMenuItem>\n            <DropdownMenuItem\n              onClick={() =>\n                copyWithToast(branchNameOf(task), 'Branch name copied')\n              }\n            >\n              <GitForkIcon />\n              Copy branch name\n            </DropdownMenuItem>\n          </DropdownMenuContent>\n        </DropdownMenu>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/page-band.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/rail-section.tsx",
      "content": "'use client';\n\nimport { useId, useState } from 'react';\n\nimport { ChevronDownIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\n\ntype RailSectionProps = {\n  title: string;\n  children: React.ReactNode;\n};\n\nexport function RailSection({ title, children }: RailSectionProps) {\n  const [isOpen, setIsOpen] = useState(true);\n  const contentId = useId();\n\n  return (\n    <section className='hairline-b border-border py-3 @5xl:px-5'>\n      <button\n        type='button'\n        aria-expanded={isOpen}\n        aria-controls={contentId}\n        onClick={() => setIsOpen((current) => !current)}\n        className='text-muted-foreground hover:text-foreground focus-visible:ring-ring/25 flex h-7 w-full cursor-pointer items-center justify-between rounded-md text-xs font-medium outline-none focus-visible:ring-[3px]'\n      >\n        {title}\n        <ChevronDownIcon\n          className={cn(\n            'size-3.5 transition-transform duration-200 ease-(--ease-out-strong)',\n            !isOpen && '-rotate-90'\n          )}\n        />\n      </button>\n      <AnimatedSize>\n        <div id={contentId}>\n          {isOpen && <div className='pt-1 pb-1'>{children}</div>}\n        </div>\n      </AnimatedSize>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/rail-section.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/time-summary.tsx",
      "content": "import { cn } from '@/registry/ndeko/lib/utils';\n\nimport type { TaskDetail } from './data';\nimport { durationLabel, personOf, workedMinutesOf } from './detail-model';\nimport { PersonAvatar } from './task-glyphs';\n\nfunction limitShareOf(worked: number, estimate: number) {\n  if (estimate <= 0) {\n    return 0;\n  }\n  return Math.min(worked / estimate, 1);\n}\n\nfunction verdictOf(worked: number, estimate: number | undefined) {\n  if (estimate === undefined) {\n    return 'Add an estimate to compare the time spent';\n  }\n  const left = estimate - worked;\n  if (left >= 0) {\n    return `${durationLabel(left)} left`;\n  }\n  return `${durationLabel(-left)} over the estimate`;\n}\n\nfunction scaleStyleOf(share: number) {\n  return { transform: `scaleX(${share})` } as React.CSSProperties;\n}\n\nexport function TimeSummary({ task }: { task: TaskDetail }) {\n  const worked = workedMinutesOf(task);\n  const estimate = task.estimateMinutes;\n  const hasEstimate = estimate !== undefined;\n  const hasWorked = worked > 0;\n  const isOver = hasEstimate && worked > estimate;\n\n  if (!hasWorked) {\n    return (\n      <p className='text-muted-foreground py-1 text-[13px]'>\n        No time tracked on this task yet\n      </p>\n    );\n  }\n\n  return (\n    <div className='flex flex-col gap-3 py-1'>\n      <div className='flex flex-col gap-1.5'>\n        <p className='text-[13px]'>\n          <span className='font-medium tabular-nums'>\n            {durationLabel(worked)}\n          </span>\n          {hasEstimate && (\n            <span className='text-muted-foreground'>\n              {' '}\n              of <span className='tabular-nums'>\n                {durationLabel(estimate)}\n              </span>{' '}\n              estimated\n            </span>\n          )}\n        </p>\n        {hasEstimate && (\n          <span className='bg-foreground/10 relative h-1.5 overflow-hidden rounded-full'>\n            <span\n              style={scaleStyleOf(limitShareOf(worked, estimate))}\n              className={cn(\n                'absolute inset-0 origin-left rounded-full transition-transform duration-300 ease-(--ease-out-strong)',\n                isOver && 'bg-destructive',\n                !isOver && 'bg-primary'\n              )}\n            />\n          </span>\n        )}\n        <p\n          className={cn(\n            'text-xs',\n            isOver && 'text-destructive-ink',\n            !isOver && 'text-muted-foreground'\n          )}\n        >\n          {verdictOf(worked, estimate)}\n        </p>\n      </div>\n      <ul className='flex flex-col gap-2'>\n        {task.worked.map((entry) => {\n          const person = personOf(entry.personId);\n          const share = entry.minutes / worked;\n          return (\n            <li key={entry.personId} className='flex items-center gap-2'>\n              <PersonAvatar person={person} />\n              <span className='min-w-0 flex-1 truncate text-[13px]'>\n                {person.name}\n              </span>\n              <span className='bg-foreground/10 relative h-1 w-12 overflow-hidden rounded-full'>\n                <span\n                  style={scaleStyleOf(share)}\n                  className='bg-primary/70 absolute inset-0 origin-left rounded-full'\n                />\n              </span>\n              <span className='text-muted-foreground w-14 text-right text-xs tabular-nums'>\n                {durationLabel(entry.minutes)}\n              </span>\n            </li>\n          );\n        })}\n      </ul>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/time-summary.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/property-rows.tsx",
      "content": "'use client';\n\nimport {\n  CalendarIcon,\n  CircleDashedIcon,\n  ClockIcon,\n  HashIcon,\n  PlusIcon,\n  UsersIcon,\n  XIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport {\n  DropdownMenu,\n  DropdownMenuCheckboxItem,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\n\nimport { LABELS, PEOPLE, PRIORITIES, STATUSES, type TaskDetail } from './data';\nimport {\n  datePresetsOf,\n  durationLabel,\n  ESTIMATE_PRESETS,\n  isOverdue,\n  isPriorityId,\n  isStatusId,\n  labelsOf,\n  longDateOf,\n  peopleOf,\n  priorityOf,\n  statusOf,\n  toggledIds,\n} from './detail-model';\nimport { Swap } from './motion-parts';\nimport { PersonAvatar, PriorityGlyph, StatusGlyph } from './task-glyphs';\n\ntype Patch = (patch: Partial<TaskDetail>) => void;\n\nconst VALUE_TRIGGER =\n  'inline-flex h-7 min-w-0 max-w-full -mx-1.5 cursor-pointer items-center gap-1.5 rounded-md px-1.5 text-[13px] outline-none transition-colors duration-150 hover:bg-foreground/5 focus-visible:ring-[3px] focus-visible:ring-ring/25 data-popup-open:bg-foreground/5';\n\nconst ADD_SLOT =\n  'inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full hairline-border border-dashed border-foreground/20 text-muted-foreground outline-none transition-colors duration-150 hover:border-foreground/35 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/25 data-popup-open:border-foreground/35';\n\nfunction EmptyValue({ text }: { text: string }) {\n  return (\n    <span className='text-muted-foreground inline-flex items-center gap-1'>\n      <PlusIcon className='size-3.5' />\n      {text}\n    </span>\n  );\n}\n\ntype PropertyRowProps = {\n  icon: React.ReactNode;\n  label: string;\n  children: React.ReactNode;\n};\n\nfunction PropertyRow({ icon, label, children }: PropertyRowProps) {\n  return (\n    <div className='flex min-h-9 items-center gap-2'>\n      <div className='text-muted-foreground flex w-[6.75rem] shrink-0 items-center gap-2 text-[13px] [&_svg]:size-4'>\n        {icon}\n        {label}\n      </div>\n      <div className='flex min-w-0 flex-1 flex-wrap items-center gap-1'>\n        {children}\n      </div>\n    </div>\n  );\n}\n\nfunction StatusValue({ task, onPatch }: { task: TaskDetail; onPatch: Patch }) {\n  const meta = statusOf(task.status);\n\n  function pick(value: unknown) {\n    if (isStatusId(value)) {\n      onPatch({ status: value });\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        aria-label={`Status: ${meta.name}. Change status`}\n        className={VALUE_TRIGGER}\n      >\n        <Swap swapKey={task.status}>\n          <StatusGlyph status={task.status} />\n        </Swap>\n        <span className='truncate'>{meta.name}</span>\n      </DropdownMenuTrigger>\n      <DropdownMenuContent className='w-48'>\n        <DropdownMenuRadioGroup value={task.status} onValueChange={pick}>\n          {STATUSES.map((status) => (\n            <DropdownMenuRadioItem\n              key={status.id}\n              value={status.id}\n              closeOnClick\n            >\n              <StatusGlyph status={status.id} />\n              {status.name}\n            </DropdownMenuRadioItem>\n          ))}\n        </DropdownMenuRadioGroup>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nfunction PriorityValue({\n  task,\n  onPatch,\n}: {\n  task: TaskDetail;\n  onPatch: Patch;\n}) {\n  const meta = priorityOf(task.priority);\n  const isUnset = task.priority === 'none';\n\n  function pick(value: unknown) {\n    if (isPriorityId(value)) {\n      onPatch({ priority: value });\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        aria-label={`Priority: ${meta.name}. Change priority`}\n        className={VALUE_TRIGGER}\n      >\n        {isUnset && <EmptyValue text='Set priority' />}\n        {!isUnset && (\n          <>\n            <Swap swapKey={task.priority}>\n              <PriorityGlyph priority={task.priority} />\n            </Swap>\n            <span className='truncate'>{meta.name}</span>\n          </>\n        )}\n      </DropdownMenuTrigger>\n      <DropdownMenuContent className='w-44'>\n        <DropdownMenuRadioGroup value={task.priority} onValueChange={pick}>\n          {PRIORITIES.map((priority) => (\n            <DropdownMenuRadioItem\n              key={priority.id}\n              value={priority.id}\n              closeOnClick\n            >\n              <PriorityGlyph priority={priority.id} />\n              {priority.name}\n            </DropdownMenuRadioItem>\n          ))}\n        </DropdownMenuRadioGroup>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nfunction firstNameOf(name: string) {\n  return name.split(' ')[0];\n}\n\nfunction PeopleValue({ task, onPatch }: { task: TaskDetail; onPatch: Patch }) {\n  const assignees = peopleOf(task.assigneeIds);\n  const hasAssignees = assignees.length > 0;\n\n  function toggle(personId: string, isIncluded: boolean) {\n    onPatch({\n      assigneeIds: toggledIds(task.assigneeIds, personId, isIncluded),\n    });\n  }\n\n  const menu = (\n    <DropdownMenuContent className='w-52'>\n      {PEOPLE.map((person) => (\n        <DropdownMenuCheckboxItem\n          key={person.id}\n          checked={task.assigneeIds.includes(person.id)}\n          onCheckedChange={(checked) => toggle(person.id, checked)}\n        >\n          <PersonAvatar person={person} />\n          {person.name}\n        </DropdownMenuCheckboxItem>\n      ))}\n    </DropdownMenuContent>\n  );\n\n  if (!hasAssignees) {\n    return (\n      <DropdownMenu>\n        <DropdownMenuTrigger className={VALUE_TRIGGER}>\n          <EmptyValue text='Add people' />\n        </DropdownMenuTrigger>\n        {menu}\n      </DropdownMenu>\n    );\n  }\n\n  return (\n    <>\n      {assignees.map((person) => (\n        <span\n          key={person.id}\n          className='bg-card hairline-ring ring-border inline-flex h-6 max-w-40 items-center gap-1.5 rounded-full ps-0.5 pe-2 text-xs'\n        >\n          <PersonAvatar person={person} />\n          <span className='truncate'>{firstNameOf(person.name)}</span>\n        </span>\n      ))}\n      <DropdownMenu>\n        <DropdownMenuTrigger aria-label='Change people' className={ADD_SLOT}>\n          <PlusIcon className='size-3.5' />\n        </DropdownMenuTrigger>\n        {menu}\n      </DropdownMenu>\n    </>\n  );\n}\n\nfunction LabelsValue({ task, onPatch }: { task: TaskDetail; onPatch: Patch }) {\n  const labels = labelsOf(task.labelIds);\n  const hasLabels = labels.length > 0;\n\n  function toggle(labelId: string, isIncluded: boolean) {\n    onPatch({ labelIds: toggledIds(task.labelIds, labelId, isIncluded) });\n  }\n\n  const menu = (\n    <DropdownMenuContent className='w-48'>\n      {LABELS.map((label) => {\n        const dotStyle = {\n          backgroundColor: label.color,\n        } as React.CSSProperties;\n        return (\n          <DropdownMenuCheckboxItem\n            key={label.id}\n            checked={task.labelIds.includes(label.id)}\n            onCheckedChange={(checked) => toggle(label.id, checked)}\n          >\n            <span\n              aria-hidden='true'\n              style={dotStyle}\n              className='mx-1 size-2 shrink-0 rounded-full'\n            />\n            {label.name}\n          </DropdownMenuCheckboxItem>\n        );\n      })}\n    </DropdownMenuContent>\n  );\n\n  if (!hasLabels) {\n    return (\n      <DropdownMenu>\n        <DropdownMenuTrigger className={VALUE_TRIGGER}>\n          <EmptyValue text='Add label' />\n        </DropdownMenuTrigger>\n        {menu}\n      </DropdownMenu>\n    );\n  }\n\n  return (\n    <>\n      {labels.map((label) => (\n        <Chip key={label.id} color={label.color} className='h-6 px-2'>\n          {label.name}\n        </Chip>\n      ))}\n      <DropdownMenu>\n        <DropdownMenuTrigger aria-label='Change labels' className={ADD_SLOT}>\n          <PlusIcon className='size-3.5' />\n        </DropdownMenuTrigger>\n        {menu}\n      </DropdownMenu>\n    </>\n  );\n}\n\nfunction dueToneOf(task: TaskDetail) {\n  if (isOverdue(task)) {\n    return 'text-destructive-ink';\n  }\n  return '';\n}\n\nfunction DueValue({ task, onPatch }: { task: TaskDetail; onPatch: Patch }) {\n  const presets = datePresetsOf();\n\n  function pick(value: unknown) {\n    if (typeof value === 'string') {\n      onPatch({ due: value });\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger className={VALUE_TRIGGER}>\n        {!task.due && <EmptyValue text='Add date' />}\n        {task.due && (\n          <Swap swapKey={task.due} className={dueToneOf(task)}>\n            {longDateOf(task.due)}\n            {isOverdue(task) && <span className='sr-only'>, overdue</span>}\n          </Swap>\n        )}\n      </DropdownMenuTrigger>\n      <DropdownMenuContent className='w-60'>\n        <DropdownMenuRadioGroup value={task.due ?? ''} onValueChange={pick}>\n          {presets.map((preset) => (\n            <DropdownMenuRadioItem\n              key={preset.label}\n              value={preset.date}\n              closeOnClick\n            >\n              <CalendarIcon />\n              <span className='flex-1'>{preset.label}</span>\n              <span className='text-muted-foreground text-xs tabular-nums'>\n                {longDateOf(preset.date)}\n              </span>\n            </DropdownMenuRadioItem>\n          ))}\n        </DropdownMenuRadioGroup>\n        {task.due && (\n          <>\n            <DropdownMenuSeparator />\n            <DropdownMenuItem onClick={() => onPatch({ due: undefined })}>\n              <XIcon />\n              Clear date\n            </DropdownMenuItem>\n          </>\n        )}\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nfunction EstimateValue({\n  task,\n  onPatch,\n}: {\n  task: TaskDetail;\n  onPatch: Patch;\n}) {\n  const estimate = task.estimateMinutes;\n  const hasEstimate = estimate !== undefined;\n\n  function pick(value: unknown) {\n    const minutes = Number(value);\n    if (Number.isFinite(minutes)) {\n      onPatch({ estimateMinutes: minutes });\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger className={VALUE_TRIGGER}>\n        {!hasEstimate && <EmptyValue text='Estimate' />}\n        {hasEstimate && (\n          <Swap swapKey={String(estimate)} className='tabular-nums'>\n            {durationLabel(estimate)}\n          </Swap>\n        )}\n      </DropdownMenuTrigger>\n      <DropdownMenuContent className='w-40'>\n        <DropdownMenuRadioGroup\n          value={String(estimate ?? '')}\n          onValueChange={pick}\n        >\n          {ESTIMATE_PRESETS.map((minutes) => (\n            <DropdownMenuRadioItem\n              key={minutes}\n              value={String(minutes)}\n              closeOnClick\n            >\n              <ClockIcon />\n              <span className='tabular-nums'>{durationLabel(minutes)}</span>\n            </DropdownMenuRadioItem>\n          ))}\n        </DropdownMenuRadioGroup>\n        {hasEstimate && (\n          <>\n            <DropdownMenuSeparator />\n            <DropdownMenuItem\n              onClick={() => onPatch({ estimateMinutes: undefined })}\n            >\n              <XIcon />\n              Clear estimate\n            </DropdownMenuItem>\n          </>\n        )}\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\ntype PropertyRowsProps = {\n  task: TaskDetail;\n  onPatch: Patch;\n  columns: 1 | 2;\n};\n\nexport function PropertyRows({ task, onPatch, columns }: PropertyRowsProps) {\n  const isTwoColumn = columns === 2;\n\n  return (\n    <div className={cn('grid gap-x-8', isTwoColumn && '@xl:grid-cols-2')}>\n      <PropertyRow icon={<CircleDashedIcon />} label='Status'>\n        <StatusValue task={task} onPatch={onPatch} />\n      </PropertyRow>\n      <PropertyRow\n        icon={\n          <PriorityGlyph priority='high' className='text-muted-foreground' />\n        }\n        label='Priority'\n      >\n        <PriorityValue task={task} onPatch={onPatch} />\n      </PropertyRow>\n      <PropertyRow icon={<UsersIcon />} label='People'>\n        <PeopleValue task={task} onPatch={onPatch} />\n      </PropertyRow>\n      <PropertyRow icon={<HashIcon />} label='Labels'>\n        <LabelsValue task={task} onPatch={onPatch} />\n      </PropertyRow>\n      <PropertyRow icon={<CalendarIcon />} label='Due date'>\n        <DueValue task={task} onPatch={onPatch} />\n      </PropertyRow>\n      <PropertyRow icon={<ClockIcon />} label='Estimate'>\n        <EstimateValue task={task} onPatch={onPatch} />\n      </PropertyRow>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/property-rows.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/description-block.tsx",
      "content": "'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { PencilIcon, PlusIcon } from '@/registry/ndeko/lib/icons';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Textarea } from '@/registry/ndeko/ui/textarea';\n\nfunction paragraphsOf(text: string) {\n  const blocks = text.split(/\\n\\s*\\n/);\n  const trimmed = blocks.map((block) => block.trim());\n  return trimmed.filter(Boolean);\n}\n\ntype DescriptionBlockProps = {\n  paragraphs: string[];\n  onSave: (paragraphs: string[]) => void;\n};\n\nexport function DescriptionBlock({\n  paragraphs,\n  onSave,\n}: DescriptionBlockProps) {\n  const textareaRef = useRef<HTMLTextAreaElement>(null);\n  const [isEditing, setIsEditing] = useState(false);\n  const [draft, setDraft] = useState('');\n  const isEmpty = paragraphs.length === 0;\n  const showsText = !isEditing && !isEmpty;\n  const showsAdd = !isEditing && isEmpty;\n\n  useEffect(() => {\n    if (isEditing) {\n      textareaRef.current?.focus();\n    }\n  }, [isEditing]);\n\n  function startEditing() {\n    setDraft(paragraphs.join('\\n\\n'));\n    setIsEditing(true);\n  }\n\n  function cancel() {\n    setIsEditing(false);\n  }\n\n  function save() {\n    onSave(paragraphsOf(draft));\n    setIsEditing(false);\n  }\n\n  function handleKeyDown(event: React.KeyboardEvent<HTMLTextAreaElement>) {\n    if (event.key === 'Escape') {\n      event.preventDefault();\n      event.stopPropagation();\n      cancel();\n      return;\n    }\n    const isCommand = event.metaKey || event.ctrlKey;\n    if (event.key === 'Enter' && isCommand) {\n      event.preventDefault();\n      save();\n    }\n  }\n\n  return (\n    <section aria-label='Description'>\n      <div className='flex h-7 items-center justify-between gap-2'>\n        <h3 className='text-[13px] font-medium'>Description</h3>\n        {showsText && (\n          <Button\n            variant='ghost'\n            size='sm'\n            onClick={startEditing}\n            className='text-muted-foreground'\n          >\n            <PencilIcon />\n            Edit\n          </Button>\n        )}\n      </div>\n      <AnimatedSize className='mt-2'>\n        {showsText && (\n          <div\n            onDoubleClick={startEditing}\n            className='flex flex-col gap-3 text-sm leading-relaxed text-pretty'\n          >\n            {paragraphs.map((paragraph) => (\n              <p key={paragraph}>{paragraph}</p>\n            ))}\n          </div>\n        )}\n        {showsAdd && (\n          <button\n            type='button'\n            onClick={startEditing}\n            className='text-muted-foreground hover:text-foreground focus-visible:ring-ring/25 inline-flex h-7 cursor-pointer items-center gap-1 rounded-md text-[13px] outline-none focus-visible:ring-[3px]'\n          >\n            <PlusIcon className='size-3.5' />\n            Add a description\n          </button>\n        )}\n        {isEditing && (\n          <div className='flex flex-col gap-2'>\n            <Textarea\n              ref={textareaRef}\n              value={draft}\n              onChange={(event) => setDraft(event.target.value)}\n              onKeyDown={handleKeyDown}\n              aria-label='Description'\n              placeholder='What needs to happen, and why'\n              className='min-h-28 text-base leading-relaxed md:text-sm'\n            />\n            <div className='flex items-center justify-end gap-2'>\n              <Button variant='ghost' size='sm' onClick={cancel}>\n                Cancel\n              </Button>\n              <Button size='sm' onClick={save}>\n                Save\n              </Button>\n            </div>\n          </div>\n        )}\n      </AnimatedSize>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/description-block.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/child-issues.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { PlusIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nimport type { ChildIssue, StatusId } from './data';\nimport { keyOf, personOf, statusOf } from './detail-model';\nimport { heightPresenceOf, Swap } from './motion-parts';\nimport { PersonAvatar, StatusGlyph } from './task-glyphs';\n\nconst RING_RADIUS = 6;\nconst RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS;\n\nconst ADD_ROW =\n  'flex h-9 w-full items-center gap-2.5 rounded-lg px-2.5 text-[13px] text-muted-foreground hairline-border border-dashed border-foreground/20 outline-none transition-colors duration-150';\n\nfunction shareOf(done: number, total: number) {\n  if (total === 0) {\n    return 0;\n  }\n  return done / total;\n}\n\nfunction ProgressRing({ done, total }: { done: number; total: number }) {\n  const share = shareOf(done, total);\n  const offset = RING_CIRCUMFERENCE * (1 - share);\n\n  return (\n    <svg viewBox='0 0 16 16' aria-hidden='true' className='size-4 -rotate-90'>\n      <circle\n        cx='8'\n        cy='8'\n        r={RING_RADIUS}\n        fill='none'\n        stroke='currentColor'\n        strokeWidth='2'\n        className='text-foreground/10'\n      />\n      <circle\n        cx='8'\n        cy='8'\n        r={RING_RADIUS}\n        fill='none'\n        stroke='var(--success)'\n        strokeWidth='2'\n        strokeDasharray={RING_CIRCUMFERENCE}\n        strokeDashoffset={offset}\n        className='transition-[stroke-dashoffset] duration-300 ease-(--ease-out-strong)'\n      />\n    </svg>\n  );\n}\n\nfunction nextStatusOf(status: StatusId): StatusId {\n  if (status === 'done') {\n    return 'todo';\n  }\n  return 'done';\n}\n\nfunction toggleLabelOf(child: ChildIssue) {\n  const key = keyOf(child.number);\n  if (child.status === 'done') {\n    return `Reopen ${key}`;\n  }\n  return `Mark ${key} as done`;\n}\n\nfunction assigneeOf(child: ChildIssue) {\n  if (!child.assigneeId) {\n    return undefined;\n  }\n  return personOf(child.assigneeId);\n}\n\nfunction ChildRow({\n  child,\n  onToggle,\n}: {\n  child: ChildIssue;\n  onToggle: (childId: string) => void;\n}) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const presence = heightPresenceOf(shouldReduceMotion);\n  const isDone = child.status === 'done';\n  const assignee = assigneeOf(child);\n\n  return (\n    <motion.li {...presence} className='overflow-hidden'>\n      <div className='flex h-9 items-center gap-2.5 px-1.5'>\n        <button\n          type='button'\n          aria-label={toggleLabelOf(child)}\n          onClick={() => onToggle(child.id)}\n          className='hover:bg-foreground/5 focus-visible:ring-ring/25 inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md outline-none focus-visible:ring-[3px]'\n        >\n          <Swap swapKey={child.status}>\n            <StatusGlyph status={child.status} />\n          </Swap>\n        </button>\n        <span className='text-muted-foreground w-14 shrink-0 text-xs tabular-nums'>\n          {keyOf(child.number)}\n        </span>\n        <span\n          className={cn(\n            'min-w-0 flex-1 truncate text-[13px]',\n            isDone && 'text-muted-foreground line-through'\n          )}\n        >\n          {child.title}\n        </span>\n        <span className='sr-only'>{statusOf(child.status).name}</span>\n        {assignee && <PersonAvatar person={assignee} className='me-1' />}\n      </div>\n    </motion.li>\n  );\n}\n\ntype ChildIssuesProps = {\n  items: ChildIssue[];\n  nextNumber: number;\n  onChange: (items: ChildIssue[]) => void;\n};\n\nexport function ChildIssues({ items, nextNumber, onChange }: ChildIssuesProps) {\n  const [isAdding, setIsAdding] = useState(false);\n  const [title, setTitle] = useState('');\n  const doneCount = items.filter((child) => child.status === 'done').length;\n  const hasItems = items.length > 0;\n\n  function toggle(childId: string) {\n    const next = items.map((child) => {\n      if (child.id !== childId) {\n        return child;\n      }\n      return { ...child, status: nextStatusOf(child.status) };\n    });\n    onChange(next);\n  }\n\n  function add() {\n    const trimmed = title.trim();\n    if (!trimmed) {\n      return;\n    }\n    const child: ChildIssue = {\n      id: `child-${nextNumber}`,\n      number: nextNumber,\n      title: trimmed,\n      status: 'todo',\n    };\n    onChange([...items, child]);\n    setTitle('');\n  }\n\n  function stopAdding() {\n    setIsAdding(false);\n    setTitle('');\n  }\n\n  function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n    if (event.key === 'Enter') {\n      event.preventDefault();\n      add();\n      return;\n    }\n    if (event.key === 'Escape') {\n      event.preventDefault();\n      event.stopPropagation();\n      stopAdding();\n    }\n  }\n\n  function handleBlur() {\n    const isEmpty = title.trim().length === 0;\n    if (isEmpty) {\n      stopAdding();\n    }\n  }\n\n  return (\n    <section aria-label='Child issues'>\n      <div className='flex h-7 items-center gap-2'>\n        <h3 className='text-[13px] font-medium'>Child issues</h3>\n        {hasItems && (\n          <span className='text-muted-foreground flex items-center gap-1.5 text-xs tabular-nums'>\n            <ProgressRing done={doneCount} total={items.length} />\n            <span aria-hidden='true' className='flex'>\n              <MotionNumber value={doneCount} />/\n              <MotionNumber value={items.length} />\n            </span>\n            <span className='sr-only'>\n              {doneCount} of {items.length} done\n            </span>\n          </span>\n        )}\n      </div>\n      <div className='mt-2 flex flex-col gap-2'>\n        {hasItems && (\n          <ul className='bg-card hairline-ring ring-border hairline-divide-y divide-border overflow-clip rounded-lg'>\n            <AnimatePresence initial={false}>\n              {items.map((child) => (\n                <ChildRow key={child.id} child={child} onToggle={toggle} />\n              ))}\n            </AnimatePresence>\n          </ul>\n        )}\n        {!isAdding && (\n          <button\n            type='button'\n            onClick={() => setIsAdding(true)}\n            className={cn(\n              ADD_ROW,\n              'hover:border-foreground/35 hover:text-foreground focus-visible:ring-ring/25 cursor-pointer focus-visible:ring-[3px]'\n            )}\n          >\n            <PlusIcon className='size-4' />\n            Add child issue\n          </button>\n        )}\n        {isAdding && (\n          <div className={cn(ADD_ROW, 'border-foreground/35 text-foreground')}>\n            <StatusGlyph status='todo' />\n            <input\n              autoFocus\n              value={title}\n              onChange={(event) => setTitle(event.target.value)}\n              onKeyDown={handleKeyDown}\n              onBlur={handleBlur}\n              aria-label='Child issue title'\n              placeholder='Child issue title, then Enter'\n              className='placeholder:text-muted-foreground/75 h-7 min-w-0 flex-1 bg-transparent text-base outline-none md:text-[13px]'\n            />\n          </div>\n        )}\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/child-issues.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/task-feed.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useRef } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  CircleDashedIcon,\n  ClockIcon,\n  HashIcon,\n  PlusIcon,\n  UserIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Tabs, TabsList, TabsTab } from '@/registry/ndeko/ui/tabs';\n\nimport type { ChangeKind, FeedChange, FeedComment, FeedItem } from './data';\nimport {\n  dayGroupsOf,\n  feedCountsOf,\n  isFeedFilter,\n  personOf,\n  timeOf,\n  type FeedFilter,\n} from './detail-model';\nimport { heightPresenceOf } from './motion-parts';\nimport { PersonAvatar, PriorityGlyph } from './task-glyphs';\n\nconst FILTERS: { id: FeedFilter; label: string }[] = [\n  { id: 'all', label: 'All' },\n  { id: 'comments', label: 'Comments' },\n  { id: 'history', label: 'History' },\n];\n\nconst EMPTY_LINE: Record<FeedFilter, string> = {\n  all: 'Nothing has happened on this task yet',\n  comments: 'No comments yet, write the first one below',\n  history: 'No changes recorded yet',\n};\n\nconst CHANGE_GLYPH: Record<ChangeKind, React.ReactNode> = {\n  created: <PlusIcon />,\n  status: <CircleDashedIcon />,\n  assignee: <UserIcon />,\n  estimate: <ClockIcon />,\n  label: <HashIcon />,\n  priority: <PriorityGlyph priority='high' className='text-muted-foreground' />,\n};\n\nconst THREAD =\n  'relative before:absolute before:inset-y-4 before:start-3 before:hairline-l before:border-dashed before:border-foreground/15';\n\nfunction scrollBehaviorOf(shouldReduceMotion: boolean | null): ScrollBehavior {\n  if (shouldReduceMotion) {\n    return 'auto';\n  }\n  return 'smooth';\n}\n\nfunction CommentEntry({ item }: { item: FeedComment }) {\n  const author = personOf(item.authorId);\n  return (\n    <div className='flex gap-3'>\n      <PersonAvatar person={author} className='relative size-6 text-[10px]' />\n      <div className='min-w-0 flex-1 pt-0.5'>\n        <p className='flex items-baseline gap-2 text-[13px]'>\n          <span className='font-medium'>{author.name}</span>\n          <time\n            dateTime={item.at}\n            className='text-muted-foreground text-xs tabular-nums'\n          >\n            {timeOf(item.at)}\n          </time>\n        </p>\n        <p className='mt-1 text-[13px] leading-relaxed whitespace-pre-line'>\n          {item.body}\n        </p>\n      </div>\n    </div>\n  );\n}\n\nfunction ChangeEntry({ item }: { item: FeedChange }) {\n  const author = personOf(item.authorId);\n  return (\n    <div className='flex items-center gap-3'>\n      <span className='keycap-3d text-muted-foreground relative flex size-6 shrink-0 items-center justify-center rounded-full [&_svg]:size-3'>\n        {CHANGE_GLYPH[item.change]}\n      </span>\n      <p className='text-muted-foreground min-w-0 text-[13px]'>\n        <span className='text-foreground font-medium'>{author.name}</span>{' '}\n        {item.text}\n        <time dateTime={item.at} className='ms-2 text-xs tabular-nums'>\n          {timeOf(item.at)}\n        </time>\n      </p>\n    </div>\n  );\n}\n\nfunction FeedEntry({ item, isFresh }: { item: FeedItem; isFresh: boolean }) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const presence = heightPresenceOf(shouldReduceMotion);\n  const entryRef = useRef<HTMLLIElement>(null);\n\n  function revealIfFresh() {\n    if (!isFresh) {\n      return;\n    }\n    entryRef.current?.scrollIntoView({\n      block: 'nearest',\n      behavior: scrollBehaviorOf(shouldReduceMotion),\n    });\n  }\n\n  return (\n    <motion.li\n      ref={entryRef}\n      {...presence}\n      onAnimationComplete={revealIfFresh}\n      className='overflow-hidden'\n    >\n      <div className='py-1.5'>\n        {item.kind === 'comment' && <CommentEntry item={item} />}\n        {item.kind === 'change' && <ChangeEntry item={item} />}\n      </div>\n    </motion.li>\n  );\n}\n\nfunction DayGroupBlock({\n  label,\n  items,\n  freshItemId,\n}: {\n  label: string;\n  items: FeedItem[];\n  freshItemId: string | null;\n}) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const presence = heightPresenceOf(shouldReduceMotion);\n\n  return (\n    <motion.div {...presence} className='overflow-hidden'>\n      <p className='text-muted-foreground pt-3 pb-1 text-xs font-medium'>\n        {label}\n      </p>\n      <ul className={THREAD}>\n        <AnimatePresence initial={false}>\n          {items.map((item) => (\n            <FeedEntry\n              key={item.id}\n              item={item}\n              isFresh={item.id === freshItemId}\n            />\n          ))}\n        </AnimatePresence>\n      </ul>\n    </motion.div>\n  );\n}\n\ntype TaskFeedProps = {\n  items: FeedItem[];\n  filter: FeedFilter;\n  onFilterChange: (filter: FeedFilter) => void;\n  freshItemId: string | null;\n  children?: React.ReactNode;\n};\n\nexport function TaskFeed({\n  items,\n  filter,\n  onFilterChange,\n  freshItemId,\n  children,\n}: TaskFeedProps) {\n  const counts = feedCountsOf(items);\n  const groups = dayGroupsOf(items, filter);\n  const isEmpty = groups.length === 0;\n\n  function change(value: unknown) {\n    if (isFeedFilter(value)) {\n      onFilterChange(value);\n    }\n  }\n\n  return (\n    <section aria-label='Activity'>\n      <div className='flex flex-wrap items-center justify-between gap-2'>\n        <h3 className='text-[13px] font-medium'>Activity</h3>\n        <Tabs value={filter} onValueChange={change}>\n          <TabsList variant='segmented' aria-label='What the activity shows'>\n            {FILTERS.map((option) => (\n              <TabsTab key={option.id} value={option.id}>\n                {option.label}\n                <MotionNumber\n                  value={counts[option.id]}\n                  className='text-muted-foreground text-xs'\n                />\n              </TabsTab>\n            ))}\n          </TabsList>\n        </Tabs>\n      </div>\n      <AnimatedSize className='mt-1'>\n        <div key={filter}>\n          {isEmpty && (\n            <p className='text-muted-foreground py-4 text-[13px]'>\n              {EMPTY_LINE[filter]}\n            </p>\n          )}\n          <AnimatePresence initial={false}>\n            {groups.map((group) => (\n              <DayGroupBlock\n                key={group.day}\n                label={group.label}\n                items={group.items}\n                freshItemId={freshItemId}\n              />\n            ))}\n          </AnimatePresence>\n        </div>\n      </AnimatedSize>\n      {children}\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/task-feed.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/comment-composer.tsx",
      "content": "'use client';\n\nimport { useState } from 'react';\n\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Textarea } from '@/registry/ndeko/ui/textarea';\n\nimport { currentUser } from './detail-model';\nimport { PersonAvatar } from './task-glyphs';\n\ntype CommentComposerProps = {\n  onSubmit: (body: string) => void;\n  className?: string;\n};\n\nexport function CommentComposer({ onSubmit, className }: CommentComposerProps) {\n  const [body, setBody] = useState('');\n  const me = currentUser();\n  const trimmed = body.trim();\n  const canSend = trimmed.length > 0;\n\n  function submit() {\n    if (!canSend) {\n      return;\n    }\n    onSubmit(trimmed);\n    setBody('');\n  }\n\n  function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    submit();\n  }\n\n  function handleKeyDown(event: React.KeyboardEvent<HTMLTextAreaElement>) {\n    if (event.key === 'Escape') {\n      event.stopPropagation();\n      event.currentTarget.blur();\n      return;\n    }\n    const isCommand = event.metaKey || event.ctrlKey;\n    if (event.key === 'Enter' && isCommand) {\n      event.preventDefault();\n      submit();\n    }\n  }\n\n  return (\n    <form\n      onSubmit={handleSubmit}\n      className={cn('flex items-start gap-2.5', className)}\n    >\n      <PersonAvatar person={me} className='mt-1 size-7 text-[10px]' />\n      <div className='relative min-w-0 flex-1'>\n        <Textarea\n          value={body}\n          onChange={(event) => setBody(event.target.value)}\n          onKeyDown={handleKeyDown}\n          rows={1}\n          aria-label={`Comment as ${me.name}`}\n          placeholder='Leave a comment'\n          className='min-h-9 py-2 pe-24'\n        />\n        <Button\n          type='submit'\n          size='sm'\n          disabled={!canSend}\n          className='absolute end-1 bottom-1'\n        >\n          Comment\n        </Button>\n      </div>\n    </form>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/comment-composer.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/task-glyphs.tsx",
      "content": "import {\n  BookmarkIcon,\n  CheckIcon,\n  CircleAlertIcon,\n  ZapIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\n\nimport type { IssueTypeId, Person, PriorityId, StatusId } from './data';\nimport { issueTypeOf, statusOf } from './detail-model';\n\nconst PIE_RADIUS = 2;\nconst PIE_CIRCUMFERENCE = 2 * Math.PI * PIE_RADIUS;\n\nfunction pieDashOf(share: number) {\n  const filled = share * PIE_CIRCUMFERENCE;\n  return `${filled} ${PIE_CIRCUMFERENCE}`;\n}\n\nfunction StartedShape({ share }: { share: number }) {\n  return (\n    <>\n      <circle cx='7' cy='7' r='6' stroke='currentColor' strokeWidth='1.5' />\n      <circle\n        cx='7'\n        cy='7'\n        r={PIE_RADIUS}\n        stroke='currentColor'\n        strokeWidth={PIE_RADIUS * 2}\n        strokeDasharray={pieDashOf(share)}\n        transform='rotate(-90 7 7)'\n      />\n    </>\n  );\n}\n\nfunction statusShapeOf(status: StatusId) {\n  if (status === 'backlog') {\n    return (\n      <circle\n        cx='7'\n        cy='7'\n        r='6'\n        stroke='currentColor'\n        strokeWidth='1.5'\n        strokeDasharray='1.6 1.9'\n      />\n    );\n  }\n  if (status === 'todo') {\n    return (\n      <circle cx='7' cy='7' r='6' stroke='currentColor' strokeWidth='1.5' />\n    );\n  }\n  if (status === 'in_progress') {\n    return <StartedShape share={0.5} />;\n  }\n  if (status === 'in_review') {\n    return <StartedShape share={0.75} />;\n  }\n  return (\n    <>\n      <circle cx='7' cy='7' r='7' fill='currentColor' />\n      <path\n        d='M4.4 7.2 6.2 9l3.4-3.8'\n        stroke='var(--card)'\n        strokeWidth='1.6'\n        strokeLinecap='round'\n        strokeLinejoin='round'\n      />\n    </>\n  );\n}\n\nexport function StatusGlyph({\n  status,\n  className,\n}: {\n  status: StatusId;\n  className?: string;\n}) {\n  const meta = statusOf(status);\n  const glyphStyle = { color: meta.color } as React.CSSProperties;\n\n  return (\n    <svg\n      viewBox='0 0 14 14'\n      fill='none'\n      aria-hidden='true'\n      style={glyphStyle}\n      className={cn('size-3.5 shrink-0', className)}\n    >\n      {statusShapeOf(status)}\n    </svg>\n  );\n}\n\nconst PRIORITY_BARS = [\n  { x: 1.5, height: 4 },\n  { x: 5.75, height: 7 },\n  { x: 10, height: 10 },\n];\n\nconst FILLED_BAR_COUNT: Record<PriorityId, number> = {\n  urgent: 3,\n  high: 3,\n  medium: 2,\n  low: 1,\n  none: 0,\n};\n\nfunction barOpacityOf(index: number, filledCount: number) {\n  if (index < filledCount) {\n    return 0.75;\n  }\n  return 0.2;\n}\n\nfunction priorityShapeOf(priority: PriorityId) {\n  if (priority === 'urgent') {\n    return (\n      <g style={{ color: 'var(--destructive)' }}>\n        <rect\n          x='1'\n          y='1'\n          width='12'\n          height='12'\n          rx='3.5'\n          fill='currentColor'\n          fillOpacity='0.16'\n        />\n        <rect\n          x='6.25'\n          y='3.5'\n          width='1.5'\n          height='4.75'\n          rx='0.75'\n          fill='currentColor'\n        />\n        <circle cx='7' cy='10.1' r='0.95' fill='currentColor' />\n      </g>\n    );\n  }\n  if (priority === 'none') {\n    return (\n      <g fill='currentColor' fillOpacity='0.45'>\n        {PRIORITY_BARS.map((bar) => (\n          <rect\n            key={bar.x}\n            x={bar.x}\n            y='6.25'\n            width='2.5'\n            height='1.5'\n            rx='0.75'\n          />\n        ))}\n      </g>\n    );\n  }\n  const filledCount = FILLED_BAR_COUNT[priority];\n  return (\n    <g fill='currentColor'>\n      {PRIORITY_BARS.map((bar, index) => (\n        <rect\n          key={bar.x}\n          x={bar.x}\n          y={12 - bar.height}\n          width='2.5'\n          height={bar.height}\n          rx='0.75'\n          fillOpacity={barOpacityOf(index, filledCount)}\n        />\n      ))}\n    </g>\n  );\n}\n\nexport function PriorityGlyph({\n  priority,\n  className,\n}: {\n  priority: PriorityId;\n  className?: string;\n}) {\n  return (\n    <svg\n      viewBox='0 0 14 14'\n      aria-hidden='true'\n      className={cn('text-foreground size-3.5 shrink-0', className)}\n    >\n      {priorityShapeOf(priority)}\n    </svg>\n  );\n}\n\nconst TYPE_GLYPH: Record<IssueTypeId, Icon> = {\n  task: CheckIcon,\n  bug: CircleAlertIcon,\n  story: BookmarkIcon,\n  epic: ZapIcon,\n};\n\nexport function IssueTypeGem({\n  type,\n  className,\n}: {\n  type: IssueTypeId;\n  className?: string;\n}) {\n  const meta = issueTypeOf(type);\n  const Glyph = TYPE_GLYPH[type];\n  const gemStyle = { '--gem': meta.color } as React.CSSProperties;\n\n  return (\n    <span\n      role='img'\n      aria-label={meta.name}\n      style={gemStyle}\n      className={cn(\n        'gem-plate inline-flex size-4 shrink-0 items-center justify-center rounded-[5px]',\n        className\n      )}\n    >\n      <Glyph strokeWidth={2.5} className='size-2.5' />\n    </span>\n  );\n}\n\nexport function PersonAvatar({\n  person,\n  className,\n}: {\n  person: Person;\n  className?: string;\n}) {\n  return (\n    <Avatar className={cn('size-5 text-[9px]', className)} seed={person.name} />\n  );\n}\n\nconst MAX_STACKED_PEOPLE = 3;\n\nexport function PeopleStack({\n  people,\n  ringClassName = 'ring-background',\n}: {\n  people: Person[];\n  ringClassName?: string;\n}) {\n  const shown = people.slice(0, MAX_STACKED_PEOPLE);\n  const hiddenCount = people.length - shown.length;\n  const hasHidden = hiddenCount > 0;\n\n  return (\n    <span className='flex items-center -space-x-1.5'>\n      {shown.map((person) => (\n        <PersonAvatar\n          key={person.id}\n          person={person}\n          className={cn('ring-2', ringClassName)}\n        />\n      ))}\n      {hasHidden && (\n        <span\n          className={cn(\n            'bg-muted text-muted-foreground relative inline-flex size-5 items-center justify-center rounded-full text-[10px] font-medium tabular-nums ring-2',\n            ringClassName\n          )}\n        >\n          +{hiddenCount}\n        </span>\n      )}\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/task-glyphs.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/motion-parts.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type MotionProps,\n  type Transition,\n  type Variants,\n} from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nconst EASE_OUT_STRONG: [number, number, number, number] = [0.23, 1, 0.32, 1];\n\nconst ENTER: Transition = { duration: 0.2, ease: EASE_OUT_STRONG };\n\nconst EXIT: Transition = { duration: 0.15, ease: EASE_OUT_STRONG };\n\ntype PresenceProps = Pick<\n  MotionProps,\n  'initial' | 'animate' | 'exit' | 'transition'\n>;\n\nconst HEIGHT_PRESENCE: PresenceProps = {\n  initial: { height: 0, opacity: 0 },\n  animate: { height: 'auto', opacity: 1 },\n  exit: { height: 0, opacity: 0, transition: EXIT },\n  transition: ENTER,\n};\n\nconst FADE_PRESENCE: PresenceProps = {\n  initial: { opacity: 0 },\n  animate: { opacity: 1 },\n  exit: { opacity: 0, transition: EXIT },\n  transition: ENTER,\n};\n\nexport function heightPresenceOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_PRESENCE;\n  }\n  return HEIGHT_PRESENCE;\n}\n\nexport function fadePresence() {\n  return FADE_PRESENCE;\n}\n\nconst SWAP_TRANSITION: Transition = { duration: 0.15, ease: EASE_OUT_STRONG };\n\nconst SWAP_VARIANTS: Variants = {\n  hidden: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n  shown: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n};\n\nconst FADE_VARIANTS: Variants = {\n  hidden: { opacity: 0 },\n  shown: { opacity: 1 },\n};\n\nfunction swapVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return SWAP_VARIANTS;\n}\n\ntype SwapProps = {\n  swapKey: string;\n  children: React.ReactNode;\n  className?: string;\n};\n\nexport function Swap({ swapKey, children, className }: SwapProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = swapVariantsOf(shouldReduceMotion);\n\n  return (\n    <span className={cn('relative inline-flex', className)}>\n      <AnimatePresence mode='popLayout' initial={false}>\n        <motion.span\n          key={swapKey}\n          variants={variants}\n          initial='hidden'\n          animate='shown'\n          exit='hidden'\n          transition={SWAP_TRANSITION}\n          className='inline-flex'\n        >\n          {children}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/motion-parts.tsx"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/use-copied.ts",
      "content": "'use client';\n\nimport { useEffect, useRef, useState } from 'react';\nimport { toast } from 'sonner';\n\nconst COPIED_FOR_MS = 1600;\n\nexport function useCopied() {\n  const [isCopied, setIsCopied] = useState(false);\n  const timers = useRef(new Set<ReturnType<typeof setTimeout>>());\n\n  useEffect(() => {\n    const pending = timers.current;\n    return () => {\n      pending.forEach((timer) => clearTimeout(timer));\n    };\n  }, []);\n\n  async function copy(text: string) {\n    try {\n      await navigator.clipboard.writeText(text);\n    } catch {\n      toast.error('Couldn’t copy', {\n        description:\n          'The browser blocked the clipboard, copy it from the address bar instead',\n      });\n      return;\n    }\n    setIsCopied(true);\n    timers.current.forEach((timer) => clearTimeout(timer));\n    timers.current.clear();\n    const timer = setTimeout(() => setIsCopied(false), COPIED_FOR_MS);\n    timers.current.add(timer);\n  }\n\n  return { isCopied, copy };\n}\n\nexport async function copyWithToast(text: string, confirmation: string) {\n  try {\n    await navigator.clipboard.writeText(text);\n  } catch {\n    toast.error('Couldn’t copy', {\n      description: 'The browser blocked the clipboard, try again from the menu',\n    });\n    return;\n  }\n  toast.success(confirmation);\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/use-copied.ts"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/task-edits.ts",
      "content": "import { format } from 'date-fns';\n\nimport {\n  CURRENT_USER_ID,\n  TODAY,\n  type FeedChange,\n  type FeedComment,\n  type StatusId,\n  type TaskDetail,\n} from './data';\nimport { statusOf } from './detail-model';\n\nfunction nowStamp() {\n  const time = format(new Date(), 'HH:mm:ss');\n  return `${TODAY}T${time}`;\n}\n\nfunction localIdOf(prefix: string) {\n  return `${prefix}-${Date.now()}`;\n}\n\nfunction statusChangeOf(from: StatusId, to: StatusId): FeedChange {\n  const fromName = statusOf(from).name;\n  const toName = statusOf(to).name;\n  return {\n    kind: 'change',\n    id: localIdOf('change'),\n    authorId: CURRENT_USER_ID,\n    at: nowStamp(),\n    change: 'status',\n    text: `moved it from ${fromName} to ${toName}`,\n  };\n}\n\nexport function patchedTask(\n  task: TaskDetail,\n  patch: Partial<TaskDetail>\n): TaskDetail {\n  const next = { ...task, ...patch, updatedAt: nowStamp() };\n  const nextStatus = patch.status;\n  if (!nextStatus) {\n    return next;\n  }\n  if (nextStatus === task.status) {\n    return next;\n  }\n  const change = statusChangeOf(task.status, nextStatus);\n  return { ...next, feed: [...task.feed, change] };\n}\n\nexport function commentOf(body: string): FeedComment {\n  return {\n    kind: 'comment',\n    id: localIdOf('comment'),\n    authorId: CURRENT_USER_ID,\n    at: nowStamp(),\n    body,\n  };\n}\n\nexport function withComment(task: TaskDetail, comment: FeedComment) {\n  return { ...task, feed: [...task.feed, comment], updatedAt: comment.at };\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/task-edits.ts"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/detail-model.ts",
      "content": "import {\n  addDays,\n  format,\n  isBefore,\n  isSameDay,\n  nextMonday,\n  parseISO,\n  subDays,\n} from 'date-fns';\n\nimport {\n  CURRENT_USER_ID,\n  ISSUE_TYPES,\n  LABELS,\n  PEOPLE,\n  PRIORITIES,\n  STATUSES,\n  TEAM_KEY,\n  TODAY,\n  type FeedItem,\n  type IssueTypeId,\n  type PriorityId,\n  type StatusId,\n  type TaskDetail,\n} from './data';\n\nexport type FeedFilter = 'all' | 'comments' | 'history';\n\nexport type DayGroup = {\n  day: string;\n  label: string;\n  items: FeedItem[];\n};\n\nexport type DatePreset = {\n  label: string;\n  date: string;\n};\n\nfunction byId<Item extends { id: string }>(items: Item[], id: string): Item {\n  const found = items.find((item) => item.id === id);\n  if (found) {\n    return found;\n  }\n  return items[0];\n}\n\nexport function statusOf(id: StatusId) {\n  return byId(STATUSES, id);\n}\n\nexport function priorityOf(id: PriorityId) {\n  return byId(PRIORITIES, id);\n}\n\nexport function issueTypeOf(id: IssueTypeId) {\n  return byId(ISSUE_TYPES, id);\n}\n\nexport function personOf(id: string) {\n  return byId(PEOPLE, id);\n}\n\nexport function currentUser() {\n  return personOf(CURRENT_USER_ID);\n}\n\nexport function peopleOf(ids: string[]) {\n  return PEOPLE.filter((person) => ids.includes(person.id));\n}\n\nexport function labelsOf(ids: string[]) {\n  return LABELS.filter((label) => ids.includes(label.id));\n}\n\nexport function isStatusId(value: unknown): value is StatusId {\n  return STATUSES.some((status) => status.id === value);\n}\n\nexport function isPriorityId(value: unknown): value is PriorityId {\n  return PRIORITIES.some((priority) => priority.id === value);\n}\n\nexport function isFeedFilter(value: unknown): value is FeedFilter {\n  const isAll = value === 'all';\n  const isComments = value === 'comments';\n  const isHistory = value === 'history';\n  return isAll || isComments || isHistory;\n}\n\nexport function keyOf(number: number) {\n  return `${TEAM_KEY}-${number}`;\n}\n\nexport function taskUrlOf(number: number) {\n  return `https://example.com/mossline/tasks/${keyOf(number)}`;\n}\n\nexport function toggledIds(ids: string[], id: string, isIncluded: boolean) {\n  const withoutId = ids.filter((current) => current !== id);\n  if (isIncluded) {\n    return [...withoutId, id];\n  }\n  return withoutId;\n}\n\nexport function durationLabel(minutes: number) {\n  const hours = Math.floor(minutes / 60);\n  const rest = minutes % 60;\n  const paddedRest = String(rest).padStart(2, '0');\n  return `${hours}h ${paddedRest}m`;\n}\n\nexport function shortDateOf(iso: string) {\n  return format(parseISO(iso), 'MMM d');\n}\n\nexport function longDateOf(iso: string) {\n  return format(parseISO(iso), 'EEE, MMM d');\n}\n\nexport function timeOf(iso: string) {\n  return format(parseISO(iso), 'HH:mm');\n}\n\nexport function isOverdue(task: TaskDetail) {\n  if (!task.due) {\n    return false;\n  }\n  if (task.status === 'done') {\n    return false;\n  }\n  return isBefore(parseISO(task.due), parseISO(TODAY));\n}\n\nfunction isoDayOf(date: Date) {\n  return format(date, 'yyyy-MM-dd');\n}\n\nexport function datePresetsOf(): DatePreset[] {\n  const today = parseISO(TODAY);\n  return [\n    { label: 'Today', date: TODAY },\n    { label: 'Tomorrow', date: isoDayOf(addDays(today, 1)) },\n    { label: 'Next Monday', date: isoDayOf(nextMonday(today)) },\n    { label: 'In a week', date: isoDayOf(addDays(today, 7)) },\n    { label: 'In two weeks', date: isoDayOf(addDays(today, 14)) },\n  ];\n}\n\nexport const ESTIMATE_PRESETS = [30, 60, 120, 240, 480];\n\nfunction dayLabelOf(day: string) {\n  const date = parseISO(day);\n  const today = parseISO(TODAY);\n  if (isSameDay(date, today)) {\n    return 'Today';\n  }\n  if (isSameDay(date, subDays(today, 1))) {\n    return 'Yesterday';\n  }\n  return format(date, 'EEE, MMM d');\n}\n\nfunction matchesFeedFilter(item: FeedItem, filter: FeedFilter) {\n  if (filter === 'comments') {\n    return item.kind === 'comment';\n  }\n  if (filter === 'history') {\n    return item.kind === 'change';\n  }\n  return true;\n}\n\nexport function feedCountsOf(items: FeedItem[]): Record<FeedFilter, number> {\n  const comments = items.filter((item) => item.kind === 'comment').length;\n  const history = items.length - comments;\n  return { all: items.length, comments, history };\n}\n\nexport function dayGroupsOf(items: FeedItem[], filter: FeedFilter) {\n  const shown = items.filter((item) => matchesFeedFilter(item, filter));\n  const sorted = [...shown].sort((first, second) =>\n    first.at.localeCompare(second.at)\n  );\n  const groups: DayGroup[] = [];\n  for (const item of sorted) {\n    const day = item.at.slice(0, 10);\n    const last = groups.at(-1);\n    const isSameGroup = last?.day === day;\n    if (isSameGroup) {\n      last.items.push(item);\n      continue;\n    }\n    groups.push({ day, label: dayLabelOf(day), items: [item] });\n  }\n  return groups;\n}\n\nexport function countLabel(count: number, singular: string, plural: string) {\n  if (count === 1) {\n    return `${count} ${singular}`;\n  }\n  return `${count} ${plural}`;\n}\n\nexport function nextNumberOf(tasks: TaskDetail[]) {\n  const numbers: number[] = [];\n  for (const task of tasks) {\n    numbers.push(task.number);\n    const childNumbers = task.children.map((child) => child.number);\n    numbers.push(...childNumbers);\n  }\n  return Math.max(0, ...numbers) + 1;\n}\n\nexport function workedMinutesOf(task: TaskDetail) {\n  let total = 0;\n  for (const entry of task.worked) {\n    total += entry.minutes;\n  }\n  return total;\n}\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/detail-model.ts"
    },
    {
      "path": "registry/ndeko/blocks/task-detail/task-detail-02/data.ts",
      "content": "export type StatusId =\n  'backlog' | 'todo' | 'in_progress' | 'in_review' | 'done';\n\nexport type PriorityId = 'urgent' | 'high' | 'medium' | 'low' | 'none';\n\nexport type IssueTypeId = 'task' | 'bug' | 'story' | 'epic';\n\nexport type Person = {\n  id: string;\n  name: string;\n};\n\nexport type Status = {\n  id: StatusId;\n  name: string;\n  color: string;\n};\n\nexport type Priority = {\n  id: PriorityId;\n  name: string;\n};\n\nexport type IssueType = {\n  id: IssueTypeId;\n  name: string;\n  color: string;\n};\n\nexport type Label = {\n  id: string;\n  name: string;\n  color: string;\n};\n\nexport type ChildIssue = {\n  id: string;\n  number: number;\n  title: string;\n  status: StatusId;\n  assigneeId?: string;\n};\n\nexport type ChangeKind =\n  'created' | 'status' | 'assignee' | 'estimate' | 'label' | 'priority';\n\nexport type FeedComment = {\n  kind: 'comment';\n  id: string;\n  authorId: string;\n  at: string;\n  body: string;\n};\n\nexport type FeedChange = {\n  kind: 'change';\n  id: string;\n  authorId: string;\n  at: string;\n  change: ChangeKind;\n  text: string;\n};\n\nexport type FeedItem = FeedComment | FeedChange;\n\nexport type WorkedTime = {\n  personId: string;\n  minutes: number;\n};\n\nexport type ParentTask = {\n  number: number;\n  title: string;\n};\n\nexport type TaskDetail = {\n  id: string;\n  number: number;\n  title: string;\n  type: IssueTypeId;\n  status: StatusId;\n  priority: PriorityId;\n  labelIds: string[];\n  assigneeIds: string[];\n  due?: string;\n  estimateMinutes?: number;\n  createdAt: string;\n  updatedAt: string;\n  reporterId: string;\n  parent?: ParentTask;\n  description: string[];\n  children: ChildIssue[];\n  feed: FeedItem[];\n  worked: WorkedTime[];\n};\n\nexport const TEAM_KEY = 'MOS';\n\nexport const TEAM_NAME = 'Mossline Web';\n\nexport const TODAY = '2026-11-05';\n\nexport const CURRENT_USER_ID = 'amara';\n\nexport const PEOPLE: Person[] = [\n  {\n    id: 'amara',\n    name: 'Amara Okafor',\n  },\n  {\n    id: 'leo',\n    name: 'Léo Martin',\n  },\n  {\n    id: 'sana',\n    name: 'Sana Iqbal',\n  },\n  {\n    id: 'tomas',\n    name: 'Tomás Rivera',\n  },\n  {\n    id: 'mei',\n    name: 'Mei Lin',\n  },\n];\n\nexport const STATUSES: Status[] = [\n  { id: 'backlog', name: 'Backlog', color: 'var(--muted-foreground)' },\n  { id: 'todo', name: 'Todo', color: 'var(--muted-foreground)' },\n  { id: 'in_progress', name: 'In progress', color: 'var(--warning)' },\n  { id: 'in_review', name: 'In review', color: 'var(--primary)' },\n  { id: 'done', name: 'Done', color: 'var(--success)' },\n];\n\nexport const PRIORITIES: Priority[] = [\n  { id: 'urgent', name: 'Urgent' },\n  { id: 'high', name: 'High' },\n  { id: 'medium', name: 'Medium' },\n  { id: 'low', name: 'Low' },\n  { id: 'none', name: 'No priority' },\n];\n\nexport const ISSUE_TYPES: IssueType[] = [\n  { id: 'task', name: 'Task', color: 'var(--info)' },\n  { id: 'bug', name: 'Bug', color: 'var(--destructive)' },\n  { id: 'story', name: 'Story', color: 'var(--success)' },\n  { id: 'epic', name: 'Epic', color: 'var(--primary)' },\n];\n\nexport const LABELS: Label[] = [\n  { id: 'frontend', name: 'Frontend', color: 'var(--info)' },\n  { id: 'design', name: 'Design', color: 'hsl(280 62% 58%)' },\n  { id: 'api', name: 'API', color: 'var(--success)' },\n  { id: 'mobile', name: 'Mobile', color: 'hsl(190 75% 40%)' },\n  { id: 'performance', name: 'Performance', color: 'var(--warning)' },\n  { id: 'accessibility', name: 'Accessibility', color: 'hsl(330 70% 55%)' },\n];\n\nexport const TASKS: TaskDetail[] = [\n  {\n    id: 'mos-148',\n    number: 148,\n    title: 'Booking calendar skips the first week on Safari',\n    type: 'bug',\n    status: 'in_progress',\n    priority: 'urgent',\n    labelIds: ['frontend'],\n    assigneeIds: ['leo'],\n    due: '2026-11-06',\n    estimateMinutes: 480,\n    createdAt: '2026-11-02T09:14:00',\n    updatedAt: '2026-11-05T10:31:00',\n    reporterId: 'mei',\n    parent: { number: 131, title: 'Booking flow redesign' },\n    description: [\n      'On Safari, the booking calendar opens on the second week of the month when the month starts on a Sunday. The first row of days is never drawn, so nobody can book the 1st or the 2nd.',\n      'Open a studio page, pick November and look at the first row: it is there in the other browsers and missing in Safari.',\n      'The month should start on its first day in every browser, with the week starting on the day set for the workspace.',\n    ],\n    children: [\n      {\n        id: 'mos-149',\n        number: 149,\n        title: 'Reproduce on the last two Safari versions',\n        status: 'done',\n        assigneeId: 'leo',\n      },\n      {\n        id: 'mos-150',\n        number: 150,\n        title: 'Fix the week offset when a month starts on Sunday',\n        status: 'in_progress',\n        assigneeId: 'leo',\n      },\n      {\n        id: 'mos-151',\n        number: 151,\n        title: 'Add a test month that starts on a Sunday',\n        status: 'todo',\n        assigneeId: 'sana',\n      },\n      {\n        id: 'mos-153',\n        number: 153,\n        title: 'Check the calendar in the mobile web view',\n        status: 'todo',\n        assigneeId: 'tomas',\n      },\n    ],\n    feed: [\n      {\n        kind: 'change',\n        id: 'f-148-1',\n        authorId: 'mei',\n        at: '2026-11-02T09:14:00',\n        change: 'created',\n        text: 'created the task',\n      },\n      {\n        kind: 'change',\n        id: 'f-148-2',\n        authorId: 'mei',\n        at: '2026-11-02T09:15:00',\n        change: 'assignee',\n        text: 'assigned Léo Martin',\n      },\n      {\n        kind: 'comment',\n        id: 'f-148-3',\n        authorId: 'leo',\n        at: '2026-11-03T11:02:00',\n        body: 'Reproduced on both versions. It only happens when the 1st is a Sunday and the week starts on Monday.',\n      },\n      {\n        kind: 'change',\n        id: 'f-148-4',\n        authorId: 'leo',\n        at: '2026-11-04T08:40:00',\n        change: 'status',\n        text: 'moved it from Todo to In progress',\n      },\n      {\n        kind: 'comment',\n        id: 'f-148-5',\n        authorId: 'sana',\n        at: '2026-11-04T16:20:00',\n        body: 'The week number for the 1st comes back one higher on Safari. I can pair on it tomorrow morning.',\n      },\n      {\n        kind: 'change',\n        id: 'f-148-6',\n        authorId: 'leo',\n        at: '2026-11-05T09:05:00',\n        change: 'estimate',\n        text: 'set the estimate to 8h 00m',\n      },\n      {\n        kind: 'comment',\n        id: 'f-148-7',\n        authorId: 'mei',\n        at: '2026-11-05T10:31:00',\n        body: 'Studios open November bookings on Monday, so this is the one to land first.',\n      },\n    ],\n    worked: [\n      { personId: 'leo', minutes: 145 },\n      { personId: 'sana', minutes: 55 },\n    ],\n  },\n  {\n    id: 'mos-152',\n    number: 152,\n    title: 'Offline drafts for field notes',\n    type: 'story',\n    status: 'in_progress',\n    priority: 'high',\n    labelIds: ['frontend', 'mobile'],\n    assigneeIds: ['tomas', 'amara'],\n    due: '2026-11-12',\n    createdAt: '2026-10-29T14:02:00',\n    updatedAt: '2026-11-04T17:45:00',\n    reporterId: 'mei',\n    description: [\n      'A note written without a connection stays on the device as a draft and syncs on its own once the device is back online.',\n      'Drafts show a quiet mark in the list until they are synced, and a conflict keeps both versions side by side.',\n    ],\n    children: [\n      {\n        id: 'mos-156',\n        number: 156,\n        title: 'Store drafts on the device',\n        status: 'done',\n        assigneeId: 'tomas',\n      },\n      {\n        id: 'mos-157',\n        number: 157,\n        title: 'Draft mark in the notes list',\n        status: 'done',\n        assigneeId: 'amara',\n      },\n      {\n        id: 'mos-158',\n        number: 158,\n        title: 'Sync drafts when the device is back online',\n        status: 'in_progress',\n        assigneeId: 'tomas',\n      },\n      {\n        id: 'mos-159',\n        number: 159,\n        title: 'Conflict view with both versions',\n        status: 'todo',\n        assigneeId: 'amara',\n      },\n      {\n        id: 'mos-162',\n        number: 162,\n        title: 'Copy for the offline banner',\n        status: 'backlog',\n      },\n    ],\n    feed: [\n      {\n        kind: 'change',\n        id: 'f-152-1',\n        authorId: 'mei',\n        at: '2026-10-29T14:02:00',\n        change: 'created',\n        text: 'created the task',\n      },\n      {\n        kind: 'comment',\n        id: 'f-152-2',\n        authorId: 'amara',\n        at: '2026-11-03T10:12:00',\n        body: 'The draft mark is in review. I kept it to a small dot so the list does not get louder.',\n      },\n      {\n        kind: 'change',\n        id: 'f-152-3',\n        authorId: 'tomas',\n        at: '2026-11-04T17:45:00',\n        change: 'label',\n        text: 'added the label Mobile',\n      },\n    ],\n    worked: [\n      { personId: 'tomas', minutes: 380 },\n      { personId: 'amara', minutes: 150 },\n    ],\n  },\n  {\n    id: 'mos-139',\n    number: 139,\n    title: 'Rate limit the public share links',\n    type: 'task',\n    status: 'in_review',\n    priority: 'high',\n    labelIds: ['api'],\n    assigneeIds: ['sana'],\n    due: '2026-11-04',\n    estimateMinutes: 240,\n    createdAt: '2026-10-27T11:30:00',\n    updatedAt: '2026-11-03T15:10:00',\n    reporterId: 'sana',\n    description: [\n      'Shared notes can be opened by anyone with the link. Limit each link to a fair number of opens per minute so a leaked link cannot be scraped.',\n    ],\n    children: [],\n    feed: [\n      {\n        kind: 'change',\n        id: 'f-139-1',\n        authorId: 'sana',\n        at: '2026-10-27T11:30:00',\n        change: 'created',\n        text: 'created the task',\n      },\n      {\n        kind: 'change',\n        id: 'f-139-2',\n        authorId: 'sana',\n        at: '2026-11-03T15:10:00',\n        change: 'status',\n        text: 'moved it from In progress to In review',\n      },\n    ],\n    worked: [{ personId: 'sana', minutes: 265 }],\n  },\n  {\n    id: 'mos-163',\n    number: 163,\n    title: 'Map tiles flicker when zooming out',\n    type: 'bug',\n    status: 'todo',\n    priority: 'none',\n    labelIds: [],\n    assigneeIds: [],\n    createdAt: '2026-11-04T13:22:00',\n    updatedAt: '2026-11-04T13:22:00',\n    reporterId: 'tomas',\n    description: [\n      'Zooming out on the garden map shows grey squares for a moment before the tiles come back.',\n    ],\n    children: [],\n    feed: [\n      {\n        kind: 'change',\n        id: 'f-163-1',\n        authorId: 'tomas',\n        at: '2026-11-04T13:22:00',\n        change: 'created',\n        text: 'created the task',\n      },\n    ],\n    worked: [],\n  },\n];\n",
      "type": "registry:component",
      "target": "components/blocks/task-detail-02/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "task-detail"
  ],
  "type": "registry:block"
}