import type { ReactNode } from "react"; import type { Issue } from "@paperclipai/shared"; import { Link } from "@/lib/router"; import { X } from "lucide-react"; import { createIssueDetailPath, rememberIssueDetailLocationState } from "../lib/issueDetailBreadcrumb"; import { cn } from "../lib/utils"; import { StatusIcon } from "./StatusIcon"; type UnreadState = "hidden" | "visible" | "fading"; interface IssueRowProps { issue: Issue; issueLinkState?: unknown; selected?: boolean; mobileLeading?: ReactNode; desktopMetaLeading?: ReactNode; desktopLeadingSpacer?: boolean; mobileMeta?: ReactNode; desktopTrailing?: ReactNode; trailingMeta?: ReactNode; titleSuffix?: ReactNode; unreadState?: UnreadState | null; onMarkRead?: () => void; onArchive?: () => void; archiveDisabled?: boolean; className?: string; } export function IssueRow({ issue, issueLinkState, selected = false, mobileLeading, desktopMetaLeading, desktopLeadingSpacer = false, mobileMeta, desktopTrailing, trailingMeta, titleSuffix, unreadState = null, onMarkRead, onArchive, archiveDisabled, className, }: IssueRowProps) { const issuePathId = issue.identifier ?? issue.id; const identifier = issue.identifier ?? issue.id.slice(0, 8); const showUnreadSlot = unreadState !== null; const showUnreadDot = unreadState === "visible" || unreadState === "fading"; const selectedStatusClass = selected ? "!text-muted-foreground !border-muted-foreground" : undefined; return ( rememberIssueDetailLocationState(issuePathId, issueLinkState)} className={cn( "group flex items-start gap-2 border-b border-border py-2.5 pl-2 pr-3 text-sm no-underline text-inherit transition-colors last:border-b-0 sm:items-center sm:py-2 sm:pl-1", selected ? "hover:bg-transparent" : "hover:bg-accent/50", className, )} > {mobileLeading ?? } {issue.title}{titleSuffix} {desktopLeadingSpacer ? ( ) : null} {desktopMetaLeading ?? ( <> {identifier} )} {mobileMeta ? ( <> {mobileMeta} ) : null} {(desktopTrailing || trailingMeta) ? ( {desktopTrailing} {trailingMeta ? ( {trailingMeta} ) : null} ) : null} {showUnreadSlot ? ( {showUnreadDot ? ( ) : onArchive ? ( ) : ( ) : null} ); }