diff --git a/packages/react-devtools-shared/src/devtools/views/Button.css b/packages/react-devtools-shared/src/devtools/views/Button.css index d3885372b485..182b1b2526d3 100644 --- a/packages/react-devtools-shared/src/devtools/views/Button.css +++ b/packages/react-devtools-shared/src/devtools/views/Button.css @@ -5,6 +5,7 @@ padding: 0; border-radius: 0.25rem; flex: 0 0 auto; + cursor: pointer; } .ButtonContent { display: inline-flex; diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarEventInfo.css b/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarEventInfo.css index b16e8b97847f..98b0dad5325d 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarEventInfo.css +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarEventInfo.css @@ -20,18 +20,15 @@ } .ListItem { - margin: 0; + flex: 1 1; + margin: 0 0 0.5rem; } .Label { - display: flex; - justify-content: space-between; - + overflow: hidden; + text-overflow: ellipsis; font-weight: bold; -} - -[data-source="true"]:hover .Label > .Button { - background-color: var(--color-background-hover); + flex: 1 1; } .Value { @@ -39,32 +36,31 @@ font-size: var(--font-size-monospace-normal); } -.NothingSelected { - display: flex; +.Row { + display: flex; + flex-direction: row; align-items: center; - justify-content: center; - height: 100%; - color: var(--color-dim); -} - -.Button { - display: flex; - flex: 1; + border-top: 1px solid var(--color-border); +} - max-width: 95%; +.UnclickableSource, +.ClickableSource { + width: 100%; overflow: hidden; text-overflow: ellipsis; + font-family: var(--font-family-sans); + font-size: var(--font-size-sans-normal); } -[data-source="true"] .Button { - cursor: pointer; +.UnclickableSource { + color: var(--color-dim); } - -.Button > span { - display: block; - text-align: left; +.ClickableSource { + color: var(--color-text); } -.Source { +.ClickableSource:focus, +.ClickableSource:hover { + background-color: var(--color-background-hover); } diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarEventInfo.js b/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarEventInfo.js index c26f2c2faec7..18bd77443eb9 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarEventInfo.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarEventInfo.js @@ -15,18 +15,25 @@ import ButtonIcon from '../ButtonIcon'; import ViewSourceContext from '../Components/ViewSourceContext'; import {useContext} from 'react'; import {TimelineContext} from 'react-devtools-timeline/src/TimelineContext'; +import { + formatTimestamp, + getSchedulingEventLabel, +} from 'react-devtools-timeline/src/utils/formatting'; import {stackToComponentSources} from 'react-devtools-shared/src/devtools/utils'; +import {copy} from 'clipboard-js'; import styles from './SidebarEventInfo.css'; export type Props = {||}; -function SchedulingEventInfo({eventInfo}: {eventInfo: SchedulingEvent}) { - const {viewUrlSourceFunction} = useContext(ViewSourceContext); +type SchedulingEventProps = {| + eventInfo: SchedulingEvent, +|}; - const componentStack = eventInfo.componentStack - ? stackToComponentSources(eventInfo.componentStack) - : null; +function SchedulingEventInfo({eventInfo}: SchedulingEventProps) { + const {viewUrlSourceFunction} = useContext(ViewSourceContext); + const {componentName, timestamp} = eventInfo; + const componentStack = eventInfo.componentStack || null; const viewSource = source => { if (viewUrlSourceFunction != null && source != null) { @@ -35,45 +42,60 @@ function SchedulingEventInfo({eventInfo}: {eventInfo: SchedulingEvent}) { }; return ( -