/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import type { SetStateAction } from "react"; import { observer } from "mobx-react"; import { DragDropOutline, EditOutline } from "@makeplane/propel/icons"; import { EIconSize } from "@plane/constants"; // plane imports 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; }; type TDisabledStateItemTitleProps = TBaseStateItemTitleProps & { disabled: true; }; export type TStateItemTitleProps = TEnabledStateItemTitleProps | TDisabledStateItemTitleProps; export const StateItemTitle = observer(function StateItemTitle(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 */}
)}
); });