import type { SetStateAction } from "react"; import { observer } from "mobx-react"; import { GripVertical, Pencil } from "lucide-react"; // plane imports import { EIconSize, STATE_TRACKER_ELEMENTS } from "@plane/constants"; import { StateGroupIcon } from "@plane/propel/icons"; import type { IState, TStateOperationsCallbacks } from "@plane/types"; // local imports import { useProjectState } from "@/hooks/store/use-project-state"; import { StateDelete, StateMarksAsDefault } from "./options"; type TBaseStateItemTitleProps = { stateCount: number; state: IState; shouldShowDescription?: boolean; setUpdateStateModal: (value: SetStateAction) => void; }; type TEnabledStateItemTitleProps = TBaseStateItemTitleProps & { disabled: false; stateOperationsCallbacks: Pick; shouldTrackEvents: boolean; }; type TDisabledStateItemTitleProps = TBaseStateItemTitleProps & { disabled: true; }; export type TStateItemTitleProps = TEnabledStateItemTitleProps | TDisabledStateItemTitleProps; export const StateItemTitle = observer((props: TStateItemTitleProps) => { const { stateCount, setUpdateStateModal, disabled, state, shouldShowDescription = true } = props; // store hooks const { getStatePercentageInGroup } = useProjectState(); // derived values const statePercentage = getStatePercentageInGroup(state.id); const percentage = statePercentage ? statePercentage / 100 : undefined; return (
{/* draggable indicator */} {!disabled && stateCount != 1 && (
)} {/* state icon */}
{/* state title and description */}
{state.name}
{shouldShowDescription &&

{state.description}

}
{!disabled && (
{/* state mark as default option */}
{/* state edit options */}
)}
); });