import React, { FC, useState } from "react"; import { observer } from "mobx-react-lite"; // lib import { useMobxStore } from "lib/mobx/store-provider"; import { IIssue } from "types"; import useUserAuth from "hooks/use-user-auth"; // icons import { ClipboardDocumentCheckIcon, LinkIcon, PencilIcon, TrashIcon, XMarkIcon, ArrowTopRightOnSquareIcon, PaperClipIcon, } from "@heroicons/react/24/outline"; // components import { Tooltip, CustomMenu, ContextMenu } from "components/ui"; import { LayerDiagonalIcon } from "components/icons"; import { ViewAssigneeSelect, ViewDueDateSelect, ViewEstimateSelect, ViewIssueLabel, ViewPrioritySelect, ViewStartDateSelect, ViewStateSelect, } from "components/issues"; import { IssuePrioritySelect } from "../properties"; export interface IIssueListItem { issue: IIssue; groupId: string; } export const IssueListItem: FC = observer((props) => { const { issue, groupId } = props; // store const { user: userStore, issueFilters: issueFilterStore, issueDetail: issueDetailStore } = useMobxStore(); const displayProperties = issueFilterStore.userFilters?.display_properties; const workspaceId = issueFilterStore.workspaceId; const projectId = issueFilterStore.projectId; const issueId = issue.id; const user = userStore.currentUser; console.log("userStore", userStore); // context menu const [contextMenu, setContextMenu] = useState(false); const [contextMenuPosition, setContextMenuPosition] = useState(null); const isNotAllowed = false; // const isNotAllowed = // userAuth?.isGuest || userAuth?.isViewer || disableUserActions || isArchivedIssues; const partialUpdateIssue = (data: any) => { // console.log("data", data); if (workspaceId && projectId && issueId) issueDetailStore.updateIssueAsync(workspaceId, projectId, issueId, data); }; return (
<> {/* {!isNotAllowed && ( <> Edit issue Make a copy... handleDeleteIssue(issue)}> Delete issue )} Copy issue link Open issue in new tab */}
{ e.preventDefault(); setContextMenu(true); setContextMenuPosition(e); }} >
{/* {properties.key && ( {issue.project_detail?.identifier}-{issue.sequence_id} )} */}
{displayProperties?.priority && ( // )} {displayProperties?.state && ( )} {displayProperties?.start_date && issue.start_date && ( )} {displayProperties?.due_date && issue.target_date && ( )} {displayProperties?.labels && } {displayProperties?.assignee && ( )} {displayProperties?.estimate && issue.estimate_point !== null && ( )} {displayProperties?.sub_issue_count && issue.sub_issues_count > 0 && (
{issue.sub_issues_count}
)} {displayProperties?.link && issue.link_count > 0 && (
{issue.link_count}
)} {displayProperties?.attachment_count && issue.attachment_count > 0 && (
{issue.attachment_count}
)} {/* {type && !isNotAllowed && (
Edit issue
{type !== "issue" && removeIssue && (
Remove from {type}
)} handleDeleteIssue(issue)}>
Delete issue
Copy issue link
)} */}
); });