Skip to content

Commit f70ee35

Browse files
committed
feat(metric): Use MetricViewEnum for period selection
1 parent a61b7a5 commit f70ee35

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

resources/views/components/metric.blade.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
'metric',
33
])
44

5+
@use('\Cachet\Enums\MetricViewEnum')
6+
57
<div x-data="chart">
68
<div class="flex flex-col gap-2">
79
<div class="flex items-center gap-1.5">
@@ -19,10 +21,9 @@
1921

2022
<!-- Period Selector -->
2123
<select x-model="period" class="ml-auto rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm font-medium">
22-
<option value="0">Last Hour</option>
23-
<option value="1">Today</option>
24-
<option value="2">Week</option>
25-
<option value="3">Month</option>
24+
@foreach([MetricViewEnum::last_hour, MetricViewEnum::today, MetricViewEnum::week, MetricViewEnum::month] as $value)
25+
<option value="{{ $value }}">{{ $value->getLabel() }}</option>
26+
@endforeach
2627
</select>
2728
</div>
2829
<canvas x-ref="canvas" height="300" class="ring-1 ring-gray-900/5 dark:ring-gray-100/10 bg-gray-50 dark:bg-gray-800 rounded-md shadow-sm text-white"></canvas>

0 commit comments

Comments
 (0)