fix(history): update relations display (#20081)

This commit is contained in:
markkaylor 2024-04-10 17:27:04 +02:00 committed by GitHub
parent 0a031cc777
commit a1b6aeee27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,16 +65,7 @@ const CustomRelationInput = (props: RelationsFieldProps) => {
return (
<Box>
<FieldLabel>{props.label}</FieldLabel>
{results.length === 0 ? (
<Box marginTop={1}>
<StyledAlert variant="default">
{formatMessage({
id: 'content-manager.history.content.no-relations',
defaultMessage: 'No relations.',
})}
</StyledAlert>
</Box>
) : (
{results.length > 0 && (
<Flex direction="column" gap={2} marginTop={1} alignItems="stretch">
{results.map((relationData) => {
// @ts-expect-error targetModel does exist on the attribute. But it's not typed.
@ -104,8 +95,11 @@ const CustomRelationInput = (props: RelationsFieldProps) => {
</Flex>
);
})}
</Flex>
)}
{meta.missingCount > 0 && (
<StyledAlert
marginTop={1}
variant="warning"
title={formatMessage(
{
@ -126,7 +120,15 @@ const CustomRelationInput = (props: RelationsFieldProps) => {
)}
</StyledAlert>
)}
</Flex>
{results.length === 0 && meta.missingCount === 0 && (
<Box marginTop={1}>
<StyledAlert variant="default">
{formatMessage({
id: 'content-manager.history.content.no-relations',
defaultMessage: 'No relations.',
})}
</StyledAlert>
</Box>
)}
</Box>
);