Skip to content

Commit

Permalink
basemap styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mluena committed May 6, 2024
1 parent 02a3c06 commit 61e77b8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions client/src/constants/basemaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export const BASEMAPS = [
export const LABELS = [
{
label: 'Dark labels',
slug: 'dark',
slug: 'labels-dark',
},
{
label: 'Light labels',
slug: 'light',
slug: 'labels-light',
},
{
label: 'No labels',
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/countries/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function CountryItem({ data }: { data: CountryListResponseDataIte
);

const handleClick = useCallback(() => {
push(`/countries/${data.id}${queryParams}`);
push(`/countries/${data.id}${queryParams}&bbox=${data.attributes?.bbox}`);
setTempBbox(data.attributes?.bbox as Bbox);
}, [data, push, queryParams, setTempBbox]);

Expand Down
1 change: 0 additions & 1 deletion client/src/containers/map/settings/boundaries/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Switch } from '@/components/ui/switch';
const Boundaries = () => {
const [mapSettings, setMapSettings] = useSyncBasemap();
const { boundaries } = mapSettings || null;

const handleChange = useCallback(
(v: boolean) => {
setMapSettings((prev) => ({
Expand Down
10 changes: 8 additions & 2 deletions client/src/containers/map/settings/manager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ const MapSettingsManager = () => {
...metadata['mapbox:groups'][gId],
id: gId,
}));
const GROUP_TO_DISPLAY = GROUPS_META.find((_group) => _group.name.includes(groupId)) || {};

const GROUPS_TO_DISPLAY =
GROUPS_META.filter((_group) => {
return _group.name.includes(groupId);
}) || {};

const GROUPS_LAYERS = lys.filter((l) => {
const { metadata: layerMetadata } = l;
Expand All @@ -50,7 +54,9 @@ const MapSettingsManager = () => {
});

GROUPS_LAYERS.forEach((_layer) => {
const match = _layer.metadata['mapbox:group'] === GROUP_TO_DISPLAY.id && visible;
const match =
GROUPS_TO_DISPLAY.map(({ id }) => id).includes(_layer.metadata['mapbox:group']) &&
visible;
if (!match) {
map.setLayoutProperty(_layer.id, 'visibility', 'none');
} else {
Expand Down
2 changes: 1 addition & 1 deletion client/src/hooks/datasets/query-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const layersParser = parseAsJson<LayerSettings[]>().withDefault([

export const basemapSettingsParser = parseAsJson<MapSettings>().withDefault({
basemap: 'basemap-light',
labels: 'dark',
labels: 'labels-dark',
boundaries: true,
roads: false,
});
Expand Down

0 comments on commit 61e77b8

Please sign in to comment.