- Migrate issue-detail.tsx: useQuery for issue data, useUpdateIssue/useDeleteIssue
- Migrate issues-page.tsx, my-issues-page.tsx, board-card.tsx: useQuery for list
- Migrate batch-action-toolbar.tsx, create-issue.tsx: mutation hooks
- Migrate edge consumers: mention-suggestion, mention-view, agents page, issue-mention-card
- Remove Zustand writes from WS sync (TQ cache is now sole source of truth)
- Remove useIssueStore.fetch() dependency from workspace store
- Gut useIssueStore to client-only: { activeIssueId, setActiveIssue }
- Update test wrappers with QueryClientProvider
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import { issueListOptions } from "@core/issues/queries";
|
|
import { useWorkspaceId } from "@core/hooks";
|
|
import { StatusIcon } from "./status-icon";
|
|
|
|
interface IssueMentionCardProps {
|
|
issueId: string;
|
|
/** Fallback text when issue is not in store (e.g. "MUL-7") */
|
|
fallbackLabel?: string;
|
|
}
|
|
|
|
export function IssueMentionCard({ issueId, fallbackLabel }: IssueMentionCardProps) {
|
|
const wsId = useWorkspaceId();
|
|
const { data: issues = [] } = useQuery(issueListOptions(wsId));
|
|
const issue = issues.find((i) => i.id === issueId);
|
|
|
|
if (!issue) {
|
|
return (
|
|
<Link
|
|
href={`/issues/${issueId}`}
|
|
className="text-primary font-medium cursor-pointer hover:underline"
|
|
>
|
|
{fallbackLabel ?? issueId.slice(0, 8)}
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Link
|
|
href={`/issues/${issueId}`}
|
|
className="inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 text-sm hover:bg-accent transition-colors cursor-pointer no-underline"
|
|
>
|
|
<StatusIcon status={issue.status} className="h-3.5 w-3.5" />
|
|
<span className="font-medium text-muted-foreground">{issue.identifier}</span>
|
|
<span className="text-foreground">{issue.title}</span>
|
|
</Link>
|
|
);
|
|
}
|