diff --git a/package-lock.json b/package-lock.json index 7f19dd51..a047121a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "lodash": "^4.17.21", "react": "^18.2.0", "react-redux": "^8.1.3", - "terraso-backend": "github:techmatters/terraso-backend#ae60684", + "terraso-backend": "github:techmatters/terraso-backend#d50504f", "uuid": "^9.0.1" }, "devDependencies": { @@ -13882,7 +13882,7 @@ }, "node_modules/terraso-backend": { "version": "0.1.0", - "resolved": "git+ssh://git@github.com/techmatters/terraso-backend.git#ae6068499327c74e289114f32cf0a3480fa279c1" + "resolved": "git+ssh://git@github.com/techmatters/terraso-backend.git#d50504f0ae462f33de2407541cd5524eb4925136" }, "node_modules/test-exclude": { "version": "6.0.0", diff --git a/package.json b/package.json index b86d3e2d..8ea1334e 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "lodash": "^4.17.21", "react": "^18.2.0", "react-redux": "^8.1.3", - "terraso-backend": "github:techmatters/terraso-backend#ae60684", + "terraso-backend": "github:techmatters/terraso-backend#d50504f", "uuid": "^9.0.1" }, "scripts": { diff --git a/src/project/projectFragments.ts b/src/project/projectFragments.ts index f8622558..0200f3ce 100644 --- a/src/project/projectFragments.ts +++ b/src/project/projectFragments.ts @@ -44,6 +44,7 @@ export const projectData = /* GraphQL */ ` id name privacy + measurementUnits description siteInstructions updatedAt diff --git a/src/project/projectSlice.ts b/src/project/projectSlice.ts index 46be8d3a..4f9eff7a 100644 --- a/src/project/projectSlice.ts +++ b/src/project/projectSlice.ts @@ -23,6 +23,7 @@ import { } from 'terraso-client-shared/account/accountSlice'; import { ProjectAddUserMutationInput, + ProjectManagementProjectMeasurementUnitsChoices, ProjectManagementProjectPrivacyChoices, ProjectMembershipProjectRoleChoices, } from 'terraso-client-shared/graphqlSchema/graphql'; @@ -48,6 +49,12 @@ export const PROJECT_ROLES = [ 'VIEWER', ] as const satisfies readonly ProjectRole[]; +export type MeasurementUnit = ProjectManagementProjectMeasurementUnitsChoices; +export const MEASUREMENT_UNITS = [ + 'METRIC', + 'ENGLISH', +] as const satisfies readonly MeasurementUnit[]; + export type ProjectPrivacy = ProjectManagementProjectPrivacyChoices; export const PROJECT_PRIVACIES = [ 'PRIVATE', @@ -57,7 +64,8 @@ export const PROJECT_PRIVACIES = [ export type Project = { id: string; name: string; - privacy: 'PRIVATE' | 'PUBLIC'; + privacy: ProjectPrivacy; + measurementUnits: MeasurementUnit; description: string; siteInstructions?: string; updatedAt: string; // this should be Date.toLocaleDateString; redux can't serialize Dates diff --git a/src/selectors.test.ts b/src/selectors.test.ts index c528e526..d92d48b8 100644 --- a/src/selectors.test.ts +++ b/src/selectors.test.ts @@ -83,6 +83,7 @@ const generateProject = ( return { id, name: id, + measurementUnits: 'METRIC', privacy: privacy ?? 'PRIVATE', description: '', updatedAt: '2023-10-12', @@ -149,7 +150,6 @@ const createProjectSettings = ( depthIntervals: [], electricalConductivityRequired: false, landUseLandCoverRequired: false, - measurementUnits: 'METRIC', notesRequired: false, phRequired: false, photosRequired: false, diff --git a/src/soilId/soilIdFragments.ts b/src/soilId/soilIdFragments.ts index 3537924d..82038c75 100644 --- a/src/soilId/soilIdFragments.ts +++ b/src/soilId/soilIdFragments.ts @@ -24,7 +24,6 @@ export const projectSoilSettings = /* GraphQL */ ` } label } - measurementUnits depthIntervalPreset soilPitRequired slopeRequired diff --git a/src/soilId/soilIdTypes.ts b/src/soilId/soilIdTypes.ts index 17b1ffca..e194620b 100644 --- a/src/soilId/soilIdTypes.ts +++ b/src/soilId/soilIdTypes.ts @@ -25,7 +25,6 @@ import type { SoilIdDepthDependentSoilDataRockFragmentVolumeChoices, SoilIdDepthDependentSoilDataTextureChoices, SoilIdProjectSoilSettingsDepthIntervalPresetChoices, - SoilIdProjectSoilSettingsMeasurementUnitsChoices, SoilIdSoilDataSurfaceCracksSelectChoices, } from 'terraso-client-shared/graphqlSchema/graphql'; @@ -52,12 +51,6 @@ export const collectionMethods = [ export type SoilPitMethod = (typeof soilPitMethods)[number]; export type CollectionMethod = (typeof collectionMethods)[number]; -export type MeasurementUnit = SoilIdProjectSoilSettingsMeasurementUnitsChoices; -export const MEASUREMENT_UNITS = [ - 'METRIC', - 'IMPERIAL', -] as const satisfies readonly MeasurementUnit[]; - export { DepthInterval }; export type LabelledDepthInterval = { label: string;