Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove country form, update map #1164

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.5",
"@graasp/chatbox": "3.1.0",
"@graasp/map": "1.9.0",
"@graasp/map": "1.10.0",
"@graasp/query-client": "3.4.1",
"@graasp/sdk": "4.7.2",
"@graasp/translations": "1.26.0",
Expand Down
16 changes: 3 additions & 13 deletions src/components/item/settings/GeolocationModalButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import Dialog from '@mui/material/Dialog';
import DialogTitle from '@mui/material/DialogTitle';

import { CountryForm } from '@graasp/map';
import { DiscriminatedItem } from '@graasp/sdk';
import { COMMON } from '@graasp/translations';
import { Button } from '@graasp/ui';
Expand All @@ -35,7 +34,6 @@ export const GeolocationModalButton = ({ item }: Props): JSX.Element => {
const addressLabelRef = useRef<HTMLInputElement>(null);
const latRef = useRef<HTMLInputElement>(null);
const lngRef = useRef<HTMLInputElement>(null);
const [country, setCountry] = useState<string>();

const handleClickOpen = () => {
setOpen(true);
Expand Down Expand Up @@ -64,7 +62,9 @@ export const GeolocationModalButton = ({ item }: Props): JSX.Element => {
geolocation: {
helperLabel: helperLabelRef.current?.value ?? geoloc?.helperLabel,
addressLabel: addressLabelRef.current?.value ?? geoloc?.addressLabel,
country: country ?? geoloc?.country,
// country is sent, but actually not used in the backend
// it is because the backend compute automatically the country given lat and lng to prevent mismatch
// country: country ?? geoloc?.country,
lat: +lat,
lng: +lng,
},
Expand Down Expand Up @@ -136,16 +136,6 @@ export const GeolocationModalButton = ({ item }: Props): JSX.Element => {
type="text"
/>
</Stack>
<Stack>
<CountryForm
label={t(BUILDER.ITEM_GEOLOCATION_ADVANCED_MODAL_COUNTRY_LABEL)}
initialValue={geoloc?.country ?? undefined}
onChange={(e) => {
// eslint-disable-next-line no-console
setCountry(e.alpha2);
}}
/>
</Stack>
</Stack>
</DialogContent>
<DialogActions>
Expand Down
2 changes: 1 addition & 1 deletion src/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,6 @@
"ITEM_GEOLOCATION_ADVANCED_MODAL_ADDRESS_LABEL": "Address",
"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_COUNTRY_LABEL": "Country (ie: CH, FR...)",
"ITEM_GEOLOCATION_ADVANCED_MODAL_ERROR": "Latitude and longitude have to be defined"
}
2 changes: 1 addition & 1 deletion src/langs/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,6 @@
"ITEM_GEOLOCATION_ADVANCED_MODAL_ADDRESS_LABEL": "Adresse",
"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_COUNTRY_LABEL": "Pays (ex: CH, FR...)",
"ITEM_GEOLOCATION_ADVANCED_MODAL_ERROR": "La latitude et longitude doivent être définies"
}
27 changes: 22 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1472,9 +1472,9 @@ __metadata:
languageName: node
linkType: hard

"@graasp/map@npm:1.9.0":
version: 1.9.0
resolution: "@graasp/map@npm:1.9.0"
"@graasp/map@npm:1.10.0":
version: 1.10.0
resolution: "@graasp/map@npm:1.10.0"
dependencies:
"@emotion/react": "npm:11.11.4"
"@emotion/styled": "npm:11.11.5"
Expand All @@ -1484,6 +1484,7 @@ __metadata:
"@mui/icons-material": "npm:5.15.15"
"@mui/lab": "npm:5.0.0-alpha.170"
"@mui/material": "npm:5.15.15"
i18n-iso-countries: "npm:7.11.0"
leaflet: "npm:^1.9.4"
leaflet-easybutton: "npm:2.4.0"
leaflet-geosearch: "npm:3.11.1"
Expand All @@ -1508,7 +1509,7 @@ __metadata:
react: "*"
react-dom: "*"
react-i18next: ^14.0.0
checksum: 10/655783fc0b378f327a366b1e9d12ca3965fbf5bfc0dea2926162083b8ec570171d0630f225b8a23f552195849229f6b36c0f27d174bb1e2168e1f45da81c580e
checksum: 10/dceb9733555e3c2f9213cf9ee5caa9aa2ed83ff42c8fb3c9d2b165ce94131bd828a877f70c9af869e6955bf8db93bd65c0877d5d5d72a52f1713d30125e55cb7
languageName: node
linkType: hard

Expand Down Expand Up @@ -5627,6 +5628,13 @@ __metadata:
languageName: node
linkType: hard

"diacritics@npm:1.3.0":
version: 1.3.0
resolution: "diacritics@npm:1.3.0"
checksum: 10/c5a7d6843a3569f1c5aaf643d2e01aaaf695dd369d0f7868300a1c637b91157fe89cf78aa2e87224042d7f4fc87ab39d20aadb7e006c25e0a7c6a2ef92972e74
languageName: node
linkType: hard

"diff-sequences@npm:^29.6.3":
version: 29.6.3
resolution: "diff-sequences@npm:29.6.3"
Expand Down Expand Up @@ -7424,7 +7432,7 @@ __metadata:
"@emotion/react": "npm:11.11.4"
"@emotion/styled": "npm:11.11.5"
"@graasp/chatbox": "npm:3.1.0"
"@graasp/map": "npm:1.9.0"
"@graasp/map": "npm:1.10.0"
"@graasp/query-client": "npm:3.4.1"
"@graasp/sdk": "npm:4.7.2"
"@graasp/translations": "npm:1.26.0"
Expand Down Expand Up @@ -7783,6 +7791,15 @@ __metadata:
languageName: node
linkType: hard

"i18n-iso-countries@npm:7.11.0":
version: 7.11.0
resolution: "i18n-iso-countries@npm:7.11.0"
dependencies:
diacritics: "npm:1.3.0"
checksum: 10/30f5ab51b58599854130f41d42bd51aa99027917711cd307984dee45684c2c4c3493ff39241ed5b89feca1d49d5e3f9b247f6b2c32c8768224b7975149eaa049
languageName: node
linkType: hard

"i18next@npm:23.11.2":
version: 23.11.2
resolution: "i18next@npm:23.11.2"
Expand Down