diff --git a/dev-client/__tests__/integration/models/soilId/soilIdSelectors.test.ts b/dev-client/__tests__/integration/models/soilId/soilIdSelectors.test.ts index beef18886..4ceebad17 100644 --- a/dev-client/__tests__/integration/models/soilId/soilIdSelectors.test.ts +++ b/dev-client/__tests__/integration/models/soilId/soilIdSelectors.test.ts @@ -25,7 +25,7 @@ import { selectSyncErrorSites, selectUnsyncedSiteIds, selectUnsyncedSites, -} from 'terraso-mobile-client/model/soilId/soilIdSelectors'; +} from 'terraso-mobile-client/model/soilData/soilDataSelectors'; import { markEntityError, markEntityModified, @@ -43,7 +43,7 @@ const appState = (): AppState => { preferences: {colorWorkflow: 'MANUAL'}, project: {projects: {}}, site: {sites: {}}, - soilId: { + soilData: { projectSettings: {}, soilSync: {}, soilData: {}, @@ -72,8 +72,8 @@ describe('selectUnsyncedSites', () => { test('selects unsynced sites only', () => { const state = appState(); const now = Date.now(); - markEntitySynced(state.soilId.soilSync, 'a', {value: soilData()}, now); - markEntityModified(state.soilId.soilSync, 'b', now); + markEntitySynced(state.soilData.soilSync, 'a', {value: soilData()}, now); + markEntityModified(state.soilData.soilSync, 'b', now); const selected = renderSelectorHook( () => useSelector(selectUnsyncedSites), @@ -87,7 +87,7 @@ describe('selectUnsyncedSites', () => { test('returns stable values for input states only', () => { const stateA = appState(); - markEntityModified(stateA.soilId.soilSync, 'a', Date.now()); + markEntityModified(stateA.soilData.soilSync, 'a', Date.now()); const selectedA1 = renderSelectorHook( () => useSelector(selectUnsyncedSites), @@ -99,7 +99,7 @@ describe('selectUnsyncedSites', () => { ); const stateB = cloneDeep(stateA); - markEntityModified(stateB.soilId.soilSync, 'b', Date.now()); + markEntityModified(stateB.soilData.soilSync, 'b', Date.now()); const selectedB = renderSelectorHook( () => useSelector(selectUnsyncedSites), @@ -116,10 +116,10 @@ describe('selectUnsyncedSiteIds', () => { test('selects unsynced site IDs only, sorted', () => { const state = appState(); const now = Date.now(); - markEntitySynced(state.soilId.soilSync, 'a', {value: soilData()}, now); + markEntitySynced(state.soilData.soilSync, 'a', {value: soilData()}, now); - markEntityModified(state.soilId.soilSync, 'c', now); - markEntityModified(state.soilId.soilSync, 'b', now); + markEntityModified(state.soilData.soilSync, 'c', now); + markEntityModified(state.soilData.soilSync, 'b', now); const selected = renderSelectorHook( () => useSelector(selectUnsyncedSiteIds), @@ -131,7 +131,7 @@ describe('selectUnsyncedSiteIds', () => { test('returns stable values for input states', () => { const stateA = appState(); - markEntityModified(stateA.soilId.soilSync, 'a', Date.now()); + markEntityModified(stateA.soilData.soilSync, 'a', Date.now()); const selectedA1 = renderSelectorHook( () => useSelector(selectUnsyncedSiteIds), @@ -143,7 +143,7 @@ describe('selectUnsyncedSiteIds', () => { ); const stateB = cloneDeep(stateA); - markEntityModified(stateB.soilId.soilSync, 'b', Date.now()); + markEntityModified(stateB.soilData.soilSync, 'b', Date.now()); const selectedB = renderSelectorHook( () => useSelector(selectUnsyncedSiteIds), @@ -160,9 +160,9 @@ describe('selectSyncErrorSites', () => { test('selects sync error sites only', () => { const state = appState(); const now = Date.now(); - markEntitySynced(state.soilId.soilSync, 'a', {value: soilData()}, now); + markEntitySynced(state.soilData.soilSync, 'a', {value: soilData()}, now); markEntityError( - state.soilId.soilSync, + state.soilData.soilSync, 'b', {revisionId: 1, value: 'DOES_NOT_EXIST'}, now, @@ -185,7 +185,7 @@ describe('selectSyncErrorSites', () => { test('returns stable values for input states', () => { const stateA = appState(); markEntityError( - stateA.soilId.soilSync, + stateA.soilData.soilSync, 'a', {value: 'DOES_NOT_EXIST'}, Date.now(), @@ -202,7 +202,7 @@ describe('selectSyncErrorSites', () => { const stateB = cloneDeep(stateA); markEntityError( - stateB.soilId.soilSync, + stateB.soilData.soilSync, 'b', {revisionId: 1, value: 'DOES_NOT_EXIST'}, Date.now(), diff --git a/dev-client/__tests__/integration/store/selectors.test.ts b/dev-client/__tests__/integration/store/selectors.test.ts index e414a94d5..566c214e8 100644 --- a/dev-client/__tests__/integration/store/selectors.test.ts +++ b/dev-client/__tests__/integration/store/selectors.test.ts @@ -35,7 +35,7 @@ import {SerializableSet} from 'terraso-client-shared/store/utils'; import { DEFAULT_ENABLED_SOIL_PIT_METHODS, DEPTH_INTERVAL_PRESETS, -} from 'terraso-mobile-client/model/soilId/soilDataConstants'; +} from 'terraso-mobile-client/model/soilData/soilDataConstants'; import { DepthInterval, methodEnabled, @@ -47,7 +47,7 @@ import { SoilPitMethod, soilPitMethods, SoilState, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {createStore} from 'terraso-mobile-client/store'; import { selectProjectMembershipsWithUsers, @@ -257,7 +257,7 @@ function initState( site: { sites: keyBy(sites, 'id'), }, - soilId: { + soilData: { soilData, projectSettings, status: 'ready', diff --git a/dev-client/__tests__/integration/store/sync/PullDispatcher.test.tsx b/dev-client/__tests__/integration/store/sync/PullDispatcher.test.tsx index 214a4e270..1ff032e8d 100644 --- a/dev-client/__tests__/integration/store/sync/PullDispatcher.test.tsx +++ b/dev-client/__tests__/integration/store/sync/PullDispatcher.test.tsx @@ -21,7 +21,7 @@ import {SoilIdSoilDataDepthIntervalPresetChoices} from 'terraso-client-shared/gr import * as appStateHooks from 'terraso-mobile-client/hooks/appStateHooks'; import * as connectivityHooks from 'terraso-mobile-client/hooks/connectivityHooks'; -import {LoadingState} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {LoadingState} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {AppState as ReduxAppState} from 'terraso-mobile-client/store'; import * as syncHooks from 'terraso-mobile-client/store/sync/hooks/syncHooks'; import {PullDispatcher} from 'terraso-mobile-client/store/sync/PullDispatcher'; @@ -67,7 +67,7 @@ describe('PullDispatcher', () => { } as Partial; const stateWithUnsyncedSites = { - soilId: { + soilData: { soilData: {}, projectSettings: {}, status: 'ready' as LoadingState, diff --git a/dev-client/__tests__/snapshot/SlopeScreen-test.tsx b/dev-client/__tests__/snapshot/SlopeScreen-test.tsx index 990ea4028..37bea5d16 100644 --- a/dev-client/__tests__/snapshot/SlopeScreen-test.tsx +++ b/dev-client/__tests__/snapshot/SlopeScreen-test.tsx @@ -21,7 +21,7 @@ import {render} from '@testing/integration/utils'; import {collectionMethods} from 'terraso-client-shared/soilId/soilIdTypes'; import {fromEntries} from 'terraso-client-shared/utils'; -import {methodRequired} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {methodRequired} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {SlopeScreen} from 'terraso-mobile-client/screens/SlopeScreen/SlopeScreen'; test('renders correctly', () => { @@ -29,7 +29,7 @@ test('renders correctly', () => { route: 'SITE_TABS', initialState: { ...testState, - soilId: { + soilData: { status: 'ready', soilData: { '1': { diff --git a/dev-client/src/components/AddDepthModal.tsx b/dev-client/src/components/AddDepthModal.tsx index 1e35d8b8a..639f31727 100644 --- a/dev-client/src/components/AddDepthModal.tsx +++ b/dev-client/src/components/AddDepthModal.tsx @@ -30,7 +30,7 @@ import {Box} from 'terraso-mobile-client/components/NativeBaseAdapters'; import { DepthInterval, LabelledDepthInterval, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {depthSchema} from 'terraso-mobile-client/schemas/depthSchema'; type Props = { diff --git a/dev-client/src/components/SyncContent.tsx b/dev-client/src/components/SyncContent.tsx index e3ac5c66d..810be44f0 100644 --- a/dev-client/src/components/SyncContent.tsx +++ b/dev-client/src/components/SyncContent.tsx @@ -21,7 +21,7 @@ import {Button} from 'native-base'; import {Text} from 'terraso-mobile-client/components/NativeBaseAdapters'; import {RestrictByFlag} from 'terraso-mobile-client/components/restrictions/RestrictByFlag'; -import {selectUnsyncedSiteIds} from 'terraso-mobile-client/model/soilId/soilIdSelectors'; +import {selectUnsyncedSiteIds} from 'terraso-mobile-client/model/soilData/soilDataSelectors'; import {selectPullRequested} from 'terraso-mobile-client/model/sync/syncSelectors'; import {setPullRequested} from 'terraso-mobile-client/model/sync/syncSlice'; import {useDispatch, useSelector} from 'terraso-mobile-client/store'; diff --git a/dev-client/src/components/tables/soilProperties/SoilPropertiesData.tsx b/dev-client/src/components/tables/soilProperties/SoilPropertiesData.tsx index 2ae8f8138..b34c003a0 100644 --- a/dev-client/src/components/tables/soilProperties/SoilPropertiesData.tsx +++ b/dev-client/src/components/tables/soilProperties/SoilPropertiesData.tsx @@ -31,7 +31,7 @@ import { fullMunsellColor, munsellToString, } from 'terraso-mobile-client/model/color/colorConversions'; -import {sameDepth} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {sameDepth} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {AggregatedInterval} from 'terraso-mobile-client/store/selectors'; export type SoilPropertiesDataTableRow = { diff --git a/dev-client/src/context/SoilIdMatchContext.tsx b/dev-client/src/context/SoilIdMatchContext.tsx index 7d8e03c7b..5ef5e83eb 100644 --- a/dev-client/src/context/SoilIdMatchContext.tsx +++ b/dev-client/src/context/SoilIdMatchContext.tsx @@ -33,7 +33,7 @@ import {Coords} from 'terraso-client-shared/types'; import {useIsOffline} from 'terraso-mobile-client/hooks/connectivityHooks'; import {useValueSet} from 'terraso-mobile-client/hooks/useValueSet'; -import {selectUnsyncedSiteIds} from 'terraso-mobile-client/model/soilId/soilIdSelectors'; +import {selectUnsyncedSiteIds} from 'terraso-mobile-client/model/soilData/soilDataSelectors'; import {coordsKey} from 'terraso-mobile-client/model/soilIdMatch/soilIdMatches'; import { selectDataBasedInputs, diff --git a/dev-client/src/model/project/projectGlobalReducer.ts b/dev-client/src/model/project/projectGlobalReducer.ts index dd1778ef3..821683cd4 100644 --- a/dev-client/src/model/project/projectGlobalReducer.ts +++ b/dev-client/src/model/project/projectGlobalReducer.ts @@ -24,7 +24,7 @@ import { updateProjects, } from 'terraso-mobile-client/model/project/projectSlice'; import {updateSites} from 'terraso-mobile-client/model/site/siteSlice'; -import {updateProjectSettings} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateProjectSettings} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {createGlobalReducer} from 'terraso-mobile-client/store/reducers'; export const fetchProject = createAsyncThunk( @@ -60,20 +60,20 @@ export const projectGlobalReducer = createGlobalReducer(builder => { updateProjects(state.project, {[payload.project.id]: payload.project}); updateSites(state.site, payload.sites); updateUsers(state.account, payload.users); - updateProjectSettings(state.soilId, payload.soilSettings); + updateProjectSettings(state.soilData, payload.soilSettings); }); builder.addCase(addProject.fulfilled, (state, {payload}) => { updateProjects(state.project, {[payload.project.id]: payload.project}); updateSites(state.site, payload.sites); updateUsers(state.account, payload.users); - updateProjectSettings(state.soilId, payload.soilSettings); + updateProjectSettings(state.soilData, payload.soilSettings); }); builder.addCase(updateProject.fulfilled, (state, {payload}) => { updateProjects(state.project, {[payload.project.id]: payload.project}); updateSites(state.site, payload.sites); updateUsers(state.account, payload.users); - updateProjectSettings(state.soilId, payload.soilSettings); + updateProjectSettings(state.soilData, payload.soilSettings); }); }); diff --git a/dev-client/src/model/site/siteGlobalReducer.ts b/dev-client/src/model/site/siteGlobalReducer.ts index 0d526c870..e7c32ddad 100644 --- a/dev-client/src/model/site/siteGlobalReducer.ts +++ b/dev-client/src/model/site/siteGlobalReducer.ts @@ -28,7 +28,7 @@ import { updateProjectOfSite, updateSites, } from 'terraso-mobile-client/model/site/siteSlice'; -import {deleteSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {deleteSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {deleteSiteMatches} from 'terraso-mobile-client/model/soilIdMatch/soilIdMatchSlice'; import {deleteSoilMetadata} from 'terraso-mobile-client/model/soilMetadata/soilMetadataSlice'; import {createGlobalReducer} from 'terraso-mobile-client/store/reducers'; @@ -75,7 +75,7 @@ export const siteGlobalReducer = createGlobalReducer(builder => { builder.addCase(deleteSite.fulfilled, (state, {payload}) => { removeSiteFromAllProjects(state.project, payload); deleteSites(state.site, [payload]); - deleteSoilData(state.soilId, [payload]); + deleteSoilData(state.soilData, [payload]); deleteSoilMetadata(state.soilMetadata, [payload]); deleteSiteMatches(state.soilIdMatch, [payload]); }); diff --git a/dev-client/src/model/soilId/actions/localSoilDataActions.ts b/dev-client/src/model/soilData/actions/localSoilDataActions.ts similarity index 96% rename from dev-client/src/model/soilId/actions/localSoilDataActions.ts rename to dev-client/src/model/soilData/actions/localSoilDataActions.ts index 33f2e836d..0c5007374 100644 --- a/dev-client/src/model/soilId/actions/localSoilDataActions.ts +++ b/dev-client/src/model/soilData/actions/localSoilDataActions.ts @@ -30,12 +30,12 @@ import { DEPTH_DEPENDENT_SOIL_DATA_UPDATE_FIELDS, DEPTH_INTERVAL_UPDATE_FIELDS, SOIL_DATA_UPDATE_FIELDS, -} from 'terraso-mobile-client/model/soilId/actions/soilDataActionFields'; -import {DEFAULT_DEPTH_INTERVAL_PRESET} from 'terraso-mobile-client/model/soilId/soilDataConstants'; +} from 'terraso-mobile-client/model/soilData/actions/soilDataActionFields'; +import {DEFAULT_DEPTH_INTERVAL_PRESET} from 'terraso-mobile-client/model/soilData/soilDataConstants'; import { compareInterval, sameDepth, -} from 'terraso-mobile-client/model/soilId/soilIdFunctions'; +} from 'terraso-mobile-client/model/soilData/soilDataFunctions'; /* * Logic ported from `apps/soil_id/graphql/soil_data.py` in backend project diff --git a/dev-client/src/model/soilId/actions/localSoilIDataActions.test.ts b/dev-client/src/model/soilData/actions/localSoilIDataActions.test.ts similarity index 98% rename from dev-client/src/model/soilId/actions/localSoilIDataActions.test.ts rename to dev-client/src/model/soilData/actions/localSoilIDataActions.test.ts index 1e9cf75e6..ae907eafc 100644 --- a/dev-client/src/model/soilId/actions/localSoilIDataActions.test.ts +++ b/dev-client/src/model/soilData/actions/localSoilIDataActions.test.ts @@ -29,17 +29,17 @@ import { updateFields, updateSoilData, updateSoilDataDepthInterval, -} from 'terraso-mobile-client/model/soilId/actions/localSoilDataActions'; +} from 'terraso-mobile-client/model/soilData/actions/localSoilDataActions'; import { DEPTH_DEPENDENT_SOIL_DATA_UPDATE_FIELDS, DEPTH_INTERVAL_UPDATE_FIELDS, SOIL_DATA_UPDATE_FIELDS, -} from 'terraso-mobile-client/model/soilId/actions/soilDataActionFields'; +} from 'terraso-mobile-client/model/soilData/actions/soilDataActionFields'; import { DepthDependentSoilData, SoilData, SoilDataDepthInterval, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; describe('initializeResult', () => { test('deep-copies soil data object', () => { diff --git a/dev-client/src/model/soilId/actions/remoteSoilDataActions.test.ts b/dev-client/src/model/soilData/actions/remoteSoilDataActions.test.ts similarity index 97% rename from dev-client/src/model/soilId/actions/remoteSoilDataActions.test.ts rename to dev-client/src/model/soilData/actions/remoteSoilDataActions.test.ts index 023705b6d..85330b67f 100644 --- a/dev-client/src/model/soilId/actions/remoteSoilDataActions.test.ts +++ b/dev-client/src/model/soilData/actions/remoteSoilDataActions.test.ts @@ -25,8 +25,8 @@ import { mutationResponseToResults, unsyncedDataToMutationInput, unsyncedDataToMutationInputEntry, -} from 'terraso-mobile-client/model/soilId/actions/remoteSoilDataActions'; -import {SoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/actions/remoteSoilDataActions'; +import {SoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import { SyncRecord, SyncRecords, diff --git a/dev-client/src/model/soilId/actions/remoteSoilDataActions.ts b/dev-client/src/model/soilData/actions/remoteSoilDataActions.ts similarity index 98% rename from dev-client/src/model/soilId/actions/remoteSoilDataActions.ts rename to dev-client/src/model/soilData/actions/remoteSoilDataActions.ts index 06865fa8e..ef8190da0 100644 --- a/dev-client/src/model/soilId/actions/remoteSoilDataActions.ts +++ b/dev-client/src/model/soilData/actions/remoteSoilDataActions.ts @@ -29,7 +29,7 @@ import { getChangedDepthIntervals, getChangedSoilDataFields, getDeletedDepthIntervals, -} from 'terraso-mobile-client/model/soilId/actions/soilDataDiff'; +} from 'terraso-mobile-client/model/soilData/actions/soilDataDiff'; import { getEntityRecord, SyncRecord, diff --git a/dev-client/src/model/soilId/actions/soilDataActionFields.ts b/dev-client/src/model/soilData/actions/soilDataActionFields.ts similarity index 98% rename from dev-client/src/model/soilId/actions/soilDataActionFields.ts rename to dev-client/src/model/soilData/actions/soilDataActionFields.ts index 8dbc09f4c..8d85da03c 100644 --- a/dev-client/src/model/soilId/actions/soilDataActionFields.ts +++ b/dev-client/src/model/soilData/actions/soilDataActionFields.ts @@ -25,7 +25,7 @@ import { DepthDependentSoilData, SoilData, SoilDataDepthInterval, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; /** * The soil data fields which are covered by the update action. diff --git a/dev-client/src/model/soilId/actions/soilDataActions.ts b/dev-client/src/model/soilData/actions/soilDataActions.ts similarity index 92% rename from dev-client/src/model/soilId/actions/soilDataActions.ts rename to dev-client/src/model/soilData/actions/soilDataActions.ts index 43af6341b..5d2a9d2c1 100644 --- a/dev-client/src/model/soilId/actions/soilDataActions.ts +++ b/dev-client/src/model/soilData/actions/soilDataActions.ts @@ -28,8 +28,8 @@ import {SoilData} from 'terraso-client-shared/soilId/soilIdTypes'; import {ThunkAPI} from 'terraso-client-shared/store/utils'; import {isFlagEnabled} from 'terraso-mobile-client/config/featureFlags'; -import * as localSoilData from 'terraso-mobile-client/model/soilId/actions/localSoilDataActions'; -import * as remoteSoilData from 'terraso-mobile-client/model/soilId/actions/remoteSoilDataActions'; +import * as localSoilData from 'terraso-mobile-client/model/soilData/actions/localSoilDataActions'; +import * as remoteSoilData from 'terraso-mobile-client/model/soilData/actions/remoteSoilDataActions'; import { getDataForRecords, getEntityRecords, @@ -49,11 +49,11 @@ export const pushSoilData = async ( state: AppState, ): Promise> => { const unsyncedChanges = getUnsyncedRecords( - getEntityRecords(state.soilId.soilSync, input), + getEntityRecords(state.soilData.soilSync, input), ); const unsyncedData = getDataForRecords( unsyncedChanges, - state.soilId.soilData, + state.soilData.soilData, ); return remoteSoilData.pushSoilData(unsyncedChanges, unsyncedData); }; @@ -69,7 +69,7 @@ export const updateSoilData = async ( state: AppState, ): Promise => { if (isFlagEnabled('FF_offline')) { - const data = state.soilId.soilData[input.siteId]; + const data = state.soilData.soilData[input.siteId]; return Promise.resolve(localSoilData.updateSoilData(input, data)); } else { return soilDataService.updateSoilData(input); @@ -87,7 +87,7 @@ export const deleteSoilDataDepthInterval = async ( state: AppState, ): Promise => { if (isFlagEnabled('FF_offline')) { - const data = state.soilId.soilData[input.siteId]; + const data = state.soilData.soilData[input.siteId]; return Promise.resolve( localSoilData.deleteSoilDataDepthInterval(input, data), ); @@ -107,7 +107,7 @@ export const updateSoilDataDepthInterval = async ( state: AppState, ): Promise => { if (isFlagEnabled('FF_offline')) { - const data = state.soilId.soilData[input.siteId]; + const data = state.soilData.soilData[input.siteId]; return Promise.resolve( localSoilData.updateSoilDataDepthInterval(input, data), ); @@ -127,7 +127,7 @@ export const updateDepthDependentSoilData = async ( state: AppState, ): Promise => { if (isFlagEnabled('FF_offline')) { - const data = state.soilId.soilData[input.siteId]; + const data = state.soilData.soilData[input.siteId]; return Promise.resolve( localSoilData.updateDepthDependentSoilData(input, data), ); diff --git a/dev-client/src/model/soilId/actions/soilDataDiff.test.ts b/dev-client/src/model/soilData/actions/soilDataDiff.test.ts similarity index 98% rename from dev-client/src/model/soilId/actions/soilDataDiff.test.ts rename to dev-client/src/model/soilData/actions/soilDataDiff.test.ts index 198cadef2..7cae8c600 100644 --- a/dev-client/src/model/soilId/actions/soilDataDiff.test.ts +++ b/dev-client/src/model/soilData/actions/soilDataDiff.test.ts @@ -19,7 +19,7 @@ import { DEPTH_DEPENDENT_SOIL_DATA_UPDATE_FIELDS, DEPTH_INTERVAL_UPDATE_FIELDS, SOIL_DATA_UPDATE_FIELDS, -} from 'terraso-mobile-client/model/soilId/actions/soilDataActionFields'; +} from 'terraso-mobile-client/model/soilData/actions/soilDataActionFields'; import { getChangedDepthDependentData, getChangedDepthDependentFields, @@ -27,12 +27,12 @@ import { getChangedDepthIntervals, getChangedSoilDataFields, getDeletedDepthIntervals, -} from 'terraso-mobile-client/model/soilId/actions/soilDataDiff'; +} from 'terraso-mobile-client/model/soilData/actions/soilDataDiff'; import { DepthDependentSoilData, SoilData, SoilDataDepthInterval, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; describe('soil data diff', () => { describe('getChangedSoilDataFields', () => { diff --git a/dev-client/src/model/soilId/actions/soilDataDiff.ts b/dev-client/src/model/soilData/actions/soilDataDiff.ts similarity index 97% rename from dev-client/src/model/soilId/actions/soilDataDiff.ts rename to dev-client/src/model/soilData/actions/soilDataDiff.ts index 78540b6ed..d2792af91 100644 --- a/dev-client/src/model/soilId/actions/soilDataDiff.ts +++ b/dev-client/src/model/soilData/actions/soilDataDiff.ts @@ -26,8 +26,8 @@ import { DEPTH_DEPENDENT_SOIL_DATA_UPDATE_FIELDS, DEPTH_INTERVAL_UPDATE_FIELDS, SOIL_DATA_UPDATE_FIELDS, -} from 'terraso-mobile-client/model/soilId/actions/soilDataActionFields'; -import {depthIntervalKey} from 'terraso-mobile-client/model/soilId/soilIdFunctions'; +} from 'terraso-mobile-client/model/soilData/actions/soilDataActionFields'; +import {depthIntervalKey} from 'terraso-mobile-client/model/soilData/soilDataFunctions'; export const getChangedSoilDataFields = ( curr: SoilData, diff --git a/dev-client/src/model/soilId/soilDataConstants.ts b/dev-client/src/model/soilData/soilDataConstants.ts similarity index 97% rename from dev-client/src/model/soilId/soilDataConstants.ts rename to dev-client/src/model/soilData/soilDataConstants.ts index 8f6a746ed..0354efca8 100644 --- a/dev-client/src/model/soilId/soilDataConstants.ts +++ b/dev-client/src/model/soilData/soilDataConstants.ts @@ -28,7 +28,7 @@ import {fromEntries, mapEntries} from 'terraso-client-shared/utils'; import { methodEnabled, methodRequired, -} from 'terraso-mobile-client/model/soilId/soilIdFunctions'; +} from 'terraso-mobile-client/model/soilData/soilDataFunctions'; export const DEFAULT_DEPTH_INTERVAL_PRESET = 'NRCS'; diff --git a/dev-client/src/model/soilId/soilIdFunctions.test.tsx b/dev-client/src/model/soilData/soilDataFunctions.test.tsx similarity index 98% rename from dev-client/src/model/soilId/soilIdFunctions.test.tsx rename to dev-client/src/model/soilData/soilDataFunctions.test.tsx index 1143c9234..8e8c94a6d 100644 --- a/dev-client/src/model/soilId/soilIdFunctions.test.tsx +++ b/dev-client/src/model/soilData/soilDataFunctions.test.tsx @@ -22,7 +22,7 @@ import { methodRequired, overlaps, sameDepth, -} from 'terraso-mobile-client/model/soilId/soilIdFunctions'; +} from 'terraso-mobile-client/model/soilData/soilDataFunctions'; describe('methodEnabled', () => { test('formats method names with the Enabled suffix', () => { diff --git a/dev-client/src/model/soilId/soilIdFunctions.ts b/dev-client/src/model/soilData/soilDataFunctions.ts similarity index 100% rename from dev-client/src/model/soilId/soilIdFunctions.ts rename to dev-client/src/model/soilData/soilDataFunctions.ts diff --git a/dev-client/src/model/soilId/soilIdGlobalReducer.ts b/dev-client/src/model/soilData/soilDataGlobalReducer.ts similarity index 85% rename from dev-client/src/model/soilId/soilIdGlobalReducer.ts rename to dev-client/src/model/soilData/soilDataGlobalReducer.ts index cd06ae497..ade7bfdb9 100644 --- a/dev-client/src/model/soilId/soilIdGlobalReducer.ts +++ b/dev-client/src/model/soilData/soilDataGlobalReducer.ts @@ -25,7 +25,7 @@ import { setProjectSettings, setSoilData, updateSoilIdStatus, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {setSoilMetadata} from 'terraso-mobile-client/model/soilMetadata/soilMetadataSlice'; import {createGlobalReducer} from 'terraso-mobile-client/store/reducers'; @@ -39,17 +39,17 @@ export const soilIdGlobalReducer = createGlobalReducer(builder => { setProjects(state.project, payload.projects); setSites(state.site, payload.sites); setUsers(state.account, payload.users); - setProjectSettings(state.soilId, payload.projectSoilSettings); - setSoilData(state.soilId, payload.soilData); + setProjectSettings(state.soilData, payload.projectSoilSettings); + setSoilData(state.soilData, payload.soilData); setSoilMetadata(state.soilMetadata, payload.soilMetadata); - updateSoilIdStatus(state.soilId, 'ready'); + updateSoilIdStatus(state.soilData, 'ready'); }); builder.addCase(fetchSoilDataForUser.pending, state => { - updateSoilIdStatus(state.soilId, 'loading'); + updateSoilIdStatus(state.soilData, 'loading'); }); builder.addCase(fetchSoilDataForUser.rejected, state => { - updateSoilIdStatus(state.soilId, 'error'); + updateSoilIdStatus(state.soilData, 'error'); }); }); diff --git a/dev-client/src/model/soilId/soilIdSelectors.ts b/dev-client/src/model/soilData/soilDataSelectors.ts similarity index 99% rename from dev-client/src/model/soilId/soilIdSelectors.ts rename to dev-client/src/model/soilData/soilDataSelectors.ts index 8115f08c5..00d794101 100644 --- a/dev-client/src/model/soilId/soilIdSelectors.ts +++ b/dev-client/src/model/soilData/soilDataSelectors.ts @@ -23,7 +23,7 @@ import { } from 'terraso-mobile-client/model/sync/records'; import {AppState} from 'terraso-mobile-client/store'; -export const selectSoilChanges = (state: AppState) => state.soilId.soilSync; +export const selectSoilChanges = (state: AppState) => state.soilData.soilSync; /* * Note: selectors that derive new values from change records are memoized to ensure diff --git a/dev-client/src/model/soilId/soilIdSlice.ts b/dev-client/src/model/soilData/soilDataSlice.ts similarity index 96% rename from dev-client/src/model/soilId/soilIdSlice.ts rename to dev-client/src/model/soilData/soilDataSlice.ts index 7518fb51c..3affb283d 100644 --- a/dev-client/src/model/soilId/soilIdSlice.ts +++ b/dev-client/src/model/soilData/soilDataSlice.ts @@ -28,7 +28,7 @@ import { } from 'terraso-client-shared/soilId/soilIdTypes'; import {createAsyncThunk} from 'terraso-client-shared/store/utils'; -import * as soilDataActions from 'terraso-mobile-client/model/soilId/actions/soilDataActions'; +import * as soilDataActions from 'terraso-mobile-client/model/soilData/actions/soilDataActions'; import { markEntityModified, mergeUnsyncedEntities, @@ -37,7 +37,7 @@ import { import {applySyncResults} from 'terraso-mobile-client/model/sync/results'; export * from 'terraso-client-shared/soilId/soilIdTypes'; -export * from 'terraso-mobile-client/model/soilId/soilIdFunctions'; +export * from 'terraso-mobile-client/model/soilData/soilDataFunctions'; export type MethodRequired< T extends CollectionMethod | DisabledCollectionMethod, @@ -100,8 +100,8 @@ export const deleteSoilData = (state: Draft, siteIds: string[]) => { } }; -const soilIdSlice = createSlice({ - name: 'soilId', +const soilDataSlice = createSlice({ + name: 'soilData', initialState, reducers: { setSoilIdStatus: (state, action: PayloadAction) => { @@ -157,7 +157,7 @@ const soilIdSlice = createSlice({ }, }); -export const {setSoilIdStatus} = soilIdSlice.actions; +export const {setSoilIdStatus} = soilDataSlice.actions; export const pushSoilData = createAsyncThunk( 'soilId/pushSoilData', @@ -199,4 +199,4 @@ export const deleteProjectDepthInterval = createAsyncThunk( soilDataService.deleteProjectDepthInterval, ); -export default soilIdSlice.reducer; +export default soilDataSlice.reducer; diff --git a/dev-client/src/model/soilIdMatch/soilIdMatchSelectors.ts b/dev-client/src/model/soilIdMatch/soilIdMatchSelectors.ts index 37fec2a8d..c406040fd 100644 --- a/dev-client/src/model/soilIdMatch/soilIdMatchSelectors.ts +++ b/dev-client/src/model/soilIdMatch/soilIdMatchSelectors.ts @@ -63,7 +63,7 @@ export const selectDataBasedInputs = createSelector( export const selectNextDataBasedInputs = createSelector( createSelector( [ - (state: AppState) => state.soilId.soilData, + (state: AppState) => state.soilData.soilData, (_: AppState, siteIds: string[]) => siteIds, ], /* Combine soil data with site IDs to extract relevant entries */ diff --git a/dev-client/src/model/soilMetadata/soilMetadataSlice.ts b/dev-client/src/model/soilMetadata/soilMetadataSlice.ts index c1c6570ea..936404a16 100644 --- a/dev-client/src/model/soilMetadata/soilMetadataSlice.ts +++ b/dev-client/src/model/soilMetadata/soilMetadataSlice.ts @@ -22,7 +22,7 @@ import * as soilMetadataService from 'terraso-client-shared/soilId/soilMetadataS import {createAsyncThunk} from 'terraso-client-shared/store/utils'; export * from 'terraso-client-shared/soilId/soilIdTypes'; -export * from 'terraso-mobile-client/model/soilId/soilIdFunctions'; +export * from 'terraso-mobile-client/model/soilData/soilDataFunctions'; export type SoilState = { /* Note that the keys for these records are the site IDs to which the soil metadata belongs */ diff --git a/dev-client/src/schemas/depthSchema.ts b/dev-client/src/schemas/depthSchema.ts index e5e3a10ed..e50469c14 100644 --- a/dev-client/src/schemas/depthSchema.ts +++ b/dev-client/src/schemas/depthSchema.ts @@ -22,7 +22,7 @@ import { DEPTH_LABEL_MAX_LENGTH, DEPTH_MAX, } from 'terraso-mobile-client/constants'; -import {DepthInterval} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {DepthInterval} from 'terraso-mobile-client/model/soilData/soilDataSlice'; type Args = { t: TFunction; diff --git a/dev-client/src/screens/ColorAnalysisScreen/ColorAnalysisHomeScreen.tsx b/dev-client/src/screens/ColorAnalysisScreen/ColorAnalysisHomeScreen.tsx index a49402050..ed6e2c56a 100644 --- a/dev-client/src/screens/ColorAnalysisScreen/ColorAnalysisHomeScreen.tsx +++ b/dev-client/src/screens/ColorAnalysisScreen/ColorAnalysisHomeScreen.tsx @@ -40,7 +40,7 @@ import { InvalidColorResult, MunsellColor, } from 'terraso-mobile-client/model/color/types'; -import {updateDepthDependentSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateDepthDependentSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; import {useColorAnalysisContext} from 'terraso-mobile-client/screens/ColorAnalysisScreen/context/colorAnalysisContext'; import {useColorAnalysisNavigation} from 'terraso-mobile-client/screens/ColorAnalysisScreen/navigation/navigation'; diff --git a/dev-client/src/screens/LocationScreens/components/LocationSoilIdCard.tsx b/dev-client/src/screens/LocationScreens/components/LocationSoilIdCard.tsx index fc20addc9..bd49e0fdc 100644 --- a/dev-client/src/screens/LocationScreens/components/LocationSoilIdCard.tsx +++ b/dev-client/src/screens/LocationScreens/components/LocationSoilIdCard.tsx @@ -35,7 +35,7 @@ import { } from 'terraso-mobile-client/components/NativeBaseAdapters'; import {SoilIdStatusDisplay} from 'terraso-mobile-client/components/SoilIdStatusDisplay'; import {useSoilIdData} from 'terraso-mobile-client/hooks/soilIdHooks'; -import {SoilIdStatus} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {SoilIdStatus} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {getTopMatch} from 'terraso-mobile-client/model/soilIdMatch/soilIdRanking'; import {findSelectedMatch} from 'terraso-mobile-client/model/soilMetadata/soilMetadataFunctions'; import {useSoilIdSelection} from 'terraso-mobile-client/model/soilMetadata/soilMetadataHooks'; diff --git a/dev-client/src/screens/LocationScreens/components/soilId/SiteSlopeDataSection.tsx b/dev-client/src/screens/LocationScreens/components/soilId/SiteSlopeDataSection.tsx index 6fa16ca4b..47ea34b00 100644 --- a/dev-client/src/screens/LocationScreens/components/soilId/SiteSlopeDataSection.tsx +++ b/dev-client/src/screens/LocationScreens/components/soilId/SiteSlopeDataSection.tsx @@ -29,7 +29,7 @@ import { } from 'terraso-mobile-client/components/NativeBaseAdapters'; import {RestrictBySiteRole} from 'terraso-mobile-client/components/restrictions/RestrictByRole'; import {SITE_EDITOR_ROLES} from 'terraso-mobile-client/model/permissions/permissions'; -import {SoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {SoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; import { renderSlopeSteepnessDegree, diff --git a/dev-client/src/screens/ProjectInputScreen/DepthTable.tsx b/dev-client/src/screens/ProjectInputScreen/DepthTable.tsx index dd775255d..6e6bb9b12 100644 --- a/dev-client/src/screens/ProjectInputScreen/DepthTable.tsx +++ b/dev-client/src/screens/ProjectInputScreen/DepthTable.tsx @@ -26,7 +26,7 @@ import { deleteProjectDepthInterval, DepthInterval, ProjectDepthInterval, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {useDispatch} from 'terraso-mobile-client/store'; type TableProps = { diff --git a/dev-client/src/screens/ProjectInputScreen/RequiredDataSettings.tsx b/dev-client/src/screens/ProjectInputScreen/RequiredDataSettings.tsx index b7d76807d..d993494e5 100644 --- a/dev-client/src/screens/ProjectInputScreen/RequiredDataSettings.tsx +++ b/dev-client/src/screens/ProjectInputScreen/RequiredDataSettings.tsx @@ -30,7 +30,7 @@ import { collectionMethods, methodRequired, updateProjectSoilSettings, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {useDispatch} from 'terraso-mobile-client/store'; import {useProjectSoilSettings} from 'terraso-mobile-client/store/selectors'; import {SWITCH_PADDING} from 'terraso-mobile-client/theme'; diff --git a/dev-client/src/screens/ProjectInputScreen/SoilPitSettings.tsx b/dev-client/src/screens/ProjectInputScreen/SoilPitSettings.tsx index 091deab42..2defd4198 100644 --- a/dev-client/src/screens/ProjectInputScreen/SoilPitSettings.tsx +++ b/dev-client/src/screens/ProjectInputScreen/SoilPitSettings.tsx @@ -41,7 +41,7 @@ import { ProjectDepthIntervalPreset, updateProjectDepthInterval, updateProjectSoilSettings, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {DepthTable} from 'terraso-mobile-client/screens/ProjectInputScreen/DepthTable'; import {useDispatch} from 'terraso-mobile-client/store'; import {useProjectSoilSettings} from 'terraso-mobile-client/store/selectors'; diff --git a/dev-client/src/screens/ProjectListScreen/ProjectListScreen.tsx b/dev-client/src/screens/ProjectListScreen/ProjectListScreen.tsx index 6d6a39b53..89ebe11b6 100644 --- a/dev-client/src/screens/ProjectListScreen/ProjectListScreen.tsx +++ b/dev-client/src/screens/ProjectListScreen/ProjectListScreen.tsx @@ -62,7 +62,9 @@ export const ProjectListScreen = () => { () => navigation.navigate('CREATE_PROJECT'), [navigation], ); - const isLoadingData = useSelector(state => state.soilId.status === 'loading'); + const isLoadingData = useSelector( + state => state.soilData.status === 'loading', + ); const renderSortOption = useCallback( (option: string) => t(`projects.search.${option}`), [t], diff --git a/dev-client/src/screens/SitesScreen/SitesScreen.tsx b/dev-client/src/screens/SitesScreen/SitesScreen.tsx index a263529ce..27575819b 100644 --- a/dev-client/src/screens/SitesScreen/SitesScreen.tsx +++ b/dev-client/src/screens/SitesScreen/SitesScreen.tsx @@ -38,7 +38,7 @@ import {Box} from 'terraso-mobile-client/components/NativeBaseAdapters'; import {positionToCoords} from 'terraso-mobile-client/components/StaticMapView'; import {useGeospatialContext} from 'terraso-mobile-client/context/GeospatialContext'; import {SitesScreenContext} from 'terraso-mobile-client/context/SitesScreenContext'; -import {fetchSoilDataForUser} from 'terraso-mobile-client/model/soilId/soilIdGlobalReducer'; +import {fetchSoilDataForUser} from 'terraso-mobile-client/model/soilData/soilDataGlobalReducer'; import {AppBar} from 'terraso-mobile-client/navigation/components/AppBar'; import {ScreenScaffold} from 'terraso-mobile-client/screens/ScreenScaffold'; import MapSearch from 'terraso-mobile-client/screens/SitesScreen/components/MapSearch'; diff --git a/dev-client/src/screens/SitesScreen/components/SiteListBottomSheet.tsx b/dev-client/src/screens/SitesScreen/components/SiteListBottomSheet.tsx index 449f7ce8c..08400ad05 100644 --- a/dev-client/src/screens/SitesScreen/components/SiteListBottomSheet.tsx +++ b/dev-client/src/screens/SitesScreen/components/SiteListBottomSheet.tsx @@ -65,7 +65,7 @@ export const SiteListBottomSheet = memo( ({sites, showSiteOnMap, snapIndex}, ref) => { const {t} = useTranslation(); const isLoadingData = useSelector( - state => state.soilId.status === 'loading', + state => state.soilData.status === 'loading', ); const deviceBottomInsets = useSafeAreaInsets().bottom; diff --git a/dev-client/src/screens/SitesScreen/components/TemporaryLocationCallout.tsx b/dev-client/src/screens/SitesScreen/components/TemporaryLocationCallout.tsx index 81576d586..91bd429f7 100644 --- a/dev-client/src/screens/SitesScreen/components/TemporaryLocationCallout.tsx +++ b/dev-client/src/screens/SitesScreen/components/TemporaryLocationCallout.tsx @@ -42,7 +42,7 @@ import {useIsOffline} from 'terraso-mobile-client/hooks/connectivityHooks'; import {useSoilIdData} from 'terraso-mobile-client/hooks/soilIdHooks'; import {useElevationData} from 'terraso-mobile-client/model/elevation/elevationHooks'; import {ElevationRecord} from 'terraso-mobile-client/model/elevation/elevationTypes'; -import {SoilIdStatus} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {SoilIdStatus} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {getTopMatch} from 'terraso-mobile-client/model/soilIdMatch/soilIdRanking'; import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; import {CalloutDetail} from 'terraso-mobile-client/screens/SitesScreen/components/CalloutDetail'; diff --git a/dev-client/src/screens/SlopeScreen/SlopeMeterScreen.tsx b/dev-client/src/screens/SlopeScreen/SlopeMeterScreen.tsx index c80e32b11..ef138a6b5 100644 --- a/dev-client/src/screens/SlopeScreen/SlopeMeterScreen.tsx +++ b/dev-client/src/screens/SlopeScreen/SlopeMeterScreen.tsx @@ -36,7 +36,7 @@ import { Heading, Row, } from 'terraso-mobile-client/components/NativeBaseAdapters'; -import {updateSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; import {ScreenScaffold} from 'terraso-mobile-client/screens/ScreenScaffold'; import {SlopeMeterInfoContent} from 'terraso-mobile-client/screens/SlopeScreen/components/SlopeMeterInfoContent'; diff --git a/dev-client/src/screens/SlopeScreen/SlopeShapeScreen.tsx b/dev-client/src/screens/SlopeScreen/SlopeShapeScreen.tsx index 729b1d4fb..c8ae57470 100644 --- a/dev-client/src/screens/SlopeScreen/SlopeShapeScreen.tsx +++ b/dev-client/src/screens/SlopeScreen/SlopeShapeScreen.tsx @@ -54,7 +54,7 @@ import { isProjectViewer, SITE_EDITOR_ROLES, } from 'terraso-mobile-client/model/permissions/permissions'; -import {updateSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {AppBar} from 'terraso-mobile-client/navigation/components/AppBar'; import {ScreenScaffold} from 'terraso-mobile-client/screens/ScreenScaffold'; import {SlopeShapeInfoContent} from 'terraso-mobile-client/screens/SlopeScreen/components/SlopeShapeInfoContent'; diff --git a/dev-client/src/screens/SlopeScreen/SlopeSteepnessScreen.tsx b/dev-client/src/screens/SlopeScreen/SlopeSteepnessScreen.tsx index 5121e270d..d26fc9f9b 100644 --- a/dev-client/src/screens/SlopeScreen/SlopeSteepnessScreen.tsx +++ b/dev-client/src/screens/SlopeScreen/SlopeSteepnessScreen.tsx @@ -47,7 +47,7 @@ import { isProjectViewer, SITE_EDITOR_ROLES, } from 'terraso-mobile-client/model/permissions/permissions'; -import {updateSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {AppBar} from 'terraso-mobile-client/navigation/components/AppBar'; import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; import {ScreenScaffold} from 'terraso-mobile-client/screens/ScreenScaffold'; diff --git a/dev-client/src/screens/SlopeScreen/components/ManualSteepnessModal.tsx b/dev-client/src/screens/SlopeScreen/components/ManualSteepnessModal.tsx index d5638ac92..186e2a593 100644 --- a/dev-client/src/screens/SlopeScreen/components/ManualSteepnessModal.tsx +++ b/dev-client/src/screens/SlopeScreen/components/ManualSteepnessModal.tsx @@ -31,7 +31,7 @@ import { Heading, Row, } from 'terraso-mobile-client/components/NativeBaseAdapters'; -import {updateSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import { degreeToPercent, percentToDegree, diff --git a/dev-client/src/screens/SlopeScreen/utils/renderValues.ts b/dev-client/src/screens/SlopeScreen/utils/renderValues.ts index f90cfb1bb..c27ebd8f1 100644 --- a/dev-client/src/screens/SlopeScreen/utils/renderValues.ts +++ b/dev-client/src/screens/SlopeScreen/utils/renderValues.ts @@ -17,7 +17,7 @@ import {TFunction} from 'i18next'; -import {SoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {SoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {formatPercent} from 'terraso-mobile-client/util'; export const renderSteepness = ( diff --git a/dev-client/src/screens/SoilScreen/ColorScreen/ColorScreen.tsx b/dev-client/src/screens/SoilScreen/ColorScreen/ColorScreen.tsx index 3d5fe2faa..23208b4b4 100644 --- a/dev-client/src/screens/SoilScreen/ColorScreen/ColorScreen.tsx +++ b/dev-client/src/screens/SoilScreen/ColorScreen/ColorScreen.tsx @@ -39,7 +39,7 @@ import { isProjectEditor, SITE_EDITOR_ROLES, } from 'terraso-mobile-client/model/permissions/permissions'; -import {updateDepthDependentSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateDepthDependentSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {CameraWorkflow} from 'terraso-mobile-client/screens/SoilScreen/ColorScreen/components/CameraWorkflow'; import {ColorDisplay} from 'terraso-mobile-client/screens/SoilScreen/ColorScreen/components/ColorDisplay'; import {ManualWorkflow} from 'terraso-mobile-client/screens/SoilScreen/ColorScreen/components/ManualWorkflow'; diff --git a/dev-client/src/screens/SoilScreen/ColorScreen/components/ManualWorkflow.tsx b/dev-client/src/screens/SoilScreen/ColorScreen/components/ManualWorkflow.tsx index a9ce27a69..2260e4a6b 100644 --- a/dev-client/src/screens/SoilScreen/ColorScreen/components/ManualWorkflow.tsx +++ b/dev-client/src/screens/SoilScreen/ColorScreen/components/ManualWorkflow.tsx @@ -53,7 +53,7 @@ import { SoilColorHue, soilColorHues, updateDepthDependentSoilData, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {SwitchWorkflowButton} from 'terraso-mobile-client/screens/SoilScreen/ColorScreen/components/SwitchWorkflowButton'; import {SoilPitInputScreenProps} from 'terraso-mobile-client/screens/SoilScreen/components/SoilPitInputScreenScaffold'; import {useDispatch, useSelector} from 'terraso-mobile-client/store'; diff --git a/dev-client/src/screens/SoilScreen/ColorScreen/components/PhotoConditions.tsx b/dev-client/src/screens/SoilScreen/ColorScreen/components/PhotoConditions.tsx index 593f4d4f2..510a151bd 100644 --- a/dev-client/src/screens/SoilScreen/ColorScreen/components/PhotoConditions.tsx +++ b/dev-client/src/screens/SoilScreen/ColorScreen/components/PhotoConditions.tsx @@ -25,7 +25,7 @@ import {RadioBlock} from 'terraso-mobile-client/components/RadioBlock'; import {RestrictBySiteRole} from 'terraso-mobile-client/components/restrictions/RestrictByRole'; import {SiteRoleContextProvider} from 'terraso-mobile-client/context/SiteRoleContext'; import {SITE_EDITOR_ROLES} from 'terraso-mobile-client/model/permissions/permissions'; -import {updateDepthDependentSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateDepthDependentSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {SoilPitInputScreenProps} from 'terraso-mobile-client/screens/SoilScreen/components/SoilPitInputScreenScaffold'; import {useDispatch, useSelector} from 'terraso-mobile-client/store'; import {selectDepthDependentData} from 'terraso-mobile-client/store/selectors'; diff --git a/dev-client/src/screens/SoilScreen/ColorScreen/components/SwitchWorkflowButton.tsx b/dev-client/src/screens/SoilScreen/ColorScreen/components/SwitchWorkflowButton.tsx index c5be2d56d..3a8d9b909 100644 --- a/dev-client/src/screens/SoilScreen/ColorScreen/components/SwitchWorkflowButton.tsx +++ b/dev-client/src/screens/SoilScreen/ColorScreen/components/SwitchWorkflowButton.tsx @@ -23,7 +23,7 @@ import {Button} from 'native-base'; import {ConfirmModal} from 'terraso-mobile-client/components/modals/ConfirmModal'; import {isColorComplete} from 'terraso-mobile-client/model/color/colorConversions'; import {updatePreferences} from 'terraso-mobile-client/model/preferences/preferencesSlice'; -import {updateDepthDependentSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateDepthDependentSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {SoilPitInputScreenProps} from 'terraso-mobile-client/screens/SoilScreen/components/SoilPitInputScreenScaffold'; import {useDispatch, useSelector} from 'terraso-mobile-client/store'; import {selectDepthDependentData} from 'terraso-mobile-client/store/selectors'; diff --git a/dev-client/src/screens/SoilScreen/SoilScreen.tsx b/dev-client/src/screens/SoilScreen/SoilScreen.tsx index 0e88c2f39..dc97cd9f7 100644 --- a/dev-client/src/screens/SoilScreen/SoilScreen.tsx +++ b/dev-client/src/screens/SoilScreen/SoilScreen.tsx @@ -41,7 +41,7 @@ import { soilPitMethods, updateSoilData, updateSoilDataDepthInterval, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {EditSiteSoilDepthPreset} from 'terraso-mobile-client/screens/SoilScreen/components/EditSiteSoilDepthPreset'; import {SoilDepthSummary} from 'terraso-mobile-client/screens/SoilScreen/components/SoilDepthSummary'; import {SoilSurfaceStatus} from 'terraso-mobile-client/screens/SoilScreen/components/SoilSurfaceStatus'; diff --git a/dev-client/src/screens/SoilScreen/TextureGuideScreen.tsx b/dev-client/src/screens/SoilScreen/TextureGuideScreen.tsx index 3661f6f3e..5061f3d94 100644 --- a/dev-client/src/screens/SoilScreen/TextureGuideScreen.tsx +++ b/dev-client/src/screens/SoilScreen/TextureGuideScreen.tsx @@ -34,7 +34,7 @@ import {RadioBlock} from 'terraso-mobile-client/components/RadioBlock'; import { SoilTexture, updateDepthDependentSoilData, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {AppBar} from 'terraso-mobile-client/navigation/components/AppBar'; import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; import {ScreenScaffold} from 'terraso-mobile-client/screens/ScreenScaffold'; diff --git a/dev-client/src/screens/SoilScreen/TextureScreen.tsx b/dev-client/src/screens/SoilScreen/TextureScreen.tsx index dc83f43e4..bba451d53 100644 --- a/dev-client/src/screens/SoilScreen/TextureScreen.tsx +++ b/dev-client/src/screens/SoilScreen/TextureScreen.tsx @@ -53,7 +53,7 @@ import { SoilTexture, textures, updateDepthDependentSoilData, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; import {RockFragmentVolumeInfoContent} from 'terraso-mobile-client/screens/SoilScreen/components/RockFragmentVolumeInfoContent'; import { diff --git a/dev-client/src/screens/SoilScreen/components/DepthEditor.tsx b/dev-client/src/screens/SoilScreen/components/DepthEditor.tsx index d41b30175..81aa4a1d7 100644 --- a/dev-client/src/screens/SoilScreen/components/DepthEditor.tsx +++ b/dev-client/src/screens/SoilScreen/components/DepthEditor.tsx @@ -22,7 +22,7 @@ import { } from 'terraso-mobile-client/components/NativeBaseAdapters'; import {RestrictBySiteRole} from 'terraso-mobile-client/components/restrictions/RestrictByRole'; import {SITE_EDITOR_ROLES} from 'terraso-mobile-client/model/permissions/permissions'; -import {soilPitMethods} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {soilPitMethods} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {EditDepthModal} from 'terraso-mobile-client/screens/SoilScreen/components/EditDepthModal'; import {renderDepth} from 'terraso-mobile-client/screens/SoilScreen/components/RenderValues'; import {AggregatedInterval} from 'terraso-mobile-client/store/selectors'; diff --git a/dev-client/src/screens/SoilScreen/components/EditDepthModal.tsx b/dev-client/src/screens/SoilScreen/components/EditDepthModal.tsx index 36c3a2e10..426a319d5 100644 --- a/dev-client/src/screens/SoilScreen/components/EditDepthModal.tsx +++ b/dev-client/src/screens/SoilScreen/components/EditDepthModal.tsx @@ -55,7 +55,7 @@ import { SoilPitMethod, soilPitMethods, updateSoilDataDepthInterval, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {depthSchema} from 'terraso-mobile-client/schemas/depthSchema'; import {renderDepth} from 'terraso-mobile-client/screens/SoilScreen/components/RenderValues'; import {useDispatch} from 'terraso-mobile-client/store'; diff --git a/dev-client/src/screens/SoilScreen/components/RenderValues.tsx b/dev-client/src/screens/SoilScreen/components/RenderValues.tsx index 2a41e7cca..999f953ad 100644 --- a/dev-client/src/screens/SoilScreen/components/RenderValues.tsx +++ b/dev-client/src/screens/SoilScreen/components/RenderValues.tsx @@ -26,7 +26,7 @@ import { DepthDependentSoilData, LabelledDepthInterval, SoilPitMethod, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {ColorDisplay} from 'terraso-mobile-client/screens/SoilScreen/ColorScreen/components/ColorDisplay'; export const renderDepth = ( diff --git a/dev-client/src/screens/SoilScreen/components/SoilDepthSummary.tsx b/dev-client/src/screens/SoilScreen/components/SoilDepthSummary.tsx index c2adf3eb3..1afa83818 100644 --- a/dev-client/src/screens/SoilScreen/components/SoilDepthSummary.tsx +++ b/dev-client/src/screens/SoilScreen/components/SoilDepthSummary.tsx @@ -23,7 +23,7 @@ import { methodEnabled, methodRequired, soilPitMethods, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {useNavigation} from 'terraso-mobile-client/navigation/hooks/useNavigation'; import {DepthEditor} from 'terraso-mobile-client/screens/SoilScreen/components/DepthEditor'; import {pitMethodSummary} from 'terraso-mobile-client/screens/SoilScreen/components/RenderValues'; diff --git a/dev-client/src/screens/SoilScreen/components/SoilPitInputScreenScaffold.tsx b/dev-client/src/screens/SoilScreen/components/SoilPitInputScreenScaffold.tsx index a2228a458..cbc99a35c 100644 --- a/dev-client/src/screens/SoilScreen/components/SoilPitInputScreenScaffold.tsx +++ b/dev-client/src/screens/SoilScreen/components/SoilPitInputScreenScaffold.tsx @@ -18,7 +18,7 @@ import {useTranslation} from 'react-i18next'; import {Heading} from 'terraso-mobile-client/components/NativeBaseAdapters'; -import {LabelledDepthInterval} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {LabelledDepthInterval} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {AppBar} from 'terraso-mobile-client/navigation/components/AppBar'; import {ScreenScaffold} from 'terraso-mobile-client/screens/ScreenScaffold'; import {renderDepth} from 'terraso-mobile-client/screens/SoilScreen/components/RenderValues'; diff --git a/dev-client/src/screens/SoilScreen/components/SoilSurfaceScreen.tsx b/dev-client/src/screens/SoilScreen/components/SoilSurfaceScreen.tsx index f5cb0d2ab..a1c3f772b 100644 --- a/dev-client/src/screens/SoilScreen/components/SoilSurfaceScreen.tsx +++ b/dev-client/src/screens/SoilScreen/components/SoilSurfaceScreen.tsx @@ -38,7 +38,7 @@ import { isProjectViewer, SITE_EDITOR_ROLES, } from 'terraso-mobile-client/model/permissions/permissions'; -import {updateSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {updateSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {AppBar} from 'terraso-mobile-client/navigation/components/AppBar'; import {ScreenScaffold} from 'terraso-mobile-client/screens/ScreenScaffold'; import {useDispatch, useSelector} from 'terraso-mobile-client/store'; diff --git a/dev-client/src/screens/Toasts.tsx b/dev-client/src/screens/Toasts.tsx index a3d051922..710ebe53e 100644 --- a/dev-client/src/screens/Toasts.tsx +++ b/dev-client/src/screens/Toasts.tsx @@ -19,14 +19,14 @@ import {useTranslation} from 'react-i18next'; import {useToast} from 'native-base'; -import {setSoilIdStatus} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import {setSoilIdStatus} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {useDispatch, useSelector} from 'terraso-mobile-client/store'; export const Toasts = () => { const dispatch = useDispatch(); const {t} = useTranslation(); const toast = useToast(); - const soilIdStatus = useSelector(state => state.soilId.status); + const soilIdStatus = useSelector(state => state.soilData.status); useEffect(() => { if (soilIdStatus === 'error') { diff --git a/dev-client/src/store/index.ts b/dev-client/src/store/index.ts index ea744ae41..de5f38b86 100644 --- a/dev-client/src/store/index.ts +++ b/dev-client/src/store/index.ts @@ -31,7 +31,7 @@ import { import {projectGlobalReducer} from 'terraso-mobile-client/model/project/projectGlobalReducer'; import {siteGlobalReducer} from 'terraso-mobile-client/model/site/siteGlobalReducer'; -import {soilIdGlobalReducer} from 'terraso-mobile-client/model/soilId/soilIdGlobalReducer'; +import {soilIdGlobalReducer} from 'terraso-mobile-client/model/soilData/soilDataGlobalReducer'; import {persistenceMiddleware} from 'terraso-mobile-client/store/persistence'; import {AppState, rootReducer} from 'terraso-mobile-client/store/reducers'; diff --git a/dev-client/src/store/persistence.test.ts b/dev-client/src/store/persistence.test.ts index 17224b2e3..1943d8e98 100644 --- a/dev-client/src/store/persistence.test.ts +++ b/dev-client/src/store/persistence.test.ts @@ -117,14 +117,14 @@ describe('persistence middleware', () => { describe('patchPersistedReduxState', () => { test('adds sync records if absent', () => { - const state: any = {soilId: {soilSync: undefined}}; + const state: any = {soilData: {soilSync: undefined}}; const result = patchPersistedReduxState(state); - expect(result.soilId!.soilSync).toEqual({}); + expect(result.soilData!.soilSync).toEqual({}); }); test('retains sync records if present', () => { - const state: any = {soilId: {soilSync: {a: {}}}}; + const state: any = {soilData: {soilSync: {a: {}}}}; const result = patchPersistedReduxState(state); - expect(result.soilId!.soilSync).toEqual({a: {}}); + expect(result.soilData!.soilSync).toEqual({a: {}}); }); }); diff --git a/dev-client/src/store/persistence.ts b/dev-client/src/store/persistence.ts index b0cac6d29..1996d4708 100644 --- a/dev-client/src/store/persistence.ts +++ b/dev-client/src/store/persistence.ts @@ -44,7 +44,7 @@ export const patchPersistedReduxState = ( state: Partial, ): Partial => { return merge(state, { - soilId: {soilSync: {}}, + soilData: {soilSync: {}}, soilMetadata: {soilMetadata: {}}, soilIdMatch: {locationBasedMatches: {}, siteDataBasedMatches: {}}, sync: {pullRequested: false}, diff --git a/dev-client/src/store/reducers.ts b/dev-client/src/store/reducers.ts index fb2077611..f5c8be7d0 100644 --- a/dev-client/src/store/reducers.ts +++ b/dev-client/src/store/reducers.ts @@ -29,7 +29,7 @@ import {reducer as mapReducer} from 'terraso-mobile-client/model/map/mapSlice'; import {reducer as preferencesReducer} from 'terraso-mobile-client/model/preferences/preferencesSlice'; import projectReducer from 'terraso-mobile-client/model/project/projectSlice'; import siteReducer from 'terraso-mobile-client/model/site/siteSlice'; -import soilIdReducer from 'terraso-mobile-client/model/soilId/soilIdSlice'; +import soilDataReducer from 'terraso-mobile-client/model/soilData/soilDataSlice'; import soilIdMatchReducer from 'terraso-mobile-client/model/soilIdMatch/soilIdMatchSlice'; import soilMetadataReducer from 'terraso-mobile-client/model/soilMetadata/soilMetadataSlice'; import syncReducer from 'terraso-mobile-client/model/sync/syncSlice'; @@ -41,7 +41,7 @@ const sliceReducers = { elevation: elevationReducer, site: siteReducer, project: projectReducer, - soilId: soilIdReducer, + soilData: soilDataReducer, soilMetadata: soilMetadataReducer, soilIdMatch: soilIdMatchReducer, sync: syncReducer, diff --git a/dev-client/src/store/selectors.ts b/dev-client/src/store/selectors.ts index a6f0dad17..2c478e002 100644 --- a/dev-client/src/store/selectors.ts +++ b/dev-client/src/store/selectors.ts @@ -47,7 +47,7 @@ import { DEFAULT_PROJECT_SETTINGS, DEFAULT_SOIL_DATA, DEPTH_INTERVAL_PRESETS, -} from 'terraso-mobile-client/model/soilId/soilDataConstants'; +} from 'terraso-mobile-client/model/soilData/soilDataConstants'; import { compareInterval, DepthInterval, @@ -56,7 +56,7 @@ import { overlaps, sameDepth, SoilData, -} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {type AppState} from 'terraso-mobile-client/store/index'; const useSelector = reduxUseSelector as TypedUseSelectorHook; @@ -256,7 +256,9 @@ const useProjectSoilSettingsBase = ( return undefined; } - return state.soilId.projectSettings[projectId] ?? DEFAULT_PROJECT_SETTINGS; + return ( + state.soilData.projectSettings[projectId] ?? DEFAULT_PROJECT_SETTINGS + ); }); return useMemo( @@ -283,7 +285,7 @@ export type AggregatedInterval = { }; export const selectSoilData = (siteId: string) => (state: AppState) => - state.soilId.soilData[siteId] ?? DEFAULT_SOIL_DATA; + state.soilData.soilData[siteId] ?? DEFAULT_SOIL_DATA; export const useSiteSoilIntervals = (siteId: string): AggregatedInterval[] => { const projectSettings = useSiteProjectSoilSettings(siteId); diff --git a/dev-client/src/store/sync/PullDispatcher.tsx b/dev-client/src/store/sync/PullDispatcher.tsx index 4cfd7b6df..7ef10f073 100644 --- a/dev-client/src/store/sync/PullDispatcher.tsx +++ b/dev-client/src/store/sync/PullDispatcher.tsx @@ -18,7 +18,7 @@ import {useEffect} from 'react'; import {useAppState} from 'terraso-mobile-client/hooks/appStateHooks'; -import {selectUnsyncedSiteIds} from 'terraso-mobile-client/model/soilId/soilIdSelectors'; +import {selectUnsyncedSiteIds} from 'terraso-mobile-client/model/soilData/soilDataSelectors'; import {selectPullRequested} from 'terraso-mobile-client/model/sync/syncSelectors'; import {setPullRequested} from 'terraso-mobile-client/model/sync/syncSlice'; import {useDispatch, useSelector} from 'terraso-mobile-client/store'; diff --git a/dev-client/src/store/sync/hooks/syncHooks.tsx b/dev-client/src/store/sync/hooks/syncHooks.tsx index 29863ec40..d0aff9ea5 100644 --- a/dev-client/src/store/sync/hooks/syncHooks.tsx +++ b/dev-client/src/store/sync/hooks/syncHooks.tsx @@ -20,12 +20,12 @@ import {useCallback, useRef} from 'react'; import {useDebounce} from 'use-debounce'; import {useIsOffline} from 'terraso-mobile-client/hooks/connectivityHooks'; -import {fetchSoilDataForUser} from 'terraso-mobile-client/model/soilId/soilIdGlobalReducer'; +import {fetchSoilDataForUser} from 'terraso-mobile-client/model/soilData/soilDataGlobalReducer'; import { selectSyncErrorSiteIds, selectUnsyncedSiteIds, -} from 'terraso-mobile-client/model/soilId/soilIdSelectors'; -import {pushSoilData} from 'terraso-mobile-client/model/soilId/soilIdSlice'; +} from 'terraso-mobile-client/model/soilData/soilDataSelectors'; +import {pushSoilData} from 'terraso-mobile-client/model/soilData/soilDataSlice'; import {useDispatch, useSelector} from 'terraso-mobile-client/store'; export const useIsLoggedIn = () => {