{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "profile-page",
  "title": "Profile Page",
  "author": "AlgorizeTech",
  "description": "Ask the user to pick one of 3 profile page variants: https://avaraui.com/view/profile-page. This item holds 3 of them as looks of one component (glass, solid, liquid-glass). Skip the question if the user already named one. A person's profile as a glass bento page: an aurora backdrop, frosted panels, and a 24-hour dial that shows their working window live. Use it for team directories, member pages and public profiles.",
  "dependencies": [],
  "registryDependencies": [
    "https://avaraui.com/r/glass-panel.json",
    "https://avaraui.com/r/social-links.json",
    "utils",
    "https://avaraui.com/r/verify-badge.json"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/ProfilePageBlock.tsx",
      "content": "\"use client\";\n\nimport {\n  GlassBackdrop,\n  type GlassBackdropProps,\n} from \"@/components/custom/blocks/GlassPanelBlock\";\nimport { cn } from \"@/lib/utils\";\nimport { useState } from \"react\";\nimport { useLocalTime, type LocalTime } from \"./profile-page-hooks\";\nimport { useSurface } from \"./glass-panel-context\";\n\n// The surface primitives live in GlassPanelBlock so other pages can install\n// them without this one. Re-exported here so existing imports keep working.\n// Hooks are not re-exported from a component file: import `useSurface` from\n// glass-panel-context.ts and `useLocalTime` from profile-page-hooks.ts.\nexport {\n  GlassPanel,\n  type GlassPanelProps,\n  type GlassShape,\n  type SurfaceVariant,\n} from \"@/components/custom/blocks/GlassPanelBlock\";\nexport type { LocalTime };\n\n// ==========================================\n// 1. PAGE SHELL — the glass backdrop, named for the page\n// ==========================================\nexport type ProfilePageProps = GlassBackdropProps;\n\n/** A `GlassBackdrop`: aurora ground, surface context and the 12-column grid. */\nexport function ProfilePage(props: ProfilePageProps) {\n  return <GlassBackdrop {...props} />;\n}\n\n// ==========================================\n// 3. LOCAL TIME — useLocalTime, in profile-page-hooks.ts\n// ==========================================\n\n// ==========================================\n// 4. WORKDAY DIAL — 24 hours on a ring\n// The working arc, the live marker and the \"Working now\" line take the\n// theme's `primary` (and the focus ring `ring`), so the dial follows the\n// site palette — and the docs colour picker — like every other block.\n// ==========================================\nexport interface WorkdayDialProps {\n  /** IANA zone the person works in, e.g. \"Asia/Dhaka\". */\n  timeZone: string;\n  /** Working window in that zone, hours 0–24. */\n  start: number;\n  end: number;\n  /** Short name shown under the clock, e.g. \"Dhaka\". */\n  place: string;\n  /** Person's first name, for the accessible description and the tooltip. */\n  name: string;\n  /** One extra line for the tooltip, e.g. \"Usually answers the same day\". */\n  note?: string;\n  className?: string;\n}\n\nconst R = 42;\nconst CIRCUMFERENCE = 2 * Math.PI * R;\nconst TIP_WIDTH = 224;\n\n/** Point on the ring for an hour of the day. The svg is rotated -90°, so\n *  angle 0 lands at the top — midnight. */\nconst pointAt = (hour: number) => {\n  const a = (hour / 24) * Math.PI * 2;\n  return { x: 50 + R * Math.cos(a), y: 50 + R * Math.sin(a) };\n};\n\n/** 13.5 → \"1:30 PM\". Wraps past midnight. */\nconst clock = (hour: number) => {\n  const minutes = ((Math.round(hour * 60) % 1440) + 1440) % 1440;\n  const h = Math.floor(minutes / 60);\n  const m = minutes % 60;\n  return `${h % 12 || 12}:${String(m).padStart(2, \"0\")} ${h < 12 ? \"AM\" : \"PM\"}`;\n};\n\n/** 3.75 → \"3 h 45 m\". */\nconst duration = (hours: number) => {\n  const total = Math.round(hours * 60);\n  const h = Math.floor(total / 60);\n  const m = total % 60;\n  return h === 0 ? `${m} m` : m === 0 ? `${h} h` : `${h} h ${m} m`;\n};\n\nconst clamp = (v: number, lo: number, hi: number) =>\n  Math.min(Math.max(v, lo), hi);\n\n/** Hour labels around the ring, so it reads as a day and not a clock face. */\nconst HOUR_LABELS = [\n  { text: \"12 am\", className: \"left-1/2 top-0 -translate-x-1/2\" },\n  { text: \"6 am\", className: \"-right-1 top-1/2 -translate-y-1/2\" },\n  { text: \"12 pm\", className: \"bottom-0 left-1/2 -translate-x-1/2\" },\n  { text: \"6 pm\", className: \"-left-1 top-1/2 -translate-y-1/2\" },\n];\n\nexport function WorkdayDial({\n  timeZone,\n  start,\n  end,\n  place,\n  name,\n  note,\n  className,\n}: WorkdayDialProps) {\n  const surface = useSurface();\n  const isLiquid = surface === \"liquid-glass\";\n  const time = useLocalTime(timeZone);\n  const working = time !== null && time.hour >= start && time.hour < end;\n  const marker = time ? pointAt(time.hour) : null;\n\n  // Tooltip: follows the pointer; sits above the ring under keyboard focus.\n  const [pointer, setPointer] = useState<{\n    x: number;\n    y: number;\n    w: number;\n  } | null>(null);\n  const [focused, setFocused] = useState(false);\n\n  // The window in the viewer's own clock — what a visitor actually wants.\n  const viewerStart = time ? clock(start - time.offsetFromViewer) : null;\n  const viewerEnd = time ? clock(end - time.offsetFromViewer) : null;\n  const sameClock = time !== null && Math.abs(time.offsetFromViewer) < 1 / 60;\n  const untilChange = time\n    ? working\n      ? `Available for ${duration(end - time.hour)}`\n      : `Back in ${duration((start - time.hour + 24) % 24)}`\n    : null;\n\n  const description = time\n    ? `It is ${time.label} in ${place}. ${name} works ${clock(start)} to ${clock(end)} there` +\n      (sameClock ? \"\" : `, ${viewerStart} to ${viewerEnd} your time`) +\n      `. ${untilChange}.`\n    : `${name} works ${clock(start)} to ${clock(end)} ${place} time.`;\n\n  const showTip = time !== null && (pointer !== null || focused);\n\n  return (\n    <div\n      role=\"img\"\n      tabIndex={0}\n      aria-label={description}\n      onPointerMove={(e) => {\n        const box = e.currentTarget.getBoundingClientRect();\n        setPointer({\n          x: e.clientX - box.left,\n          y: e.clientY - box.top,\n          w: box.width,\n        });\n      }}\n      onPointerLeave={() => setPointer(null)}\n      onFocus={() => setFocused(true)}\n      onBlur={() => setFocused(false)}\n      className={cn(\n        \"relative mx-auto aspect-square w-full max-w-[240px] rounded-full p-6 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-transparent\",\n        className,\n      )}\n    >\n      {HOUR_LABELS.map((l) => (\n        <span\n          key={l.text}\n          aria-hidden\n          className={cn(\n            \"absolute text-[10px] font-medium tabular-nums\",\n            isLiquid ? \"text-white/70\" : \"text-foreground/45\",\n            l.className,\n          )}\n        >\n          {l.text}\n        </span>\n      ))}\n\n      <svg viewBox=\"0 0 100 100\" className=\"size-full -rotate-90\">\n        {/* Full day */}\n        <circle\n          cx=\"50\"\n          cy=\"50\"\n          r={R}\n          fill=\"none\"\n          strokeWidth=\"6\"\n          className={cn(isLiquid ? \"stroke-white/20\" : \"stroke-foreground/[0.08]\")}\n        />\n        {/* Working window */}\n        <circle\n          cx=\"50\"\n          cy=\"50\"\n          r={R}\n          fill=\"none\"\n          strokeWidth=\"6\"\n          strokeLinecap=\"round\"\n          strokeDasharray={`${(CIRCUMFERENCE * (end - start)) / 24} ${CIRCUMFERENCE}`}\n          strokeDashoffset={-(CIRCUMFERENCE * start) / 24}\n          className={cn(isLiquid ? \"stroke-white\" : \"stroke-primary\")}\n        />\n        {/* Six-hour ticks, just outside the ring */}\n        {[0, 6, 12, 18].map((h) => {\n          const a = (h / 24) * Math.PI * 2;\n          return (\n            <line\n              key={h}\n              x1={50 + 47 * Math.cos(a)}\n              y1={50 + 47 * Math.sin(a)}\n              x2={50 + 49.5 * Math.cos(a)}\n              y2={50 + 49.5 * Math.sin(a)}\n              strokeWidth=\"1.5\"\n              strokeLinecap=\"round\"\n              className={cn(isLiquid ? \"stroke-white/40\" : \"stroke-foreground/25\")}\n            />\n          );\n        })}\n        {/* Live marker */}\n        {marker && (\n          <g className=\"transition-transform duration-700 motion-reduce:transition-none\">\n            <circle\n              cx={marker.x}\n              cy={marker.y}\n              r=\"5\"\n              className=\"fill-background\"\n            />\n            <circle\n              cx={marker.x}\n              cy={marker.y}\n              r=\"3\"\n              className={cn(\n                working\n                  ? isLiquid\n                    ? \"fill-white\"\n                    : \"fill-primary\"\n                  : isLiquid\n                    ? \"fill-white/60\"\n                    : \"fill-muted-foreground\",\n              )}\n            />\n          </g>\n        )}\n      </svg>\n\n      <div className=\"absolute inset-0 grid place-items-center text-center\">\n        <div>\n          <p className={cn(\"text-3xl font-semibold tabular-nums tracking-tight\", isLiquid && \"text-white\")}>\n            {time ? time.label : \"--:--\"}\n          </p>\n          <p className={cn(\"mt-0.5 text-sm\", isLiquid ? \"text-white/70\" : \"text-foreground/60\")}>\n            {place}\n          </p>\n          <p\n            className={cn(\n              \"mt-2 text-xs font-medium\",\n              working\n                ? isLiquid\n                  ? \"text-white font-semibold\"\n                  : \"text-primary\"\n                : isLiquid\n                  ? \"text-white/60\"\n                  : \"text-foreground/50\",\n            )}\n          >\n            {working ? \"Working now\" : \"Off hours\"}\n          </p>\n        </div>\n      </div>\n\n      {showTip && time && (\n        <div\n          aria-hidden\n          style={\n            pointer\n              ? {\n                  left: clamp(\n                    pointer.x,\n                    TIP_WIDTH / 2 - 32,\n                    pointer.w - TIP_WIDTH / 2 + 32,\n                  ),\n                  top: pointer.y - 14,\n                  width: TIP_WIDTH,\n                }\n              : { left: \"50%\", top: 0, width: TIP_WIDTH }\n          }\n          className={cn(\n            \"pointer-events-none absolute z-10 -translate-x-1/2 -translate-y-full rounded-2xl p-3 text-left text-xs leading-relaxed shadow-xl backdrop-blur-xl transition-colors duration-200\",\n            isLiquid\n              ? \"border border-white/40 bg-white/20 backdrop-blur-2xl text-white shadow-2xl\"\n              : \"border border-popover/70 bg-popover/85 text-popover-foreground dark:border-foreground/10 dark:bg-popover/90 dark:shadow-[0_16px_40px_-16px_rgba(0,0,0,0.9)]\",\n          )}\n        >\n          <p className={cn(\"font-semibold\", isLiquid ? \"text-white\" : \"text-popover-foreground\")}>\n            {time.label} in {place}\n          </p>\n          <p className={cn(\"mt-1\", isLiquid ? \"text-white/80\" : \"text-popover-foreground/70\")}>\n            Works {clock(start)} to {clock(end)}\n            {sameClock ? \"\" : `, ${viewerStart} to ${viewerEnd} your time`}\n          </p>\n          <p\n            className={cn(\n              \"mt-1 font-medium\",\n              working\n                ? isLiquid\n                  ? \"text-white font-semibold\"\n                  : \"text-primary\"\n                : isLiquid\n                  ? \"text-white/60\"\n                  : \"text-popover-foreground/60\",\n            )}\n          >\n            {untilChange}\n          </p>\n          {note && (\n            <p className={cn(\"mt-1\", isLiquid ? \"text-white/60\" : \"text-popover-foreground/60\")}>{note}</p>\n          )}\n        </div>\n      )}\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/custom/blocks/ProfilePageBlock.tsx"
    },
    {
      "path": "src/components/custom/blocks/glass-panel-context.ts",
      "content": "\"use client\";\n\nimport { createContext, useContext } from \"react\";\n\n/**\n * The page's surface treatment. `glass` is frosted panels over an aurora;\n * `solid` is plain theme cards with an ordinary shadow on a flat ground.\n */\nexport type SurfaceVariant = \"glass\" | \"solid\" | \"liquid-glass\";\n\n/** Set by `GlassBackdrop` for every `GlassPanel` inside it. */\nexport const SurfaceContext = createContext<SurfaceVariant>(\"glass\");\n\n/** The surface variant of the enclosing `GlassBackdrop`. */\nexport const useSurface = () => useContext(SurfaceContext);\n",
      "type": "registry:component",
      "target": "components/custom/blocks/glass-panel-context.ts"
    },
    {
      "path": "src/components/custom/blocks/profile-page-hooks.ts",
      "content": "\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n// ==========================================\n// 3. LOCAL TIME — hour-of-day in someone else's zone\n// ==========================================\nexport interface LocalTime {\n  /** Hour of day with minutes as a fraction, e.g. 14.5 for 14:30. */\n  hour: number;\n  /** Readable clock in that zone, e.g. \"2:30 PM\". */\n  label: string;\n  /**\n   * How far that zone runs ahead of the viewer's own clock, in hours, in\n   * -12..12. Subtract it from an hour in that zone to get the viewer's hour.\n   */\n  offsetFromViewer: number;\n}\n\n/** Hour of day, minutes as a fraction, in a zone (or the viewer's own). */\nfunction hourOfDay(date: Date, timeZone?: string) {\n  const parts = new Intl.DateTimeFormat(\"en-US\", {\n    timeZone,\n    hour: \"numeric\",\n    minute: \"numeric\",\n    hour12: false,\n  }).formatToParts(date);\n  const h = Number(parts.find((p) => p.type === \"hour\")?.value ?? 0) % 24;\n  const m = Number(parts.find((p) => p.type === \"minute\")?.value ?? 0);\n  return h + m / 60;\n}\n\n/**\n * Reads the clock in `timeZone` every 30 seconds. Returns `null` until the\n * first read so server and client render the same thing.\n */\nexport function useLocalTime(timeZone: string): LocalTime | null {\n  const [time, setTime] = useState<LocalTime | null>(null);\n\n  useEffect(() => {\n    const read = () => {\n      const now = new Date();\n      const hour = hourOfDay(now, timeZone);\n      const label = new Intl.DateTimeFormat(\"en-US\", {\n        timeZone,\n        hour: \"numeric\",\n        minute: \"2-digit\",\n      }).format(now);\n      let offsetFromViewer = hour - hourOfDay(now);\n      if (offsetFromViewer > 12) offsetFromViewer -= 24;\n      if (offsetFromViewer < -12) offsetFromViewer += 24;\n      setTime({ hour, label, offsetFromViewer });\n    };\n    read();\n    const id = setInterval(read, 30_000);\n    return () => clearInterval(id);\n  }, [timeZone]);\n\n  return time;\n}\n",
      "type": "registry:component",
      "target": "components/custom/blocks/profile-page-hooks.ts"
    }
  ],
  "docs": "Named exports: ProfilePage, WorkdayDial (GlassPanel is re-exported from the glass-panel item, which installs alongside; useSurface comes from its glass-panel-context.ts). useLocalTime is exported from profile-page-hooks.ts, which installs alongside. `ProfilePage` is the glass backdrop and 12-column grid; place `GlassPanel`s inside with `shape` and column spans. `WorkdayDial` takes `timeZone`, `start`, `end`, `place`, `name`.",
  "categories": [
    "layout",
    "marketing"
  ],
  "type": "registry:component"
}
