{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "block-choose-workspace",
  "type": "registry:block",
  "title": "Choose workspace",
  "description": "Choosing a workspace in the sign-in card after signing in: the workspaces with the last used marked, invitations to accept or decline, and creating a new one.",
  "dependencies": [
    "@remixicon/react@^4.9.0"
  ],
  "registryDependencies": [
    "https://wideset.co/r/action-tile.json",
    "https://wideset.co/r/avatar.json",
    "https://wideset.co/r/block-styles.json",
    "https://wideset.co/r/button.json",
    "https://wideset.co/r/toast.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/choose-workspace/app-icon.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/choose-workspace/app-icon.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\nimport { useId } from 'react';\n\n/** Figma's W, in its own box (24.97 × 13.87). */\nconst W =\n  'M21.377 0C21.377 0 18.14 9.233 18.017 9.574C17.95 9.402 14.331 0 14.331 0H11.069C11.069 0 7.462 9.574 7.41 9.703C7.353 9.57 3.508 0 3.508 0H0L5.853 13.871H9.059L12.716 4.054H12.773C12.81 4.149 16.51 13.871 16.51 13.871H19.827C19.827 13.871 24.932 0.114 24.967 0H21.377Z';\n\n/** Figma's tile, 46.24 × 46.89 with a 16.18 radius, at its place in the 47.25 × 48 icon. */\nconst TILE = { x: 0.69, y: 0.81, width: 46.24, height: 46.89, rx: 16.18 };\n\n// Light-palette primitives: the icon looks the same in dark mode.\nconst INDIGO_300 = '[stop-color:var(--ws-colors-light-indigo-300)]';\nconst INDIGO_400 = '[stop-color:var(--ws-colors-light-indigo-400)]';\nconst INDIGO_500 = '[stop-color:var(--ws-colors-light-indigo-500)]';\nconst INDIGO_600 = '[stop-color:var(--ws-colors-light-indigo-600)]';\nconst INDIGO_700 = '[stop-color:var(--ws-colors-light-indigo-700)]';\nconst PURPLE_200 = '[stop-color:var(--ws-colors-light-purple-200)]';\nconst PURPLE_400 = '[stop-color:var(--ws-colors-light-purple-400)]';\nconst WHITE = '[stop-color:var(--ws-colors-light-neutral-0)]';\n\n/**\n * The app icon at the top of a sign-in card: Figma's glass tile, a W lit from below. It is not the\n * flat brand mark of an app's sidebar, and it keeps its colours in dark mode, so it draws with the\n * light palette's primitives. Figma lights the tile with blurred, blended shapes; here that light is\n * two gradients in the nearest tokens. Decorative: the title beside it names the product.\n */\nexport function AppIcon({ className }: { className?: string }) {\n  const id = useId();\n  const url = (name: string) => `url(#${id}${name})`;\n\n  return (\n    <svg\n      viewBox=\"0 0 47.25 48\"\n      preserveAspectRatio=\"none\"\n      aria-hidden=\"true\"\n      className={cn('size-ws-18 shrink-0', className)}\n    >\n      <defs>\n        <clipPath id={`${id}tile`}>\n          <rect {...TILE} />\n        </clipPath>\n        {/* The light rising from the bottom edge. */}\n        <linearGradient id={`${id}glow`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n          <stop offset=\"0\" stopOpacity={0.06} className={INDIGO_600} />\n          <stop offset=\"0.4\" stopOpacity={0.1} className={INDIGO_600} />\n          <stop offset=\"0.6\" stopOpacity={0.38} className={INDIGO_600} />\n          <stop offset=\"0.75\" stopOpacity={0.62} className={INDIGO_600} />\n          <stop offset=\"0.86\" stopOpacity={0.85} className={INDIGO_600} />\n          <stop offset=\"0.93\" stopOpacity={0.9} className={INDIGO_500} />\n          <stop offset=\"0.97\" className={INDIGO_400} />\n          <stop offset=\"1\" className={INDIGO_300} />\n        </linearGradient>\n        {/* Figma's radial fill: centred above the tile, so its rim lights the lower corners. */}\n        <radialGradient\n          id={`${id}bowl`}\n          cx=\"0.5\"\n          cy=\"-0.111\"\n          r=\"1\"\n          gradientTransform=\"matrix(0.8005 0 0 1.4758 0.0998 0.0528)\"\n        >\n          <stop offset=\"0.55\" stopOpacity={0} className={INDIGO_600} />\n          <stop offset=\"0.79\" className={INDIGO_600} />\n          <stop offset=\"0.86\" className={INDIGO_400} />\n        </radialGradient>\n        <linearGradient id={`${id}w`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n          <stop offset=\"0\" className={PURPLE_200} />\n          <stop offset=\"0.5\" stopOpacity={0.56} className={INDIGO_500} />\n          <stop offset=\"1\" stopOpacity={0.15} className={INDIGO_700} />\n        </linearGradient>\n        {/* Figma's two glass highlights: a lilac line along the top, a white one along the bottom. */}\n        <linearGradient id={`${id}rim`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n          <stop offset=\"0\" stopOpacity={0.3} className={PURPLE_400} />\n          <stop offset=\"0.15\" stopOpacity={0} className={PURPLE_400} />\n          <stop offset=\"0.92\" stopOpacity={0} className={WHITE} />\n          <stop offset=\"1\" stopOpacity={0.2} className={WHITE} />\n        </linearGradient>\n      </defs>\n      <g clipPath={url('tile')}>\n        <rect {...TILE} className=\"fill-(--ws-colors-light-brand-1100)\" />\n        <rect {...TILE} fill={url('bowl')} />\n        <rect {...TILE} fill={url('glow')} />\n      </g>\n      <rect\n        x=\"0.23\"\n        y=\"0.23\"\n        width=\"46.79\"\n        height=\"47.54\"\n        rx=\"16.18\"\n        fill=\"none\"\n        stroke={url('rim')}\n        strokeWidth=\"0.46\"\n      />\n      <path transform=\"translate(11.32 18.61)\" d={W} fill={url('w')} />\n    </svg>\n  );\n}\n"
    },
    {
      "path": "src/blocks/choose-workspace/auth-card.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/choose-workspace/auth-card.tsx",
      "content": "'use client';\n\nimport {\n  type RemixiconComponentType,\n  RiArrowDownSLine,\n  RiArrowLeftLine,\n  RiArrowUpSLine,\n} from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport { type AnchorHTMLAttributes, type ReactNode, useEffect, useRef } from 'react';\n\nimport { AppIcon } from './app-icon';\n\n/*\n  The card a sign-in or sign-up screen sits in. Every starting point that uses it (the sign-in,\n  sign-up and account-access screens) carries a byte-identical copy of this file and of app-icon.tsx;\n  src/__tests__/blocks.test.tsx keeps them the same.\n*/\n\ntype AuthCardProps = {\n  /** The other screen (sign in, or create an account), in the footer; ↑ and ↓ open it too. */\n  other: { href: string; label: string };\n  children: ReactNode;\n  className?: string;\n};\n\nconst FOOTER_CONTROL =\n  'typography-body-md text-ws-static-subtle hover:text-ws-static-base gap-ws-5 rounded-ws-control-md focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default flex cursor-pointer items-center';\n\n/**\n * Figma's sign-in card: the app icon and the form on white, a grey footer that says how to leave by\n * keyboard. Esc, or ← outside a text field, goes back; ↑ or ↓ outside a text field opens the other\n * screen. In a field the arrows stay with the field: they move the caret and open autofill.\n * 740px tall as in Figma, or the window less the page's padding when that is shorter, and never\n * shorter than its content.\n */\nexport function AuthCard({ other, children, className }: AuthCardProps) {\n  const back = useRef<HTMLButtonElement>(null);\n  const next = useRef<HTMLAnchorElement>(null);\n\n  useEffect(() => {\n    const onKeyDown = (event: KeyboardEvent) => {\n      if (event.defaultPrevented || event.isComposing) return;\n      if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n      const typing =\n        event.target instanceof Element &&\n        event.target.closest('input, textarea, select, [contenteditable]') !== null;\n      if (event.key === 'Escape' || (event.key === 'ArrowLeft' && !typing)) {\n        back.current?.click();\n      } else if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && !typing) {\n        event.preventDefault();\n        next.current?.click();\n      }\n    };\n    document.addEventListener('keydown', onKeyDown);\n    return () => document.removeEventListener('keydown', onKeyDown);\n  }, []);\n\n  return (\n    <div\n      className={cn(\n        'bg-ws-static-foreground rounded-ws-container-xl shadow-ws-low flex h-[min(46.25rem,calc(100dvh-3rem))] min-h-fit flex-col justify-between overflow-hidden',\n        className,\n      )}\n    >\n      <div className=\"gap-ws-14 p-ws-12 sm:p-ws-18 flex flex-col items-start\">\n        <AppIcon />\n        {children}\n      </div>\n      <footer className=\"bg-ws-static-alpha-subtle px-ws-12 py-ws-9 flex items-center justify-between\">\n        <button\n          ref={back}\n          type=\"button\"\n          aria-keyshortcuts=\"Escape ArrowLeft\"\n          onClick={() => window.history.back()}\n          className={FOOTER_CONTROL}\n        >\n          <Key icon={RiArrowLeftLine} />\n          Back\n        </button>\n        <a\n          ref={next}\n          href={other.href}\n          aria-keyshortcuts=\"ArrowUp ArrowDown\"\n          className={FOOTER_CONTROL}\n        >\n          <span className=\"gap-ws-3 flex\">\n            <Key icon={RiArrowUpSLine} />\n            <Key icon={RiArrowDownSLine} />\n          </span>\n          {other.label}\n        </a>\n      </footer>\n    </div>\n  );\n}\n\n/**\n * A key, drawn as Figma draws it here: the box of Button `xs` Border, as a `kbd`. The control it\n * sits in names the shortcut (`aria-keyshortcuts`), so screen readers skip the key itself.\n */\nfunction Key({ icon: Icon }: { icon: RemixiconComponentType }) {\n  return (\n    <kbd\n      aria-hidden=\"true\"\n      className=\"border-ws-dynamic-secondary-default bg-ws-static-highlight-subtle shadow-ws-controls-control rounded-ws-control-md size-ws-12 text-ws-dynamic-secondary-default flex shrink-0 items-center justify-center border\"\n    >\n      <Icon className=\"size-ws-8\" />\n    </kbd>\n  );\n}\n\n/** A link inside a sentence, as Figma draws the help line's: body text in the primary colour, underlined. */\nexport function TextLink({\n  className,\n  children,\n  ...props\n}: AnchorHTMLAttributes<HTMLAnchorElement>) {\n  return (\n    <a\n      className={cn(\n        'text-ws-dynamic-primary-default hover:text-ws-dynamic-primary-hover active:text-ws-dynamic-primary-pressed rounded-ws-control-sm focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default underline decoration-from-font',\n        className,\n      )}\n      {...props}\n    >\n      {children}\n    </a>\n  );\n}\n"
    },
    {
      "path": "src/blocks/choose-workspace/data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/choose-workspace/data.ts",
      "content": "import type { AvatarColor } from '@/components/ui/wideset/avatar/Avatar.colors';\n\n/** Where the screen leads: replace with your routes. */\nexport const ROUTES = {\n  /** A workspace's home; your router builds it from the workspace's id. */\n  workspace: (id: string) => `#${id}`,\n  createWorkspace: '#new-workspace',\n  signIn: '#sign-in',\n};\n\n/** The account that signed in. */\nexport const SIGNED_IN_AS = 'maya@lumenstudio.co';\n\nexport type Workspace = {\n  id: string;\n  name: string;\n  initials: string;\n  /** Pinned, so a workspace keeps the colour the account menu gives it. */\n  color: AvatarColor;\n  members: number;\n  plan: 'Starter' | 'Growth' | 'Scale';\n};\n\n/** The workspaces this account belongs to, the last one used first. */\nexport const WORKSPACES: Workspace[] = [\n  {\n    id: 'lumen-studio',\n    name: 'Lumen Studio',\n    initials: 'LS',\n    color: 'orange',\n    members: 40,\n    plan: 'Growth',\n  },\n  { id: 'sandbox', name: 'Sandbox', initials: 'SB', color: 'teal', members: 3, plan: 'Starter' },\n  {\n    id: 'northgate',\n    name: 'Northgate Partners',\n    initials: 'NP',\n    color: 'blue',\n    members: 12,\n    plan: 'Starter',\n  },\n];\n\n/** The workspace opened last on this account. */\nexport const LAST_USED = 'lumen-studio';\n\nexport type Invitation = Workspace & { invitedBy: string };\n\n/** Invitations waiting for this account's address. */\nexport const INVITATIONS: Invitation[] = [\n  {\n    id: 'lumen-studio-eu',\n    name: 'Lumen Studio EU',\n    initials: 'LE',\n    color: 'green',\n    members: 9,\n    plan: 'Growth',\n    invitedBy: 'Leo Marchetti',\n  },\n];\n"
    },
    {
      "path": "src/blocks/choose-workspace/format.ts",
      "type": "registry:file",
      "target": "blocks/wideset/choose-workspace/format.ts",
      "content": "const count = new Intl.NumberFormat('en-US');\n\n/** \"40 members · Growth\": a workspace's size and plan, as plain text. */\nexport const workspaceFacts = ({ members, plan }: { members: number; plan: string }) =>\n  `${count.format(members)} ${members === 1 ? 'member' : 'members'} · ${plan}`;\n"
    },
    {
      "path": "src/blocks/choose-workspace/index.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/choose-workspace/index.tsx",
      "content": "'use client';\n\nimport '@/styles/wideset-blocks.css';\n\nimport { ToastProvider } from '@/components/ui/wideset/toast/Toast.context';\n\nimport { AuthCard } from './auth-card';\nimport { ROUTES } from './data';\nimport { WorkspacePicker } from './workspace-picker';\n\n/**\n * Choose a workspace, Inset direction with no navigation: the sign-in card after signing in to an\n * account in several workspaces, with the invitations waiting and creating a new one.\n */\nexport default function ChooseWorkspace() {\n  return (\n    <ToastProvider position=\"bottom-center\">\n      <main className=\"ws-block-utility bg-ws-static-background p-ws-12 flex min-h-dvh items-center justify-center\">\n        <AuthCard\n          other={{ href: ROUTES.signIn, label: 'Use another account' }}\n          className=\"w-full max-w-[38.75rem]\"\n        >\n          <WorkspacePicker />\n        </AuthCard>\n      </main>\n    </ToastProvider>\n  );\n}\n"
    },
    {
      "path": "src/blocks/choose-workspace/invitation-list.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/choose-workspace/invitation-list.tsx",
      "content": "'use client';\n\n// TODO(custom): an invitation row with Accept and Decline, drawn on ActionTile's border box; ActionTile is one control and may not hold buttons, and ListItem reads as clickable.\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { useId } from 'react';\n\nimport type { Invitation } from './data';\n\n/**\n * ActionTile's `border` box, without its hover: the row is not a control, its buttons are. On a\n * narrow card the buttons wrap under the name instead of squeezing it.\n */\nconst BOX =\n  'rounded-ws-container-md bg-ws-static-highlight-base inset-ring inset-ring-[var(--ws-dynamic-stroke-secondary-default)] min-h-ws-20 gap-ws-7 px-ws-9 py-ws-7 flex flex-wrap items-center';\n\ntype InvitationListProps = {\n  invitations: Invitation[];\n  onAccept: (invitation: Invitation) => void;\n  onDecline: (invitation: Invitation) => void;\n};\n\n/**\n * Invitations waiting for this account, as their own short group under the workspaces: the same\n * box and square avatar as a workspace tile, so the two read as one kind of thing, with who\n * invited you under the name and Accept and Decline in place of the arrow. Accept is the bordered\n * one, Decline the quiet one; both name the workspace for a screen reader.\n */\nexport function InvitationList({ invitations, onAccept, onDecline }: InvitationListProps) {\n  const id = useId();\n\n  return (\n    <section aria-labelledby={id} className=\"gap-ws-7 flex flex-col\">\n      <h2 id={id} className=\"typography-label-strong-md text-ws-static-strong\">\n        Invitations\n      </h2>\n      <ul className=\"gap-ws-5 flex flex-col\">\n        {invitations.map((invitation) => (\n          <li key={invitation.id} className={BOX}>\n            <Avatar\n              aria-hidden=\"true\"\n              shape=\"square\"\n              initials={invitation.initials}\n              color={invitation.color}\n            />\n            <div className=\"gap-ws-3 flex min-w-[8rem] flex-1 flex-col\">\n              <p className=\"typography-label-strong-sm text-ws-static-strong truncate\">\n                {invitation.name}\n              </p>\n              <p className=\"typography-body-sm text-ws-static-subtle truncate\">\n                Invited by {invitation.invitedBy}\n              </p>\n            </div>\n            <div className=\"gap-ws-5 ml-auto flex shrink-0\">\n              <Button\n                variant=\"secondary\"\n                preset=\"ghost\"\n                aria-label={`Decline ${invitation.name}`}\n                onClick={() => onDecline(invitation)}\n              >\n                Decline\n              </Button>\n              <Button\n                variant=\"secondary\"\n                preset=\"border\"\n                aria-label={`Accept ${invitation.name}`}\n                onClick={() => onAccept(invitation)}\n              >\n                Accept\n              </Button>\n            </div>\n          </li>\n        ))}\n      </ul>\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/choose-workspace/people.assets.ts",
      "type": "registry:file",
      "target": "blocks/wideset/choose-workspace/people.assets.ts",
      "content": "// Portraits of the sample people as small JPEG data URLs (a block ships only .ts and .tsx).\n// Exported from the Wideset Core Figma file by people.cjs: do not edit by hand.\n\n/** A person’s photo by name. People who are not here show their initials. */\nexport const PHOTOS: Record<string, string | undefined> = {\n  'Leo Marchetti':\n    'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAA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NgnP71JIVui2tJLKMuEYKzuo/2rZJJ716Yp1WLXX1UdY23Ktt6Mek81oU8rKz7VoWEJ7ZNe/etSCd/KpGpH3PBxhLzakKQCk7EEbGuW640MzborlygIUlKVfmND9IHmPL6V1fJQyk9zWJ0duXGWwtIU2tJCge+akY2S9DhlPx98hZ2DVmVFHHXsfYZ/9k=',\n};\n"
    },
    {
      "path": "src/blocks/choose-workspace/workspace-list.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/choose-workspace/workspace-list.tsx",
      "content": "'use client';\n\nimport { RiArrowRightLine, RiLoader4Line } from '@remixicon/react';\nimport { ActionTile } from '@/components/ui/wideset/action-tile/ActionTile';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\n\nimport type { Workspace } from './data';\nimport { workspaceFacts } from './format';\n\ntype WorkspaceListProps = {\n  /** Each tile's id is this plus the workspace's, so the screen can move focus to one. */\n  idPrefix: string;\n  workspaces: Workspace[];\n  /** The workspace opened last, marked in words. */\n  lastUsed: string;\n  /** The workspace being opened. */\n  busy?: string;\n  onChoose: (workspace: Workspace) => void;\n};\n\n/**\n * The workspaces an account belongs to, one `ActionTile` each: the whole tile opens it. A square\n * avatar (a workspace, not a person), the name, its size and plan as plain text, and \"Last used\"\n * in words on the one opened last. The one being opened swaps its arrow for a spinner and says it\n * is busy; the others stay as they are, so nothing jumps.\n */\nexport function WorkspaceList({\n  idPrefix,\n  workspaces,\n  lastUsed,\n  busy,\n  onChoose,\n}: WorkspaceListProps) {\n  return (\n    <ul className=\"gap-ws-5 flex flex-col\">\n      {workspaces.map((workspace) => {\n        const opening = busy === workspace.id;\n        return (\n          <li key={workspace.id}>\n            <ActionTile\n              id={`${idPrefix}${workspace.id}`}\n              aria-busy={opening || undefined}\n              onClick={() => onChoose(workspace)}\n            >\n              <Avatar\n                aria-hidden=\"true\"\n                shape=\"square\"\n                initials={workspace.initials}\n                color={workspace.color}\n              />\n              <div className=\"gap-ws-3 flex min-w-0 flex-1 flex-col\">\n                <ActionTile.Title className=\"truncate\">{workspace.name}</ActionTile.Title>\n                <ActionTile.Description className=\"truncate\">\n                  {workspaceFacts(workspace)}\n                </ActionTile.Description>\n              </div>\n              {workspace.id === lastUsed && (\n                <span className=\"typography-body-sm text-ws-static-subtle shrink-0\">Last used</span>\n              )}\n              <ActionTile.Icon\n                icon={opening ? RiLoader4Line : RiArrowRightLine}\n                className={opening ? 'animate-spin motion-reduce:animate-none' : undefined}\n              />\n            </ActionTile>\n          </li>\n        );\n      })}\n    </ul>\n  );\n}\n"
    },
    {
      "path": "src/blocks/choose-workspace/workspace-picker.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/choose-workspace/workspace-picker.tsx",
      "content": "'use client';\n\nimport { useToast } from '@/components/ui/wideset/toast/Toast.context';\nimport { useEffect, useId, useRef, useState } from 'react';\n\nimport { TextLink } from './auth-card';\nimport {\n  type Invitation,\n  INVITATIONS,\n  LAST_USED,\n  ROUTES,\n  SIGNED_IN_AS,\n  type Workspace,\n  WORKSPACES,\n} from './data';\nimport { InvitationList } from './invitation-list';\nimport { WorkspaceList } from './workspace-list';\n\n/**\n * Choosing where to go after signing in to an account in several workspaces: the workspaces, the\n * last used first and marked; invitations waiting, as their own group; and creating a workspace as\n * a quiet link at the end. There is no filled button: each tile is the action. Choosing one shows\n * it busy for a moment while it opens; accepting an invitation moves it into the workspaces and\n * focus with it. Nothing here talks to a server.\n */\nexport function WorkspacePicker() {\n  const id = useId();\n  const title = useRef<HTMLHeadingElement>(null);\n  const { showToast } = useToast();\n  const [workspaces, setWorkspaces] = useState(WORKSPACES);\n  const [invitations, setInvitations] = useState(INVITATIONS);\n  const [busy, setBusy] = useState<string>();\n  const [joined, setJoined] = useState<string>();\n  const timer = useRef<number>(undefined);\n  useEffect(() => () => window.clearTimeout(timer.current), []);\n  // The accepted invitation becomes a tile on the next render: focus follows it there.\n  useEffect(() => {\n    if (joined) document.getElementById(`${id}-${joined}`)?.focus();\n  }, [id, joined]);\n\n  const choose = (workspace: Workspace) => {\n    if (busy) return;\n    setBusy(workspace.id);\n    // Open the workspace here.\n    timer.current = window.setTimeout(\n      () => window.location.assign(ROUTES.workspace(workspace.id)),\n      900,\n    );\n  };\n\n  const accept = (invitation: Invitation) => {\n    // Accept the invitation here.\n    setInvitations((all) => all.filter((other) => other.id !== invitation.id));\n    setWorkspaces((all) => [...all, invitation]);\n    setJoined(invitation.id);\n    showToast({ content: `You joined ${invitation.name}`, status: 'success' });\n  };\n\n  const decline = (invitation: Invitation) => {\n    // Decline the invitation here.\n    setInvitations((all) => all.filter((other) => other.id !== invitation.id));\n    title.current?.focus();\n    showToast({ content: `You declined the invitation to ${invitation.name}` });\n  };\n\n  return (\n    <section aria-labelledby={`${id}-title`} className=\"gap-ws-12 flex w-full flex-col\">\n      <div className=\"gap-ws-5 mb-ws-5 flex flex-col\">\n        <h1\n          ref={title}\n          id={`${id}-title`}\n          tabIndex={-1}\n          className=\"typography-title-md text-ws-static-strong outline-none\"\n        >\n          Choose a workspace\n        </h1>\n        <p className=\"typography-body-md text-ws-static-base\">\n          You’re signed in as <span className=\"text-ws-static-strong\">{SIGNED_IN_AS}</span>.\n        </p>\n      </div>\n      <WorkspaceList\n        idPrefix={`${id}-`}\n        workspaces={workspaces}\n        lastUsed={LAST_USED}\n        busy={busy}\n        onChoose={choose}\n      />\n      {invitations.length > 0 && (\n        <InvitationList invitations={invitations} onAccept={accept} onDecline={decline} />\n      )}\n      <p className=\"typography-body-md text-ws-static-subtle\">\n        Starting something new?{' '}\n        <TextLink href={ROUTES.createWorkspace} className=\"whitespace-nowrap\">\n          Create a workspace\n        </TextLink>\n      </p>\n    </section>\n  );\n}\n"
    }
  ],
  "meta": {
    "version": "1.1.0",
    "commit": "a734f9f0"
  }
}
