Skip to content

Commit 92f3011

Browse files
committed
web: the newest supported version is the cell headline
1 parent 3149dc2 commit 92f3011

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

‎web/src/components/CompatCell.vue‎

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,21 @@ import StateIcon from "./StateIcon.vue";
99
const props = defineProps<{ summary: CellSummary; toolchain: string; open: boolean }>();
1010
const emit = defineEmits<{ toggle: [] }>();
1111
12-
/** The cell speaks for the newest stable toolchain version; everything older lives in the timeline. */
13-
const state = computed<CellState>(() => props.summary.latest?.cell.state ?? "unverified");
12+
/**
13+
* The headline is the newest stable version that works; when the newest one
14+
* does not, it moves to a secondary line with its problem. Older versions
15+
* live in the timeline.
16+
*/
17+
const primary = computed(() => props.summary.latestSupported ?? props.summary.latest);
18+
const secondary = computed(() => (props.summary.latestSupported ? props.summary.latest : undefined));
19+
const state = computed<CellState>(() => primary.value?.cell.state ?? "unverified");
20+
const SECONDARY_LABEL: Record<CellState, string> = {
21+
verified: "verified",
22+
declared: "declared",
23+
unverified: "unverified",
24+
advisory: "advisory",
25+
unsupported: "unsupported",
26+
};
1427
const flagged = computed(() => props.summary.advisories.length > 0);
1528
1629
const TEXT: Record<CellState, string> = {
@@ -46,15 +59,15 @@ const background = computed(() => {
4659
@keydown.space.prevent="emit('toggle')"
4760
>
4861
<StateIcon :state="state" :size="22" class="mx-auto" />
49-
<span class="mt-1 block tabular-nums" :class="TEXT[state]">{{ summary.latest?.version ?? "No data" }}</span>
62+
<span class="mt-1 block tabular-nums" :class="TEXT[state]">{{ primary?.version ?? "No data" }}</span>
5063
<span
51-
v-if="summary.latestSupported"
64+
v-if="secondary"
5265
class="mt-0.5 flex items-center justify-center gap-1 text-[11px] tabular-nums"
53-
:title="`${summary.latestSupported.version}: ${summary.latestSupported.cell.reason}`"
66+
:title="`${secondary.version}: ${secondary.cell.reason}`"
5467
>
55-
<StateIcon :state="summary.latestSupported.cell.state" :size="12" />
56-
<span class="font-medium text-ok">{{ summary.latestSupported.version }}</span>
57-
<span class="text-neutral-500 dark:text-neutral-400">supported</span>
68+
<StateIcon :state="secondary.cell.state" :size="12" />
69+
<span class="font-medium" :class="TEXT[secondary.cell.state]">{{ secondary.version }}</span>
70+
<span class="text-neutral-500 dark:text-neutral-400">{{ SECONDARY_LABEL[secondary.cell.state] }}</span>
5871
</span>
5972
<span
6073
v-if="summary.prerelease"

0 commit comments

Comments
 (0)