Skip to content

Commit

Permalink
fix: move measurement units to right model (d'oh!) (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouxm authored Mar 28, 2024
1 parent 33509bf commit 40ae7e2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 1 addition & 0 deletions src/project/projectFragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const projectData = /* GraphQL */ `
id
name
privacy
measurementUnits
description
siteInstructions
updatedAt
Expand Down
10 changes: 9 additions & 1 deletion src/project/projectSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from 'terraso-client-shared/account/accountSlice';
import {
ProjectAddUserMutationInput,
ProjectManagementProjectMeasurementUnitsChoices,
ProjectManagementProjectPrivacyChoices,
ProjectMembershipProjectRoleChoices,
} from 'terraso-client-shared/graphqlSchema/graphql';
Expand All @@ -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',
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/selectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const generateProject = (
return {
id,
name: id,
measurementUnits: 'METRIC',
privacy: privacy ?? 'PRIVATE',
description: '',
updatedAt: '2023-10-12',
Expand Down Expand Up @@ -149,7 +150,6 @@ const createProjectSettings = (
depthIntervals: [],
electricalConductivityRequired: false,
landUseLandCoverRequired: false,
measurementUnits: 'METRIC',
notesRequired: false,
phRequired: false,
photosRequired: false,
Expand Down
1 change: 0 additions & 1 deletion src/soilId/soilIdFragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const projectSoilSettings = /* GraphQL */ `
}
label
}
measurementUnits
depthIntervalPreset
soilPitRequired
slopeRequired
Expand Down
7 changes: 0 additions & 7 deletions src/soilId/soilIdTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import type {
SoilIdDepthDependentSoilDataRockFragmentVolumeChoices,
SoilIdDepthDependentSoilDataTextureChoices,
SoilIdProjectSoilSettingsDepthIntervalPresetChoices,
SoilIdProjectSoilSettingsMeasurementUnitsChoices,
SoilIdSoilDataSurfaceCracksSelectChoices,
} from 'terraso-client-shared/graphqlSchema/graphql';

Expand All @@ -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;
Expand Down

0 comments on commit 40ae7e2

Please sign in to comment.