import { FC } from "react";
import { observer } from "mobx-react-lite";
import { useRouter } from "next/router";
import { ContrastIcon, FileText, Inbox, Layers } from "lucide-react";
// ui
import { DiceIcon, ToggleSwitch, TOAST_TYPE, setToast } from "@plane/ui";
// constants
import { EUserProjectRoles } from "constants/project";
// hooks
import { useEventTracker, useProject, useUser } from "hooks/store";
// types
import { IProject } from "@plane/types";
const PROJECT_FEATURES_LIST = [
{
title: "Cycles",
description: "Cycles are enabled for all the projects in this workspace. Access them from the sidebar.",
icon: ,
property: "cycle_view",
},
{
title: "Modules",
description: "Modules are enabled for all the projects in this workspace. Access it from the sidebar.",
icon: ,
property: "module_view",
},
{
title: "Views",
description: "Views are enabled for all the projects in this workspace. Access it from the sidebar.",
icon: ,
property: "issue_views_view",
},
{
title: "Pages",
description: "Pages are enabled for all the projects in this workspace. Access it from the sidebar.",
icon: ,
property: "page_view",
},
{
title: "Inbox",
description: "Inbox are enabled for all the projects in this workspace. Access it from the issues views page.",
icon: ,
property: "inbox_view",
},
];
export const ProjectFeaturesList: FC = observer(() => {
// router
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
// store hooks
const { captureEvent } = useEventTracker();
const {
currentUser,
membership: { currentProjectRole },
} = useUser();
const { currentProjectDetails, updateProject } = useProject();
const isAdmin = currentProjectRole === EUserProjectRoles.ADMIN;
const handleSubmit = async (formData: Partial) => {
if (!workspaceSlug || !projectId || !currentProjectDetails) return;
setToast({
type: TOAST_TYPE.SUCCESS,
title: "Success!",
message: "Project feature updated successfully.",
});
updateProject(workspaceSlug.toString(), projectId.toString(), formData);
};
if (!currentUser) return <>>;
return (