From bb33ea4714abe2e52dae4ab2320c644e9e48ce45 Mon Sep 17 00:00:00 2001 From: sylenien Date: Mon, 16 May 2022 17:51:47 +0200 Subject: [PATCH] fix(ui): lettering fixes, move create dashboard to sidebar title --- .../DashboardMetricSelection.tsx | 2 +- .../DashboardModal/DashboardModal.tsx | 64 ++++++++++--------- .../DashboardOptions/DashboardOptions.tsx | 6 +- .../DashboardRouter/DashboardRouter.tsx | 2 +- .../DashboardSideMenu/DashboardSideMenu.tsx | 39 +++++++---- 5 files changed, 63 insertions(+), 50 deletions(-) diff --git a/frontend/app/components/Dashboard/components/DashboardMetricSelection/DashboardMetricSelection.tsx b/frontend/app/components/Dashboard/components/DashboardMetricSelection/DashboardMetricSelection.tsx index 400654df2..1482250ef 100644 --- a/frontend/app/components/Dashboard/components/DashboardMetricSelection/DashboardMetricSelection.tsx +++ b/frontend/app/components/Dashboard/components/DashboardMetricSelection/DashboardMetricSelection.tsx @@ -114,4 +114,4 @@ function DashboardMetricSelection(props) { )); } -export default DashboardMetricSelection; \ No newline at end of file +export default DashboardMetricSelection; diff --git a/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx b/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx index d19556857..f310cc824 100644 --- a/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx +++ b/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx @@ -36,41 +36,43 @@ function DashboardModal(props) { } return useObserver(() => ( -
-
-
-

- { dashboard.exists() ? "Add metric(s) to dashboard" : "Create Dashboard" } -

+
+
+
+
+

+ { dashboard.exists() ? "Add metrics to dashboard" : "Create Dashboard" } +

+
+
+ {dashboard.exists() && } +
-
- {dashboard.exists() && } -
-
- { !dashboard.exists() && ( - <> - -

Create new dashboard by choosing from the range of predefined metrics that you care about. You can always add your custom metrics later.

- - )} - + { !dashboard.exists() && ( + <> + +

Create new dashboard by choosing from the range of predefined metrics that you care about. You can always add your custom metrics later.

+ + )} + -
- - {selectedWidgetsCount} Widgets +
+ + {selectedWidgetsCount} Metrics +
)); } -export default withRouter(DashboardModal); \ No newline at end of file +export default withRouter(DashboardModal); diff --git a/frontend/app/components/Dashboard/components/DashboardOptions/DashboardOptions.tsx b/frontend/app/components/Dashboard/components/DashboardOptions/DashboardOptions.tsx index b616d2e50..08e5f88f4 100644 --- a/frontend/app/components/Dashboard/components/DashboardOptions/DashboardOptions.tsx +++ b/frontend/app/components/Dashboard/components/DashboardOptions/DashboardOptions.tsx @@ -19,10 +19,10 @@ function DashboardOptions(props: Props) { if (isEnterprise) { menuItems.unshift({ icon: 'pdf-download', text: 'Download Report', onClick: renderReport }); } - + return ( ); @@ -30,4 +30,4 @@ function DashboardOptions(props: Props) { export default connect(state => ({ isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee', -}))(DashboardOptions); \ No newline at end of file +}))(DashboardOptions); diff --git a/frontend/app/components/Dashboard/components/DashboardRouter/DashboardRouter.tsx b/frontend/app/components/Dashboard/components/DashboardRouter/DashboardRouter.tsx index 6004202a2..31e509d52 100644 --- a/frontend/app/components/Dashboard/components/DashboardRouter/DashboardRouter.tsx +++ b/frontend/app/components/Dashboard/components/DashboardRouter/DashboardRouter.tsx @@ -58,4 +58,4 @@ function DashboardRouter(props: Props) { ); } -export default withRouter(DashboardRouter); \ No newline at end of file +export default withRouter(DashboardRouter); diff --git a/frontend/app/components/Dashboard/components/DashboardSideMenu/DashboardSideMenu.tsx b/frontend/app/components/Dashboard/components/DashboardSideMenu/DashboardSideMenu.tsx index 9dd64733c..7d2ca62b4 100644 --- a/frontend/app/components/Dashboard/components/DashboardSideMenu/DashboardSideMenu.tsx +++ b/frontend/app/components/Dashboard/components/DashboardSideMenu/DashboardSideMenu.tsx @@ -11,15 +11,18 @@ import DashboardModal from '../DashboardModal'; import cn from 'classnames'; import { Tooltip } from 'react-tippy'; import { connect } from 'react-redux'; +import { compose } from 'redux' import { setShowAlerts } from 'Duck/dashboard'; +import stl from 'Shared/MainSearchBar/mainSearchBar.css'; const SHOW_COUNT = 8; + interface Props { siteId: string history: any setShowAlerts: (show: boolean) => void } -function DashboardSideMenu(props: Props) { +function DashboardSideMenu(props: RouteComponentProps) { const { history, siteId, setShowAlerts } = props; const { hideModal, showModal } = useModal(); const { dashboardStore } = useStore(); @@ -40,7 +43,7 @@ function DashboardSideMenu(props: Props) { const onAddDashboardClick = (e) => { dashboardStore.initDashboard(); - showModal(, {}) + showModal(, { right: true }) } const togglePinned = (dashboard) => { @@ -49,11 +52,24 @@ function DashboardSideMenu(props: Props) { return useObserver(() => (
- + + + Create + + } + /> {dashboardsPicked.sort((a: any, b: any) => a.isPinned === b.isPinned ? 0 : a.isPinned ? -1 : 1 ).map((item: any) => ( onItemClick(item)} @@ -92,14 +108,6 @@ function DashboardSideMenu(props: Props) { )}
-
- -
setShowAlerts(true)} - /> + />
)); } -export default connect(null, { setShowAlerts })(withRouter(DashboardSideMenu)); \ No newline at end of file +export default compose( + withRouter, + connect(null, { setShowAlerts }), +)(DashboardSideMenu) as React.FunctionComponent>