Skip to content

Commit 127a19e

Browse files
authored
Incident Timeline and Schedule Localization (#98)
1 parent 9328849 commit 127a19e

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

resources/lang/en.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"Settings": "Settings",
4141
"Setup Cachet": "Setup Cachet",
4242
"Show Dashboard Link": "Show Dashboard Link",
43-
"Showing :from - :to": "Showing :from - :to",
4443
"Status Page": "Status Page",
4544
"Subscriber": "Subscriber",
4645
"Sum": "Sum",

resources/views/components/incident-timeline.blade.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
<div>
44
<h2 class="text-2xl font-semibold">{{ __('Past Incidents') }}</h2>
55
</div>
6-
<div class="text-sm text-zinc-500 dark:text-zinc-400">
7-
{{ __('Showing :from - :to', ['from' => $from, 'to' => $to]) }}
6+
<div class="flex items-center gap-2 text-sm text-zinc-500 dark:text-zinc-400" x-data="{ from: new Date(@js($from)), to: new Date(@js($to)) }">
7+
<div><x-heroicon-m-calendar class="size-4" /></div>
8+
<div><span x-html="from.toLocaleDateString()"></span> &mdash; <span x-html="to.toLocaleDateString()"></span></div>
89
</div>
910
</div>
1011

resources/views/components/incident.blade.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
'incidents',
44
])
55

6-
<div class="relative flex flex-col gap-5">
7-
<h3 class="text-xl font-semibold">{{ $date }}</h3>
6+
<div class="relative flex flex-col gap-5" x-data="{ forDate: new Date(@js($date)) }">
7+
<h3 class="text-xl font-semibold" x-html="forDate.toLocaleDateString()"></h3>
88
@forelse($incidents as $incident)
9-
<div class="bg-white border divide-y rounded-lg ml-9 dark:divide-zinc-700 dark:border-zinc-700 dark:bg-zinc-800">
9+
<div x-data="{ timestamp: new Date(@js($incident->timestamp)) }" class="bg-white border divide-y rounded-lg ml-9 dark:divide-zinc-700 dark:border-zinc-700 dark:bg-zinc-800">
1010
<div @class([
1111
'flex flex-col bg-zinc-50 p-4 dark:bg-zinc-900 gap-2',
1212
'rounded-t-lg' => $incident->incidentUpdates->isNotEmpty(),
@@ -19,7 +19,7 @@
1919
<a href="{{ route('cachet.status-page.incident', $incident) }}">{{ $incident->name}}</a>
2020
</h3>
2121
<span class="text-xs text-zinc-500 dark:text-zinc-400">
22-
{{ $incident->timestamp->diffForHumans() }}{{ $incident->timestamp->toDayDateTimeString() }}
22+
{{ $incident->timestamp->diffForHumans() }}<span x-text="timestamp.toLocaleString()"></span>
2323
</span>
2424
</div>
2525
<div class="flex justify-start sm:justify-end">
@@ -40,10 +40,12 @@
4040
</div>
4141
<div class="flex flex-col px-4 divide-y dark:divide-zinc-700">
4242
@foreach ($incident->incidentUpdates as $update)
43-
<div class="relative py-4">
43+
<div class="relative py-4" x-data="{ timestamp: new Date(@js($update->created_at)) }">
4444
<x-cachet::incident-update-status :update="$update" />
4545
{{-- <h3 class="text-lg font-semibold">Incident Update Title</h3>--}}
46-
<span class="text-xs text-zinc-500 dark:text-zinc-400">{{ $update->created_at->diffForHumans() }}{{ $update->created_at->toDayDateTimeString() }}</span>
46+
<span class="text-xs text-zinc-500 dark:text-zinc-400">
47+
{{ $update->created_at->diffForHumans() }} — <span x-text="timestamp.toLocaleString()"></span>
48+
</span>
4749
<div class="mt-1 prose-sm md:prose md:prose-zinc dark:text-zinc-100">
4850
{!! $update->formattedMessage() !!}
4951
</div>

resources/views/components/schedule.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<li class="p-4">
1+
<li class="p-4" x-data="{ timestamp: new Date(@js($schedule->scheduled_at)) }">
22
<div class="flex flex-col-reverse items-start justify-between gap-4 md:flex-row md:items-center">
33
<div class="flex items-start gap-2.5">
44
<span class="mt-1.5 h-3 w-3 shrink-0 rounded-full bg-orange-200 animate-pulse"></span>
@@ -7,10 +7,10 @@
77
<h3 class="font-semibold leading-6">{{ $schedule->name }}</h3>
88
<div class="flex grow text-sm sm:text-xs gap-2 text-zinc-500 dark:text-zinc-400 items-center">
99
@svg('cachet-clock', 'size-4 hidden sm:block')
10-
<span>{{ $schedule->scheduled_at->toFormattedDayDateString() }}</span>
10+
<span x-text="timestamp.toLocaleString()"></span>
1111
</div>
1212
</div>
13-
<div class="prose-sm md:prose md:prose-zinc dark:prose-invert mt-1">
13+
<div class="prose-sm md:prose md:prose-zinc dark:text-zinc-100">
1414
{!! $schedule->formattedMessage() !!}
1515
</div>
1616
</div>

0 commit comments

Comments
 (0)