Skip to content

Commit 1f198bc

Browse files
authored
Merge pull request #3823 from asgerf/h/colorize-delta-text
Colorize delta text instead of icons, and default to using absolute delta
2 parents cd998c4 + bdd8d73 commit 1f198bc

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,28 +98,13 @@ function renderAbsoluteValue(x: PredicateInfo, metric: Metric) {
9898
}
9999
}
100100

101-
const DeltaPositive = styled(Codicon)`
102-
color: var(--vscode-problemsErrorIcon-foreground);
103-
`;
104-
105-
const DeltaNegative = styled(Codicon)`
106-
color: var(--vscode-problemsInfoIcon-foreground);
107-
`;
108-
109101
function renderDelta(x: number, unit?: string) {
110102
const sign = x > 0 ? "+" : "";
111-
const symbol =
112-
x > 0 ? (
113-
<DeltaPositive name="triangle-up" />
114-
) : (
115-
<DeltaNegative name="triangle-down" />
116-
);
117103
return (
118-
<NumberCell>
104+
<NumberCell className={x > 0 ? "bad-value" : x < 0 ? "good-value" : ""}>
119105
{sign}
120106
{formatDecimal(x)}
121107
{renderUnit(unit)}
122-
{symbol}
123108
</NumberCell>
124109
);
125110
}
@@ -154,6 +139,19 @@ const NameCell = styled.td``;
154139
const NumberCell = styled.td`
155140
text-align: right;
156141
width: 10em !important;
142+
143+
&.bad-value {
144+
color: var(--vscode-problemsErrorIcon-foreground);
145+
tr.expanded & {
146+
color: inherit;
147+
}
148+
}
149+
&.good-value {
150+
color: var(--vscode-problemsInfoIcon-foreground);
151+
tr.expanded & {
152+
color: inherit;
153+
}
154+
}
157155
`;
158156

159157
const AbsentNumberCell = styled.td`
@@ -385,7 +383,7 @@ function ComparePerformanceWithData(props: {
385383

386384
const [hideCacheHits, setHideCacheHits] = useState(false);
387385

388-
const [sortOrder, setSortOrder] = useState<"delta" | "absDelta">("delta");
386+
const [sortOrder, setSortOrder] = useState<"delta" | "absDelta">("absDelta");
389387

390388
const [metric, setMetric] = useState<Metric>(metrics.tuples);
391389

0 commit comments

Comments
 (0)