Files
hstream/resources/views/profile/notifications.blade.php
2026-07-25 13:54:21 +02:00

84 lines
5.0 KiB
PHP

<x-profile-layout>
<div class="space-y-5">
{{-- Header --}}
<div class="flex items-center justify-between">
<h2 class="text-xl font-bold text-gray-900 dark:text-gray-100 flex items-center gap-2">
<i class="fa-solid fa-bell text-rose-500"></i>
Notifications
</h2>
@if($notifications->isNotEmpty())
<form method="POST" action="{{ route('profile.notifications.delete') }}" class="hidden sm:block">
@csrf
@method('delete')
<button type="submit"
class="inline-flex items-center gap-1.5 rounded-lg border border-red-200 dark:border-red-800/50 px-3 py-1.5 text-xs font-medium text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/30 transition-colors">
<i class="fa-solid fa-trash-can text-[10px]"></i>
Clear All
</button>
</form>
@endif
</div>
@forelse($notifications as $notification)
<div class="group relative rounded-xl bg-white/40 dark:bg-neutral-950/40 backdrop-blur shadow-sm ring-1 ring-black/5 dark:ring-white/5 hover:shadow-md transition-all duration-200 overflow-hidden">
{{-- Unread indicator --}}
@if(is_null($notification->read_at))
<div class="absolute left-0 top-0 bottom-0 w-1 bg-rose-500"></div>
@endif
<div class="p-4 sm:p-5 {{ is_null($notification->read_at) ? 'pl-5 sm:pl-6' : '' }}">
<div class="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3">
{{-- Content --}}
<div class="flex-1 min-w-0">
<div class="flex items-center gap-2 mb-1.5">
<span class="inline-flex items-center gap-1 rounded-full bg-rose-100 dark:bg-rose-900/30 px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide text-rose-700 dark:text-rose-400">
<i class="fa-solid fa-tag text-[9px]"></i>
{{ $notification->data['type'] ?? 'Notification' }}
</span>
<span class="text-xs text-gray-400 dark:text-gray-500">
{{ $notification->created_at->diffForHumans(['parts' => 1]) }}
</span>
</div>
<p class="text-sm text-gray-700 dark:text-gray-300 leading-relaxed">
{{ $notification->data['message'] ?? '' }}
</p>
</div>
{{-- Actions --}}
<div class="flex items-center gap-2 shrink-0">
@if(isset($notification->data['url']))
<a href="{{ $notification->data['url'] }}"
class="inline-flex items-center gap-1 rounded-lg bg-rose-600 px-3.5 py-2 text-xs font-semibold text-white hover:bg-rose-700 shadow-sm shadow-rose-600/20 transition-all duration-150 hover:shadow-md hover:shadow-rose-600/25">
Open
<i class="fa-solid fa-arrow-right text-[10px]"></i>
</a>
@endif
<form method="POST" action="{{ route('profile.notifications.delete') }}">
@csrf
@method('delete')
<input type="hidden" value="{{ $notification->id }}" name="id">
<button type="submit"
class="inline-flex items-center rounded-lg p-2 text-gray-400 hover:bg-red-50 dark:hover:bg-red-950/30 hover:text-red-500 dark:hover:text-red-400 transition-colors"
title="Delete">
<i class="fa-solid fa-xmark text-sm"></i>
</button>
</form>
</div>
</div>
</div>
</div>
@empty
<div class="rounded-2xl bg-white/40 dark:bg-neutral-950/40 backdrop-blur shadow-sm ring-1 ring-black/5 dark:ring-white/5 p-12 text-center">
<div class="inline-flex h-20 w-20 items-center justify-center rounded-full bg-gray-100 dark:bg-neutral-800 mb-4">
<i class="fa-solid fa-bell-slash text-3xl text-gray-400 dark:text-gray-500"></i>
</div>
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300">No notifications</h3>
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">You're all caught up! Nothing new here.</p>
</div>
@endforelse
</div>
</x-profile-layout>