Skip to content

Commit

Permalink
fix: Translation name of of forms for "Suggested next forms" view
Browse files Browse the repository at this point in the history
  • Loading branch information
hopetambala committed Sep 10, 2023
1 parent f87e809 commit 49240bf
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 30 deletions.
33 changes: 18 additions & 15 deletions domains/DataCollection/FormGallery/FormsHorizontalView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,25 @@ const FormsHorizontalView = ({
</View>
)}
<ScrollView horizontal>
{forms.map((form) => (
<Card
key={() => uuid.v4()}
style={layout.cardSmallStyle}
onPress={() => {
navigateToCustomForm(form);
}}
onLongPress={() => pinForm(form)}
>
<View style={styles.cardContainer}>
<View style={styles.textContainer}>
<Text style={styles.text}>{form.name}</Text>
{forms.map((form) => {
const cardId = uuid.v4();
return (
<Card
key={cardId}
style={layout.cardSmallStyle}
onPress={() => {
navigateToCustomForm(form);
}}
onLongPress={() => pinForm(form)}
>
<View style={styles.cardContainer}>
<View style={styles.textContainer}>
<Text style={styles.text}>{form.name}</Text>
</View>
</View>
</View>
</Card>
))}
</Card>
);
})}
{forms?.length < 1 && (
<View style={layout.screenRow}>
<Card key={() => uuid.v4()}>
Expand Down
39 changes: 24 additions & 15 deletions domains/DataCollection/Forms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,31 @@ const Forms = (props) => {
</Text>
<ScrollView horizontal>
{pinnedForms &&
pinnedForms.map((form) => (
<Card
key={form.objectId ?? form.tag}
style={layout.cardSmallStyle}
onPress={() => {
if (!form.tag) return navigateToCustomForm(form);
return navigateToNewRecord(form.tag);
}}
>
<View style={styles.cardContainer}>
<View style={styles.textContainer}>
<Text style={styles.text}>{form.name}</Text>
pinnedForms.map((form) => {
const {
objectId,
tag,
name,
customForm: isCustomForm,
} = form;
const formName = isCustomForm ? name : I18n.t(name);
return (
<Card
key={objectId ?? tag}
style={layout.cardSmallStyle}
onPress={() => {
if (!form.tag) return navigateToCustomForm(form);
return navigateToNewRecord(tag);
}}
>
<View style={styles.cardContainer}>
<View style={styles.textContainer}>
<Text style={styles.text}>{formName}</Text>
</View>
</View>
</View>
</Card>
))}
</Card>
);
})}
{pinnedForms.length < 1 && (
<View style={layout.screenRow}>
<Card>
Expand Down

0 comments on commit 49240bf

Please sign in to comment.