fix(ui): fix colors for metric picker
This commit is contained in:
parent
e33d886b9b
commit
901539f27d
9 changed files with 80 additions and 70 deletions
|
|
@ -31,7 +31,7 @@ function DashboardList() {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className="mt-3 border-b">
|
<div className="mt-3 border-b">
|
||||||
<div className="grid grid-cols-12 py-2 font-medium">
|
<div className="grid grid-cols-12 py-2 px-2 font-medium">
|
||||||
<div className="col-span-8">Title</div>
|
<div className="col-span-8">Title</div>
|
||||||
<div className="col-span-2">Visibility</div>
|
<div className="col-span-2">Visibility</div>
|
||||||
<div className="col-span-2 text-right">Created</div>
|
<div className="col-span-2 text-right">Created</div>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Icon } from 'UI';
|
import { Icon } from 'UI';
|
||||||
import { connect } from 'react-redux';
|
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 { checkForRecent } from 'App/date';
|
||||||
import { withSiteId, dashboardSelected } from 'App/routes';
|
import { withSiteId, dashboardSelected } from 'App/routes';
|
||||||
import { useStore } from 'App/mstore';
|
import { useStore } from 'App/mstore';
|
||||||
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
||||||
|
|
||||||
interface Props extends RouteComponentProps {
|
interface Props extends RouteComponentProps {
|
||||||
dashboard: IDashboard;
|
dashboard: IDashboard;
|
||||||
siteId: string;
|
siteId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DashboardListItem(props: Props) {
|
function DashboardListItem(props: Props) {
|
||||||
|
|
@ -22,34 +22,28 @@ function DashboardListItem(props: Props) {
|
||||||
history.push(path);
|
history.push(path);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="hover:bg-active-blue px-2 cursor-pointer" onClick={onItemClick}>
|
||||||
<div className="grid grid-cols-12 py-4 border-t select-none">
|
<div className="grid grid-cols-12 py-4 border-t select-none">
|
||||||
<div className="col-span-8 flex items-start">
|
<div className="col-span-8 flex items-start">
|
||||||
<div className="flex items-center link capitalize-first" onClick={onItemClick}>
|
<div className="flex items-center capitalize-first">
|
||||||
<div className="w-9 h-9 rounded-full bg-tealx-lightest flex items-center justify-center mr-2">
|
<div className="w-9 h-9 rounded-full bg-tealx-lightest flex items-center justify-center mr-2">
|
||||||
<Icon name="columns-gap" size="16" color="tealx" />
|
<Icon name="columns-gap" size="16" color="tealx" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>{dashboard.name}</div>
|
||||||
{dashboard.name}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* <div><Label className="capitalize">{metric.metricType}</Label></div> */}
|
{/* <div><Label className="capitalize">{metric.metricType}</Label></div> */}
|
||||||
<div className="col-span-2">
|
<div className="col-span-2">
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<Icon name={dashboard.isPublic ? "user-friends" : "person-fill"} className="mr-2" />
|
<Icon name={dashboard.isPublic ? 'user-friends' : 'person-fill'} className="mr-2" />
|
||||||
<span>{dashboard.isPublic ? 'Team' : 'Private'}</span>
|
<span>{dashboard.isPublic ? 'Team' : 'Private'}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-2 text-right">
|
<div className="col-span-2 text-right">{checkForRecent(dashboard.createdAt, 'LLL dd, yyyy, hh:mm a')}</div>
|
||||||
{checkForRecent(dashboard.createdAt, 'LLL dd, yyyy, hh:mm a')}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="text-disabled-text px-4 pb-2">
|
{dashboard.description ? <div className="text-disabled-text px-4 pb-2">{dashboard.description}</div> : null}
|
||||||
{dashboard.description}
|
</div>
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export default connect(state => ({ siteId: state.getIn([ 'site', 'siteId' ]) }))(withRouter(DashboardListItem))
|
export default connect((state) => ({ siteId: state.getIn(['site', 'siteId']) }))(withRouter(DashboardListItem));
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
.tooltipContainer {
|
||||||
|
& > tippy-popper > tippy-tooltip {
|
||||||
|
padding: 0!important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,6 +17,10 @@ import DashboardOptions from '../DashboardOptions';
|
||||||
import SelectDateRange from 'Shared/SelectDateRange';
|
import SelectDateRange from 'Shared/SelectDateRange';
|
||||||
import { Tooltip } from 'react-tippy';
|
import { Tooltip } from 'react-tippy';
|
||||||
import Breadcrumb from 'Shared/Breadcrumb';
|
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 {
|
interface IProps {
|
||||||
siteId: string;
|
siteId: string;
|
||||||
|
|
@ -27,6 +31,7 @@ interface IProps {
|
||||||
type Props = IProps & RouteComponentProps;
|
type Props = IProps & RouteComponentProps;
|
||||||
|
|
||||||
function DashboardView(props: Props) {
|
function DashboardView(props: Props) {
|
||||||
|
const [isTooltipShown, setTooltip] = React.useState(false);
|
||||||
const { siteId, dashboardId } = props;
|
const { siteId, dashboardId } = props;
|
||||||
const { dashboardStore } = useStore();
|
const { dashboardStore } = useStore();
|
||||||
const { showModal } = useModal();
|
const { showModal } = useModal();
|
||||||
|
|
@ -123,9 +128,21 @@ function DashboardView(props: Props) {
|
||||||
onDoubleClick={() => onEdit(true)}
|
onDoubleClick={() => onEdit(true)}
|
||||||
className="mr-3 select-none border-b border-b-borderColor-transparent hover:border-dotted hover:border-gray-medium cursor-pointer"
|
className="mr-3 select-none border-b border-b-borderColor-transparent hover:border-dotted hover:border-gray-medium cursor-pointer"
|
||||||
actionButton={
|
actionButton={
|
||||||
<Button variant="primary" onClick={onAddWidgets}>
|
<OutsideClickDetectingDiv onClickOutside={() => setTooltip(false)}>
|
||||||
Add Metric
|
{/* @ts-ignore */}
|
||||||
</Button>
|
<Tooltip
|
||||||
|
interactive
|
||||||
|
useContext
|
||||||
|
// @ts-ignore
|
||||||
|
theme="nopadding"
|
||||||
|
open={isTooltipShown}
|
||||||
|
html={<div style={{ padding: 0 }}><AddMetricContainer isPopup siteId={siteId} /></div>}
|
||||||
|
>
|
||||||
|
<Button variant="primary" onClick={() => setTooltip(true)}>
|
||||||
|
Add Metric
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
|
</OutsideClickDetectingDiv>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -50,20 +50,11 @@ function AddMetric({ metrics, history, siteId, title, description }: IProps) {
|
||||||
<h1 className="text-2xl">{title}</h1>
|
<h1 className="text-2xl">{title}</h1>
|
||||||
<div className="text-disabled-text">{description}</div>
|
<div className="text-disabled-text">{description}</div>
|
||||||
</div>
|
</div>
|
||||||
{title.includes('Custom') ? (
|
|
||||||
<div>
|
<Button variant="text-primary" className="font-medium ml-2" onClick={onCreateNew}>
|
||||||
<span className="text-md link" onClick={onCreateNew}>
|
+ Create new
|
||||||
+ Create new
|
</Button>
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div>
|
|
||||||
Don’t find the one you need?
|
|
||||||
<span className="text-md link ml-2" onClick={onCreateNew}>
|
|
||||||
+ Create custom metric
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid h-full grid-cols-4 gap-4 px-8 items-start py-1" style={{ maxHeight: 'calc(100vh - 160px)', overflowY: 'auto', gridTemplateRows: 'max-content' }}>
|
<div className="grid h-full grid-cols-4 gap-4 px-8 items-start py-1" style={{ maxHeight: 'calc(100vh - 160px)', overflowY: 'auto', gridTemplateRows: 'max-content' }}>
|
||||||
|
|
|
||||||
|
|
@ -12,39 +12,42 @@ interface AddMetricButtonProps {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
isPremade?: boolean;
|
isPremade?: boolean;
|
||||||
|
isPopup?: boolean;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddMetricButton({ iconName, title, description, onClick, isPremade }: AddMetricButtonProps) {
|
function AddMetricButton({ iconName, title, description, onClick, isPremade, isPopup }: AddMetricButtonProps) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
className={cn(
|
className={cn(
|
||||||
'px-4 py-8 flex items-center flex-col hover:bg-gray-lightest group rounded border cursor-pointer',
|
'flex items-center hover:bg-gray-lightest hover:!border-gray-light group rounded border cursor-pointer',
|
||||||
isPremade ? 'bg-figmaColors-primary-outlined-hover-background' : 'bg-figmaColors-secondary-outlined-hover-background'
|
isPremade ? 'bg-figmaColors-primary-outlined-hover-background' : 'bg-figmaColors-secondary-outlined-hover-background',
|
||||||
|
isPopup ? 'p-4 z-50' : 'px-4 py-8 flex-col'
|
||||||
)}
|
)}
|
||||||
style={{ borderColor: 'rgb(238, 238, 238)' }}
|
style={{ borderColor: 'rgb(238, 238, 238)' }}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'p-6 my-3 rounded-full group-hover:bg-gray-light',
|
'p-6 my-3 rounded-full group-hover:bg-gray-light',
|
||||||
isPremade ? 'bg-figmaColors-primary-outlined-hover-background' : 'bg-figmaColors-secondary-outlined-hover-background'
|
isPremade
|
||||||
|
? 'bg-figmaColors-primary-outlined-hover-background fill-figmaColors-accent-secondary group-hover:!bg-figmaColors-accent-secondary group-hover:!fill-white'
|
||||||
|
: 'bg-figmaColors-secondary-outlined-hover-background fill-figmaColors-secondary-outlined-resting-border group-hover:!bg-teal group-hover:!fill-white'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon name={iconName} size={26} style={{ fill: 'inherit' }} />
|
||||||
name={iconName}
|
</div>
|
||||||
size={26}
|
<div className={isPopup ? 'flex flex-col text-left ml-4' : 'flex flex-col text-center items-center'}>
|
||||||
className="group-hover:fill-gray-medium"
|
<div className="font-bold text-base text-figmaColors-text-primary">{title}</div>
|
||||||
style={{ fill: isPremade ? '#3EAAAF' : 'rgba(63, 81, 181, 0.5)' }}
|
<div className={cn('text-disabled-test text-figmaColors-text-primary text-base', isPopup ? 'w-full' : 'mt-2 w-2/3 text-center')}>
|
||||||
/>
|
{description}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="font-bold mb-2 text-figmaColors-text-primary">{title}</div>
|
|
||||||
<div className="text-disabled-test w-2/3 text-center text-figmaColors-text-primary">{description}</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddMetricContainer({ siteId }: any) {
|
function AddMetricContainer({ siteId, isPopup }: any) {
|
||||||
const { showModal } = useModal();
|
const { showModal } = useModal();
|
||||||
const [categories, setCategories] = React.useState<Record<string, any>[]>([]);
|
const [categories, setCategories] = React.useState<Record<string, any>[]>([]);
|
||||||
const { dashboardStore } = useStore();
|
const { dashboardStore } = useStore();
|
||||||
|
|
@ -78,20 +81,26 @@ function AddMetricContainer({ siteId }: any) {
|
||||||
{ right: true }
|
{ 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 (
|
return (
|
||||||
<div style={{ borderColor: 'rgb(238, 238, 238)', height: 285 }} className="bg-white border border-dashed rounded p-8 grid grid-cols-2 gap-8">
|
<div style={{ borderColor: 'rgb(238, 238, 238)', height: isPopup ? undefined : 300 }} className={classes}>
|
||||||
<AddMetricButton
|
<AddMetricButton
|
||||||
title="+ Add custom Metric"
|
title="+ Add custom Metric"
|
||||||
description="Metrics that are manually created by you or your team"
|
description="Metrics that are manually created by you or your team"
|
||||||
iconName="bar-pencil"
|
iconName="bar-pencil"
|
||||||
onClick={onAddCustomMetrics}
|
onClick={onAddCustomMetrics}
|
||||||
isPremade
|
isPremade
|
||||||
|
isPopup={isPopup}
|
||||||
/>
|
/>
|
||||||
<AddMetricButton
|
<AddMetricButton
|
||||||
title="+ Add Ready-Made Metric"
|
title="+ Add Ready-Made Metric"
|
||||||
description="Curated metrics predfined by OpenReplay."
|
description="Curated metrics predfined by OpenReplay."
|
||||||
iconName="grid-check"
|
iconName="grid-check"
|
||||||
onClick={onAddPredefinedMetrics}
|
onClick={onAddPredefinedMetrics}
|
||||||
|
isPopup={isPopup}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -83,23 +83,16 @@ function AddPredefinedMetric({ categories, history, siteId, title, description }
|
||||||
<h1 className="text-2xl">{title}</h1>
|
<h1 className="text-2xl">{title}</h1>
|
||||||
<div className="text-disabled-text">{description}</div>
|
<div className="text-disabled-text">{description}</div>
|
||||||
</div>
|
</div>
|
||||||
{title.includes('Custom') ? (
|
|
||||||
<div>
|
<div className="flex items-center">
|
||||||
<span className="text-md link" onClick={onCreateNew}>
|
Don’t find the one you need?
|
||||||
+ Create new
|
<Button variant="text-primary" className="font-medium ml-2" onClick={onCreateNew}>
|
||||||
</span>
|
+ Create custom metric
|
||||||
</div>
|
</Button>
|
||||||
) : (
|
</div>
|
||||||
<div>
|
|
||||||
Don’t find the one you need?
|
|
||||||
<span className="text-md link ml-2" onClick={onCreateNew}>
|
|
||||||
+ Create custom metric
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex px-8 h-full" style={{ maxHeight: 'calc(100vh - 160px)'}}>
|
<div className="flex px-8 h-full" style={{ maxHeight: 'calc(100vh - 160px)' }}>
|
||||||
<div style={{ flex: 3 }}>
|
<div style={{ flex: 3 }}>
|
||||||
<div className="grid grid-cols-1 gap-4 py-1 pr-2" style={{ maxHeight: 'calc(100vh - 160px)', overflowY: 'auto' }}>
|
<div className="grid grid-cols-1 gap-4 py-1 pr-2" style={{ maxHeight: 'calc(100vh - 160px)', overflowY: 'auto' }}>
|
||||||
{activeCategory &&
|
{activeCategory &&
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ function handleClickOutside(e) {
|
||||||
|
|
||||||
document.addEventListener('click', handleClickOutside);
|
document.addEventListener('click', handleClickOutside);
|
||||||
|
|
||||||
|
function OutsideClickDetectingDiv({ onClickOutside, children, ...props}) {
|
||||||
export default React.memo(function OutsideClickDetectingDiv({ onClickOutside, children, ...props}) {
|
|
||||||
const ref = useRef(null);
|
const ref = useRef(null);
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
function handleClickOutside(event) {
|
function handleClickOutside(event) {
|
||||||
|
|
@ -44,7 +43,6 @@ export default React.memo(function OutsideClickDetectingDiv({ onClickOutside, ch
|
||||||
}, [ ref ]);
|
}, [ ref ]);
|
||||||
|
|
||||||
return <div ref={ref} {...props}>{children}</div>;
|
return <div ref={ref} {...props}>{children}</div>;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default React.memo(OutsideClickDetectingDiv);
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,9 @@ p {
|
||||||
.tippy-tooltip.openreplay-theme .tippy-backdrop {
|
.tippy-tooltip.openreplay-theme .tippy-backdrop {
|
||||||
background-color: $tealx;
|
background-color: $tealx;
|
||||||
}
|
}
|
||||||
|
.tippy-tooltip[data-theme~='nopadding'], .nopadding-theme {
|
||||||
|
padding: 0!important
|
||||||
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
.no-print {
|
.no-print {
|
||||||
|
|
@ -302,4 +305,4 @@ p {
|
||||||
|
|
||||||
.recharts-legend-item-text {
|
.recharts-legend-item-text {
|
||||||
white-space: nowrap !important;
|
white-space: nowrap !important;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue