Skip to content

Commit

Permalink
feat: mark rmm tokens option as in progress work
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic-maury committed Nov 17, 2024
1 parent c2d6b02 commit 7dee7d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import MapIcon from '@mui/icons-material/Map';
import EngineeringIcon from '@mui/icons-material/Engineering';
import { useAppDispatch, useAppSelector } from "../../../../hooks/useInitStore";
import { Option } from "../Option";
import { setDifferentiateOwned, setDisplayAll, setDisplayGnosis, setDisplayRmm } from "../../../../store/mapOptions/mapOptionsReducer";
Expand All @@ -9,11 +10,14 @@ import { selectWalletAddresses } from "../../../../store/settings/settingsSelect
import { MapMarkerOpacity } from "./MapMarkerOpacity";
import { MapMarkerClustering } from "./MapMarkerClustering";
import { analyticsEvent } from "../../../../services/analytics";
import { CheckboxProps } from "@mantine/core";

export function MapOptions() {
const { t } = useTranslation('common', { keyPrefix: 'mapOptions' });
const dispatch = useAppDispatch();

const rmmDisabled = true;

const mapOptions = useAppSelector((state) => state.mapOptions);
const walletAddresses = useAppSelector(selectWalletAddresses);

Expand All @@ -25,6 +29,9 @@ export function MapOptions() {
}, []);

function onDisplayRmm(toggle: boolean) {
if (rmmDisabled) {
return;
}
analyticsEvent({
category: 'Settings',
action: 'Display RMM',
Expand Down Expand Up @@ -60,13 +67,16 @@ export function MapOptions() {
dispatch(setDifferentiateOwned(toggle));
}

const ExpectedFeature: CheckboxProps['icon'] = ({ ...props }) => <EngineeringIcon {...props} />;

return (
<SettingsPanelSection icon={<MapIcon className="inline-block mr-2" />} label={t('mapOptions')}>
<Option
id="rmm"
label={t('displayRmm')}
checked={mapOptions.displayRmm}
disabled={walletAddresses.length === 0}
icon={ExpectedFeature}
checked={mapOptions.displayRmm || rmmDisabled}
disabled={walletAddresses.length === 0 || rmmDisabled}
onChange={(e) => onDisplayRmm(e)} />
<Option
id="gnosis"
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/Settings/Settings/Option.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { Checkbox, Grid, Tooltip } from "@mantine/core";
import { Checkbox, CheckboxProps, Grid, Tooltip } from "@mantine/core";

export function Option({
id,
label,
checked,
icon,
disabled = false,
onChange,
}: {
id: string,
label: string,
checked: boolean,
icon?: CheckboxProps['icon'],
disabled?: boolean,
onChange: (event: boolean) => void,
}) {
Expand All @@ -23,6 +25,7 @@ export function Option({
checked={checked}
disabled={disabled}
onChange={() => onChange(!checked)}
icon={icon}
id={id}
name={id}
/>
Expand Down

0 comments on commit 7dee7d5

Please sign in to comment.