import React, { useRef } from "react"; import { observer } from "mobx-react-lite"; // types import { TIssue, IIssueDisplayFilterOptions, IIssueDisplayProperties } from "@plane/types"; // components import { LogoSpinner } from "@/components/common"; import { MultipleSelectGroup } from "@/components/core"; import { IssueBulkOperationsRoot, SpreadsheetQuickAddIssueForm } from "@/components/issues"; // constants import { SPREADSHEET_PROPERTY_LIST, SPREADSHEET_SELECT_GROUP } from "@/constants/spreadsheet"; // hooks import { useProject } from "@/hooks/store"; // types import { TRenderQuickActions } from "../list/list-view-types"; import { SpreadsheetTable } from "./spreadsheet-table"; type Props = { displayProperties: IIssueDisplayProperties; displayFilters: IIssueDisplayFilterOptions; handleDisplayFilterUpdate: (data: Partial) => void; issueIds: string[] | undefined; quickActions: TRenderQuickActions; updateIssue: ((projectId: string, issueId: string, data: Partial) => Promise) | undefined; openIssuesListModal?: (() => void) | null; quickAddCallback?: ( workspaceSlug: string, projectId: string, data: TIssue, viewId?: string ) => Promise; viewId?: string; canEditProperties: (projectId: string | undefined) => boolean; enableQuickCreateIssue?: boolean; disableIssueCreation?: boolean; isWorkspaceLevel?: boolean; }; export const SpreadsheetView: React.FC = observer((props) => { const { displayProperties, displayFilters, handleDisplayFilterUpdate, issueIds, quickActions, updateIssue, quickAddCallback, viewId, canEditProperties, enableQuickCreateIssue, disableIssueCreation, isWorkspaceLevel = false, } = props; // refs const containerRef = useRef(null); const portalRef = useRef(null); const { currentProjectDetails } = useProject(); const isEstimateEnabled: boolean = currentProjectDetails?.estimate !== null; const spreadsheetColumnsList = isWorkspaceLevel ? SPREADSHEET_PROPERTY_LIST : SPREADSHEET_PROPERTY_LIST.filter((property) => { if (property === "cycle" && !currentProjectDetails?.cycle_view) return false; if (property === "modules" && !currentProjectDetails?.module_view) return false; return true; }); if (!issueIds || issueIds.length === 0) return (
); return (
{(helpers) => ( <>
{enableQuickCreateIssue && !disableIssueCreation && ( )}
)}
); });