From 16d75a6a1b1420f0cae384c291c197dec9603c31 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 27 Dec 2024 14:12:41 +0100 Subject: [PATCH] ui: fix card creator visibility in grid, fix table exporter visiblility in grid --- .../AddCardSection/AddCardSection.tsx | 3 +- .../DashboardWidgetGrid.tsx | 82 ++++++++++++------- .../components/WidgetChart/WidgetChart.tsx | 1 + .../WidgetDatatable/WidgetDatatable.tsx | 27 ++++-- 4 files changed, 75 insertions(+), 38 deletions(-) diff --git a/frontend/app/components/Dashboard/components/AddCardSection/AddCardSection.tsx b/frontend/app/components/Dashboard/components/AddCardSection/AddCardSection.tsx index 42f597511..85bfc451e 100644 --- a/frontend/app/components/Dashboard/components/AddCardSection/AddCardSection.tsx +++ b/frontend/app/components/Dashboard/components/AddCardSection/AddCardSection.tsx @@ -213,7 +213,7 @@ function CategoryTab({ tab, inCards }: { tab: string; inCards?: boolean }) { } const AddCardSection = observer( - ({ inCards }: { inCards?: boolean }) => { + ({ inCards, handleOpenChange }: { inCards?: boolean, handleOpenChange?: (isOpen: boolean) => void }) => { const { showModal } = useModal(); const { metricStore, dashboardStore, projectsStore } = useStore(); const [tab, setTab] = React.useState('product_analytics'); @@ -238,6 +238,7 @@ const AddCardSection = observer( }, } ); + handleOpenChange?.(false); }; return (
{list?.map((item: any, index: any) => ( -
- - dashboard?.swapWidgetPosition(dragIndex, hoverIndex) - } - dashboardId={dashboardId} - siteId={siteId} - grid="other" - showMenu={true} - isSaved={true} - /> -
- } trigger={'click'}> - -
-
+ item={item} + index={index} + dashboard={dashboard} + dashboardId={dashboardId} + siteId={siteId} + /> ))}
)} @@ -73,4 +52,51 @@ function DashboardWidgetGrid(props: Props) { ); } +function GridItem({ item, index, dashboard, dashboardId, siteId }: any) { + const [popoverOpen, setPopoverOpen] = React.useState(false); + const handleOpenChange = (open: boolean) => { + setPopoverOpen(open); + }; + + return ( +
+ + dashboard?.swapWidgetPosition(dragIndex, hoverIndex) + } + dashboardId={dashboardId} + siteId={siteId} + grid="other" + showMenu={true} + isSaved={true} + /> +
+ } + trigger={'click'} + > + +
+
+ ) +} + + export default observer(DashboardWidgetGrid); diff --git a/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx b/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx index bdbb72999..d23b96585 100644 --- a/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx +++ b/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx @@ -522,6 +522,7 @@ function WidgetChart(props: Props) { {renderChart()} {showTable ? ( void; defaultOpen?: boolean; metric: { name: string; viewType: string }; + inBuilder?: boolean; } function WidgetDatatable(props: Props) { @@ -117,14 +118,20 @@ function WidgetDatatable(props: Props) { return (
{!isTableOnlyMode && ( -
- +
+ @@ -132,7 +139,7 @@ function WidgetDatatable(props: Props) {
)} - {(showTable || isTableOnlyMode) ? ( + {showTable || isTableOnlyMode ? (
- + {props.inBuilder ? ( + + ) : null} ) : null}