Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 2x 3x 2x 2x 2x 3x 3x 3x | <template>
<ol class="flex h-4 min-w-xl gap-px">
<li
v-for="cell in cells"
:key="cell.day"
class="min-w-0 flex-1 rounded-xs"
:class="!cell.style.background && 'bg-accented/40'"
:style="cell.style"
:title="cell.label"
/>
</ol>
</template>
<script setup lang="ts">
import type { DayUsage } from "#layers/snapshot/shared/types/DayUsage.ts";
interface Props {
days: string[];
usage: DayUsage[];
/** The darkest step, shared by every strip that should be read against this one. */
busiest: number;
}
const { days, usage, busiest } = defineProps<Props>();
const { t } = useI18n();
const cells = computed(() =>
days.map((day, index) => {
const { runs = 0, failures = 0 } = usage[index] ?? {};
const named = { day: calendarDay(day), runs: t("telemetryDayStrip.runs", runs), failures };
return {
day,
style: {
background: heatColor("--usage-runs", runs, busiest),
boxShadow: failures > 0 ? FAILED_MARK : undefined,
},
label:
failures > 0
? t("telemetryDayStrip.cellFailed", named)
: t("telemetryDayStrip.cell", named),
};
}),
);
</script>
|