"use client"; import { FC } from "react"; import { observer } from "mobx-react-lite"; import { useParams, useRouter, useSearchParams } from "next/navigation"; // components import { IssueBlockDueDate } from "@/components/issues/board-views/block-due-date"; import { IssueBlockLabels } from "@/components/issues/board-views/block-labels"; import { IssueBlockPriority } from "@/components/issues/board-views/block-priority"; import { IssueBlockState } from "@/components/issues/board-views/block-state"; // mobx hook import { useIssueDetails, useProject } from "@/hooks/store"; // interfaces import { IIssue } from "@/types/issue"; // store type IssueListBlockProps = { issue: IIssue; workspaceSlug: string; projectId: string; }; export const IssueListBlock: FC = observer((props) => { const { workspaceSlug, projectId, issue } = props; const { board, states, priorities, labels } = useParams(); const searchParams = useSearchParams(); // store const { project } = useProject(); const { setPeekId } = useIssueDetails(); // router const router = useRouter(); const handleBlockClick = () => { setPeekId(issue.id); const params: any = { board: board, peekId: issue.id }; if (states && states.length > 0) params.states = states; if (priorities && priorities.length > 0) params.priorities = priorities; if (labels && labels.length > 0) params.labels = labels; router.push(`/${workspaceSlug}/${projectId}?${searchParams}`); // router.push(`/${workspace_slug?.toString()}/${project_slug}?board=${board?.toString()}&peekId=${issue.id}`); }; return (
{/* id */}
{project?.identifier}-{issue?.sequence_id}
{/* name */}
{issue.name}
{/* priority */} {issue?.priority && (
)} {/* state */} {issue?.state_detail && (
)} {/* labels */} {issue?.label_details && issue?.label_details.length > 0 && (
)} {/* due date */} {issue?.target_date && (
)}
); });