import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { AlertCircle, ArrowRightLeft, FilePlus, Lightbulb, Loader2, MessageSquare, Minus, Move, Pencil, PenLine, Plus, Share2, SlidersHorizontal, Trash2, UploadCloud, Users, } from "lucide-react";
import { Tooltip, TooltipContent, TooltipTrigger, } from "../../../../components/ui/tooltip";
import { cn } from "../../../../lib/utils";
export const BUCKET_META = {
    field: {
        icon: Pencil,
        colorClass: "bg-feedback-blue-light text-feedback-blue",
        counting: true,
        label: "Edited",
        noun: "field",
        verb: "edited",
    },
    "component-add": {
        icon: Plus,
        colorClass: "bg-feedback-green-light text-feedback-green",
        counting: true,
        label: "Added",
        noun: "component",
        verb: "added",
    },
    "component-remove": {
        icon: Minus,
        colorClass: "bg-feedback-red-light text-feedback-red",
        counting: true,
        label: "Removed",
        noun: "component",
        verb: "removed",
    },
    "component-move": {
        icon: Move,
        colorClass: "bg-feedback-orange-light text-feedback-orange",
        counting: true,
        label: "Moved",
        noun: "component",
        verb: "moved",
    },
    "component-shared": {
        icon: Share2,
        colorClass: "bg-neutral-grey-5 text-neutral-grey-50",
        counting: false,
        label: "Shared",
        noun: "component change",
        verb: "shared",
    },
    rendering: {
        icon: SlidersHorizontal,
        colorClass: "bg-feedback-blue-light text-feedback-blue",
        counting: false,
        label: "Settings",
        noun: "rendering setting",
        verb: "changed",
    },
    personalization: {
        icon: Users,
        colorClass: "bg-feedback-blue-light text-feedback-blue",
        counting: false,
        label: "Personalized",
        noun: "personalization change",
        verb: "made",
    },
    created: {
        icon: FilePlus,
        colorClass: "bg-feedback-green-light text-feedback-green",
        counting: false,
        label: "Created",
        noun: "item",
        verb: "created",
    },
    renamed: {
        icon: PenLine,
        colorClass: "bg-feedback-orange-light text-feedback-orange",
        counting: false,
        label: "Renamed",
        noun: "item",
        verb: "renamed",
    },
    moved: {
        icon: ArrowRightLeft,
        colorClass: "bg-feedback-orange-light text-feedback-orange",
        counting: false,
        label: "Moved",
        noun: "item",
        verb: "moved",
    },
    deleted: {
        icon: Trash2,
        colorClass: "bg-feedback-red-light text-feedback-red",
        counting: false,
        label: "Deleted",
        noun: "item",
        verb: "deleted",
    },
    published: {
        icon: UploadCloud,
        colorClass: "bg-neutral-grey-5 text-neutral-grey-50",
        counting: false,
        label: "Published",
        noun: "item",
        verb: "published",
    },
    suggested: {
        icon: Lightbulb,
        colorClass: "bg-highlight-10 text-highlight-100",
        counting: true,
        label: "Suggested",
        noun: "suggested edit",
        verb: "proposed",
    },
    comment: {
        icon: MessageSquare,
        colorClass: "bg-neutral-grey-5 text-neutral-grey-50",
        counting: true,
        label: "Comments",
        noun: "comment",
        verb: "added",
    },
};
function describeBucket(bucket) {
    const meta = BUCKET_META[bucket.kind];
    const noun = bucket.count === 1 ? meta.noun : `${meta.noun}s`;
    return `${bucket.count} ${noun} ${meta.verb}`;
}
function ActivityBucketChip({ bucket }) {
    const meta = BUCKET_META[bucket.kind];
    const Icon = meta.icon;
    const text = meta.counting ? String(bucket.count) : meta.label;
    return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("span", { className: cn("badge-pad-sm inline-flex items-center gap-0.5 rounded text-[10px] font-medium", meta.colorClass), "data-testid": "activity-bucket-chip", "data-bucket-kind": bucket.kind, children: [_jsx(Icon, { className: "h-3 w-3", strokeWidth: 2 }), text] }) }), _jsx(TooltipContent, { children: describeBucket(bucket) })] }));
}
export function ActivitySummaryCell({ summary }) {
    return (_jsxs("div", { className: "flex flex-wrap items-center gap-1", children: [summary.buckets.length === 0 ? (_jsx("span", { className: "bg-neutral-grey-5 text-neutral-grey-50 badge-pad-sm rounded text-[10px] font-medium", children: "All undone" })) : (summary.buckets.map((bucket) => (_jsx(ActivityBucketChip, { bucket: bucket }, bucket.kind)))), summary.hasExecuting && (_jsx(Loader2, { className: "text-feedback-blue h-3 w-3 animate-spin", "aria-label": "Running" })), summary.hasFailed && (_jsx(AlertCircle, { className: "text-feedback-red h-3 w-3", "aria-label": "Failed" }))] }));
}
//# sourceMappingURL=ActivitySummaryCell.js.map