diff --git a/frontend/app/components/Dashboard/Widgets/CardSessionsByList.tsx b/frontend/app/components/Dashboard/Widgets/CardSessionsByList.tsx new file mode 100644 index 000000000..63f296cb0 --- /dev/null +++ b/frontend/app/components/Dashboard/Widgets/CardSessionsByList.tsx @@ -0,0 +1,60 @@ +import React from 'react'; +import {List, Progress, Typography} from "antd"; +import cn from "classnames"; + +interface Props { + list: any; + selected: any; + onClickHandler: (event: any, data: any) => void; +} + +function CardSessionsByList({list, selected, onClickHandler}: Props) { + return ( + ( + onClickHandler(e, row)} + style={{ + borderBottom: '1px dotted rgba(0, 0, 0, 0.05)', + padding: '4px 10px', + lineHeight: '1px' + }} + className={cn('rounded hover:bg-active-blue cursor-pointer', selected === row.name ? 'bg-active-blue' : '')} + > + +
+ {row.name} + {row.sessionCount} +
+ + + + )} + /> +
+ )} + /> + ); +} + +export default CardSessionsByList; diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/SessionsBy.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/SessionsBy.tsx index 10fa154bd..b7a086d0c 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/SessionsBy.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/SessionsBy.tsx @@ -1,9 +1,11 @@ import React from 'react'; -import {List, Typography} from 'antd'; +import {Button, Space} from 'antd'; import {filtersMap} from 'Types/filter/newFilter'; import {Icon} from 'UI'; -import {Progress, Empty} from 'antd'; -import cn from "classnames"; +import {Empty} from 'antd'; +import {ArrowRight} from "lucide-react"; +import CardSessionsByList from "Components/Dashboard/Widgets/CardSessionsByList"; +import {useModal} from "Components/ModalContext"; interface Props { metric?: any; @@ -15,6 +17,8 @@ interface Props { function SessionsBy(props: Props) { const {metric = {}, data = {values: []}, onClick = () => null, isTemplate} = props; const [selected, setSelected] = React.useState(null); + const total = data.values.length + const {openModal, closeModal} = useModal(); const onClickHandler = (event: any, data: any) => { const filters = Array(); @@ -34,8 +38,19 @@ function SessionsBy(props: Props) { onClick(filters); } + const showMore = () => { + openModal( + { + closeModal(); + onClickHandler(null, item) + }} selected={selected}/>, { + title: metric.name, + width: 600, + }) + } + return ( -
+
{data.values && data.values.length === 0 ? ( ) : ( - ( - onClickHandler(e, row)} - // actions={[row.sessionCount]} - style={{borderBottom: '1px dotted rgba(0, 0, 0, 0.05)', padding: '6px 0'}} - className={cn('hover:bg-active-blue cursor-pointer', selected === row.name ? 'bg-gray-100' : '')} - > - - {row.name} - {row.sessionCount} -
- )} - description={ - - } - /> - {/*
{row.value}
*/} - +
+ + {total > 3 && ( +
+ +
)} - /> +
)}
); diff --git a/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx b/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx index 683a090f9..2173b6ac8 100644 --- a/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx +++ b/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx @@ -126,7 +126,7 @@ function WidgetPreview(props: Props) { {/*)}*/} -
+