Skip to content

Commit

Permalink
Merge pull request #195 from OpenBracketsCH/bugfixes/194-Change-level…
Browse files Browse the repository at this point in the history
…-attribute-to-number

Change level-attribute to number
  • Loading branch information
elektrolytmangel authored Oct 22, 2024
2 parents d83c0a9 + dbfab0e commit 7832c9c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/src/components/TextForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const TextForm = ({
errors,
errorMsg,
disabled,
inputMode,
}) => {
const [switchValue, setSwitchValue] = useState(false);
const [tempValue, setTempValue] = useState('');
Expand Down Expand Up @@ -65,6 +66,7 @@ const TextForm = ({
editable={!switchValue}
returnKeyType={multiline ? 'default' : 'done'}
readOnly={disabled}
inputMode={inputMode ?? 'text'}
/>
);
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/config/createForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ export default [
},
{
name: 'level',
rules: { required: false },
rules: { required: false, pattern: /^[0-9]*$/ },
type: 'Text',
label: 'level',
placeholder: 'placeholder_level',
defaultValue: '',
errorMsg: 'error_level',
inputMode: 'numeric',
},
{
name: 'description',
Expand Down
4 changes: 4 additions & 0 deletions app/src/i18n/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const resources = {
access: 'Accessible',
error_default: 'Value is invalid',
error_description: 'The maximum length is 200 characters',
error_level: 'The value must be a number',
error_location: 'Location is required, maximum length 200 characters',
error_openinghours: 'The entered opening hours do not match the required format.',
error_operatorphone: 'The value must be a valid phone number.',
Expand Down Expand Up @@ -111,6 +112,7 @@ const resources = {
access: 'Zugänglich',
error_default: 'Wert ist ungültig',
error_description: 'Die maximale Länge beträgt 200 Zeichen',
error_level: 'Der Wert muss eine Nummer sein',
error_location: 'Der Standort wird benötigt, maximale Länge 200 Zeichen',
error_openinghours: 'Die eingegebenen Öffnungzeiten entsprechen nicht dem geforderten Format.',
error_operatorphone: 'Der Wert muss eine gültige Telefonummer sein.',
Expand Down Expand Up @@ -189,6 +191,7 @@ const resources = {
access: 'Accessible',
error_default: 'La valeur est invalide',
error_description: 'La longueur maximale est de 200 caractères',
error_level: 'La valeur doit être un nombre',
error_location: "L'emplacement est requis, longueur maximale 200 caractères",
error_openinghours: "Les heures d'ouverture saisies ne correspondent pas au format requis.",
error_operatorphone: 'La valeur doit être un numéro de téléphone valide.',
Expand Down Expand Up @@ -267,6 +270,7 @@ const resources = {
access: 'Accessibile',
error_default: 'Il valore non è valido',
error_description: 'La lunghezza massima è di 200 caratteri',
error_level: 'Il valore deve essere un numero',
error_location: 'La posizione è richiesta, lunghezza massima 200 caratteri',
error_openinghours: 'Gli orari di apertura inseriti non corrispondono al formato richiesto.',
error_operatorphone: 'Il valore deve essere un numero di telefono valido.',
Expand Down
2 changes: 1 addition & 1 deletion app/src/screens/CreateScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import TextForm from '../components/TextForm';
import createForm from '../config/createForm';
import { Context as DefibrillatorContext } from '../context/DefibrillatorContext';


const CreateScreen = ({ navigation }) => {
const insets = useSafeAreaInsets();
const { state: defiState, addDefibrillator, resetError } = useContext(DefibrillatorContext);
Expand Down Expand Up @@ -67,6 +66,7 @@ const CreateScreen = ({ navigation }) => {
useSwitch={formComp.useSwitch}
placeholder={formComp.placeholder}
disabled={defiState.creating}
inputMode={formComp.inputMode}
/>
);
} else if (formComp.type === 'Switch') {
Expand Down

0 comments on commit 7832c9c

Please sign in to comment.