// react import { useState } from "react"; // hooks import useUser from "lib/hooks/useUser"; // layouts import SettingsLayout from "layouts/settings-layout"; // components import ConfirmStateDeletion from "components/project/issues/BoardView/state/confirm-state-delete"; import { CreateUpdateStateInline, StateGroup, } from "components/project/issues/BoardView/state/create-update-state-inline"; // ui import { Spinner } from "ui"; // icons import { PencilSquareIcon, PlusIcon, TrashIcon } from "@heroicons/react/24/outline"; // types import { IState } from "types"; // common import { addSpaceIfCamelCase, groupBy } from "constants/common"; const StatesSettings = () => { const [activeGroup, setActiveGroup] = useState(null); const [selectedState, setSelectedState] = useState(null); const [selectDeleteState, setSelectDeleteState] = useState(null); const { activeWorkspace, activeProject, states } = useUser(); const groupedStates: { [key: string]: IState[]; } = groupBy(states ?? [], "group"); return ( <> state.id === selectDeleteState) ?? null} onClose={() => setSelectDeleteState(null)} />

States

Manage the state of this project.

{states && activeProject ? ( Object.keys(groupedStates).map((key) => (

{key} states

{key === activeGroup && ( { setActiveGroup(null); setSelectedState(null); }} workspaceSlug={activeWorkspace?.slug} data={null} selectedGroup={key as keyof StateGroup} /> )} {groupedStates[key]?.map((state) => state.id !== selectedState ? (
{addSpaceIfCamelCase(state.name)}
) : (
{ setActiveGroup(null); setSelectedState(null); }} workspaceSlug={activeWorkspace?.slug} data={states?.find((state) => state.id === selectedState) ?? null} selectedGroup={key as keyof StateGroup} />
) )}
)) ) : (
)}
); }; export default StatesSettings;