mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
feat: open the advanced settings automatically (#1508)
This commit is contained in:
@ -4,7 +4,7 @@ import { ZFieldMetaSchema } from '../types/field-meta';
|
|||||||
|
|
||||||
// Currently it seems that the majority of fields have advanced fields for font reasons.
|
// Currently it seems that the majority of fields have advanced fields for font reasons.
|
||||||
// This array should only contain fields that have an optional setting in the fieldMeta.
|
// This array should only contain fields that have an optional setting in the fieldMeta.
|
||||||
const ADVANCED_FIELD_TYPES_WITH_OPTIONAL_SETTING: FieldType[] = [
|
export const ADVANCED_FIELD_TYPES_WITH_OPTIONAL_SETTING: FieldType[] = [
|
||||||
FieldType.NUMBER,
|
FieldType.NUMBER,
|
||||||
FieldType.TEXT,
|
FieldType.TEXT,
|
||||||
FieldType.DROPDOWN,
|
FieldType.DROPDOWN,
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import {
|
|||||||
ZFieldMetaSchema,
|
ZFieldMetaSchema,
|
||||||
} from '@documenso/lib/types/field-meta';
|
} from '@documenso/lib/types/field-meta';
|
||||||
import { nanoid } from '@documenso/lib/universal/id';
|
import { nanoid } from '@documenso/lib/universal/id';
|
||||||
|
import { ADVANCED_FIELD_TYPES_WITH_OPTIONAL_SETTING } from '@documenso/lib/utils/advanced-fields-helpers';
|
||||||
import { validateFieldsUninserted } from '@documenso/lib/utils/fields';
|
import { validateFieldsUninserted } from '@documenso/lib/utils/fields';
|
||||||
import { parseMessageDescriptor } from '@documenso/lib/utils/i18n';
|
import { parseMessageDescriptor } from '@documenso/lib/utils/i18n';
|
||||||
import {
|
import {
|
||||||
@ -353,6 +354,13 @@ export const AddFieldsFormPartial = ({
|
|||||||
|
|
||||||
append(field);
|
append(field);
|
||||||
|
|
||||||
|
// Only open fields with significant amount of settings (instead of just a font setting) to
|
||||||
|
// reduce friction when adding fields.
|
||||||
|
if (ADVANCED_FIELD_TYPES_WITH_OPTIONAL_SETTING.includes(selectedField)) {
|
||||||
|
setCurrentField(field);
|
||||||
|
setShowAdvancedSettings(true);
|
||||||
|
}
|
||||||
|
|
||||||
setIsFieldWithinBounds(false);
|
setIsFieldWithinBounds(false);
|
||||||
setSelectedField(null);
|
setSelectedField(null);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user