This commit is contained in:
2026-06-21 22:14:04 -04:00
commit 533aec8ba2
46 changed files with 3530 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
<script setup lang="ts">
import { computed } from 'vue'
import { METRICS, formatValue } from '../services/units'
import type { DataRow } from '../services/api'
const props = defineProps<{
metricKey: string
data: DataRow
}>()
const emit = defineEmits<{ (e: 'click', key: string): void }>()
const meta = computed(() => METRICS[props.metricKey])
const value = computed(() => formatValue(props.metricKey, props.data[props.metricKey] as number | null))
const label = computed(() => props.data[`${props.metricKey.replace(/_[^_]+$/, '')}_label`] as string | undefined)
</script>
<style scoped lang="scss">
.card {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 14px;
border-radius: 10px;
background: var(--surface);
border: 1px solid var(--border);
cursor: pointer;
transition: background 0.15s, transform 0.1s;
user-select: none;
&:hover { background: var(--hover); }
&:active { transform: scale(0.97); }
}
.icon {
font-size: 22px;
line-height: 1;
flex-shrink: 0;
}
.info {
flex: 1;
min-width: 0;
}
.metric-label {
font-size: 11px;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
white-space: nowrap;
}
.metric-value {
font-size: 18px;
font-weight: 600;
color: var(--text);
white-space: nowrap;
}
.metric-sub {
font-size: 11px;
color: var(--text-muted);
}
</style>
<template>
<div class="card" @click="emit('click', metricKey)">
<span class="icon">{{ meta?.icon ?? '📊' }}</span>
<div class="info">
<div class="metric-label">{{ meta?.label ?? metricKey }}</div>
<div class="metric-value">{{ value }}</div>
<div v-if="label" class="metric-sub">{{ label }}</div>
</div>
</div>
</template>