diff --git a/packages/i18n/src/locales/en/translations.json b/packages/i18n/src/locales/en/translations.json index 30cfe1a99ff..001ff5743f3 100644 --- a/packages/i18n/src/locales/en/translations.json +++ b/packages/i18n/src/locales/en/translations.json @@ -1518,7 +1518,11 @@ } }, "states": { - "describe_this_state_for_your_members": "Describe this state for your members." + "describe_this_state_for_your_members": "Describe this state for your members.", + "empty_state": { + "title": "No states available for the {groupKey} group", + "description": "Please create a new state" + } }, "labels": { "label_title": "Label title", diff --git a/packages/i18n/src/locales/es/translations.json b/packages/i18n/src/locales/es/translations.json index f3564b2594d..9062951c2fa 100644 --- a/packages/i18n/src/locales/es/translations.json +++ b/packages/i18n/src/locales/es/translations.json @@ -1687,7 +1687,11 @@ } }, "states": { - "describe_this_state_for_your_members": "Describe este estado para tus miembros." + "describe_this_state_for_your_members": "Describe este estado para tus miembros.", + "empty_state": { + "title": "No estados disponibles para el grupo {groupKey}", + "description": "Por favor, crea un nuevo estado" + } }, "labels": { "label_title": "Título de la etiqueta", diff --git a/packages/i18n/src/locales/fr/translations.json b/packages/i18n/src/locales/fr/translations.json index 8d066d42978..0f0cb2739c6 100644 --- a/packages/i18n/src/locales/fr/translations.json +++ b/packages/i18n/src/locales/fr/translations.json @@ -1687,7 +1687,11 @@ } }, "states": { - "describe_this_state_for_your_members": "Décrivez cet état pour vos membres." + "describe_this_state_for_your_members": "Décrivez cet état pour vos membres.", + "empty_state": { + "title": "Aucun état disponible pour le groupe {groupKey}", + "description": "Veuillez créer un nouvel état" + } }, "labels": { "label_title": "Titre de l'étiquette", diff --git a/packages/i18n/src/locales/ja/translations.json b/packages/i18n/src/locales/ja/translations.json index 66e8f681eca..cc665545309 100644 --- a/packages/i18n/src/locales/ja/translations.json +++ b/packages/i18n/src/locales/ja/translations.json @@ -1687,7 +1687,11 @@ } }, "states": { - "describe_this_state_for_your_members": "このステータスについてメンバーに説明してください。" + "describe_this_state_for_your_members": "このステータスについてメンバーに説明してください。", + "empty_state": { + "title": "{groupKey}グループのステータスがありません", + "description": "新しいステータスを作成してください" + } }, "labels": { "label_title": "ラベルタイトル", diff --git a/packages/i18n/src/locales/zh-CN/translations.json b/packages/i18n/src/locales/zh-CN/translations.json index 914d2662e3d..03a66da3306 100644 --- a/packages/i18n/src/locales/zh-CN/translations.json +++ b/packages/i18n/src/locales/zh-CN/translations.json @@ -1687,7 +1687,11 @@ } }, "states": { - "describe_this_state_for_your_members": "为您的成员描述此状态。" + "describe_this_state_for_your_members": "为您的成员描述此状态。", + "empty_state": { + "title": "{groupKey} 组中没有状态", + "description": "请创建一个新状态" + } }, "labels": { "label_title": "标签标题", diff --git a/web/core/components/project-states/group-item.tsx b/web/core/components/project-states/group-item.tsx index 68793636e26..6b766dacf71 100644 --- a/web/core/components/project-states/group-item.tsx +++ b/web/core/components/project-states/group-item.tsx @@ -3,11 +3,13 @@ import { FC, useState, useRef } from "react"; import { observer } from "mobx-react"; import { ChevronDown, Plus } from "lucide-react"; +// plane imports import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; +import { useTranslation } from "@plane/i18n"; import { IState, TStateGroups } from "@plane/types"; -// components import { StateGroupIcon } from "@plane/ui"; import { cn } from "@plane/utils"; +// components import { StateList, StateCreate } from "@/components/project-states"; // hooks import { useUserPermissions } from "@/hooks/store"; @@ -34,17 +36,18 @@ export const GroupItem: FC = observer((props) => { handleExpand, handleGroupCollapse, } = props; + // refs + const dropElementRef = useRef(null); + // plane hooks + const { t } = useTranslation(); // store hooks const { allowPermissions } = useUserPermissions(); // state const [createState, setCreateState] = useState(false); - // derived values const currentStateExpanded = groupsExpanded.includes(groupKey); - // refs - const dropElementRef = useRef(null); - const isEditable = allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.PROJECT); + const shouldShowEmptyState = states.length === 0 && currentStateExpanded && !createState; return (
= observer((props) => {
- {groupedStates[groupKey].length > 0 && currentStateExpanded && ( + {shouldShowEmptyState && ( +
+
{t("project_settings.states.empty_state.title", { groupKey })}
+ {isEditable &&
{t("project_settings.states.empty_state.description")}
} +
+ )} + + {currentStateExpanded && (
; + + // First group the existing states + const groupedStates = groupBy(this.projectStates, "group") as Record; + + // Ensure all STATE_GROUPS are present + const allGroups = Object.keys(STATE_GROUPS).reduce( + (acc, group) => ({ + ...acc, + [group]: groupedStates[group] || [], + }), + {} as Record + ); + + return allGroups; } /**