diff --git a/web/src/components/molecules/Schema/FieldModal/FieldCreationModal/index.tsx b/web/src/components/molecules/Schema/FieldModal/FieldCreationModal/index.tsx index c307ae03f3..33891ca9ea 100644 --- a/web/src/components/molecules/Schema/FieldModal/FieldCreationModal/index.tsx +++ b/web/src/components/molecules/Schema/FieldModal/FieldCreationModal/index.tsx @@ -1,6 +1,6 @@ import styled from "@emotion/styled"; import { CheckboxChangeEvent } from "antd/lib/checkbox"; -import { useCallback, useEffect, useState } from "react"; +import { useCallback, useEffect, useMemo, useState } from "react"; import Checkbox from "@reearth-cms/components/atoms/Checkbox"; import Form, { FieldError } from "@reearth-cms/components/atoms/Form"; @@ -260,6 +260,16 @@ const FieldCreationModal: React.FC = ({ onClose?.(true); }, [onClose]); + const isRequiredDisabled = useMemo( + () => selectedType === "Group" || selectedType === "Bool", + [selectedType], + ); + + const isUniqueDisabled = useMemo( + () => selectedType === "Group" || selectedType === "Bool", + [selectedType], + ); + return ( = ({ name="required" valuePropName="checked" extra={t("Prevents saving an entry if this field is empty")}> - {t("Make field required")} + {t("Make field required")} - {t("Set field as unique")} + {t("Set field as unique")}