From 901539f27d413af3e5df01ccf3b74248d2afe054 Mon Sep 17 00:00:00 2001 From: sylenien Date: Thu, 11 Aug 2022 17:50:10 +0200 Subject: [PATCH] fix(ui): fix colors for metric picker --- .../DashboardList/DashboardList.tsx | 2 +- .../DashboardList/DashboardListItem.tsx | 28 ++++++-------- .../DashboardView/DashboardView.module.css | 5 +++ .../DashboardView/DashboardView.tsx | 23 ++++++++++-- .../DashboardWidgetGrid/AddMetric.tsx | 19 +++------- .../AddMetricContainer.tsx | 37 ++++++++++++------- .../AddPredefinedMetric.tsx | 23 ++++-------- .../OutsideClickDetectingDiv.js | 8 ++-- frontend/app/styles/general.css | 5 ++- 9 files changed, 80 insertions(+), 70 deletions(-) create mode 100644 frontend/app/components/Dashboard/components/DashboardView/DashboardView.module.css diff --git a/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx b/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx index 466103dc8..4aa5a43e5 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/DashboardList.tsx @@ -31,7 +31,7 @@ function DashboardList() { } >
-
+
Title
Visibility
Created
diff --git a/frontend/app/components/Dashboard/components/DashboardList/DashboardListItem.tsx b/frontend/app/components/Dashboard/components/DashboardList/DashboardListItem.tsx index 1fffe9f30..057b22d9a 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/DashboardListItem.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/DashboardListItem.tsx @@ -1,15 +1,15 @@ import React from 'react'; import { Icon } from 'UI'; import { connect } from 'react-redux'; -import{ IDashboard } from "App/mstore/types/dashboard"; +import { IDashboard } from 'App/mstore/types/dashboard'; import { checkForRecent } from 'App/date'; import { withSiteId, dashboardSelected } from 'App/routes'; import { useStore } from 'App/mstore'; import { withRouter, RouteComponentProps } from 'react-router-dom'; interface Props extends RouteComponentProps { - dashboard: IDashboard; - siteId: string; + dashboard: IDashboard; + siteId: string; } function DashboardListItem(props: Props) { @@ -22,34 +22,28 @@ function DashboardListItem(props: Props) { history.push(path); }; return ( - <> +
-
+
-
- {dashboard.name} -
+
{dashboard.name}
{/*
*/}
- + {dashboard.isPublic ? 'Team' : 'Private'}
-
- {checkForRecent(dashboard.createdAt, 'LLL dd, yyyy, hh:mm a')} -
+
{checkForRecent(dashboard.createdAt, 'LLL dd, yyyy, hh:mm a')}
-
- {dashboard.description} -
- + {dashboard.description ?
{dashboard.description}
: null} +
); } // @ts-ignore -export default connect(state => ({ siteId: state.getIn([ 'site', 'siteId' ]) }))(withRouter(DashboardListItem)) +export default connect((state) => ({ siteId: state.getIn(['site', 'siteId']) }))(withRouter(DashboardListItem)); diff --git a/frontend/app/components/Dashboard/components/DashboardView/DashboardView.module.css b/frontend/app/components/Dashboard/components/DashboardView/DashboardView.module.css new file mode 100644 index 000000000..42045607f --- /dev/null +++ b/frontend/app/components/Dashboard/components/DashboardView/DashboardView.module.css @@ -0,0 +1,5 @@ +.tooltipContainer { + & > tippy-popper > tippy-tooltip { + padding: 0!important; + } +} diff --git a/frontend/app/components/Dashboard/components/DashboardView/DashboardView.tsx b/frontend/app/components/Dashboard/components/DashboardView/DashboardView.tsx index e75fe6823..8c6d7f54b 100644 --- a/frontend/app/components/Dashboard/components/DashboardView/DashboardView.tsx +++ b/frontend/app/components/Dashboard/components/DashboardView/DashboardView.tsx @@ -17,6 +17,10 @@ import DashboardOptions from '../DashboardOptions'; import SelectDateRange from 'Shared/SelectDateRange'; import { Tooltip } from 'react-tippy'; import Breadcrumb from 'Shared/Breadcrumb'; +import OutsideClickDetectingDiv from 'Shared/OutsideClickDetectingDiv'; +import AddMetricContainer from '../DashboardWidgetGrid/AddMetricContainer'; +// @ts-ignore +import stl from './DashboardView.module.css'; interface IProps { siteId: string; @@ -27,6 +31,7 @@ interface IProps { type Props = IProps & RouteComponentProps; function DashboardView(props: Props) { + const [isTooltipShown, setTooltip] = React.useState(false); const { siteId, dashboardId } = props; const { dashboardStore } = useStore(); const { showModal } = useModal(); @@ -123,9 +128,21 @@ function DashboardView(props: Props) { onDoubleClick={() => onEdit(true)} className="mr-3 select-none border-b border-b-borderColor-transparent hover:border-dotted hover:border-gray-medium cursor-pointer" actionButton={ - + setTooltip(false)}> + {/* @ts-ignore */} +
} + > + + + } />
diff --git a/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddMetric.tsx b/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddMetric.tsx index a07c57016..472d98d0f 100644 --- a/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddMetric.tsx +++ b/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddMetric.tsx @@ -50,20 +50,11 @@ function AddMetric({ metrics, history, siteId, title, description }: IProps) {

{title}

{description}
- {title.includes('Custom') ? ( -
- - + Create new - -
- ) : ( -
- Don’t find the one you need? - - + Create custom metric - -
- )} + + +
diff --git a/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddMetricContainer.tsx b/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddMetricContainer.tsx index d3caf987a..30f48f58e 100644 --- a/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddMetricContainer.tsx +++ b/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddMetricContainer.tsx @@ -12,39 +12,42 @@ interface AddMetricButtonProps { title: string; description: string; isPremade?: boolean; + isPopup?: boolean; onClick: () => void; } -function AddMetricButton({ iconName, title, description, onClick, isPremade }: AddMetricButtonProps) { +function AddMetricButton({ iconName, title, description, onClick, isPremade, isPopup }: AddMetricButtonProps) { return (
- + +
+
+
{title}
+
+ {description} +
-
{title}
-
{description}
); } -function AddMetricContainer({ siteId }: any) { +function AddMetricContainer({ siteId, isPopup }: any) { const { showModal } = useModal(); const [categories, setCategories] = React.useState[]>([]); const { dashboardStore } = useStore(); @@ -78,20 +81,26 @@ function AddMetricContainer({ siteId }: any) { { right: true } ); }; + + const classes = isPopup + ? 'bg-white border rounded p-4 grid grid-rows-2 gap-4' + : 'bg-white border border-dashed hover:!border-gray-medium rounded p-8 grid grid-cols-2 gap-8'; return ( -
+
); diff --git a/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddPredefinedMetric.tsx b/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddPredefinedMetric.tsx index 5be789a2d..c27646b2f 100644 --- a/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddPredefinedMetric.tsx +++ b/frontend/app/components/Dashboard/components/DashboardWidgetGrid/AddPredefinedMetric.tsx @@ -83,23 +83,16 @@ function AddPredefinedMetric({ categories, history, siteId, title, description }

{title}

{description}
- {title.includes('Custom') ? ( -
- - + Create new - -
- ) : ( -
- Don’t find the one you need? - - + Create custom metric - -
- )} + +
+ Don’t find the one you need? + +
-
+
{activeCategory && diff --git a/frontend/app/components/shared/OutsideClickDetectingDiv/OutsideClickDetectingDiv.js b/frontend/app/components/shared/OutsideClickDetectingDiv/OutsideClickDetectingDiv.js index 954566480..a6ec97c40 100644 --- a/frontend/app/components/shared/OutsideClickDetectingDiv/OutsideClickDetectingDiv.js +++ b/frontend/app/components/shared/OutsideClickDetectingDiv/OutsideClickDetectingDiv.js @@ -29,8 +29,7 @@ function handleClickOutside(e) { document.addEventListener('click', handleClickOutside); - -export default React.memo(function OutsideClickDetectingDiv({ onClickOutside, children, ...props}) { +function OutsideClickDetectingDiv({ onClickOutside, children, ...props}) { const ref = useRef(null); useLayoutEffect(() => { function handleClickOutside(event) { @@ -44,7 +43,6 @@ export default React.memo(function OutsideClickDetectingDiv({ onClickOutside, ch }, [ ref ]); return
{children}
; -}); - - +} +export default React.memo(OutsideClickDetectingDiv); diff --git a/frontend/app/styles/general.css b/frontend/app/styles/general.css index f0b80a54d..dd84006a2 100644 --- a/frontend/app/styles/general.css +++ b/frontend/app/styles/general.css @@ -278,6 +278,9 @@ p { .tippy-tooltip.openreplay-theme .tippy-backdrop { background-color: $tealx; } +.tippy-tooltip[data-theme~='nopadding'], .nopadding-theme { + padding: 0!important +} @media print { .no-print { @@ -302,4 +305,4 @@ p { .recharts-legend-item-text { white-space: nowrap !important; -} \ No newline at end of file +}