Skip to content

The open alternative to Salesforce, designed for AI.

Set error message not absolute (#12802)

Thomas Trompettef05da75bb5a8
diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx
index 38cc4683940..e1d37c79dd7 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx
@@ -4,7 +4,6 @@ import { FormFieldInputRowContainer } from '@/object-record/record-field/form-ty
import { VariableChipStandalone } from '@/object-record/record-field/form-types/components/VariableChipStandalone';
import { VariablePickerComponent } from '@/object-record/record-field/form-types/types/VariablePickerComponent';
import { TextInput } from '@/ui/field/input/components/TextInput';
-import { InputErrorHelper } from '@/ui/input/components/InputErrorHelper';
import { InputHint } from '@/ui/input/components/InputHint';
import { InputLabel } from '@/ui/input/components/InputLabel';
import { isStandaloneVariableString } from '@/workflow/utils/isStandaloneVariableString';
@@ -114,6 +113,8 @@ export const FormNumberFieldInput = ({
onChange(variableName);
};
+ const error = errorMessage ?? errorFromProps;
+
return (
<FormFieldInputContainer>
{label ? <InputLabel htmlFor={inputId}>{label}</InputLabel> : null}
@@ -154,7 +155,7 @@ export const FormNumberFieldInput = ({
</FormFieldInputRowContainer>
{hint ? <InputHint>{hint}</InputHint> : null}
- <InputErrorHelper>{errorMessage ?? errorFromProps}</InputErrorHelper>
+ {error && <InputHint danger>{error}</InputHint>}
</FormFieldInputContainer>
);
};
diff --git a/packages/twenty-front/src/modules/ui/input/components/InputHint.tsx b/packages/twenty-front/src/modules/ui/input/components/InputHint.tsx
index 85633dc9584..a910a5f4b5f 100644
--- a/packages/twenty-front/src/modules/ui/input/components/InputHint.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/InputHint.tsx
@@ -1,7 +1,10 @@
import styled from '@emotion/styled';
-const StyledInputHint = styled.div`
- color: ${({ theme }) => theme.font.color.light};
+const StyledInputHint = styled.div<{
+ danger?: boolean;
+}>`
+ color: ${({ danger, theme }) =>
+ danger ? theme.font.color.danger : theme.font.color.light};
font-size: ${({ theme }) => theme.font.size.xs};
font-weight: ${({ theme }) => theme.font.weight.regular};
margin-top: ${({ theme }) => theme.spacing(0.5)};