import { FC } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; // components import { IssueBlockPriority } from "components/issues/board-views/block-priority"; import { IssueBlockState } from "components/issues/board-views/block-state"; import { IssueBlockLabels } from "components/issues/board-views/block-labels"; import { IssueBlockDueDate } from "components/issues/board-views/block-due-date"; import { IssueBlockUpVotes } from "components/issues/board-views/block-upvotes"; import { IssueBlockDownVotes } from "components/issues/board-views/block-downvotes"; // mobx hook import { useMobxStore } from "lib/mobx/store-provider"; // interfaces import { IIssue } from "types/issue"; // store import { RootStore } from "store/root"; import { IssueVotes } from "components/issues/peek-overview"; export const IssueListBlock: FC<{ issue: IIssue }> = observer((props) => { const { issue } = props; // store const { project: projectStore, issueDetails: issueDetailStore }: RootStore = useMobxStore(); // router const router = useRouter(); const { workspace_slug, project_slug, board } = router.query; const handleBlockClick = () => { issueDetailStore.setPeekId(issue.id); router.replace( { pathname: `/${workspace_slug?.toString()}/${project_slug}`, query: { board: board?.toString(), peekId: issue.id, }, }, undefined, { shallow: true } ); // router.push(`/${workspace_slug?.toString()}/${project_slug}?board=${board?.toString()}&peekId=${issue.id}`); }; const totalUpVotes = issue.votes.filter((v) => v.vote === 1); const totalDownVotes = issue.votes.filter((v) => v.vote === -1); return (
{/* id */}
{projectStore?.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 && (
)}
); });