"use client"; import { useMemo, useState } from "react"; import { useStore } from "zustand"; import { ListTodo, Search } from "lucide-react"; import type { Issue, IssueTableFacetSpec, IssueTableFacetsResponse, } from "@multica/core/types"; import { actorIssuesViewStore, type ActorIssuesScope, } from "@multica/core/issues/stores/actor-issues-view-store"; import { Button } from "@multica/ui/components/ui/button"; import { Input } from "@multica/ui/components/ui/input"; import { Tooltip, TooltipContent, TooltipTrigger } from "@multica/ui/components/ui/tooltip"; import { IssueDisplayControls, ViewRefreshIndicator, } from "../issues/components/issues-header"; import { IssueSurface } from "../issues/surface/issue-surface"; import { useT } from "../i18n"; export type TaskActorType = "member" | "agent"; const SCOPE_VALUES: ActorIssuesScope[] = ["assigned", "created"]; function ActorIssuesHeader({ issues, search, onSearchChange, scope, onScopeChange, isRefreshing = false, facetCountsExact, tableFacetCounts, onTableFacetChange, }: { issues: Issue[]; search: string; onSearchChange: (value: string) => void; scope: ActorIssuesScope; onScopeChange: (scope: ActorIssuesScope) => void; isRefreshing?: boolean; facetCountsExact: boolean; tableFacetCounts?: IssueTableFacetsResponse; onTableFacetChange: (facet: IssueTableFacetSpec | null) => void; }) { const { t } = useT("issues"); return (
onSearchChange(e.target.value)} placeholder={t(($) => $.actor_issues.search_placeholder)} className="h-8 w-64 pl-8 text-sm" />
{SCOPE_VALUES.map((value) => ( onScopeChange(value)} > {t(($) => $.actor_issues.scope[value].label)} } /> {t(($) => $.actor_issues.scope[value].description)} ))}
); } export function ActorIssuesPanel({ actorType, actorId, }: { actorType: TaskActorType; actorId: string; }) { const { t } = useT("issues"); const scope = useStore(actorIssuesViewStore, (s) => s.scope); const setScope = useStore(actorIssuesViewStore, (s) => s.setScope); const [search, setSearch] = useState(""); const surfaceScope = useMemo( () => ({ type: "actor" as const, actorType, actorId, relation: scope, }), [actorId, actorType, scope], ); return ( ( )} renderEmpty={() => search.trim() === "" ? (

{t(($) => $.actor_issues.empty[scope].title)}

{t(($) => $.actor_issues.empty[scope].description)}

) : (

{t(($) => $.actor_issues.search_empty)}

) } /> ); }