diff --git a/package.json b/package.json index 13e43a8..6841752 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@fullcalendar/interaction": "5.10.0", "@fullcalendar/react": "5.10.0", "@fullcalendar/timegrid": "5.10.0", - "@kingsrook/qqq-frontend-core": "1.0.22", + "@kingsrook/qqq-frontend-core": "file:.yalc/@kingsrook/qqq-frontend-core", "@mui/icons-material": "5.4.1", "@mui/material": "5.4.1", "@mui/styled-engine": "5.4.1", diff --git a/src/qqq/components/DashboardWidgets.tsx b/src/qqq/components/DashboardWidgets.tsx index 8759781..7d19f6d 100644 --- a/src/qqq/components/DashboardWidgets.tsx +++ b/src/qqq/components/DashboardWidgets.tsx @@ -19,10 +19,14 @@ */ import {QInstance} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QInstance"; +import Card from "@mui/material/Card"; import Grid from "@mui/material/Grid"; +import parse from "html-react-parser"; import React, {useEffect, useState} from "react"; +import {useLocation} from "react-router-dom"; import MDBadgeDot from "qqq/components/Temporary/MDBadgeDot"; import MDBox from "qqq/components/Temporary/MDBox"; +import MDTypography from "qqq/components/Temporary/MDTypography"; import BarChart from "qqq/pages/dashboards/Widgets/BarChart"; import LineChart from "qqq/pages/dashboards/Widgets/LineChart"; import QuickSightChart from "qqq/pages/dashboards/Widgets/QuickSightChart"; @@ -44,6 +48,7 @@ DashboardWidgets.defaultProps = { function DashboardWidgets({widgetNameList, entityPrimaryKey}: Props): JSX.Element { + const location = useLocation(); const [qInstance, setQInstance] = useState(null as QInstance); const [widgets, setWidgets] = useState([] as any[]); const [widgetNames, setWidgetNames] = useState([] as any[]); @@ -77,7 +82,11 @@ function DashboardWidgets({widgetNameList, entityPrimaryKey}: Props): JSX.Elemen setWidgets(widgets); }, [qInstance, widgetNames]); - const widgetCount = widgets ? widgets.length : 0; + useEffect(() => + { + setWidgets([] as any[]); + setWidgetNames([] as any[]); + }, [location]); const handleDropdownOnChange = (value: string, index: number) => { @@ -87,8 +96,7 @@ function DashboardWidgets({widgetNameList, entityPrimaryKey}: Props): JSX.Elemen }, 1); }; - console.log(`primarkey ${entityPrimaryKey}`); - console.log(`widgets: ${JSON.stringify(widgets)}`); + const widgetCount = widgets ? widgets.length : 0; return ( widgetCount > 0 ? ( @@ -138,6 +146,22 @@ function DashboardWidgets({widgetNameList, entityPrimaryKey}: Props): JSX.Elemen ) } + { + widget.type === "html" && ( + + + + + {widget.title} + + + {parse(widget.html)} + + + + + ) + } { widget.type === "lineChart" && (