mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
b7757c6b1a
* fix: semicolon on estimate settings page * refactor: project settings automations store implementation * fix: active cycle stuck on infinite loading * fix: removed delete project option from sidebar * fix: discloser not opening when navigating to project * fix: clear filter not working & filter appearing even if nothing is selected * refactor: select label store implementation * refactor: select state store implementation
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
import React, { ReactElement } from "react";
|
|
import { useRouter } from "next/router";
|
|
import { observer } from "mobx-react-lite";
|
|
// store
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
// layouts
|
|
import { AppLayout } from "layouts/app-layout";
|
|
import { ProjectSettingLayout } from "layouts/settings-layout";
|
|
// hooks
|
|
import useToast from "hooks/use-toast";
|
|
// components
|
|
import { AutoArchiveAutomation, AutoCloseAutomation } from "components/automation";
|
|
import { ProjectSettingHeader } from "components/headers";
|
|
// types
|
|
import { NextPageWithLayout } from "types/app";
|
|
import { IProject } from "types";
|
|
|
|
const AutomationSettingsPage: NextPageWithLayout = observer(() => {
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query;
|
|
|
|
const { setToastAlert } = useToast();
|
|
|
|
// store
|
|
const {
|
|
user: { currentProjectRole },
|
|
project: { currentProjectDetails: projectDetails, updateProject },
|
|
} = useMobxStore();
|
|
|
|
const handleChange = async (formData: Partial<IProject>) => {
|
|
if (!workspaceSlug || !projectId || !projectDetails) return;
|
|
|
|
await updateProject(workspaceSlug.toString(), projectId.toString(), formData).catch(() => {
|
|
setToastAlert({
|
|
type: "error",
|
|
title: "Error!",
|
|
message: "Something went wrong. Please try again.",
|
|
});
|
|
});
|
|
};
|
|
|
|
const isAdmin = currentProjectRole === 20;
|
|
|
|
return (
|
|
<section className={`pr-9 py-8 w-full overflow-y-auto ${isAdmin ? "" : "opacity-60"}`}>
|
|
<div className="flex items-center py-3.5 border-b border-custom-border-100">
|
|
<h3 className="text-xl font-medium">Automations</h3>
|
|
</div>
|
|
<AutoArchiveAutomation handleChange={handleChange} />
|
|
<AutoCloseAutomation handleChange={handleChange} />
|
|
</section>
|
|
);
|
|
});
|
|
|
|
AutomationSettingsPage.getLayout = function getLayout(page: ReactElement) {
|
|
return (
|
|
<AppLayout header={<ProjectSettingHeader title="Automations Settings" />} withProjectWrapper>
|
|
<ProjectSettingLayout>{page}</ProjectSettingLayout>
|
|
</AppLayout>
|
|
);
|
|
};
|
|
|
|
export default AutomationSettingsPage;
|