diff --git a/dev-client/package-lock.json b/dev-client/package-lock.json index 9439eea57d..e4b4a173d6 100644 --- a/dev-client/package-lock.json +++ b/dev-client/package-lock.json @@ -44,7 +44,7 @@ "react-native-svg": "^14.1.0", "react-native-tab-view": "^3.5.2", "react-native-vector-icons": "^10.0.3", - "terraso-client-shared": "github:techmatters/terraso-client-shared#68f35c7", + "terraso-client-shared": "github:techmatters/terraso-client-shared#318e78d", "uuid": "^9.0.1", "yup": "^1.3.3" }, @@ -24568,7 +24568,7 @@ }, "node_modules/terraso-client-shared": { "version": "0.1.0", - "resolved": "git+ssh://git@github.com/techmatters/terraso-client-shared.git#68f35c7fd1cc91ea259cb56fca9c36d01b408946", + "resolved": "git+ssh://git@github.com/techmatters/terraso-client-shared.git#318e78d7948023255eb914c1db2c922ca23daa65", "dependencies": { "@reduxjs/toolkit": "^1.9.7", "jwt-decode": "^4.0.0", diff --git a/dev-client/package.json b/dev-client/package.json index 2ef98c08d0..7869bca9e7 100644 --- a/dev-client/package.json +++ b/dev-client/package.json @@ -51,7 +51,7 @@ "react-native-svg": "^14.1.0", "react-native-tab-view": "^3.5.2", "react-native-vector-icons": "^10.0.3", - "terraso-client-shared": "github:techmatters/terraso-client-shared#68f35c7", + "terraso-client-shared": "github:techmatters/terraso-client-shared#318e78d", "uuid": "^9.0.1", "yup": "^1.3.3" }, diff --git a/dev-client/src/assets/surface/verticalCracking.png b/dev-client/src/assets/surface/verticalCracking.png new file mode 100644 index 0000000000..156da5f4af Binary files /dev/null and b/dev-client/src/assets/surface/verticalCracking.png differ diff --git a/dev-client/src/screens/SoilScreen/SoilScreen.tsx b/dev-client/src/screens/SoilScreen/SoilScreen.tsx index a3a4231d1e..8906ce54b8 100644 --- a/dev-client/src/screens/SoilScreen/SoilScreen.tsx +++ b/dev-client/src/screens/SoilScreen/SoilScreen.tsx @@ -85,7 +85,7 @@ export const SoilScreen = ({siteId}: {siteId: string}) => { return ( diff --git a/dev-client/src/screens/SoilScreen/components/SoilSurfaceScreen.tsx b/dev-client/src/screens/SoilScreen/components/SoilSurfaceScreen.tsx index 43808282ef..4bb57151a0 100644 --- a/dev-client/src/screens/SoilScreen/components/SoilSurfaceScreen.tsx +++ b/dev-client/src/screens/SoilScreen/components/SoilSurfaceScreen.tsx @@ -15,14 +15,76 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import {ScreenScaffold} from 'terraso-mobile-client/screens/ScreenScaffold'; -import {Text} from 'terraso-mobile-client/components/NativeBaseAdapters'; +import { + Box, + Column, + Heading, + Paragraph, +} from 'terraso-mobile-client/components/NativeBaseAdapters'; +import {useTranslation} from 'react-i18next'; +import {useDispatch, useSelector} from 'terraso-mobile-client/store'; +import {selectSite} from 'terraso-client-shared/selectors'; +import {AppBar} from 'terraso-mobile-client/navigation/components/AppBar'; +import {Image} from 'react-native'; +import {LastModified} from 'terraso-mobile-client/components/LastModified'; +import {Fab, Select} from 'native-base'; +import { + SurfaceCracks, + surfaceCracks, +} from 'terraso-client-shared/soilId/soilIdTypes'; +import {Icon} from 'terraso-mobile-client/components/Icons'; +import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; +import {useCallback} from 'react'; +import {updateSoilData} from 'terraso-client-shared/soilId/soilIdSlice'; type Props = {siteId: string}; -export const SoilSurfaceScreen = ({}: Props) => { +export const SoilSurfaceScreen = ({siteId}: Props) => { + const {t} = useTranslation(); + const site = useSelector(selectSite(siteId)); + const cracking = useSelector( + state => state.soilId.soilData[siteId].surfaceCracksSelect, + ); + const navigation = useNavigation(); + const dispatch = useDispatch(); + const onUpdate = useCallback( + (surfaceCracksSelect: SurfaceCracks) => + dispatch(updateSoilData({siteId, surfaceCracksSelect})), + [dispatch, siteId], + ); + return ( - - Unimplemented soil surface screen + }> + + + {t('soil.collection_method.verticalCracking')} + + + + + {t('soil.verticalCracking_description')} + + + + + } + label={t('general.done_fab')} + isDisabled={!cracking} + onPress={() => navigation.pop()} + /> ); }; diff --git a/dev-client/src/screens/SoilScreen/components/SoilSurfaceStatus.tsx b/dev-client/src/screens/SoilScreen/components/SoilSurfaceStatus.tsx index 481f67b390..240ab4ad54 100644 --- a/dev-client/src/screens/SoilScreen/components/SoilSurfaceStatus.tsx +++ b/dev-client/src/screens/SoilScreen/components/SoilSurfaceStatus.tsx @@ -25,6 +25,7 @@ type Props = {siteId: string} & Pick< import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; import { + Column, Heading, Row, } from 'terraso-mobile-client/components/NativeBaseAdapters'; @@ -38,7 +39,7 @@ export const SoilSurfaceStatus = ({required, complete, siteId}: Props) => { }, [navigation, siteId]); return ( - <> + {t('soil.surface')} @@ -48,6 +49,6 @@ export const SoilSurfaceStatus = ({required, complete, siteId}: Props) => { label={t('soil.collection_method.verticalCracking')} onPress={onPress} /> - + ); }; diff --git a/dev-client/src/translations/en.json b/dev-client/src/translations/en.json index cdb87a4204..a8fcda1b4b 100644 --- a/dev-client/src/translations/en.json +++ b/dev-client/src/translations/en.json @@ -434,6 +434,12 @@ "photos": "Photos", "notes": "Notes" }, + "verticalCracking_description": "Vertical cracks may appear on the soil surface when some soils experience changes in moisture or temperature. The cracks may be permanent, or they may disappear after some time.\n\nVertical cracks are at least 5 mm (3/16”) wide and 25 cm (10”) deep. You should be able to place a pencil inside the cracks.", + "verticalCracking": { + "NO_CRACKING": "No Cracking", + "SURFACE_CRACKING_ONLY": "Surface Cracking Only", + "DEEP_VERTICAL_CRACKS": "Deep Vertical Cracks" + }, "data": { "rockFragmentVolume": "Rock fragment", "texture": "Texture",