fix: merge records settings select (#13944)

This commit is contained in:
neo773
2025-08-16 16:46:08 +02:00
committed by GitHub
parent 782cf5dba1
commit f9eca8f116
2 changed files with 17 additions and 34 deletions
@@ -1,17 +1,9 @@
import { useMergePreview } from '@/object-record/record-merge/hooks/useMergePreview';
import { CardComponents } from '@/object-record/record-show/components/CardComponents';
import { SummaryCard } from '@/object-record/record-show/components/SummaryCard';
import styled from '@emotion/styled';
import { isDefined } from 'twenty-shared/utils';
import { Section } from 'twenty-ui/layout';
const StyledLoadingContainer = styled.div`
align-items: center;
display: flex;
height: 100px;
justify-content: center;
`;
type MergePreviewTabProps = {
objectNameSingular: string;
};
@@ -23,30 +15,24 @@ export const MergePreviewTab = ({
objectNameSingular,
});
if (isGeneratingPreview) {
return (
<StyledLoadingContainer>
Generating merge preview...
</StyledLoadingContainer>
);
}
if (!isDefined(mergePreviewRecord)) {
if (!isDefined(mergePreviewRecord) && !isGeneratingPreview) {
return null;
}
const recordId = mergePreviewRecord?.id ?? 'merge-preview-loading';
return (
<Section>
<SummaryCard
objectNameSingular={objectNameSingular}
objectRecordId={mergePreviewRecord.id}
objectRecordId={recordId}
isInRightDrawer={true}
/>
<CardComponents.FieldCard
targetableObject={{
targetObjectNameSingular: objectNameSingular,
id: mergePreviewRecord.id,
id: recordId,
}}
showDuplicatesSection={false}
isInRightDrawer={true}
@@ -1,21 +1,18 @@
import { msg } from '@lingui/core/macro';
import { t } from '@lingui/core/macro';
import { type MUTATION_MAX_MERGE_RECORDS } from 'twenty-shared/constants';
import { type FixedLengthArray } from '../types/FixedLengthArray';
export const getPositionWordLabel = (index: number): string => {
const labels: FixedLengthArray<
ReturnType<typeof msg>,
typeof MUTATION_MAX_MERGE_RECORDS
> = [
msg`First`,
msg`Second`,
msg`Third`,
msg`Fourth`,
msg`Fifth`,
msg`Sixth`,
msg`Seventh`,
msg`Eighth`,
msg`Ninth`,
const labels: FixedLengthArray<string, typeof MUTATION_MAX_MERGE_RECORDS> = [
t`First`,
t`Second`,
t`Third`,
t`Fourth`,
t`Fifth`,
t`Sixth`,
t`Seventh`,
t`Eighth`,
t`Ninth`,
];
return labels[index] ? (labels[index].message as string) : '';
return labels[index] || '';
};