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
14 changes: 9 additions & 5 deletions src/components/timeline/FullTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,14 @@ class FullTimelineImpl extends React.PureComponent<Props, State> {
<>
<TimelineSelection width={width}>
<div className="timelineHeader">
<TimelineSettingsHiddenTracks
hiddenTrackCount={hiddenTrackCount}
changeRightClickedTrack={changeRightClickedTrack}
/>
{hiddenTrackCount.total > 1 ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not caused by this patch, but I find hiddenTrackCount to be a very confusing variable name. This if check is checking the total track count.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also confused while working on the patch! But it's not just the variable name, the selector is also named getHiddenTrackCount, and the type is called HiddenTrackCount. Would you like another PR to s/HiddenTrackCount/TrackCount/g?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please :)

<TimelineSettingsHiddenTracks
hiddenTrackCount={hiddenTrackCount}
changeRightClickedTrack={changeRightClickedTrack}
/>
) : (
<div className="timelineSettingsHiddenTracksSpacer" />
)}
<TimelineRuler
zeroAt={zeroAt}
rangeStart={committedRange.start}
Expand Down Expand Up @@ -192,7 +196,7 @@ class FullTimelineImpl extends React.PureComponent<Props, State> {
</Reorderable>
</OverflowEdgeIndicator>
</TimelineSelection>
<TimelineTrackContextMenu />
{hiddenTrackCount.total > 1 ? <TimelineTrackContextMenu /> : null}
</>
);
}
Expand Down
27 changes: 16 additions & 11 deletions src/components/timeline/GlobalTrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type StateProps = {
readonly selectedTab: TabSlug;
readonly processesWithMemoryTrack: Set<Pid>;
readonly progressGraphData: ProgressGraphData[] | null;
readonly totalTrackCount: number;
};

type DispatchProps = {
Expand Down Expand Up @@ -243,6 +244,7 @@ class GlobalTrackComponent extends PureComponent<Props> {
localTracks,
pid,
globalTrack,
totalTrackCount,
} = this.props;

if (isHidden) {
Expand Down Expand Up @@ -290,17 +292,19 @@ class GlobalTrackComponent extends PureComponent<Props> {
</div>
) : null}
</button>
<Localized
id="TrackNameButton--hide-process"
attrs={{ title: true }}
>
<button
type="button"
className="timelineTrackCloseButton"
title="Hide process"
onClick={this._hideCurrentTrack}
/>
</Localized>
{totalTrackCount > 1 ? (
<Localized
id="TrackNameButton--hide-process"
attrs={{ title: true }}
>
<button
type="button"
className="timelineTrackCloseButton"
title="Hide process"
onClick={this._hideCurrentTrack}
/>
</Localized>
) : null}
</div>
<div
className="timelineTrackTrack"
Expand Down Expand Up @@ -388,6 +392,7 @@ export const TimelineGlobalTrack = explicitConnect<
selectedTab,
processesWithMemoryTrack: getProcessesWithMemoryTrack(state),
progressGraphData,
totalTrackCount: globalTracks.length,
};
},
mapDispatchToProps: {
Expand Down
13 changes: 9 additions & 4 deletions src/components/timeline/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,22 @@
list-style: none;
}

.timelineSettingsHiddenTracks,
.timelineSettingsHiddenTracksSpacer {
width: var(--thread-label-column-width);
box-sizing: border-box;

/* Separator line between tracks menu button and timeline ruler */
border-right: 1px solid var(--grey-30);
}

.timelineSettingsHiddenTracks {
/* Make sure and override all rules that have to do with button defaults. */
position: relative;
width: var(--thread-label-column-width);

/* 8px is intentional to align this text with the text above. */
padding: 0 20px 0 8px;
border: 0;

/* Separator line between tracks menu button and timeline ruler */
border-right: 1px solid var(--grey-30);
background: none;
color: inherit;
font: inherit;
Expand Down
10 changes: 0 additions & 10 deletions src/test/components/__snapshots__/GlobalTrack.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,6 @@ exports[`timeline/GlobalTrack will not render markers to the timeline-overview w
>
Process 0
</button>
<button
class="timelineTrackCloseButton"
title="Hide process"
type="button"
/>
</div>
<div
class="timelineTrackTrack"
Expand Down Expand Up @@ -2140,11 +2135,6 @@ exports[`timeline/GlobalTrack will render markers with a timeline-overview schem
>
Process 0
</button>
<button
class="timelineTrackCloseButton"
title="Hide process"
type="button"
/>
</div>
<div
class="timelineTrackTrack"
Expand Down
10 changes: 0 additions & 10 deletions src/test/components/__snapshots__/Timeline.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ exports[`TimelineSelection does not crash when there are no samples or markers 1
>
Process 0
</button>
<button
class="timelineTrackCloseButton"
title="Hide process"
type="button"
/>
</div>
<div
class="timelineTrackTrack"
Expand Down Expand Up @@ -408,11 +403,6 @@ exports[`TimelineSelection renders the vertical line indicating the time positio
>
Process 0
</button>
<button
class="timelineTrackCloseButton"
title="Hide process"
type="button"
/>
</div>
<div
class="timelineTrackTrack"
Expand Down