-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add marker clustering setting (#13)
closes #10
- Loading branch information
Showing
8 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
frontend/src/components/Settings/Settings/MapOptions/MapMarkerClustering.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Grid, Slider } from "@mantine/core"; | ||
import OpacityIcon from '@mui/icons-material/Opacity'; | ||
import { useAppDispatch, useAppSelector } from "../../../../hooks/useInitStore"; | ||
import { setMarkerClustering } from "../../../../store/mapOptions/mapOptionsReducer"; | ||
import { selectMarkerClustering } from "../../../../store/mapOptions/mapOptionsSelector"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
export function MapMarkerClustering() { | ||
const { t } = useTranslation('common'); | ||
const dispatch = useAppDispatch(); | ||
const markerClustering = useAppSelector(selectMarkerClustering); | ||
|
||
function onClusteringChange(value: number) { | ||
dispatch(setMarkerClustering(value)); | ||
} | ||
|
||
return ( | ||
<Grid className="mt-2"> | ||
<Grid.Col span={12}> | ||
<h3 className="text-base font-semibold leading-7"> | ||
<OpacityIcon className="inline-block mr-2" /> | ||
{ t('settings.markersClustering') } | ||
</h3> | ||
</Grid.Col> | ||
<Grid.Col span={12} className="mt-4"> | ||
<Slider | ||
label={(value) => `zoom: ${value}`} | ||
step={1} | ||
min={10} | ||
max={18} | ||
defaultValue={markerClustering} | ||
thumbLabel={t('settings.mapMarkersClustering')} | ||
onChangeEnd={onClusteringChange} | ||
marks={[ | ||
{ value: 10, label: '10' }, | ||
{ value: 14, label: `14 (${t('extra.default')})` }, | ||
{ value: 18, label: '18' }, | ||
]}/> | ||
</Grid.Col> | ||
</Grid> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters