From aa8d720f0101e76f29a9f5306148a8b3106bcf5e Mon Sep 17 00:00:00 2001 From: Hope Tambala Date: Thu, 22 Apr 2021 21:32:09 -0400 Subject: [PATCH] feat: add pinned forms to suggested forms spot --- domains/DataCollection/FormGallery/index.js | 25 +---------- .../FormGallery/index.styles.js | 29 ++++++++++++ domains/DataCollection/Forms/index.js | 44 ++++++++++++++----- domains/DataCollection/Forms/index.styles.js | 29 ++++++++++++ domains/DataCollection/index.js | 3 +- 5 files changed, 96 insertions(+), 34 deletions(-) create mode 100644 domains/DataCollection/FormGallery/index.styles.js create mode 100644 domains/DataCollection/Forms/index.styles.js diff --git a/domains/DataCollection/FormGallery/index.js b/domains/DataCollection/FormGallery/index.js index 4eb14f940..a1af86955 100644 --- a/domains/DataCollection/FormGallery/index.js +++ b/domains/DataCollection/FormGallery/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { - ScrollView, StyleSheet, + ScrollView, View } from 'react-native'; import { @@ -13,6 +13,7 @@ import ComingSoonSVG from '../../../assets/graphics/static/Adventurer.svg'; import SmallCardsCarousel from '../../../components/Cards/SmallCardsCarousel'; import I18n from '../../../modules/i18n'; import { layout, theme } from '../../../modules/theme'; +import styles from './index.styles'; const FormGallery = (props) => { const { @@ -124,26 +125,4 @@ const FormGallery = (props) => { ); }; - -const styles = StyleSheet.create({ - cardContainer: { - alignItems: 'center', - justifyContent: 'center', - margin: 20 - }, - textContainer: { - flexDirection: 'row', - }, - text: { - flexShrink: 1, - textAlign: 'center', - color: theme.colors.primary, - fontWeight: 'bold', - marginVertical: 7, - }, - header: { - fontSize: 20, - fontWeight: 'bold' - } -}); export default FormGallery; diff --git a/domains/DataCollection/FormGallery/index.styles.js b/domains/DataCollection/FormGallery/index.styles.js new file mode 100644 index 000000000..e5e14c39d --- /dev/null +++ b/domains/DataCollection/FormGallery/index.styles.js @@ -0,0 +1,29 @@ +import { + StyleSheet +} from 'react-native'; + +import { theme } from '../../../modules/theme'; + +const styles = StyleSheet.create({ + cardContainer: { + alignItems: 'center', + justifyContent: 'center', + margin: 20 + }, + textContainer: { + flexDirection: 'row', + }, + text: { + flexShrink: 1, + textAlign: 'center', + color: theme.colors.primary, + fontWeight: 'bold', + marginVertical: 7, + }, + header: { + fontSize: 20, + fontWeight: 'bold' + } +}); + +export default styles; diff --git a/domains/DataCollection/Forms/index.js b/domains/DataCollection/Forms/index.js index 332fca6a9..7ef2e9b18 100644 --- a/domains/DataCollection/Forms/index.js +++ b/domains/DataCollection/Forms/index.js @@ -1,22 +1,24 @@ import React, { useState } from 'react'; -import { Keyboard, TouchableWithoutFeedback, View } from 'react-native'; -import { Button, Text } from 'react-native-paper'; +import { + Keyboard, ScrollView, TouchableWithoutFeedback, View +} from 'react-native'; +import { Button, Card, Text } from 'react-native-paper'; import PostSubmissionSVG from '../../../assets/graphics/static/Submission-Page-Icon.svg'; -import SmallCardsCarousel from '../../../components/Cards/SmallCardsCarousel'; import ResidentIdSearchbar from '../../../components/ResidentIdSearchbar'; import I18n from '../../../modules/i18n'; import { layout, theme } from '../../../modules/theme'; import GdprCompliance from '../GdprCompliance'; import IdentificationForm from './IdentificationForm'; +import styles from './index.styles'; import SupplementaryForm from './SupplementaryForm'; const Forms = (props) => { const { - navigation, navigateToGallery, + navigation, navigateToGallery, navigateToCustomForm, selectedForm, setSelectedForm, navigateToNewRecord, scrollViewScroll, setScrollViewScroll, - puenteForms, + pinnedForms, surveyingUser, surveyingOrganization, surveyee, setSurveyee, customForm, navigateToRoot @@ -82,11 +84,33 @@ const Forms = (props) => { {I18n.t('forms.suggestedForms')} - + + {pinnedForms && pinnedForms.map((form) => ( + { + if (!form.tag) return navigateToCustomForm(form); + return navigateToNewRecord(form.tag); + }} + > + + + + {form.name} + + + + + ))} + {pinnedForms.length < 1 && ( + + + + + + )} + diff --git a/domains/DataCollection/Forms/index.styles.js b/domains/DataCollection/Forms/index.styles.js new file mode 100644 index 000000000..e5e14c39d --- /dev/null +++ b/domains/DataCollection/Forms/index.styles.js @@ -0,0 +1,29 @@ +import { + StyleSheet +} from 'react-native'; + +import { theme } from '../../../modules/theme'; + +const styles = StyleSheet.create({ + cardContainer: { + alignItems: 'center', + justifyContent: 'center', + margin: 20 + }, + textContainer: { + flexDirection: 'row', + }, + text: { + flexShrink: 1, + textAlign: 'center', + color: theme.colors.primary, + fontWeight: 'bold', + marginVertical: 7, + }, + header: { + fontSize: 20, + fontWeight: 'bold' + } +}); + +export default styles; diff --git a/domains/DataCollection/index.js b/domains/DataCollection/index.js index 8566e3aba..2bd3e4f3a 100644 --- a/domains/DataCollection/index.js +++ b/domains/DataCollection/index.js @@ -201,15 +201,16 @@ const DataCollection = ({ navigation }) => { navigateToGallery={navigateToGallery} navigateToNewRecord={navigateToNewRecord} navigateToRoot={navigateToRoot} + navigateToCustomForm={navigateToCustomForm} selectedForm={selectedForm} setSelectedForm={setSelectedForm} - puenteForms={puenteForms} surveyingUser={surveyingUser} surveyingOrganization={surveyingOrganization} surveyee={surveyee} setSurveyee={setSurveyee} customForm={customForm} setView={setView} + pinnedForms={pinnedForms} /> )}