Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
.SuspenseRectsContainer {
padding: .25rem;
cursor: pointer;
outline: 1px solid var(--color-component-name);
border-radius: 0.25rem;
}

.SuspenseRectsContainer[data-highlighted='true'] {
background: var(--color-dimmest);
}

.SuspenseRectsViewBox {
Expand Down Expand Up @@ -28,6 +35,8 @@
pointer-events: all;
outline-style: solid;
outline-width: 1px;
border-radius: 0.125rem;
cursor: pointer;
}

.SuspenseRectsScaledRect {
Expand All @@ -42,7 +51,7 @@

/* highlight this boundary */
.SuspenseRectsBoundary:hover:not(:has(.SuspenseRectsBoundary:hover)) > .SuspenseRectsRect, .SuspenseRectsBoundary[data-highlighted='true'] > .SuspenseRectsRect {
background-color: var(--color-background-hover);
background-color: var(--color-background-hover);
}

.SuspenseRectsRect[data-highlighted='true'] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ const ViewBox = createContext<Rect>((null: any));

function SuspenseRectsContainer(): React$Node {
const store = useContext(StoreContext);
const {inspectedElementID} = useContext(TreeStateContext);
const treeDispatch = useContext(TreeDispatcherContext);
const suspenseTreeDispatch = useContext(SuspenseTreeDispatcherContext);
// TODO: This relies on a full re-render of all children when the Suspense tree changes.
Expand Down Expand Up @@ -329,8 +330,13 @@ function SuspenseRectsContainer(): React$Node {
});
}

const isRootSelected = roots.includes(inspectedElementID);

return (
<div className={styles.SuspenseRectsContainer} onClick={handleClick}>
<div
className={styles.SuspenseRectsContainer}
onClick={handleClick}
data-highlighted={isRootSelected}>
<ViewBox.Provider value={boundingBox}>
<div
className={styles.SuspenseRectsViewBox}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
padding-right: 0;
}

.SuspenseScrubberBead, .SuspenseScrubberBeadSelected {
.SuspenseScrubberBead {
flex: 1;
height: 0.5rem;
background: var(--color-background-selected);
Expand All @@ -51,9 +51,11 @@
background: var(--color-background-selected);
}

.SuspenseScrubberBeadTransition {
background: var(--color-component-name);
}

.SuspenseScrubberStepHighlight > .SuspenseScrubberBead,
.SuspenseScrubberStepHighlight > .SuspenseScrubberBeadSelected,
.SuspenseScrubberStep:hover > .SuspenseScrubberBead,
.SuspenseScrubberStep:hover > .SuspenseScrubberBeadSelected {
.SuspenseScrubberStep:hover > .SuspenseScrubberBead {
height: 0.75rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {useRef} from 'react';

import styles from './SuspenseScrubber.css';

import Tooltip from '../Components/reach-ui/tooltip';

export default function SuspenseScrubber({
min,
max,
Expand Down Expand Up @@ -53,24 +55,38 @@ export default function SuspenseScrubber({
const steps = [];
for (let index = min; index <= max; index++) {
steps.push(
<div
<Tooltip
key={index}
className={
styles.SuspenseScrubberStep +
(highlight === index
? ' ' + styles.SuspenseScrubberStepHighlight
: '')
}
onPointerDown={handlePress.bind(null, index)}
onMouseEnter={onHoverSegment.bind(null, index)}>
label={
index === min
? // The first step in the timeline is always a Transition (Initial Paint).
// TODO: Support multiple environments.
'Initial Paint'
: // TODO: Consider adding the name of this specific boundary if this step has only one.
'Suspense'
}>
<div
className={
index <= value
? styles.SuspenseScrubberBeadSelected
: styles.SuspenseScrubberBead
styles.SuspenseScrubberStep +
(highlight === index
? ' ' + styles.SuspenseScrubberStepHighlight
: '')
}
/>
</div>,
onPointerDown={handlePress.bind(null, index)}
onMouseEnter={onHoverSegment.bind(null, index)}>
<div
className={
styles.SuspenseScrubberBead +
(index === min
? // The first step in the timeline is always a Transition (Initial Paint).
// TODO: Support multiple environments.
' ' + styles.SuspenseScrubberBeadTransition
: '') +
(index <= value ? ' ' + styles.SuspenseScrubberBeadSelected : '')
}
/>
</div>
</Tooltip>,
);
}

Expand Down
Loading