import React, { useEffect, useRef, useState } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; import { PlusIcon } from "lucide-react"; // components import { SpreadsheetColumnsList, SpreadsheetIssuesColumn, SpreadsheetInlineCreateIssueForm } from "components/issues"; import { CustomMenu, Spinner } from "@plane/ui"; // types import { IIssue, IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueLabels, IStateResponse, IUserLite, } from "types"; type Props = { displayProperties: IIssueDisplayProperties; displayFilters: IIssueDisplayFilterOptions; handleDisplayFilterUpdate: (data: Partial) => void; issues: IIssue[] | undefined; members?: IUserLite[] | undefined; labels?: IIssueLabels[] | undefined; states?: IStateResponse | undefined; handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void; handleUpdateIssue: (issue: IIssue, data: Partial) => void; openIssuesListModal?: (() => void) | null; disableUserActions: boolean; enableQuickCreateIssue?: boolean; }; export const SpreadsheetView: React.FC = observer((props) => { const { displayProperties, displayFilters, handleDisplayFilterUpdate, issues, members, labels, states, handleIssueAction, handleUpdateIssue, openIssuesListModal, disableUserActions, enableQuickCreateIssue, } = props; const [expandedIssues, setExpandedIssues] = useState([]); const [isInlineCreateIssueFormOpen, setIsInlineCreateIssueFormOpen] = useState(false); const [isScrolled, setIsScrolled] = useState(false); const containerRef = useRef(null); const router = useRouter(); const { cycleId, moduleId } = router.query; const type = cycleId ? "cycle" : moduleId ? "module" : "issue"; const handleScroll = () => { if (!containerRef.current) return; const scrollLeft = containerRef.current.scrollLeft; setIsScrolled(scrollLeft > 0); }; useEffect(() => { const currentContainerRef = containerRef.current; if (currentContainerRef) currentContainerRef.addEventListener("scroll", handleScroll); return () => { if (currentContainerRef) currentContainerRef.removeEventListener("scroll", handleScroll); }; }, []); return (
{issues ? ( <>
{displayProperties.key && ( ID )} Issue
{issues.map((issue: IIssue, index) => ( ))}
) : (
)}
{enableQuickCreateIssue && }
{/* {!disableUserActions && !isInlineCreateIssueFormOpen && (type === "issue" ? ( ) : ( New Issue } optionsClassName="left-5 !w-36" noBorder > setIsInlineCreateIssueFormOpen(true)}> Create new {openIssuesListModal && ( Add an existing issue )} ))} */}
); });