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