feat: add Object Edit Settings section with Object preview (#4216)

* feat: add Object Edit Settings section with Object preview

Closes #3834

* fix: fix preview card stories

* test: improve getFieldDefaultPreviewValue tests

* test: add getFieldPreviewValueFromRecord tests

* test: add useFieldPreview tests

* refactor: rename and move components

* fix: restore RecordStoreDecorator
This commit is contained in:
Thaïs
2024-02-29 11:23:56 -03:00
committed by GitHub
parent 6ad3880696
commit a892d0f653
43 changed files with 1665 additions and 937 deletions

View File

@ -1,9 +1,9 @@
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { SettingsDataModelIsCustomTag } from '@/settings/data-model/objects/SettingsDataModelIsCustomTag';
import { IconArchive, IconDotsVertical, IconPencil } from '@/ui/display/icon';
import { useIcons } from '@/ui/display/icon/hooks/useIcons';
import { Tag } from '@/ui/display/tag/components/Tag';
import { H2Title } from '@/ui/display/typography/components/H2Title';
import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
import { Card } from '@/ui/layout/card/components/Card';
@ -38,7 +38,7 @@ const StyledName = styled.div`
margin-right: auto;
`;
const StyledTag = styled(Tag)`
const StyledIsCustomTag = styled(SettingsDataModelIsCustomTag)`
box-sizing: border-box;
height: ${({ theme }) => theme.spacing(6)};
`;
@ -77,11 +77,7 @@ export const SettingsAboutSection = ({
{!!Icon && <Icon size={theme.icon.size.md} />}
{name}
</StyledName>
{isCustom ? (
<StyledTag color="orange" text="Custom" weight="medium" />
) : (
<StyledTag color="blue" text="Standard" weight="medium" />
)}
<StyledIsCustomTag isCustom={isCustom} />
<Dropdown
dropdownId={dropdownId}
clickableComponent={

View File

@ -4,8 +4,8 @@ import styled from '@emotion/styled';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { SettingsDataModelIsCustomTag } from '@/settings/data-model/objects/SettingsDataModelIsCustomTag';
import { useIcons } from '@/ui/display/icon/hooks/useIcons';
import { Tag } from '@/ui/display/tag/components/Tag';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
@ -52,11 +52,7 @@ export const SettingsObjectItemTableRow = ({
{objectItem.labelPlural}
</StyledNameTableCell>
<TableCell>
{objectItem.isCustom ? (
<Tag color="orange" text="Custom" weight="regular" />
) : (
<Tag color="blue" text="Standard" weight="regular" />
)}
<SettingsDataModelIsCustomTag isCustom={objectItem.isCustom} />
</TableCell>
<TableCell align="right">
{objectItem.fields.filter((field) => !field.isSystem).length}