From 07b71afa832544d079de5338db6dcb8e4f016480 Mon Sep 17 00:00:00 2001 From: Tim Chamberlain Date: Tue, 21 Feb 2023 15:20:58 -0600 Subject: [PATCH] SPRINT-21: added minheights to widgets for stability, attempt to stop multiple requests (again) --- .../components/widgets/DashboardWidgets.tsx | 27 +++++++++---------- .../widgets/charts/piechart/PieChart.tsx | 2 +- .../widgets/statistics/StatisticsCard.tsx | 8 ++++-- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/qqq/components/widgets/DashboardWidgets.tsx b/src/qqq/components/widgets/DashboardWidgets.tsx index 6faf189..94ce913 100644 --- a/src/qqq/components/widgets/DashboardWidgets.tsx +++ b/src/qqq/components/widgets/DashboardWidgets.tsx @@ -174,7 +174,8 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, omit widgetIndex={i} widgetMetaData={widgetMetaData} data={widgetData[i]} - reloadWidgetCallback={reloadWidget} + reloadWidgetCallback={() => + {}} storeDropdownSelections={widgetMetaData.storeDropdownSelections} /> ) @@ -271,20 +272,18 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, omit } { widgetMetaData.type === "statistics" && ( - widgetData && widgetData[i] && ( - reloadWidget(i, data)} - > - - - ) + // reloadWidgetCallback={(data) => reloadWidget(i, data)} + > + + ) } { diff --git a/src/qqq/components/widgets/charts/piechart/PieChart.tsx b/src/qqq/components/widgets/charts/piechart/PieChart.tsx index f97647e..877749a 100644 --- a/src/qqq/components/widgets/charts/piechart/PieChart.tsx +++ b/src/qqq/components/widgets/charts/piechart/PieChart.tsx @@ -85,7 +85,7 @@ function PieChart({description, chartData}: Props): JSX.Element } return ( - + diff --git a/src/qqq/components/widgets/statistics/StatisticsCard.tsx b/src/qqq/components/widgets/statistics/StatisticsCard.tsx index 8a02038..ac728dd 100644 --- a/src/qqq/components/widgets/statistics/StatisticsCard.tsx +++ b/src/qqq/components/widgets/statistics/StatisticsCard.tsx @@ -55,6 +55,10 @@ StatisticsCard.defaultProps = { function StatisticsCard({data, increaseIsGood}: Props): JSX.Element { + if(! data) + { + return null; + } const {count, percentageAmount, percentageLabel} = data; let percentageString = ""; @@ -82,7 +86,7 @@ function StatisticsCard({data, increaseIsGood}: Props): JSX.Element return ( - + { count !== undefined ? ( @@ -96,7 +100,7 @@ function StatisticsCard({data, increaseIsGood}: Props): JSX.Element } ) : ( - + ) }