"use client"; import { FC } from "react"; import { observer } from "mobx-react-lite"; import Link from "next/link"; import { useSearchParams } from "next/navigation"; // components import { IssueBlockDueDate, IssueBlockLabels, IssueBlockPriority, IssueBlockState } from "@/components/issues"; // helpers import { queryParamGenerator } from "@/helpers/query-param-generator"; // hook import { useIssueDetails, usePublish } from "@/hooks/store"; // types import { IIssue } from "@/types/issue"; type IssueListBlockProps = { anchor: string; issue: IIssue; }; export const IssueListLayoutBlock: FC = observer((props) => { const { anchor, issue } = props; // query params const searchParams = useSearchParams(); const board = searchParams.get("board") || undefined; const state = searchParams.get("state") || undefined; const priority = searchParams.get("priority") || undefined; const labels = searchParams.get("labels") || undefined; // store hooks const { setPeekId } = useIssueDetails(); const { project_details } = usePublish(anchor); const { queryParam } = queryParamGenerator({ board, peekId: issue.id, priority, state, labels }); const handleBlockClick = () => { setPeekId(issue.id); }; return (
{/* id */}
{project_details?.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 && (
)}
); });