mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-01 20:39:44 +01:00
37 lines
986 B
JavaScript
37 lines
986 B
JavaScript
import { TooltipPopup, Icon, Text, Flexbox, Popup, Item, Button } from 'react-basics';
|
|
import Icons from 'components/icons';
|
|
import { saveDashboard } from 'store/dashboard';
|
|
import useMessages from 'hooks/useMessages';
|
|
|
|
export function DashboardSettingsButton() {
|
|
const { formatMessage, labels } = useMessages();
|
|
|
|
const handleToggleCharts = () => {
|
|
saveDashboard(state => ({ showCharts: !state.showCharts }));
|
|
};
|
|
|
|
const handleEdit = () => {
|
|
saveDashboard({ editing: true });
|
|
};
|
|
|
|
return (
|
|
<Flexbox gap={10}>
|
|
<TooltipPopup label={formatMessage(labels.toggleCharts)} position="bottom">
|
|
<Button onClick={handleToggleCharts}>
|
|
<Icon>
|
|
<Icons.BarChart />
|
|
</Icon>
|
|
</Button>
|
|
</TooltipPopup>
|
|
<Button onClick={handleEdit}>
|
|
<Icon>
|
|
<Icons.Edit />
|
|
</Icon>
|
|
<Text>{formatMessage(labels.edit)}</Text>
|
|
</Button>
|
|
</Flexbox>
|
|
);
|
|
}
|
|
|
|
export default DashboardSettingsButton;
|