import React from 'react'; import BaseButton from '../BaseButton'; import BaseIcon from '../BaseIcon'; import * as icons from '@mdi/js'; import { useAppDispatch, useAppSelector } from '../../stores/hooks'; import { fetchWidgets, removeWidget } from '../../stores/roles/rolesSlice'; import { WidgetChartType, WidgetType } from "./models/widget.model"; import { BarChart } from "./components/BarChart"; import { PieChart } from "./components/PieChart"; import { AreaChart } from "./components/AreaChart"; import { LineChart } from "./components/LineChart"; export const SmartWidget = ({ widget, userId, admin, roleId }) => { const dispatch = useAppDispatch(); const corners = useAppSelector((state) => state.style.corners); const cardsStyle = useAppSelector((state) => state.style.cardsStyle); const deleteWidget = async () => { await dispatch( removeWidget({ id: userId, widgetId: widget.widget_id, roleId }), ); await dispatch(fetchWidgets(roleId)); }; return (