feat: implement multiline toast notification for new incoming emails
This commit is contained in:
@@ -101,6 +101,14 @@ class Mailbox extends Component
|
|||||||
|
|
||||||
public function onNewEmail(array $eventData): void
|
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
|
// Simply refresh the list to pick up the new email from MariaDB
|
||||||
// Since we order by received_at DESC, it will appear on top.
|
// Since we order by received_at DESC, it will appear on top.
|
||||||
$this->dispatch('$refresh');
|
$this->dispatch('$refresh');
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
<div class="flex-1 min-w-0">
|
<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-[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>
|
</div>
|
||||||
|
|
||||||
<button @click="toasts = toasts.filter(t => t.id !== toast.id)"
|
<button @click="toasts = toasts.filter(t => t.id !== toast.id)"
|
||||||
|
|||||||
Reference in New Issue
Block a user