import React, { useState } from "react"; import { useRouter } from "next/router"; // headless ui import { Disclosure, Popover, Transition } from "@headlessui/react"; // icons import { ChevronDownIcon, PlusIcon, RectangleStackIcon } from "@heroicons/react/24/outline"; // layouts import AppLayout from "layouts/app-layout"; // hooks import useIssues from "hooks/use-issues"; // ui import { Spinner, EmptySpace, EmptySpaceItem, HeaderButton } from "components/ui"; import { Breadcrumbs, BreadcrumbItem } from "components/breadcrumbs"; // hooks import useIssuesProperties from "hooks/use-issue-properties"; // types import { IIssue, Properties } from "types"; // components import { DeleteIssueModal, MyIssuesListItem } from "components/issues"; // helpers import { replaceUnderscoreIfSnakeCase } from "helpers/string.helper"; // types import type { NextPage } from "next"; const MyIssuesPage: NextPage = () => { const [deleteIssueModal, setDeleteIssueModal] = useState(false); const [issueToDelete, setIssueToDelete] = useState(null); const router = useRouter(); const { workspaceSlug } = router.query; // fetching user issues const { myIssues } = useIssues(workspaceSlug as string); const [properties, setProperties] = useIssuesProperties( workspaceSlug ? (workspaceSlug as string) : undefined, undefined ); const handleDeleteIssue = (issue: IIssue) => { setDeleteIssueModal(true); setIssueToDelete(issue); }; return ( <> setDeleteIssueModal(false)} isOpen={deleteIssueModal} data={issueToDelete} /> } right={
{({ open }) => ( <> View

Properties

{Object.keys(properties).map((key) => ( ))}
)}
{ const e = new KeyboardEvent("keydown", { key: "c", }); document.dispatchEvent(e); }} />
} >
{myIssues ? ( <> {myIssues.length > 0 ? (
{({ open }) => (

My Issues

{myIssues.length}

{myIssues.map((issue: IIssue) => ( handleDeleteIssue(issue)} /> ))}
)}
) : (
Use
C
shortcut to create a new issue } Icon={PlusIcon} action={() => { const e = new KeyboardEvent("keydown", { key: "c", }); document.dispatchEvent(e); }} />
)} ) : (
)}
); }; export default MyIssuesPage;