RICH_TEXT_V2 frontend (#10083)

Adds task and note support for the new `bodyV2` field. (Field metadata
type of `bodyV2` is `RICH_TEXT_V2`.)

Related to issue https://github.com/twentyhq/twenty/issues/7613

Upgrade commands will be in separate PRs.

Fixes https://github.com/twentyhq/twenty/issues/10084

---------

Co-authored-by: ad-elias <elias@autodiligence.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
eliasylonen
2025-02-11 11:21:03 +01:00
committed by GitHub
parent de91a5e39e
commit 4f06b83d7f
55 changed files with 545 additions and 4576 deletions

View File

@ -4,6 +4,9 @@ import { IconForbid } from 'twenty-ui';
import { MatchColumnSelect } from '@/spreadsheet-import/components/MatchColumnSelect';
import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { FieldMetadataType } from 'twenty-shared';
import { FeatureFlagKey } from '~/generated-metadata/graphql';
import { Columns, ColumnType } from '../MatchColumnsStep';
const StyledContainer = styled.div`
@ -24,26 +27,35 @@ export const TemplateColumn = <T extends string>({
columnIndex,
onChange,
}: TemplateColumnProps<T>) => {
const isRichTextV2Enabled = useIsFeatureEnabled(
FeatureFlagKey.IsRichTextV2Enabled,
);
const { fields } = useSpreadsheetImportInternal<T>();
const column = columns[columnIndex];
const isIgnored = column.type === ColumnType.ignored;
const fieldOptions = fields.map(({ icon, label, key }) => {
const isSelected =
columns.findIndex((column) => {
if ('value' in column) {
return column.value === key;
}
return false;
}) !== -1;
const fieldOptions = fields
.filter((field) =>
isRichTextV2Enabled
? field.fieldMetadataType !== FieldMetadataType.RICH_TEXT
: true,
)
.map(({ icon, label, key }) => {
const isSelected =
columns.findIndex((column) => {
if ('value' in column) {
return column.value === key;
}
return false;
}) !== -1;
return {
icon: icon,
value: key,
label: label,
disabled: isSelected,
} as const;
});
return {
icon: icon,
value: key,
label: label,
disabled: isSelected,
} as const;
});
const selectOptions = [
{