correlations
All checks were successful
CI / ci (push) Successful in 18m51s

This commit is contained in:
2026-08-29 13:15:46 +02:00
parent 128e66abda
commit 4345f2322f
4 changed files with 22 additions and 3 deletions

View File

@@ -30,7 +30,9 @@ self.addEventListener("activate", (event) => {
.keys()
.then((keys) =>
Promise.all(
keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))
keys
.filter((key) => key !== CACHE_NAME)
.map((key) => caches.delete(key))
)
)
.then(() => self.clients.claim())

View File

@@ -317,6 +317,8 @@ export type DateSpanParams = z.infer<typeof DateSpanParams>
export const CorrelationInputPayload = z.discriminatedUnion("kind", [
z.object({ kind: z.literal("metric"), metric: MetricKind }),
z.object({ kind: z.literal("moonPhase") }),
z.object({ kind: z.literal("cycleProgress") }),
z.object({ kind: z.literal("temperature") }),
z.object({
kind: z.literal("activity"),
activityId: uuid,

View File

@@ -28,7 +28,10 @@ export function MetricRow({
return (
<div className="flex flex-col gap-1.5">
<Label htmlFor={inputId} className="flex items-center gap-2 text-xs">
<Icon className="h-3.5 w-3.5 text-muted-foreground" aria-hidden="true" />
<Icon
className="h-3.5 w-3.5 text-muted-foreground"
aria-hidden="true"
/>
{field.label}
<span className="text-muted-foreground">({field.unit})</span>
</Label>

View File

@@ -21,6 +21,10 @@ function labelOf(row: CorrelationRowResponse): string {
}
case "moonPhase":
return "Moon phase"
case "cycleProgress":
return "Cycle progress"
case "temperature":
return "Temperature"
case "activity":
return input.name
}
@@ -34,8 +38,12 @@ function orderOf(row: CorrelationRowResponse): number {
return METRIC_FIELDS.findIndex((f) => f.kind === input.metric)
case "moonPhase":
return METRIC_FIELDS.length
case "activity":
case "cycleProgress":
return METRIC_FIELDS.length + 1
case "temperature":
return METRIC_FIELDS.length + 2
case "activity":
return METRIC_FIELDS.length + 3
}
}
@@ -84,6 +92,10 @@ function rowKey(row: CorrelationRowResponse): string {
return `metric:${input.metric}`
case "moonPhase":
return "moonPhase"
case "cycleProgress":
return "cycleProgress"
case "temperature":
return "temperature"
case "activity":
return `activity:${input.activityId}`
}