Skip to content

Commit

Permalink
feat: change swipe view on assets to button based for formatting purp…
Browse files Browse the repository at this point in the history
…oses
  • Loading branch information
joseph-mccombs committed Sep 15, 2021
1 parent 57593ed commit 6677ab4
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 18 deletions.
4 changes: 2 additions & 2 deletions domains/DataCollection/Assets/NewAssets/AssetCore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { layout, theme } from '../../../../../modules/theme';
import configArray from './config/config';

const AssetCore = ({ setSelectedAsset, scrollViewScroll, setScrollViewScroll,
/*setSelectedForm, setSurveyee,*/ surveyingUser, surveyingOrganization }) => {
/*setSelectedForm, setSurveyee,*/ surveyingUser, surveyingOrganization, setPage }) => {

useEffect(() => {
setValidationSchema(yupValidationPicker(configArray.fields));
Expand Down Expand Up @@ -143,9 +143,9 @@ const AssetCore = ({ setSelectedAsset, scrollViewScroll, setScrollViewScroll,
/>
)}
<PaperButton
icon="gesture-swipe"
mode="text"
buttonText={I18n.t('assetCore.swipeAttachForm')}
onPressEvent={() => setPage('assetSupplementary')}
/>
</View>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import AssetFormSelect from './AssetFormSelect';
import styles from './index.styles';

const AssetSupplementary = ({
selectedAsset, setSelectedAsset, surveyingOrganization, surveyingUser
selectedAsset, setSelectedAsset, surveyingOrganization, surveyingUser, setPage
}) => {
const [selectedForm, setSelectedForm] = useState();
const [submitting, setSubmitting] = useState(false);
Expand Down Expand Up @@ -132,6 +132,11 @@ const AssetSupplementary = ({
buttonText={validForm() ? I18n.t('global.submit') : I18n.t('assetForms.attachForm')}
/>
)}
<PaperButton
mode="text"
buttonText={I18n.t('assetCore.tapCreateAsset')}
onPressEvent={() => setPage('assetCore')}
/>
</View>
</View>
</TouchableWithoutFeedback>
Expand Down
19 changes: 9 additions & 10 deletions domains/DataCollection/Assets/NewAssets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,37 @@ import AssetSupplementary from './AssetSupplementary';

const NewAsset = ({
selectedAsset, setSelectedAsset, surveyingOrganization, assetPageIndex,
surveyingUser, scrollViewScroll, setScrollViewScroll
surveyingUser, scrollViewScroll, setScrollViewScroll, setPage
}) => (
<View>
<PagerView style={styles.viewPager} initialPage={assetPageIndex}>
<View key="1" style={styles.page}>
{assetPageIndex == 'assetCore' && (
<View style={styles.page}>
<AssetCore
setSelectedAsset={setSelectedAsset}
selectedAsset={selectedAsset}
surveyingOrganization={surveyingOrganization}
surveyingUser={surveyingUser}
scrollViewScroll={scrollViewScroll}
setScrollViewScroll={setScrollViewScroll}
setPage={setPage}
/>
</View>
<View key="2" style={styles.page}>
)}
{assetPageIndex == 'assetSupplementary' && (
<View style={styles.page}>
<AssetSupplementary
setSelectedAsset={setSelectedAsset}
selectedAsset={selectedAsset}
surveyingOrganization={surveyingOrganization}
surveyingUser={surveyingUser}
setPage={setPage}
/>
</View>
</PagerView>
)}
</View>
);

const styles = StyleSheet.create({
viewPager: {
flex: 1,
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
},
page: {
justifyContent: 'center',
alignItems: 'center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { layout } from '../../../../../modules/theme';

const SelectedAsset = ({ selectedMarker, switchAssetPage }) => (
<TouchableWithoutFeedback
onPress={switchAssetPage ? () => switchAssetPage(1, selectedMarker) : (e) => e}
onPress={switchAssetPage ? () => switchAssetPage('assetSupplementary', selectedMarker) : (e) => e}
style={layout.resCardContainer}
>
<View
Expand Down
3 changes: 2 additions & 1 deletion domains/DataCollection/Assets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ViewAssets from './ViewAssets';
const Assets = ({
selectedAsset, setSelectedAsset, surveyingOrganization, scrollViewScroll, setScrollViewScroll
}) => {
const [page, setPage] = useState(0);
const [page, setPage] = useState('assetCore');

const switchAssetPage = (pageIndex, asset) => {
setPage(pageIndex);
Expand All @@ -24,6 +24,7 @@ const Assets = ({
assetPageIndex={page}
scrollViewScroll={scrollViewScroll}
setScrollViewScroll={setScrollViewScroll}
setPage={setPage}
/>
)}
{selectedAsset === null && (
Expand Down
3 changes: 2 additions & 1 deletion modules/i18n/english/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@
"communityName": "Community Name",
"province": "Province",
"country": "Country",
"swipeAttachForm": "Swipe to Attach Form"
"swipeAttachForm": "Tap to Attach Form",
"tapCreateAsset": "Tap to Create New Asset"
},
"assetFormSelect": {
"supAssetForms": "Supplementary Asset Forms"
Expand Down
3 changes: 2 additions & 1 deletion modules/i18n/kreyol/hk.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@
"communityName": "Non kominote a",
"province": "Pwovens",
"country": "Peyi",
"swipeAttachForm": "Glise nan Tache Fòm"
"swipeAttachForm": "Tape pou Tache Fòm",
"tapCreateAsset": "Tape pou kreye nouvo byen"
},
"assetFormSelect": {
"supAssetForms": "Fòm Byen Siplemantè"
Expand Down
3 changes: 2 additions & 1 deletion modules/i18n/spanish/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@
"communityName": "Nombre de la comunidad",
"province": "Provincia",
"country": "País",
"swipeAttachForm": "Deslizar para adjuntar formulario"
"swipeAttachForm": "Toque para adjuntar formulario",
"tapCreateAsset": "Toque para crear un activo nuevo"
},
"assetFormSelect": {
"supAssetForms": "Formularios de activos suplementarios"
Expand Down

0 comments on commit 6677ab4

Please sign in to comment.