This commit is contained in:
Stefanescu Mihai
2026-03-19 19:47:06 +02:00
parent e8d2728d57
commit eb735a9a98
19 changed files with 860 additions and 9 deletions
@@ -0,0 +1,75 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Notifications</h2>
@if(Auth::user()->unreadNotifications->count() > 0)
<form method="POST" action="{{ route('notifications.mark-all-read') }}">
@csrf
<x-secondary-button type="submit">Mark All as Read</x-secondary-button>
</form>
@endif
</div>
</x-slot>
<div class="py-8">
<div class="max-w-3xl mx-auto sm:px-6 lg:px-8">
@if(session('status'))
<div class="mb-4 bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-md text-sm">
{{ session('status') }}
</div>
@endif
@if($notifications->isEmpty())
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-12 text-center text-gray-500">
No notifications yet.
</div>
@else
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg divide-y divide-gray-200">
@foreach($notifications as $notification)
@php
$data = $notification->data;
$isUnread = $notification->read_at === null;
$typeLabel = match($data['type'] ?? '') {
'new_issue' => 'New Issue',
'regression' => 'Regression',
'spike' => 'Spike',
default => 'Notification',
};
$typeColor = match($data['type'] ?? '') {
'new_issue' => 'bg-blue-100 text-blue-800',
'regression' => 'bg-orange-100 text-orange-800',
'spike' => 'bg-red-100 text-red-800',
default => 'bg-gray-100 text-gray-600',
};
@endphp
<a href="{{ route('notifications.read', $notification->id) }}"
class="block px-6 py-4 hover:bg-gray-50 transition {{ $isUnread ? 'bg-indigo-50/30' : '' }}">
<div class="flex items-start gap-3">
@if($isUnread)
<span class="mt-2 w-2 h-2 rounded-full bg-indigo-500 shrink-0"></span>
@else
<span class="mt-2 w-2 h-2 shrink-0"></span>
@endif
<div class="flex-1 min-w-0">
<div class="flex items-center gap-2 mb-1">
<span class="inline-flex px-2 py-0.5 rounded-full text-[10px] font-semibold {{ $typeColor }}">{{ $typeLabel }}</span>
<span class="text-xs text-gray-400">{{ $data['project_name'] ?? '' }}</span>
<span class="text-xs text-gray-400 ml-auto">{{ $notification->created_at->diffForHumans() }}</span>
</div>
<p class="text-sm text-gray-900 truncate">{{ $data['issue_title'] ?? '' }}</p>
@if(($data['type'] ?? '') === 'spike')
<p class="text-xs text-gray-500 mt-0.5">{{ $data['event_count'] ?? 0 }} events in {{ $data['window_minutes'] ?? 0 }}m</p>
@endif
</div>
</div>
</a>
@endforeach
</div>
<div class="mt-4">
{{ $notifications->links() }}
</div>
@endif
</div>
</div>
</x-app-layout>