"use client"; import { FC } from "react"; import { observer } from "mobx-react-lite"; import { useRouter, useSearchParams } from "next/navigation"; // components import { IssueBlockDueDate } from "@/components/issues/board-views/block-due-date"; import { IssueBlockPriority } from "@/components/issues/board-views/block-priority"; import { IssueBlockState } from "@/components/issues/board-views/block-state"; // helpers import { queryParamGenerator } from "@/helpers/query-param-generator"; // hooks import { useIssueDetails, useProject } from "@/hooks/store"; // interfaces import { IIssue } from "@/types/issue"; type IssueKanBanBlockProps = { issue: IIssue; workspaceSlug: string; projectId: string; params: any; }; export const IssueKanBanBlock: FC = observer((props) => { const router = useRouter(); const searchParams = useSearchParams(); // query params const board = searchParams.get("board") || undefined; const state = searchParams.get("state") || undefined; const priority = searchParams.get("priority") || undefined; const labels = searchParams.get("labels") || undefined; // props const { workspaceSlug, projectId, issue } = props; // hooks const { project } = useProject(); const { setPeekId } = useIssueDetails(); const handleBlockClick = () => { setPeekId(issue.id); const { queryParam } = queryParamGenerator({ board, peekId: issue.id, priority, state, labels }); router.push(`/${workspaceSlug}/${projectId}?${queryParam}`); }; return (
{/* id */}
{project?.identifier}-{issue?.sequence_id}
{/* name */}
{issue.name}
{/* priority */} {issue?.priority && (
)} {/* state */} {issue?.state_detail && (
)} {/* due date */} {issue?.target_date && (
)}
); });