Skip to content

Commit

Permalink
chore: add I18n translations
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-mccombs committed Nov 13, 2020
1 parent 3c9fb10 commit 747f6a7
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 126 deletions.
93 changes: 50 additions & 43 deletions components/Cards/SmallCardsCarousel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,50 +33,57 @@ import I18n from '../../../modules/i18n';
const SmallCardsCarousel = ({
puenteForms, navigateToNewRecord, setView, surveyee, setUser
}) => (
<ScrollView horizontal>
{puenteForms.map((form) => (
<Card
key={form.tag}
style={styles.cardSmallStyle}
onPress={() => {
if (setUser) {
setView('Forms');
navigateToNewRecord(form.tag, surveyee);
} else {
navigateToNewRecord(form.tag);
}
}}
>
{form.tag === 'id' && (
<View marginTop="auto" marginBottom="auto">
<NewRecordSVG height={40} style={styles.svg} />
<Button labelStyle={styles.topButton} compact>{I18n.t('cards.smallCards.residentID')}</Button>
<Button labelStyle={styles.bottomButton} compact />
</View>
)}
<ScrollView horizontal>
{puenteForms.map((form) => (
<Card
key={form.tag}
style={styles.cardSmallStyle}
onPress={() => {
if (setUser) {
setView('Forms');
navigateToNewRecord(form.tag, surveyee);
} else {
navigateToNewRecord(form.tag);
}
}}
>
{form.tag === 'id' && (
<View marginTop="auto" marginBottom="auto">
<NewRecordSVG height={40} style={styles.svg} />
<Button labelStyle={styles.topButton} compact>{I18n.t('cards.smallCards.residentID')}</Button>
<Button labelStyle={styles.bottomButton} compact />
</View>
)}

{form.tag === 'env' && (
<View marginTop="auto" marginBottom="auto">
<EnvSVG height={40} style={styles.svg} />
<View>
<Button labelStyle={styles.topButton} compact>{I18n.t('cards.smallCards.environmental')}</Button>
<Button labelStyle={styles.bottomButton} compact>{I18n.t('cards.smallCards.history')}</Button>
</View>
</View>
)}
{form.tag === 'med-eval' && (
<View marginTop="auto" marginBottom="auto">
<MedEvalSVG height={40} style={styles.svg} />
<View marginTop="auto">
<Button labelStyle={styles.topButton} compact>{I18n.t('cards.smallCards.medical')}</Button>
<Button labelStyle={styles.bottomButton} compact>{I18n.t('cards.smallCards.evaluation')}</Button>
</View>
</View>
)}
</Card>
))}
</ScrollView>
);
{form.tag === 'env' && (
<View marginTop="auto" marginBottom="auto">
<EnvSVG height={40} style={styles.svg} />
<View>
<Button labelStyle={styles.topButton} compact>{I18n.t('cards.smallCards.environmental')}</Button>
<Button labelStyle={styles.bottomButton} compact>{I18n.t('cards.smallCards.history')}</Button>
</View>
</View>
)}
{form.tag === 'med-eval' && (
<View marginTop="auto" marginBottom="auto">
<MedEvalSVG height={40} style={styles.svg} />
<View marginTop="auto">
<Button labelStyle={styles.topButton} compact>{I18n.t('cards.smallCards.medical')}</Button>
<Button labelStyle={styles.bottomButton} compact>{I18n.t('cards.smallCards.evaluation')}</Button>
</View>
</View>
)}
{form.tag === 'vitals' && (
<View marginTop="auto" marginBottom="auto">
<NewRecordSVG height={40} style={styles.svg} />
<Button labelStyle={styles.topButton} compact>{I18n.t('cards.smallCards.vitals')}</Button>
<Button labelStyle={styles.bottomButton} compact />
</View>
)}
</Card>
))}
</ScrollView>
);

