mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-27 21:33:41 +02:00
Drop the filled status chip (bg-warning/text-white etc.) from the list/board column headers — StatusIcon already carries the semantic color, so the chip duplicated it on the text background, and the bg-muted variants were nearly invisible against the muted/40 row background. Wrap the shared icon + label + count in a new StatusHeading component used by both list-view and board-column. Remove the now-unused badgeBg/badgeText fields from STATUS_CONFIG. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
112 lines
3.7 KiB
TypeScript
112 lines
3.7 KiB
TypeScript
"use client";
|
|
|
|
import { useMemo, type ReactNode } from "react";
|
|
import { EyeOff, MoreHorizontal, Plus } from "lucide-react";
|
|
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
|
|
import { useDroppable } from "@dnd-kit/core";
|
|
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
import type { Issue, IssueStatus } from "@multica/core/types";
|
|
import { Button } from "@multica/ui/components/ui/button";
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuTrigger,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
} from "@multica/ui/components/ui/dropdown-menu";
|
|
import { STATUS_CONFIG } from "@multica/core/issues/config";
|
|
import { useModalStore } from "@multica/core/modals";
|
|
import { useViewStoreApi } from "@multica/core/issues/stores/view-store-context";
|
|
import { StatusHeading } from "./status-heading";
|
|
import { DraggableBoardCard } from "./board-card";
|
|
import type { ChildProgress } from "./list-row";
|
|
|
|
export function BoardColumn({
|
|
status,
|
|
issueIds,
|
|
issueMap,
|
|
childProgressMap,
|
|
totalCount,
|
|
footer,
|
|
}: {
|
|
status: IssueStatus;
|
|
issueIds: string[];
|
|
issueMap: Map<string, Issue>;
|
|
childProgressMap?: Map<string, ChildProgress>;
|
|
totalCount?: number;
|
|
footer?: ReactNode;
|
|
}) {
|
|
const cfg = STATUS_CONFIG[status];
|
|
const { setNodeRef, isOver } = useDroppable({ id: status });
|
|
const viewStoreApi = useViewStoreApi();
|
|
|
|
// Resolve IDs to Issue objects, preserving parent-provided order
|
|
const resolvedIssues = useMemo(
|
|
() =>
|
|
issueIds.flatMap((id) => {
|
|
const issue = issueMap.get(id);
|
|
return issue ? [issue] : [];
|
|
}),
|
|
[issueIds, issueMap],
|
|
);
|
|
|
|
return (
|
|
<div className={`flex w-[280px] shrink-0 flex-col rounded-xl ${cfg.columnBg} p-2`}>
|
|
<div className="mb-2 flex items-center justify-between px-1.5">
|
|
<StatusHeading status={status} count={totalCount ?? issueIds.length} />
|
|
|
|
{/* Right: add + menu */}
|
|
<div className="flex items-center gap-1">
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger
|
|
render={
|
|
<Button variant="ghost" size="icon-sm" className="rounded-full text-muted-foreground">
|
|
<MoreHorizontal className="size-3.5" />
|
|
</Button>
|
|
}
|
|
/>
|
|
<DropdownMenuContent align="end">
|
|
<DropdownMenuItem onClick={() => viewStoreApi.getState().hideStatus(status)}>
|
|
<EyeOff className="size-3.5" />
|
|
Hide column
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
<Tooltip>
|
|
<TooltipTrigger
|
|
render={
|
|
<Button
|
|
variant="ghost"
|
|
size="icon-sm"
|
|
className="rounded-full text-muted-foreground"
|
|
onClick={() => useModalStore.getState().open("create-issue", { status })}
|
|
>
|
|
<Plus className="size-3.5" />
|
|
</Button>
|
|
}
|
|
/>
|
|
<TooltipContent>Add issue</TooltipContent>
|
|
</Tooltip>
|
|
</div>
|
|
</div>
|
|
<div
|
|
ref={setNodeRef}
|
|
className={`min-h-[200px] flex-1 space-y-2 overflow-y-auto rounded-lg p-1 transition-colors ${
|
|
isOver ? "bg-accent/60" : ""
|
|
}`}
|
|
>
|
|
<SortableContext items={issueIds} strategy={verticalListSortingStrategy}>
|
|
{resolvedIssues.map((issue) => (
|
|
<DraggableBoardCard key={issue.id} issue={issue} childProgress={childProgressMap?.get(issue.id)} />
|
|
))}
|
|
</SortableContext>
|
|
{issueIds.length === 0 && (
|
|
<p className="py-8 text-center text-xs text-muted-foreground">
|
|
No issues
|
|
</p>
|
|
)}
|
|
{footer}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|