import { useState } from "react"; import { useRouter } from "next/router"; import Link from "next/link"; import { observer } from "mobx-react-lite"; import { Pencil, Trash2 } from "lucide-react"; // components import { CreateUpdateWorkspaceViewModal, DeleteGlobalViewModal } from "components/workspace"; // ui import { CustomMenu, PhotoFilterIcon } from "@plane/ui"; // helpers import { truncateText } from "helpers/string.helper"; import { calculateTotalFilters } from "helpers/filter.helper"; // types import { IWorkspaceView } from "types/workspace-views"; type Props = { view: IWorkspaceView }; export const GlobalViewListItem: React.FC = observer((props) => { const { view } = props; const [updateViewModal, setUpdateViewModal] = useState(false); const [deleteViewModal, setDeleteViewModal] = useState(false); const router = useRouter(); const { workspaceSlug } = router.query; const totalFilters = calculateTotalFilters(view.query_data.filters ?? {}); return ( <> setUpdateViewModal(false)} /> setDeleteViewModal(false)} />

{truncateText(view.name, 75)}

{view?.description &&

{view.description}

}

{totalFilters} {totalFilters === 1 ? "filter" : "filters"}

{ e.preventDefault(); e.stopPropagation(); setUpdateViewModal(true); }} > Edit View { e.preventDefault(); e.stopPropagation(); setDeleteViewModal(true); }} > Delete View
); });