{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "popover-1",
  "type": "registry:component",
  "title": "Popover 1",
  "description": "Popover 1. Popovers are used to display rich content within an overlay that is triggered by a button click.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "badge",
    "button",
    "popover",
    "progress",
    "separator"
  ],
  "files": [
    {
      "path": "components/watermelon/popover-1.tsx",
      "type": "registry:component",
      "content": "import { StarIcon } from 'lucide-react';\n\nimport { Badge } from '@/components/base-ui/badge';\nimport { Button } from '@/components/base-ui/button';\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from '@/components/base-ui/popover';\nimport { Progress } from '@/components/base-ui/progress';\nimport { Separator } from '@/components/base-ui/separator';\nimport { cn } from '@/lib/utils';\n\nconst ratings = {\n  1: 0,\n  2: 15,\n  3: 30,\n  4: 30,\n  5: 225,\n};\n\nconst Popover1 = () => {\n  const totalReviews = Object.values(ratings).reduce(\n    (acc, count) => acc + count,\n    0,\n  );\n  const totalRating = Object.entries(ratings).reduce(\n    (acc, [star, count]) => acc + Number(star) * count,\n    0,\n  );\n  const averageRating = Number((totalRating / totalReviews || 0).toFixed(2));\n\n  return (\n    <Popover>\n      <PopoverTrigger asChild backdrop-blur-sm>\n        <Button\n          variant=\"outline\"\n          size=\"icon\"\n          className=\"rounded-xl border-neutral-200 transition-all hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900\"\n        >\n          <StarIcon className=\"size-4 text-neutral-500\" />\n          <span className=\"sr-only\">View Reviews</span>\n        </Button>\n      </PopoverTrigger>\n      <PopoverContent\n        sideOffset={8}\n        collisionPadding={12}\n        className=\"shadow-3xl max-h-[var(--radix-popover-content-available-height)] w-[calc(100vw-32px)] max-w-[340px] overflow-y-auto rounded-3xl border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-950\"\n      >\n        <div className=\"flex flex-col gap-4 sm:gap-8\">\n          <div className=\"flex items-end justify-between px-1\">\n            <div className=\"flex flex-col gap-1\">\n              <span className=\"text-4xl font-bold tracking-tight text-neutral-900 dark:text-neutral-100\">\n                {averageRating}\n              </span>\n              <div className=\"text-[10px] font-bold tracking-widest text-neutral-400 uppercase dark:text-neutral-500\">\n                Rating Score\n              </div>\n            </div>\n            <div className=\"flex flex-col items-end gap-1.5\">\n              <div className=\"flex items-center gap-0.5\">\n                {[...Array(5)].map((_, i) => (\n                  <StarIcon\n                    key={i}\n                    className={cn(\n                      'size-3.5',\n                      i < Math.floor(averageRating)\n                        ? 'fill-orange-500 stroke-orange-500'\n                        : 'fill-neutral-100 stroke-neutral-200 dark:fill-neutral-900 dark:stroke-neutral-800',\n                    )}\n                  />\n                ))}\n              </div>\n              <div className=\"text-[11px] font-medium text-neutral-400 dark:text-neutral-600\">\n                {totalReviews} global reviews\n              </div>\n            </div>\n          </div>\n\n          <div className=\"flex flex-col gap-2\">\n            <div className=\"flex items-center justify-between px-1\">\n              <div className=\"flex items-center gap-2\">\n                <div className=\"size-1.5 animate-pulse rounded-full bg-emerald-500\" />\n                <span className=\"text-[11px] font-bold text-neutral-900 dark:text-neutral-100\">\n                  Live Activity\n                </span>\n              </div>\n              <Badge\n                variant=\"secondary\"\n                className=\"rounded-sm bg-emerald-500/10 px-2 py-0.5 text-[9px] font-bold tracking-widest text-emerald-700 uppercase dark:text-emerald-400\"\n              >\n                +6 Today\n              </Badge>\n            </div>\n            <Separator className=\"opacity-50 dark:opacity-20\" />\n\n            <ul className=\"space-y-4 px-1\">\n              {Object.entries(ratings)\n                .reverse()\n                .map(([star, count]) => (\n                  <li key={star} className=\"flex items-center gap-4\">\n                    <span className=\"w-10 shrink-0 text-[11px] font-medium text-neutral-500 dark:text-neutral-400\">\n                      {star} Star\n                    </span>\n                    <Progress\n                      value={(count / totalReviews) * 100}\n                      className=\"h-1 bg-neutral-50 dark:bg-neutral-900 [&>[data-slot=progress-indicator]]:bg-orange-500\"\n                    />\n                    <span className=\"w-8 shrink-0 text-right text-[11px] font-medium text-neutral-300 dark:text-neutral-700\">\n                      {count.toString()}\n                    </span>\n                  </li>\n                ))}\n            </ul>\n          </div>\n        </div>\n      </PopoverContent>\n    </Popover>\n  );\n};\n\nexport default Popover1;\n"
    }
  ]
}
