change(ui) - xray - feature tooltips

This commit is contained in:
Shekar Siri 2022-08-19 12:19:29 +02:00
parent 3af03dcea7
commit 586ee81a5d
3 changed files with 29 additions and 8 deletions

View file

@ -6,7 +6,7 @@ import EventRow from './components/EventRow';
import { TYPES } from 'Types/session/event'; import { TYPES } from 'Types/session/event';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import TimelineScale from './components/TimelineScale'; import TimelineScale from './components/TimelineScale';
import FeatureSelection from './components/FeatureSelection/FeatureSelection'; import FeatureSelection, { HELP_MESSAGE } from './components/FeatureSelection/FeatureSelection';
import TimelinePointer from './components/TimelinePointer'; import TimelinePointer from './components/TimelinePointer';
import VerticalPointerLine from './components/VerticalPointerLine'; import VerticalPointerLine from './components/VerticalPointerLine';
import cn from 'classnames'; import cn from 'classnames';
@ -52,7 +52,7 @@ function OverviewPanel(props: Props) {
return ( return (
dataLoaded && ( dataLoaded && (
<Wrapper {...props}> <Wrapper {...props}>
<BottomBlock style={{ height: '250px' }}> <BottomBlock style={{ height: '245px' }}>
<BottomBlock.Header> <BottomBlock.Header>
<span className="font-semibold color-gray-medium mr-4">X-RAY</span> <span className="font-semibold color-gray-medium mr-4">X-RAY</span>
<div className="flex items-center h-20"> <div className="flex items-center h-20">
@ -62,7 +62,7 @@ function OverviewPanel(props: Props) {
<BottomBlock.Content> <BottomBlock.Content>
<OverviewPanelContainer endTime={props.endTime}> <OverviewPanelContainer endTime={props.endTime}>
<TimelineScale endTime={props.endTime} /> <TimelineScale endTime={props.endTime} />
<div style={{ width: '100%', height: '200px' }} className="transition relative"> <div style={{ width: '100%', height: '187px' }} className="transition relative">
<NoContent show={selectedFeatures.length === 0} title={ <NoContent show={selectedFeatures.length === 0} title={
<div className="flex items-center mt-16"> <div className="flex items-center mt-16">
<Icon name="info-circle" className="mr-2" size="18" /> <Icon name="info-circle" className="mr-2" size="18" />
@ -70,7 +70,7 @@ function OverviewPanel(props: Props) {
</div>}> </div>}>
<VerticalPointerLine /> <VerticalPointerLine />
{selectedFeatures.map((feature: any, index: number) => ( {selectedFeatures.map((feature: any, index: number) => (
<div className={cn('border-b', { 'bg-white': index % 2 })}> <div className={cn('border-b last:border-none', { 'bg-white': index % 2 })}>
<EventRow <EventRow
isGraph={feature === 'PERFORMANCE'} isGraph={feature === 'PERFORMANCE'}
key={feature} key={feature}
@ -78,6 +78,7 @@ function OverviewPanel(props: Props) {
list={resources[feature]} list={resources[feature]}
renderElement={(pointer: any) => <TimelinePointer pointer={pointer} type={feature} />} renderElement={(pointer: any) => <TimelinePointer pointer={pointer} type={feature} />}
endTime={props.endTime} endTime={props.endTime}
message={HELP_MESSAGE[feature]}
/> />
</div> </div>
))} ))}

View file

@ -1,18 +1,19 @@
import React from 'react'; import React from 'react';
import cn from 'classnames'; import cn from 'classnames';
import { getTimelinePosition } from 'App/utils'; import { getTimelinePosition } from 'App/utils';
import { connectPlayer } from 'App/player'; import { Icon, Popup } from 'UI';
import PerformanceGraph from '../PerformanceGraph'; import PerformanceGraph from '../PerformanceGraph';
interface Props { interface Props {
list?: any[]; list?: any[];
title: string; title: string;
message?: string;
className?: string; className?: string;
endTime?: number; endTime?: number;
renderElement?: (item: any) => React.ReactNode; renderElement?: (item: any) => React.ReactNode;
isGraph?: boolean; isGraph?: boolean;
} }
const EventRow = React.memo((props: Props) => { const EventRow = React.memo((props: Props) => {
const { title, className, list = [], endTime = 0, isGraph = false } = props; const { title, className, list = [], endTime = 0, isGraph = false, message = '' } = props;
const scale = 100 / endTime; const scale = 100 / endTime;
const _list = const _list =
!isGraph && !isGraph &&
@ -27,7 +28,10 @@ const EventRow = React.memo((props: Props) => {
return ( return (
<div className={cn('w-full flex flex-col py-2', className)} style={{ height: '60px' }}> <div className={cn('w-full flex flex-col py-2', className)} style={{ height: '60px' }}>
<div className="uppercase color-gray-medium ml-4 text-sm">{title}</div> <div className="uppercase color-gray-medium ml-4 text-sm flex items-center py-1">
<div className="mr-2 leading-none">{title}</div>
<RowInfo message={message} />
</div>
<div className="relative w-full"> <div className="relative w-full">
{isGraph ? ( {isGraph ? (
<PerformanceGraph list={list} /> <PerformanceGraph list={list} />
@ -39,7 +43,7 @@ const EventRow = React.memo((props: Props) => {
</div> </div>
); );
}) : ( }) : (
<div className="ml-4 color-gray-medium text-sm pt-1">No records captured.</div> <div className="ml-4 color-gray-medium text-sm pt-2">No records captured.</div>
) )
)} )}
</div> </div>
@ -48,3 +52,11 @@ const EventRow = React.memo((props: Props) => {
}); });
export default EventRow; export default EventRow;
function RowInfo({ message} : any) {
return (
<Popup content={message} delay={0}>
<Icon name="info-circle" />
</Popup>
)
}

View file

@ -7,6 +7,14 @@ const EVENTS = 'EVENTS';
const CLICKRAGE = 'CLICKRAGE'; const CLICKRAGE = 'CLICKRAGE';
const PERFORMANCE = 'PERFORMANCE'; const PERFORMANCE = 'PERFORMANCE';
export const HELP_MESSAGE: any = {
NETWORK: 'Network requests made in this session',
EVENTS: 'Visualizes the events that takes place in the DOM',
ERRORS: 'Visualizes native JS errors like Type, URI, Syntax etc.',
CLICKRAGE: 'Indicates user frustration when repeated clicks are recorded',
PERFORMANCE: 'Summary of this sessions memory, and CPU consumption on the timeline',
}
interface Props { interface Props {
list: any[]; list: any[];
updateList: any; updateList: any;