mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
28 lines
784 B
JavaScript
28 lines
784 B
JavaScript
import React from 'react';
|
|
import { FormattedMessage } from 'react-intl';
|
|
import MenuButton from 'components/common/MenuButton';
|
|
import Gear from 'assets/gear.svg';
|
|
import useStore, { setDashboard } from 'store/app';
|
|
|
|
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') {
|
|
setDashboard({ ...settings, showCharts: !settings.showCharts });
|
|
}
|
|
//setDashboard(value);
|
|
}
|
|
|
|
return <MenuButton icon={<Gear />} options={menuOptions} onSelect={handleSelect} hideLabel />;
|
|
}
|