import { useState } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // components import { ProjectViewListItem } from "components/views"; import { NewEmptyState } from "components/common/new-empty-state"; // ui import { Input, Loader } from "@plane/ui"; // assets import emptyView from "public/empty-state/empty_view.webp"; // icons import { Plus, Search } from "lucide-react"; // constants import { EUserWorkspaceRoles } from "constants/workspace"; export const ProjectViewsList = observer(() => { const [query, setQuery] = useState(""); const router = useRouter(); const { projectId } = router.query; const { projectViews: projectViewsStore, commandPalette: commandPaletteStore, user: { currentProjectRole }, } = useMobxStore(); const viewsList = projectId ? projectViewsStore.viewsList[projectId.toString()] : undefined; const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER; if (!viewsList) return ( ); const filteredViewsList = viewsList.filter((v) => v.name.toLowerCase().includes(query.toLowerCase())); return ( <> {viewsList.length > 0 ? (
setQuery(e.target.value)} placeholder="Search" mode="true-transparent" />
{filteredViewsList.length > 0 ? ( filteredViewsList.map((view) => ) ) : (

No results found

)}
) : ( , text: "Build your first view", onClick: () => commandPaletteStore.toggleCreateViewModal(true), } : null } disabled={!isEditingAllowed} /> )} ); });