feat: implement multiline toast notification for new incoming emails

This commit is contained in:
idevakk
2026-03-06 03:14:40 +05:30
parent c35206664d
commit 5eb2c3b41f
2 changed files with 9 additions and 1 deletions

View File

@@ -101,6 +101,14 @@ class Mailbox extends Component
public function onNewEmail(array $eventData): void
{
$sender = ($eventData['sender_name'] ?? null) ?: ($eventData['sender_email'] ?? 'Unknown');
$subject = ($eventData['subject'] ?? null) ?: '(No Subject)';
$this->dispatch('notify',
message: "Sender: {$sender}\nSubject: {$subject}",
type: 'info'
);
// Simply refresh the list to pick up the new email from MariaDB
// Since we order by received_at DESC, it will appear on top.
$this->dispatch('$refresh');

View File

@@ -81,7 +81,7 @@
<div class="flex-1 min-w-0">
<div class="text-[10px] font-black uppercase tracking-[0.2em] opacity-40 mb-0.5" x-text="toast.type"></div>
<div class="text-[11px] font-bold tracking-wide" x-text="toast.msg"></div>
<div class="text-[11px] font-bold tracking-wide whitespace-pre-wrap" x-text="toast.msg"></div>
</div>
<button @click="toasts = toasts.filter(t => t.id !== toast.id)"