From 7f908fc18b298eaad09c48cfd0c59d908009bec8 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 13 Dec 2024 14:48:12 +0100 Subject: [PATCH] ui: fix dash options menu, fix cr/up button --- .../AddCardSection/AddCardSection.tsx | 2 +- .../DashboardList/DashboardList.tsx | 65 ++++++++++++++----- .../DashboardWidgetGrid.tsx | 2 +- .../WidgetView/WidgetViewHeader.tsx | 2 +- 4 files changed, 53 insertions(+), 18 deletions(-) diff --git a/frontend/app/components/Dashboard/components/AddCardSection/AddCardSection.tsx b/frontend/app/components/Dashboard/components/AddCardSection/AddCardSection.tsx index 5e4feb6ce..42f597511 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, fit }: { fit?: boolean; inCards?: boolean }) => { + ({ inCards }: { inCards?: boolean }) => { const { showModal } = useModal(); const { metricStore, dashboardStore, projectsStore } = useStore(); const [tab, setTab] = React.useState('product_analytics'); diff --git a/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx b/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx index 20a44c01f..f1a32c29a 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx @@ -7,6 +7,8 @@ import { Tag, Tooltip, Typography, + Dropdown, + Button, } from 'antd'; import { observer } from 'mobx-react-lite'; import React from 'react'; @@ -17,8 +19,8 @@ import { useStore } from 'App/mstore'; import Dashboard from 'App/mstore/types/dashboard'; import { dashboardSelected, withSiteId } from 'App/routes'; import CreateDashboardButton from 'Components/Dashboard/components/CreateDashboardButton'; -import { ItemMenu, confirm } from 'UI'; - +import { Icon, confirm } from 'UI'; +import { EllipsisVertical } from "lucide-react"; import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG'; import DashboardEditModal from '../DashboardEditModal'; @@ -26,6 +28,7 @@ import DashboardEditModal from '../DashboardEditModal'; function DashboardList() { const { dashboardStore, projectsStore } = useStore(); const siteId = projectsStore.siteId; + const optionsRef = React.useRef(null); const [focusTitle, setFocusedInput] = React.useState(true); const [showEditModal, setShowEditModal] = React.useState(false); @@ -124,20 +127,44 @@ function DashboardList() { title: 'Options', dataIndex: 'dashboardId', width: '5%', - onCell: () => ({ onClick: (e) => e.stopPropagation() }), render: (id) => ( - onEdit(id, true) }, - { - icon: 'users', - text: 'Visibility & Access', - onClick: () => onEdit(id, false), + , + key: 'rename', + label: 'Rename', + onClick: () => onEdit(id, true), + }, + { + icon: , + key: 'access', + label: 'Visibility & Access', + onClick: () => onEdit(id, false), + }, + { + icon: , + key: 'delete', + label: 'Delete', + onClick: () => onDelete(id), + }, + ], + onClick: ({ key }) => { + if (key === 'rename') { + onEdit(id, true); + } else if (key === 'access') { + onEdit(id, false); + } else if (key === 'delete') { + void onDelete(id); + } }, - { icon: 'trash', text: 'Delete', onClick: () => onDelete(id) }, - ]} - /> + }} + > +