2022-03-02 08:03:50 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
import MenuButton from 'components/common/MenuButton';
|
|
|
|
import Gear from 'assets/gear.svg';
|
2022-07-24 08:04:07 +02:00
|
|
|
import useStore, { setDashboard } from 'store/app';
|
2022-03-02 08:03:50 +01:00
|
|
|
|
|
|
|
const selector = state => state.dashboard;
|
|
|
|
|
|
|
|
export default function DashboardSettingsButton() {
|
|
|
|
const settings = useStore(selector);
|
|
|
|
|
|
|
|
const menuOptions = [
|
|
|
|
{
|
|
|
|
label: <FormattedMessage id="message.toggle-charts" defaultMessage="Toggle charts" />,
|
|
|
|
value: 'charts',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
function handleSelect(value) {
|
|
|
|
if (value === 'charts') {
|
2022-07-24 08:04:07 +02:00
|
|
|
setDashboard({ ...settings, showCharts: !settings.showCharts });
|
2022-03-02 08:03:50 +01:00
|
|
|
}
|
|
|
|
//setDashboard(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return <MenuButton icon={<Gear />} options={menuOptions} onSelect={handleSelect} hideLabel />;
|
|
|
|
}
|