import React, { useState } from "react"; import { observer } from "mobx-react-lite"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // component import { CustomSelect, Loader, ToggleSwitch } from "@plane/ui"; import { SelectMonthModal } from "components/automation"; // icon import { ArchiveRestore } from "lucide-react"; // constants import { PROJECT_AUTOMATION_MONTHS } from "constants/project"; // types import { IProject } from "types"; import { EUserWorkspaceRoles } from "constants/workspace"; type Props = { handleChange: (formData: Partial) => Promise; }; const initialValues: Partial = { archive_in: 1 }; export const AutoArchiveAutomation: React.FC = observer((props) => { const { handleChange } = props; // states const [monthModal, setmonthModal] = useState(false); const { user: userStore, project: projectStore } = useMobxStore(); const projectDetails = projectStore.currentProjectDetails; const userRole = userStore.currentProjectRole; const isAdmin = userRole === EUserWorkspaceRoles.ADMIN; return ( <> setmonthModal(false)} handleChange={handleChange} />

Auto-archive closed issues

Plane will auto archive issues that have been completed or cancelled.

projectDetails?.archive_in === 0 ? handleChange({ archive_in: 1 }) : handleChange({ archive_in: 0 }) } size="sm" disabled={!isAdmin} />
{projectDetails ? ( projectDetails.archive_in !== 0 && (
Auto-archive issues that are closed for
{ handleChange({ archive_in: val }); }} input width="w-full" disabled={!isAdmin} > <> {PROJECT_AUTOMATION_MONTHS.map((month) => ( {month.label} ))}
) ) : ( )}
); });