Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
fix: geoloc modal (#1156)
Browse files Browse the repository at this point in the history
* fix: geoloc modal cancel button closes, add required fields

* refactor: update dependencies
  • Loading branch information
pyphilia authored Apr 17, 2024
1 parent fc1daa1 commit 2216ac1
Show file tree
Hide file tree
Showing 6 changed files with 607 additions and 619 deletions.
56 changes: 30 additions & 26 deletions cypress/fixtures/members.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { CompleteMember, MemberType } from '@graasp/sdk';
import { CompleteMember, MemberFactory, MemberType } from '@graasp/sdk';

import { MemberForTest } from '../support/types';
import { AVATAR_LINK } from './thumbnails/links';

export const SIGNED_OUT_MEMBER: CompleteMember | null = null;

export const MEMBERS: Record<string, MemberForTest> = {
ANNA: {
ANNA: MemberFactory({
id: 'ecafbd2a-5642-31fb-ae93-0242ac130002',
name: 'anna',
type: MemberType.Individual,
Expand All @@ -16,67 +16,71 @@ export const MEMBERS: Record<string, MemberForTest> = {
extra: {
lang: 'fr',
emailFreq: 'never',
enableSaveActions: false,
},
},
}),
BOB: {
id: 'ecafbd2a-5642-31fb-ae93-0242ac130004',
name: 'bob',
type: MemberType.Individual,
email: 'bob@email.com',
createdAt: '2021-04-13 14:56:34.749946',
updatedAt: '2021-04-13 14:56:34.749946',
extra: { lang: 'en' },
...MemberFactory({
id: 'ecafbd2a-5642-31fb-ae93-0242ac130004',
name: 'bob',
type: MemberType.Individual,
email: 'bob@email.com',
createdAt: '2021-04-13 14:56:34.749946',
updatedAt: '2021-04-13 14:56:34.749946',
extra: { lang: 'en' },
}),
// this only exists for test
thumbnails: AVATAR_LINK,
},
CEDRIC: {
id: 'ecafbd2a-5642-31fb-ae93-0242ac130006',
name: 'cedric',
type: MemberType.Individual,
extra: {},
email: 'cedric@email.com',
createdAt: '2021-04-13 14:56:34.749946',
updatedAt: '2021-04-13 14:56:34.749946',
...MemberFactory({
id: 'ecafbd2a-5642-31fb-ae93-0242ac130006',
name: 'cedric',
type: MemberType.Individual,
extra: {},
email: 'cedric@email.com',
createdAt: '2021-04-13 14:56:34.749946',
updatedAt: '2021-04-13 14:56:34.749946',
}),

// this only exists for test
thumbnails: AVATAR_LINK,
},
DAVID: {
DAVID: MemberFactory({
id: 'ecafbd2a-5642-31fb-ae93-0242ac130062',
name: 'david',
type: MemberType.Individual,
email: 'david@email.com',
createdAt: '2021-04-13 14:56:34.749946',
updatedAt: '2021-04-13 14:56:34.749946',
extra: { lang: 'en' },
},
EVAN: {
}),
EVAN: MemberFactory({
id: 'ecafbd2a-5642-31fb-ae93-0242ac130022',
name: 'evan',
type: MemberType.Individual,
email: 'evan@email.com',
createdAt: '2021-04-13 14:56:34.749946',
updatedAt: '2021-04-13 14:56:34.749946',
extra: { lang: 'en' },
},
FANNY: {
}),
FANNY: MemberFactory({
id: 'ecafbd2a-5642-31fb-ae93-0242ac130012',
name: 'fanny',
extra: {},
type: MemberType.Individual,
email: 'fanny@email.com',
createdAt: '2021-04-13 14:56:34.749946',
updatedAt: '2021-04-13 14:56:34.749946',
},
GARRY: {
}),
GARRY: MemberFactory({
id: 'ecafbd2a-5642-31fb-ae93-0242ac130412',
name: 'garry',
extra: {},
type: MemberType.Individual,
email: 'garry@email.com',
createdAt: '2021-04-13 14:56:34.749946',
updatedAt: '2021-04-13 14:56:34.749946',
},
}),
};

export const CURRENT_USER = MEMBERS.ANNA;
Expand Down
66 changes: 33 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@
"@ag-grid-community/styles": "31.1.1",
"@emotion/cache": "11.11.0",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.0",
"@emotion/styled": "11.11.5",
"@graasp/chatbox": "3.1.0",
"@graasp/map": "1.8.0",
"@graasp/query-client": "3.3.0",
"@graasp/sdk": "4.6.0",
"@graasp/translations": "1.25.3",
"@graasp/ui": "4.14.2",
"@mui/icons-material": "5.15.11",
"@mui/lab": "5.0.0-alpha.166",
"@mui/material": "5.15.11",
"@sentry/react": "7.108.0",
"@uppy/core": "3.9.3",
"@uppy/dashboard": "3.7.5",
"@uppy/drag-drop": "3.0.2",
"@uppy/file-input": "3.1.0",
"@uppy/progress-bar": "3.1.0",
"@uppy/react": "3.2.2",
"@uppy/status-bar": "3.3.0",
"@uppy/tus": "3.5.3",
"@graasp/map": "1.9.0",
"@graasp/query-client": "3.4.1",
"@graasp/sdk": "4.7.2",
"@graasp/translations": "1.26.0",
"@graasp/ui": "4.15.0",
"@mui/icons-material": "5.15.15",
"@mui/lab": "5.0.0-alpha.170",
"@mui/material": "5.15.15",
"@sentry/react": "7.110.1",
"@uppy/core": "3.10.1",
"@uppy/dashboard": "3.8.1",
"@uppy/drag-drop": "3.1.0",
"@uppy/file-input": "3.1.1",
"@uppy/progress-bar": "3.1.1",
"@uppy/react": "3.3.0",
"@uppy/status-bar": "3.3.1",
"@uppy/tus": "3.5.4",
"@uppy/xhr-upload": "3.6.4",
"axios": "1.6.8",
"date-fns": "3.6.0",
"filesize": "10.1.1",
"http-status-codes": "2.3.0",
"i18next": "23.10.1",
"i18next": "23.11.2",
"katex": "0.16.10",
"leaflet-geosearch": "3.11.1",
"lodash.debounce": "4.0.8",
Expand Down Expand Up @@ -109,11 +109,11 @@
]
},
"devDependencies": {
"@commitlint/cli": "19.2.1",
"@commitlint/config-conventional": "19.1.0",
"@cypress/code-coverage": "3.12.26",
"@commitlint/cli": "19.2.2",
"@commitlint/config-conventional": "19.2.2",
"@cypress/code-coverage": "3.12.35",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/react": "^15.0.2",
"@testing-library/user-event": "^14.5.2",
"@trivago/prettier-plugin-sort-imports": "4.3.0",
"@types/jest": "29.5.12",
Expand All @@ -122,19 +122,19 @@
"@types/lodash.isequal": "4.5.8",
"@types/lodash.partition": "4.6.9",
"@types/lodash.truncate": "4.4.9",
"@types/node": "20.11.23",
"@types/node": "20.12.7",
"@types/papaparse": "5.3.14",
"@types/react": "18.2.61",
"@types/react": "18.2.79",
"@types/react-csv": "1.1.10",
"@types/react-dom": "18.2.19",
"@types/react-helmet": "^6",
"@types/react-dom": "18.2.25",
"@types/react-helmet": "^6.1.11",
"@types/uuid": "9.0.8",
"@types/validator": "13.11.9",
"@typescript-eslint/eslint-plugin": "7.4.0",
"@typescript-eslint/parser": "7.4.0",
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
"@vitejs/plugin-react": "4.2.1",
"concurrently": "8.2.2",
"cypress": "13.7.0",
"cypress": "13.7.3",
"cypress-localstorage-commands": "2.2.5",
"env-cmd": "10.1.0",
"eslint": "^8.57.0",
Expand All @@ -148,11 +148,11 @@
"husky": "9.0.11",
"nyc": "15.1.0",
"prettier": "3.2.5",
"typescript": "5.4.3",
"vite": "5.2.6",
"typescript": "5.4.5",
"vite": "5.2.9",
"vite-plugin-checker": "0.6.4",
"vite-plugin-istanbul": "6.0.0",
"vitest": "1.4.0"
"vitest": "1.5.0"
},
"packageManager": "yarn@4.1.1"
}
8 changes: 7 additions & 1 deletion src/components/item/settings/GeolocationModalButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const GeolocationModalButton = ({ item }: Props): JSX.Element => {
BUILDER.ITEM_GEOLOCATION_ADVANCED_MODAL_LATITUDE_LABEL,
)}
type="number"
required
/>
</Stack>
<Stack flexGrow={1}>
Expand All @@ -108,6 +109,7 @@ export const GeolocationModalButton = ({ item }: Props): JSX.Element => {
BUILDER.ITEM_GEOLOCATION_ADVANCED_MODAL_LONGITUDE_LABEL,
)}
type="number"
required
/>
</Stack>
</Stack>
Expand All @@ -116,6 +118,7 @@ export const GeolocationModalButton = ({ item }: Props): JSX.Element => {
inputRef={addressLabelRef}
label={t(BUILDER.ITEM_GEOLOCATION_ADVANCED_MODAL_ADDRESS_LABEL)}
multiline
type="text"
defaultValue={geoloc?.addressLabel ?? undefined}
/>
</Stack>
Expand All @@ -130,6 +133,7 @@ export const GeolocationModalButton = ({ item }: Props): JSX.Element => {
placeholder={t(
BUILDER.ITEM_GEOLOCATION_ADVANCED_MODAL_SECONDARY_ADDRESS_PLACEHOLDER,
)}
type="text"
/>
</Stack>
<Stack>
Expand All @@ -145,7 +149,9 @@ export const GeolocationModalButton = ({ item }: Props): JSX.Element => {
</Stack>
</DialogContent>
<DialogActions>
<Button variant="text">{commonT(COMMON.CANCEL_BUTTON)}</Button>
<Button onClick={handleClose} variant="text">
{commonT(COMMON.CANCEL_BUTTON)}
</Button>
<Button onClick={onSave}>{commonT(COMMON.SAVE_BUTTON)}</Button>
</DialogActions>
</Dialog>
Expand Down
2 changes: 1 addition & 1 deletion src/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
"ITEM_GEOLOCATION_ADVANCED_MODAL_LATITUDE_LABEL": "Latitude",
"ITEM_GEOLOCATION_ADVANCED_MODAL_LONGITUDE_LABEL": "Longitude",
"ITEM_GEOLOCATION_ADVANCED_MODAL_ADDRESS_LABEL": "Address",
"ITEM_GEOLOCATION_ADVANCED_MODAL_SECONDARY_ADDRESS_LABEL": "Complementary information (optional)",
"ITEM_GEOLOCATION_ADVANCED_MODAL_SECONDARY_ADDRESS_LABEL": "Complementary information",
"ITEM_GEOLOCATION_ADVANCED_MODAL_SECONDARY_ADDRESS_PLACEHOLDER": "red door on the right, ...",
"ITEM_GEOLOCATION_ADVANCED_MODAL_COUNTRY_LABEL": "Country",
"ITEM_GEOLOCATION_ADVANCED_MODAL_ERROR": "Latitude and longitude have to be defined"
Expand Down
2 changes: 1 addition & 1 deletion src/langs/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
"ITEM_GEOLOCATION_ADVANCED_MODAL_LATITUDE_LABEL": "Latitude",
"ITEM_GEOLOCATION_ADVANCED_MODAL_LONGITUDE_LABEL": "Longitude",
"ITEM_GEOLOCATION_ADVANCED_MODAL_ADDRESS_LABEL": "Adresse",
"ITEM_GEOLOCATION_ADVANCED_MODAL_SECONDARY_ADDRESS_LABEL": "Informations complémentaires (optionel)",
"ITEM_GEOLOCATION_ADVANCED_MODAL_SECONDARY_ADDRESS_LABEL": "Informations complémentaires",
"ITEM_GEOLOCATION_ADVANCED_MODAL_SECONDARY_ADDRESS_PLACEHOLDER": "porte rouge sur la droite, ...",
"ITEM_GEOLOCATION_ADVANCED_MODAL_COUNTRY_LABEL": "Pays",
"ITEM_GEOLOCATION_ADVANCED_MODAL_ERROR": "La latitude et longitude doivent être définies"
Expand Down
Loading

0 comments on commit 2216ac1

Please sign in to comment.