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

State

Manage the state of this project.

{Object.keys(groupedStates).map((key) => (

{key} states

{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} />
) )}
{key === activeGroup && ( { setActiveGroup(null); setSelectedState(null); }} workspaceSlug={activeWorkspace?.slug} data={null} selectedGroup={key as keyof StateGroup} /> )}
))}
); }; export default StatesSettings;