From 4abed7321912e857cbfd552326fead048642dadd Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Wed, 26 Jun 2024 14:15:09 +0200 Subject: [PATCH] change(ui): examples --- .../Examples/SessionsBy/Component.tsx | 70 +++++++++++-------- .../NewDashModal/NewDashboardModal.tsx | 3 + .../DashboardList/NewDashModal/SelectCard.tsx | 13 ++-- .../components/WidgetForm/CardBuilder.tsx | 6 +- 4 files changed, 54 insertions(+), 38 deletions(-) diff --git a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/Examples/SessionsBy/Component.tsx b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/Examples/SessionsBy/Component.tsx index eda89c46f..2300ddeb2 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/Examples/SessionsBy/Component.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/Examples/SessionsBy/Component.tsx @@ -1,5 +1,6 @@ import ExCard from '../ExCard' import React from 'react' +import CardSessionsByList from "Components/Dashboard/Widgets/CardSessionsByList"; function ByComponent({title, rows, lineWidth, onCard, type}: { title: string @@ -13,6 +14,11 @@ function ByComponent({title, rows, lineWidth, onCard, type}: { type: string lineWidth: number }) { + const _rows = rows.map((r) => ({ + ...r, + name: r.label, + sessionCount: r.value, + })).slice(0, 4) return (
- {rows.map((r) => ( -
-
{r.icon}
-
{r.label}
-
-
-
-
-
{r.value}
-
- ))} + null}/> + + {/*{rows.map((r) => (*/} + {/* */} + {/*
{r.icon}
*/} + {/*
{r.label}
*/} + {/* */} + {/* */} + {/* */} + {/*
*/} + {/*
{r.value}
*/} + {/*
*/} + {/*))}*/}
) diff --git a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/NewDashboardModal.tsx b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/NewDashboardModal.tsx index ed17b8217..ae48e05af 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/NewDashboardModal.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/NewDashboardModal.tsx @@ -15,6 +15,7 @@ const NewDashboardModal: React.FC = ({ isAddingFromLibrary = false, }) => { const [step, setStep] = React.useState(0); + const [selectedCategory, setSelectedCategory] = React.useState('product-analytics'); useEffect(() => { return () => { @@ -28,6 +29,8 @@ const NewDashboardModal: React.FC = ({
{step === 0 && setStep(step + 1)} isLibrary={isAddingFromLibrary}/>} {step === 1 && setStep(0)}/>} diff --git a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx index 72ca572e2..6483f9a44 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx @@ -9,11 +9,12 @@ interface SelectCardProps { onClose: (refresh?: boolean) => void; onCard: () => void; isLibrary?: boolean; + selected?: string; + setSelectedCategory?: React.Dispatch>; } const SelectCard: React.FC = (props: SelectCardProps) => { - const {onCard, isLibrary = false} = props; - const [selected, setSelected] = React.useState('product-analytics'); + const {onCard, isLibrary = false, selected, setSelectedCategory} = props; const [selectedCards, setSelectedCards] = React.useState([]); const {metricStore, dashboardStore} = useStore(); const dashboardId = window.location.pathname.split('/')[3]; @@ -83,7 +84,7 @@ const SelectCard: React.FC = (props: SelectCardProps) => { )} - {!isLibrary && } + {!isLibrary && } {isLibrary ? : } @@ -111,15 +112,17 @@ const SelectCard: React.FC = (props: SelectCardProps) => { // ); interface CategorySelectorProps { - setSelected: React.Dispatch>; + setSelected?: React.Dispatch>; + selected?: string; } -const CategorySelector: React.FC = ({setSelected}) => ( +const CategorySelector: React.FC = ({setSelected, selected}) => ( ({ label: