"use client"; import { memo } from "react"; import { useQuery } from "@tanstack/react-query"; import { AppLink } from "../../navigation"; import type { Issue } from "@multica/core/types"; import { ActorAvatar } from "../../common/actor-avatar"; import { useIssueSelectionStore } from "@multica/core/issues/stores/selection-store"; import { useWorkspacePaths } from "@multica/core/paths"; import { useWorkspaceId } from "@multica/core/hooks"; import { useViewStore } from "@multica/core/issues/stores/view-store-context"; import { projectListOptions } from "@multica/core/projects/queries"; import { PriorityIcon } from "./priority-icon"; import { ProgressRing } from "./progress-ring"; export interface ChildProgress { done: number; total: number; } function formatDate(date: string): string { return new Date(date).toLocaleDateString("en-US", { month: "short", day: "numeric", }); } export const ListRow = memo(function ListRow({ issue, childProgress, }: { issue: Issue; childProgress?: ChildProgress; }) { const selected = useIssueSelectionStore((s) => s.selectedIds.has(issue.id)); const toggle = useIssueSelectionStore((s) => s.toggle); const p = useWorkspacePaths(); const storeProperties = useViewStore((s) => s.cardProperties); const wsId = useWorkspaceId(); const { data: projects = [] } = useQuery({ ...projectListOptions(wsId), enabled: storeProperties.project && !!issue.project_id, }); const project = issue.project_id ? projects.find((pr) => pr.id === issue.project_id) : undefined; const showProject = storeProperties.project && project; const showChildProgress = storeProperties.childProgress && childProgress; const showAssignee = storeProperties.assignee && issue.assignee_type && issue.assignee_id; const showDueDate = storeProperties.dueDate && issue.due_date; return (