Skip to content

Commit 4e47b53

Browse files
agalin920finnar-binshrunyan
committed
Stage merge conflicts (#2880)
Co-authored-by: Nar -- <28705606+finnar-bin@users.noreply.github.com> Co-authored-by: Stuart Runyan <shrunyan@gmail.com>
1 parent 29cbdb2 commit 4e47b53

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/apps/schema/src/app/components/AddFieldModal/FieldFormInput.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export type FieldNames =
5555
| "regexRestrictErrorMessage"
5656
| "minValue"
5757
| "maxValue"
58+
| "currency"
5859
| "fileExtensions"
5960
| "fileExtensionsErrorMessage";
6061
type FieldType =

src/apps/schema/src/app/components/AddFieldModal/views/FieldForm.tsx

+22
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ export const FieldForm = ({
233233
formFields[field.name] = fieldData.settings[field.name] ?? null;
234234
} else if (field.name === "maxValue") {
235235
formFields[field.name] = fieldData.settings[field.name] ?? null;
236+
} else if (field.name === "currency") {
237+
formFields[field.name] = fieldData.settings?.currency ?? "USD";
236238
} else if (field.name === "fileExtensions") {
237239
formFields[field.name] = fieldData.settings[field.name] ?? null;
238240
} else if (field.name === "fileExtensionsErrorMessage") {
@@ -429,6 +431,22 @@ export const FieldForm = ({
429431
newErrorsObj[inputName] = "This field is required";
430432
}
431433

434+
if (
435+
inputName === "fileExtensions" &&
436+
formData.fileExtensions !== null &&
437+
!(formData.fileExtensions as string[])?.length
438+
) {
439+
newErrorsObj[inputName] = "This field is required";
440+
}
441+
442+
if (
443+
inputName === "fileExtensionsErrorMessage" &&
444+
formData.fileExtensions !== null &&
445+
formData.fileExtensionsErrorMessage === ""
446+
) {
447+
newErrorsObj[inputName] = "This field is required";
448+
}
449+
432450
if (
433451
inputName in errors &&
434452
![
@@ -441,6 +459,7 @@ export const FieldForm = ({
441459
"regexRestrictErrorMessage",
442460
"minValue",
443461
"maxValue",
462+
"currency",
444463
"fileExtensions",
445464
"fileExtensionsErrorMessage",
446465
].includes(inputName)
@@ -602,6 +621,9 @@ export const FieldForm = ({
602621
...(formData.maxValue !== null && {
603622
maxValue: formData.maxValue as number,
604623
}),
624+
...(formData.currency !== null && {
625+
currency: formData.currency as string,
626+
}),
605627
...(formData.fileExtensions && {
606628
fileExtensions: formData.fileExtensions as string[],
607629
}),

src/shell/services/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export interface FieldSettings {
203203
regexRestrictErrorMessage?: string;
204204
minValue?: number;
205205
maxValue?: number;
206+
currency?: string;
206207
fileExtensions?: string[];
207208
fileExtensionsErrorMessage?: string;
208209
}

0 commit comments

Comments
 (0)