feat: add Money field type in settings (#2405)

Closes #2346
This commit is contained in:
Thaïs
2023-11-09 17:13:34 +01:00
committed by GitHub
parent c8eda61704
commit 0d4949484c
12 changed files with 103 additions and 50 deletions

View File

@ -7,6 +7,7 @@ import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { Field } from '~/generated-metadata/graphql';
import { dataTypes } from '../../constants/dataTypes';
import { MetadataFieldDataType } from '../../types/ObjectFieldDataType';
import { SettingsObjectFieldDataType } from './SettingsObjectFieldDataType';
@ -30,6 +31,9 @@ const StyledIconTableCell = styled(TableCell)`
padding-right: ${({ theme }) => theme.spacing(1)};
`;
// TODO: remove "relation" type for now, add it back when the backend is ready.
const { RELATION: _, ...dataTypesWithoutRelation } = dataTypes;
export const SettingsObjectFieldItemTableRow = ({
ActionIcon,
fieldItem,
@ -38,15 +42,12 @@ export const SettingsObjectFieldItemTableRow = ({
const { Icon } = useLazyLoadIcon(fieldItem.icon ?? '');
// TODO: parse with zod and merge types with FieldType (create a subset of FieldType for example)
const fieldDataTypeIsSupported = [
'TEXT',
'NUMBER',
'BOOLEAN',
'URL',
].includes(fieldItem.type);
const fieldDataTypeIsSupported = Object.keys(
dataTypesWithoutRelation,
).includes(fieldItem.type);
if (!fieldDataTypeIsSupported) {
return <></>;
return null;
}
return (