const styles = StyleSheet.create({
cardSmallStyle: {
Expand Down
85 changes: 35 additions & 50 deletions components/FormikFields/PaperInputPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,16 @@ const PaperInputPicker = ({
<View style={styles.container}>
<Text>{translatedLabel}</Text>
<View style={styles.multiInputContainer}>
{data.options.map((result) => (
<View key={result.value} style={styles.inputItem}>
{/* {!result.textSplit && (
<View>
{data.options.map((result) =>
result.textSplit ? (
<View style={{ flex: 1 }}>
<Text style={styleX.textSplit}>{result.label}</Text>
</View>
) : (
<View key={result.value} style={styles.inputItem}>
<TextInput
label={customForm ? result.label : I18n.t(result.label)}
onChangeText={handleChange(customForm ? result : I18n.t(result.label))}
onChangeText={handleChange(customForm ? result.label : I18n.t(result.label))}
onBlur={handleBlur(customForm ? result.label : I18n.t(result.label))}
{...rest} //eslint-disable-line
mode="outlined"
Expand All @@ -337,52 +340,35 @@ const PaperInputPicker = ({
{errors[customForm ? result.label : I18n.t(result.label)]}
</Text>
</View>
)} */}
{result.textSplit ? (
<Text style={styleX.textSplit}>{result.label}</Text>
) : (
<View>
<TextInput
label={customForm ? result.label : I18n.t(result.label)}
onChangeText={handleChange(customForm ? result.label : I18n.t(result.label))}
onBlur={handleBlur(customForm ? result.label : I18n.t(result.label))}
{...rest} //eslint-disable-line
mode="outlined"
theme={{ colors: { placeholder: theme.colors.primary }, text: 'black' }}
/>
<Text style={{ color: 'red' }}>
{errors[customForm ? result.label : I18n.t(result.label)]}
</Text>
</View>
)}
</View>
))}
))}
</View>
</View>
)}
{fieldType === 'multiInputRowNum' && (
<View style={styles.container}>
<Text>{translatedLabel}</Text>
<View style={styles.multiInputContainer}>
{data.options.map((result) => (
<View key={result.value} style={styles.inputItem}>
<TextInput
label={customForm ? result.label : I18n.t(result.label)}
onChangeText={handleChange(result.value)}
onBlur={handleBlur(result.value)}
{...rest} //eslint-disable-line
mode="outlined"
keyboardType="numeric"
theme={{ colors: { placeholder: theme.colors.primary }, text: 'black' }}
/>
<Text style={{ color: 'red' }}>
{errors[result.value]}
</Text>
</View>
))}
{
fieldType === 'multiInputRowNum' && (
<View style={styles.container}>
<Text>{translatedLabel}</Text>
<View style={styles.multiInputContainer}>
{data.options.map((result) => (
<View key={result.value} style={styles.inputItem}>
<TextInput
label={customForm ? result.label : I18n.t(result.label)}
onChangeText={handleChange(result.value)}
onBlur={handleBlur(result.value)}
{...rest} //eslint-disable-line
mode="outlined"
keyboardType="numeric"
theme={{ colors: { placeholder: theme.colors.primary }, text: 'black' }}
/>
<Text style={{ color: 'red' }}>
{errors[result.value]}
</Text>
</View>
))}
</View>
</View>
</View>
)}
)
}
</>
);
};
Expand All @@ -396,12 +382,11 @@ const styleX = StyleSheet.create({
fontSize: 15
},
textSplit: {
fontSize: 15,
fontSize: 35,
marginLeft: 'auto',
marginRight: 'auto',
marginTop: 'auto',
marginBottom: 'auto',
flex: .001
marginBottom: 25,
}
})

Expand Down
2 changes: 1 addition & 1 deletion components/FormikFields/PaperInputPicker/index.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const styles = StyleSheet.create({

},
inputItem: {
flex: 1,
flex: 7,
marginHorizontal: 5
},
multiInputContainer: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,107 +1,107 @@
const configArray = {
class: 'HistoryEnvironmentalHealth',
name: 'environmentalHealth.name',
customForm: true,
name: 'vitals.name',
customForm: false,
fields: [
{
label: 'Vitals',
label: 'vitals.name',
fieldType: 'header',
formikKey: 'none_vitals',
},
{
label: 'Height',
sideLabel: 'Inches',
label: 'vitals.height',
sideLabel: 'vitals.inches',
formikKey: 'height',
value: '',
fieldType: 'inputSideLabel',
validation: false
},
{
label: 'Weight',
sideLabel: 'Pounds',
label: 'vitals.weight',
sideLabel: 'vitals.pounds',
formikKey: 'weight',
value: '',
fieldType: 'inputSideLabel',
validation: false
},
{
label: 'Body Mass Index',
label: 'vitals.bmi',
formikKey: 'bmi',
value: '',
fieldType: 'input',
validation: false
},
{
label: 'Body Temperature',
sideLabel: '°Celcius',
formikKey: 'bodyTemp',
label: 'vitals.temp',
sideLabel: 'vitals.celsius',
formikKey: 'temp',
value: '',
fieldType: 'inputSideLabel',
validation: false
},
{
label: 'Pulse',
sideLabel: 'Beats Per Minute',
label: 'vitals.pulse',
sideLabel: 'vitals.bpm',
formikKey: 'pulse',
value: '',
fieldType: 'inputSideLabel',
validation: false
},
{
label: 'Respiratory Rate',
sideLabel: 'Breaths Per Minute',
formikKey: 'respiratory',
label: 'vitals.respRate',
sideLabel: 'vitals.breathspm',
formikKey: 'respRate',
value: '',
fieldType: 'inputSideLabel',
validation: false
},
{
label: 'Blood Pressure',
formikKey: 'blood_pressure',
label: 'vitals.bloodPressure.label',
formikKey: 'bloodPressure',
value: '',
fieldType: 'multiInputRow',
options: [
{
label: 'Systolic',
label: 'vitals.bloodPressure.systolic',
value: 'Systolic'
},
{
label: '/',
textSplit: true
},
{
label: 'Diastolic',
label: 'vitals.bloodPressure.diastolic',
value: 'Diastolic'
}
],
},
{
label: 'Blood Oxygen',
sideLabel: 'mm Hg',
formikKey: 'blood_oxygen',
label: 'vitals.bloodOxygen',
sideLabel: 'vitals.mmHg',
formikKey: 'bloodOxygen',
value: '',
fieldType: 'inputSideLabel',
validation: false
},
{
label: 'Blood Sugar',
sideLabel: 'mg/dL',
formikKey: 'blood_sugar',
label: 'vitals.bloodSugar',
sideLabel: 'vitals.mgdL',
formikKey: 'bloodSugar',
value: '',
fieldType: 'inputSideLabel',
validation: false
},
{
label: 'Hemoglobin Levels',
sideLabel: 'g/dL',
formikKey: 'blood_pressure',
label: 'vitals.hemoglobinLevels',
sideLabel: 'vitals.gdL',
formikKey: 'hemoglobinLevels',
value: '',
fieldType: 'inputSideLabel',
validation: false
},
{
label: 'Pain',
formikKey: 'pain',
label: 'vitals.pain',
formikKey: 'painLevels',
value: '',
fieldType: 'input',
validation: false
Expand Down
Loading

0 comments on commit 747f6a7

Please sign in to comment.