merge new_starr_app@qas history into apps/web
git-subtree-dir: apps/web git-subtree-mainline:eaa6d2276agit-subtree-split:459af9d46a
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// BundlesCell — Tier Plans table cell showing the bundled content count for a
|
||||
// plan. A bundle is single-type (Tier Plans v2), so only one of
|
||||
// courseCount/unitCount/lessonCount is ever non-zero — show that one.
|
||||
|
||||
import { BookOpen, Book, BookOpenCheck } from "lucide-react";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
const BUNDLE_KINDS = [
|
||||
{ key: "courseCount", icon: BookOpen, singular: "course", plural: "courses" },
|
||||
{ key: "unitCount", icon: Book, singular: "unit", plural: "units" },
|
||||
{ key: "lessonCount", icon: BookOpenCheck, singular: "lesson", plural: "lessons" },
|
||||
];
|
||||
|
||||
export default function BundlesCell({ plan }) {
|
||||
const active = BUNDLE_KINDS.find((k) => parseInt(plan[k.key] ?? 0, 10) > 0) ?? BUNDLE_KINDS[0];
|
||||
const count = parseInt(plan[active.key] ?? 0, 10);
|
||||
const Icon = active.icon;
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-1.5">
|
||||
<Icon className="h-3.5 w-3.5 text-muted-foreground" />
|
||||
<Badge variant="secondary" className="text-xs font-medium tabular-nums">
|
||||
{count} {count === 1 ? active.singular : active.plural}
|
||||
</Badge>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user