// next import { useRouter } from "next/router"; // react import { Fragment } from "react"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // hooks import useUser from "lib/hooks/useUser"; // services import issuesServices from "lib/services/issues.services"; import projectService from "lib/services/project.service"; // swr import useSWR from "swr"; // types import { IIssue, ProjectMember } from "types"; // constants import { PROJECT_ISSUES_DETAILS, PROJECT_MEMBERS } from "constants/fetch-keys"; import { Button } from "ui"; import { ChartBarIcon, Squares2X2Icon, TagIcon, UserIcon } from "@heroicons/react/24/outline"; type Props = { isOpen: boolean; setIsOpen: React.Dispatch>; issueId: string | null; }; const IssuePreviewModal = ({ isOpen, setIsOpen, issueId }: Props) => { const closeModal = () => { setIsOpen(false); }; const { activeWorkspace, activeProject } = useUser(); const router = useRouter(); const { data: issueDetails } = useSWR( activeWorkspace && activeProject && issueId ? PROJECT_ISSUES_DETAILS(issueId) : null, activeWorkspace && activeProject && issueId ? () => issuesServices.getIssue(activeWorkspace.slug, activeProject.id, issueId) : null ); const { data: users } = useSWR( activeWorkspace && activeProject ? PROJECT_MEMBERS(activeProject.id) : null, activeWorkspace && activeProject ? () => projectService.projectMembers(activeWorkspace.slug, activeProject.id) : null ); return ( <>
{issueDetails?.project_detail.identifier}-{issueDetails?.sequence_id}{" "} {issueDetails?.name} Created by{" "} {users?.find((u) => u.id === issueDetails?.created_by)?.member.first_name}

{issueDetails?.description}

{issueDetails?.state_detail.name} {issueDetails?.priority} {issueDetails?.label_details && issueDetails.label_details.length > 0 ? issueDetails.label_details.map((label) => ( {label.name} )) : "None"} {issueDetails?.assignee_details && issueDetails.assignee_details.length > 0 ? issueDetails.assignee_details.map((assignee) => ( {assignee.first_name} )) : "None"}
); }; export default IssuePreviewModal;