2023-07-27 22:20:22 +02:00
|
|
|
import { TooltipPopup, Icon, Text, Flexbox, Popup, Item, Button } from 'react-basics';
|
2023-02-10 12:26:57 +01:00
|
|
|
import Icons from 'components/icons';
|
2022-08-04 12:56:30 +02:00
|
|
|
import { saveDashboard } from 'store/dashboard';
|
2023-03-22 22:05:55 +01:00
|
|
|
import useMessages from 'hooks/useMessages';
|
2022-03-02 08:03:50 +01:00
|
|
|
|
2023-04-21 17:00:42 +02:00
|
|
|
export function DashboardSettingsButton() {
|
2023-03-22 22:05:55 +01:00
|
|
|
const { formatMessage, labels } = useMessages();
|
2022-03-02 08:03:50 +01:00
|
|
|
|
2023-07-27 22:20:22 +02:00
|
|
|
const handleToggleCharts = () => {
|
|
|
|
saveDashboard(state => ({ showCharts: !state.showCharts }));
|
|
|
|
};
|
2022-03-02 08:03:50 +01:00
|
|
|
|
2023-07-27 22:20:22 +02:00
|
|
|
const handleEdit = () => {
|
|
|
|
saveDashboard({ editing: true });
|
|
|
|
};
|
2022-03-02 08:03:50 +01:00
|
|
|
|
2022-12-27 01:57:59 +01:00
|
|
|
return (
|
2023-07-27 22:20:22 +02:00
|
|
|
<Flexbox gap={10}>
|
|
|
|
<TooltipPopup label={formatMessage(labels.toggleCharts)} position="bottom">
|
|
|
|
<Button onClick={handleToggleCharts}>
|
|
|
|
<Icon>
|
|
|
|
<Icons.BarChart />
|
|
|
|
</Icon>
|
|
|
|
</Button>
|
|
|
|
</TooltipPopup>
|
|
|
|
<Button onClick={handleEdit}>
|
2023-02-10 12:26:57 +01:00
|
|
|
<Icon>
|
|
|
|
<Icons.Edit />
|
|
|
|
</Icon>
|
|
|
|
<Text>{formatMessage(labels.edit)}</Text>
|
|
|
|
</Button>
|
2023-07-27 22:20:22 +02:00
|
|
|
</Flexbox>
|
2022-12-27 01:57:59 +01:00
|
|
|
);
|
2022-03-02 08:03:50 +01:00
|
|
|
}
|
2023-04-21 17:00:42 +02:00
|
|
|
|
|
|
|
export default DashboardSettingsButton;
|