Skip to content

Commit c0bcd99

Browse files
committed
Change style of summary and compile-time tab
1 parent 16b9cd7 commit c0bcd99

File tree

4 files changed

+22
-31
lines changed

4 files changed

+22
-31
lines changed

site/frontend/src/pages/compare/shared.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ export function percentClass(pct: number): string {
2929
}
3030

3131
export function diffClass(diff: number): string {
32-
let klass = "";
33-
if (diff > 1) {
34-
klass = "positive";
35-
} else if (diff < -1) {
36-
klass = "negative";
32+
if (diff >= 0) {
33+
return "positive";
3734
}
38-
return klass;
35+
return "negative";
3936
}

site/frontend/src/pages/compare/summary/percent-value.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import {computed} from "vue";
3-
import {signIfPositive} from "../shared";
3+
import {percentClass, signIfPositive} from "../shared";
44
55
const props = withDefaults(
66
defineProps<{
@@ -23,5 +23,7 @@ const padSpaces = computed((): string => {
2323
</script>
2424

2525
<template>
26-
<span><span v-html="padSpaces" />{{ formattedValue }}%</span>
26+
<span :class="percentClass(props.value)"
27+
><span v-html="padSpaces" />{{ formattedValue }}%</span
28+
>
2729
</template>

site/frontend/src/pages/compare/summary/summary-table.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const summary = computed(() => props.summary);
3939
</tr>
4040
</thead>
4141
<tbody>
42-
<tr class="positive">
42+
<tr>
4343
<td title="Regressions" v-if="withLegend">❌</td>
4444
<template v-if="summary.regressions.count !== 0">
4545
<td>
@@ -48,7 +48,7 @@ const summary = computed(() => props.summary);
4848
<td>
4949
<SummaryPercentValue :value="summary.regressions.average" />
5050
</td>
51-
<td>
51+
<td class="positive">
5252
<SummaryCount
5353
:cases="summary.regressions.count"
5454
:benchmarks="summary.regressions.benchmarks"
@@ -59,7 +59,7 @@ const summary = computed(() => props.summary);
5959
<td colspan="3" style="text-align: center">No regressions</td>
6060
</template>
6161
</tr>
62-
<tr class="negative">
62+
<tr>
6363
<td title="Improvements" v-if="withLegend">✅</td>
6464
<template v-if="summary.improvements.count !== 0">
6565
<td>
@@ -68,7 +68,7 @@ const summary = computed(() => props.summary);
6868
<td>
6969
<SummaryPercentValue :value="summary.improvements.average" />
7070
</td>
71-
<td>
71+
<td class="negative">
7272
<SummaryCount
7373
:cases="summary.improvements.count"
7474
:benchmarks="summary.improvements.benchmarks"

site/frontend/src/pages/compare/tabs.vue

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {CompareResponse, Tab} from "./types";
66
import {diffClass, percentClass} from "./shared";
77
import {SummaryGroup} from "./data";
88
import SummaryPercentValue from "./summary/percent-value.vue";
9+
import SummaryRange from "./summary/range.vue";
910
1011
const props = withDefaults(
1112
defineProps<{
@@ -55,24 +56,14 @@ const activeTab: Ref<Tab> = ref(props.initialTab);
5556
<table>
5657
<thead>
5758
<tr>
58-
<th>min</th>
59-
<th>max</th>
60-
<th>avg</th>
59+
<th>Range</th>
60+
<th>Mean</th>
6161
</tr>
6262
</thead>
6363
<thead>
6464
<tr>
6565
<td>
66-
<SummaryPercentValue
67-
:class="percentClass(compileTimeSummary.all.range[0])"
68-
:value="compileTimeSummary.all.range[0]"
69-
/>
70-
</td>
71-
<td>
72-
<SummaryPercentValue
73-
:class="percentClass(compileTimeSummary.all.range[1])"
74-
:value="compileTimeSummary.all.range[1]"
75-
/>
66+
<SummaryRange :range="compileTimeSummary.all.range" />
7667
</td>
7768
<td>
7869
<SummaryPercentValue
@@ -94,15 +85,15 @@ const activeTab: Ref<Tab> = ref(props.initialTab);
9485
@click="changeTab(Tab.Bootstrap)"
9586
>
9687
<div class="title">Bootstrap</div>
97-
<div
98-
:class="{[diffClass(bootstrapB - bootstrapA)]: bootstrapValid}"
99-
class="summary"
100-
>
88+
<div class="summary">
10189
<div>
10290
{{ formatBootstrap(bootstrapA) }} ->
10391
{{ formatBootstrap(bootstrapB) }}
10492
</div>
105-
<div v-if="bootstrapValid">
93+
<div
94+
v-if="bootstrapValid"
95+
:class="{[diffClass(bootstrapB - bootstrapA)]: bootstrapValid}"
96+
>
10697
{{ ((bootstrapB - bootstrapA) / 10e8).toFixed(1) }}s ({{
10798
(((bootstrapB - bootstrapA) / bootstrapA) * 100).toFixed(3)
10899
}}%)
@@ -161,7 +152,8 @@ const activeTab: Ref<Tab> = ref(props.initialTab);
161152
162153
.title {
163154
font-weight: bold;
164-
margin-bottom: 4px;
155+
font-size: 1.1em;
156+
margin-bottom: 5px;
165157
}
166158
167159
.selected {

0 commit comments

Comments
 (0)