Notifikasi
Setiap produk Sosialoka mengabarkan perubahan di dua tempat yang sama: panel di bawah lonceng di header, dan halaman notifikasi yang berisi semuanya. Keduanya memakai baris yang sama, jadi sebuah notifikasi terlihat sama di mana pun ia muncul.
Kapan dipakai
Section titled “Kapan dipakai”- Pakai panel untuk melihat sekilas: notifikasi terbaru dan cara menghapus badge.
- Pakai halaman untuk menelusuri semuanya, per kategori atau yang belum dibaca saja.
- Untuk pesan tentang halaman yang sedang dibuka, pakai Alert atau toast, bukan notifikasi.
Anatomi
Section titled “Anatomi”Halaman
Section titled “Halaman”- Header: judul “Notifikasi”, satu baris keterangan, dan “Tandai semua dibaca”.
- Chip kategori: chip Toggle Group, “Semua” paling depan, masing-masing dengan jumlah yang belum dibaca.
- Kartu: saklar Semua / Belum dibaca dan menu halaman di atas, lalu baris yang dikelompokkan jadi “Hari ini” dan “Sebelumnya”, lalu “Muat lagi”.
- Ikon: ikon kategori di dalam lingkaran netral.
- Judul: tebal selama belum dibaca.
- Isi: satu atau dua baris.
- Waktu dan kategori: “5 menit lalu · Pembayaran”. Tanggal dan jam lengkap muncul sebagai tooltip.
- Titik belum dibaca di ujung, lalu menu baris di sebelahnya.
- Lonceng:
DashboardIconButtondari header Dasbor, dengan jumlah yang belum dibaca sebagai badge. - Popover: lebar 360px, dengan “Notifikasi”, “Tandai semua dibaca”, dan saklar Semua / Belum dibaca di atas.
- Baris: maksimal 8, dikelompokkan per waktu, sama dengan baris di halaman.
- Footer: “Lihat semua notifikasi” membuka halamannya.
Aturan
Section titled “Aturan”- Tandai semua dibaca berlaku untuk kategori yang sedang aktif. Nonaktifkan tombolnya kalau tidak ada yang belum dibaca di situ.
- Chip kategori selalu punya satu kategori aktif: “Semua” sebagai bawaan, dan klik pada chip yang aktif tetap membuatnya aktif. Jumlahnya dibacakan sebagai kata, misalnya “Pembayaran (1 belum dibaca)”. Di HP, chip tetap satu baris yang bisa digulir ke samping; mulai
sm, chip turun ke baris baru. Kategori dan saklarnya disimpan di URL, sama seperti filter list. - Badge: jumlah yang belum dibaca, “99+” kalau lebih dari 99, dan tidak tampil saat nol. Nama tombol lonceng ikut membawa jumlahnya, misalnya “Notifikasi (3)”.
- Panel: maksimal 8 baris. Di HP, lonceng membuka halaman, bukan popover.
- Klik menandai notifikasi sebagai dibaca dan membuka halaman yang dibahasnya. Notifikasi tanpa tujuan hanya ditandai dibaca.
- Menu baris: beri tombolnya nama sesuai barisnya (“Aksi untuk Royalti Oktober sudah masuk”). “Tandai dibaca” atau “Tandai belum dibaca” di depan, lalu “Hapus” paling akhir, setelah pemisah. Hapus bersifat opsional: hilangkan kalau produknya belum bisa menghapus notifikasi. Setelah dihapus, fokus pindah ke baris berikutnya.
- Hapus yang sudah dibaca bertanya dulu lewat Alert Dialog, karena notifikasi yang dihapus tidak bisa kembali. Item ini nonaktif kalau tidak ada lagi yang sudah dibaca.
- Ikon menandai kategori dengan warna netral, jangan warna brand, supaya hanya yang belum dibaca yang menonjol.
- Waktu: relatif (“5 menit lalu”, “Kemarin”). Tanggal dan jam lengkapnya muncul saat kursor diarahkan dan dibacakan oleh pembaca layar.
- Lainnya: “Muat lagi” di bawah baris, bukan nomor halaman; notifikasi dibaca dari yang terbaru.
- State: kategori kosong menampilkan “Belum ada notifikasi di kategori ini.” dan tampilan belum dibaca yang kosong menampilkan “Semua notifikasi sudah kamu baca.”. Memuat dan error mengikuti Kosong, memuat, dan error.
import { useEffect, useRef, useState } from "react"import { CheckCheckIcon, DiscIcon, FileCheckIcon, FileTextIcon, InfoIcon, MoreHorizontalIcon, WalletIcon, type LucideIcon,} from "lucide-react"import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle,} from "@/components/ui/alert-dialog"import { Button } from "@/components/ui/button"import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
type Category = "Pembayaran" | "Clearance" | "Laporan" | "Rilis" | "Umum"
interface Notification { id: number category: Category title: string body: string /** Relative time shown in the row. */ time: string /** Full date and time, shown as the tooltip of the relative time. */ at: string /** ISO date for the <time> element. */ iso: string group: "Hari ini" | "Sebelumnya" read: boolean /** The page the notification is about. Without one, a click only marks it read. */ href?: string}
const ICONS: Record<Category, LucideIcon> = { Pembayaran: WalletIcon, Clearance: FileCheckIcon, Laporan: FileTextIcon, Rilis: DiscIcon, Umum: InfoIcon,}
const CATEGORIES: Category[] = ["Pembayaran", "Clearance", "Laporan", "Rilis", "Umum"]
const NOTIFICATIONS: Notification[] = [ { id: 1, category: "Pembayaran", title: "Royalti Oktober sudah masuk", body: "Rp1.250.000,00 masuk ke saldomu.", time: "5 menit lalu", at: "17 Nov 2026, 14.20", iso: "2026-11-17T14:20", group: "Hari ini", read: false, href: "#saldo" }, { id: 2, category: "Clearance", title: 'Clearance "Langit Jingga" disetujui', body: "Videomu siap tayang.", time: "1 jam lalu", at: "17 Nov 2026, 13.25", iso: "2026-11-17T13:25", group: "Hari ini", read: false, href: "#clearance" }, { id: 3, category: "Laporan", title: "Laporan royalti Oktober siap", body: "Cek pendapatan tiap platform.", time: "3 jam lalu", at: "17 Nov 2026, 11.05", iso: "2026-11-17T11:05", group: "Hari ini", read: false, href: "#laporan" }, { id: 4, category: "Rilis", title: '"Senja di Kota" tayang di Spotify', body: "Rilismu sudah bisa diputar.", time: "Kemarin", at: "16 Nov 2026, 19.40", iso: "2026-11-16T19:40", group: "Sebelumnya", read: true, href: "#rilis" }, { id: 5, category: "Pembayaran", title: "Tagihan langganan November", body: "Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.", time: "Kemarin", at: "16 Nov 2026, 09.00", iso: "2026-11-16T09:00", group: "Sebelumnya", read: true, href: "#tagihan" }, { id: 6, category: "Clearance", title: 'Clearance "Kaset Pertama" perlu diperbaiki', body: "Cek catatan dari tim kami, lalu kirim ulang.", time: "2 hari lalu", at: "15 Nov 2026, 10.15", iso: "2026-11-15T10:15", group: "Sebelumnya", read: true, href: "#clearance" }, { id: 7, category: "Umum", title: "Kata sandimu baru saja diganti", body: "Bukan kamu? Segera hubungi kami.", time: "3 hari lalu", at: "14 Nov 2026, 08.30", iso: "2026-11-14T08:30", group: "Sebelumnya", read: true }, { id: 8, category: "Rilis", title: '"Pulang Sore" dijadwalkan 28 Nov 2026', body: "Kami kirim ke semua platform di tanggal itu.", time: "4 hari lalu", at: "13 Nov 2026, 16.45", iso: "2026-11-13T16:45", group: "Sebelumnya", read: true, href: "#rilis" }, { id: 9, category: "Laporan", title: "Laporan royalti September siap", body: "Cek pendapatan tiap platform.", time: "14 Okt 2026", at: "14 Okt 2026, 10.00", iso: "2026-10-14T10:00", group: "Sebelumnya", read: true, href: "#laporan" }, { id: 10, category: "Pembayaran", title: "Royalti September sudah masuk", body: "Rp980.000,00 masuk ke saldomu.", time: "13 Okt 2026", at: "13 Okt 2026, 15.10", iso: "2026-10-13T15:10", group: "Sebelumnya", read: true, href: "#saldo" },]
/** Rows shown before "Muat lagi". */const FIRST_PAGE = 8
/** * One notification: category icon, title (bold while unread), body, time and category, an unread dot, and a menu * beside the row. The row is a link when it has a target, otherwise a button that only marks it read. */function NotificationRow({ notification: n, onOpen, onToggleRead, onRemove,}: { notification: Notification onOpen: () => void onToggleRead: () => void onRemove: () => void}) { const Icon = ICONS[n.category] const content = ( <> <span className="flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground"> <Icon className="size-4" /> </span> <span className="min-w-0 flex-1"> <span className={n.read ? "block text-sm" : "block text-sm font-semibold"}>{n.title}</span> <span className="mt-0.5 line-clamp-2 block text-sm text-muted-foreground">{n.body}</span> <span className="mt-1 block text-xs text-muted-foreground"> <time dateTime={n.iso} title={n.at}> {n.time} </time> <span className="sr-only">, {n.at}</span> {" · "} {n.category} </span> </span> {n.read ? null : ( <> <span aria-hidden="true" className="mt-1.5 size-2 shrink-0 rounded-full bg-primary" /> <span className="sr-only">Belum dibaca</span> </> )} </> ) const rowClass = "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-2 py-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50" return ( <li className={n.read ? "flex items-start gap-1 px-2 py-1" : "flex items-start gap-1 bg-muted/50 px-2 py-1"}> {n.href ? ( <a href={n.href} data-notification={n.id} className={rowClass} onClick={onOpen}> {content} </a> ) : ( <button type="button" data-notification={n.id} className={rowClass} onClick={onOpen}> {content} </button> )} <DropdownMenu> <DropdownMenuTrigger render={<Button variant="ghost" size="icon-sm" className="mt-1.5" aria-label={`Aksi untuk ${n.title}`} />} > <MoreHorizontalIcon /> </DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuItem onClick={onToggleRead}>{n.read ? "Tandai belum dibaca" : "Tandai dibaca"}</DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem variant="destructive" onClick={onRemove}> Hapus </DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> </li> )}
/** * The notifications page: the title and "Tandai semua dibaca" for the selected category, category chips with unread * counts, then a card with the Semua / Belum dibaca switch, the page menu, rows grouped by time and "Muat lagi". * Keep the category and the switch in the URL in a real product, as list filters do. */export default function NotificationsPageDemo() { const [items, setItems] = useState(NOTIFICATIONS) const [visible, setVisible] = useState(FIRST_PAGE) const [category, setCategory] = useState<"semua" | Category>("semua") const [show, setShow] = useState<"semua" | "belum">("semua") const [confirmRemoveRead, setConfirmRemoveRead] = useState(false) /** After a delete, focus moves to the next row (or the previous one, or the empty text) instead of the page. */ const [focusAfterRemove, setFocusAfterRemove] = useState<number | "empty" | null>(null) const emptyRef = useRef<HTMLParagraphElement>(null) /** A new filter starts again from the first page. */ const pickCategory = (value: "semua" | Category) => { setCategory(value) setVisible(FIRST_PAGE) } const pickShow = (value: "semua" | "belum") => { setShow(value) setVisible(FIRST_PAGE) }
const inCategory = (n: Notification) => category === "semua" || n.category === category const unread = (c: "semua" | Category) => items.filter((n) => !n.read && (c === "semua" || n.category === c)).length const update = (id: number, read: boolean) => setItems((all) => all.map((n) => (n.id === id ? { ...n, read } : n))) const markAllRead = () => setItems((all) => all.map((n) => (inCategory(n) ? { ...n, read: true } : n))) const readCount = items.filter((n) => n.read && inCategory(n)).length const removeRead = () => setItems((all) => all.filter((n) => !(n.read && inCategory(n))))
// Filter first, then page: "Muat lagi" shows only while more of the filtered rows exist. const filtered = items.filter((n) => inCategory(n) && (show === "semua" || !n.read)) const shown = filtered.slice(0, visible) const groups = (["Hari ini", "Sebelumnya"] as const) .map((label) => ({ label, rows: shown.filter((n) => n.group === label) })) .filter((g) => g.rows.length > 0) const empty = show === "belum" ? "Semua notifikasi sudah kamu baca." : "Belum ada notifikasi di kategori ini."
const remove = (id: number) => { const at = shown.findIndex((n) => n.id === id) const next = shown[at + 1] ?? shown[at - 1] setFocusAfterRemove(next ? next.id : "empty") setItems((all) => all.filter((n) => n.id !== id)) } useEffect(() => { if (focusAfterRemove === null) return // Wait a frame: the closing menu returns focus to its trigger first, and that trigger is gone. const frame = requestAnimationFrame(() => { const target = focusAfterRemove === "empty" ? emptyRef.current : document.querySelector<HTMLElement>(`[data-notification="${focusAfterRemove}"]`) target?.focus() setFocusAfterRemove(null) }) return () => cancelAnimationFrame(frame) }, [focusAfterRemove])
return ( <div className="min-h-svh bg-background p-6 text-foreground"> <div className="mx-auto grid max-w-3xl gap-6"> <div className="flex flex-wrap items-start justify-between gap-4"> <div> <h1 className="text-2xl font-semibold">Notifikasi</h1> <p className="mt-1 text-sm text-muted-foreground">Kabar terbaru soal akunmu.</p> </div> <Button variant="outline" disabled={unread(category) === 0} onClick={markAllRead}> <CheckCheckIcon /> Tandai semua dibaca </Button> </div>
<ToggleGroup variant="outline" spacing={2} aria-label="Filter kategori" // One line that scrolls sideways on phones; from sm the chips wrap. className="-mx-1 w-full min-w-0 flex-nowrap overflow-x-auto px-1 pb-1 sm:w-fit sm:flex-wrap sm:overflow-visible" value={[category]} // A category filter always has one value: clicking the active chip keeps it on. onValueChange={(value) => value.length > 0 && pickCategory(value[value.length - 1] as "semua" | Category)} > {(["semua", ...CATEGORIES] as const).map((c) => ( <ToggleGroupItem key={c} value={c} // The count reads as words: "Pembayaran (1 belum dibaca)". aria-label={unread(c) > 0 ? `${c === "semua" ? "Semua" : c} (${unread(c)} belum dibaca)` : undefined} > {c === "semua" ? "Semua" : c} {unread(c) > 0 ? <span className="tabular-nums text-muted-foreground">{unread(c)}</span> : null} </ToggleGroupItem> ))} </ToggleGroup>
<div className="rounded-xl border border-border bg-card"> <div className="flex items-center justify-between gap-2 border-b border-border px-4 py-2"> <ToggleGroup size="sm" aria-label="Tampilkan" value={[show]} onValueChange={(value) => value.length > 0 && pickShow(value[value.length - 1] as "semua" | "belum")} > <ToggleGroupItem value="semua">Semua</ToggleGroupItem> <ToggleGroupItem value="belum">Belum dibaca</ToggleGroupItem> </ToggleGroup> <DropdownMenu> <DropdownMenuTrigger render={<Button variant="ghost" size="icon-sm" aria-label="Opsi notifikasi" />}> <MoreHorizontalIcon /> </DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuItem render={<a href="#pengaturan-notifikasi" />}>Pengaturan notifikasi</DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem variant="destructive" disabled={readCount === 0} onClick={() => setConfirmRemoveRead(true)}> Hapus yang sudah dibaca </DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> <AlertDialog open={confirmRemoveRead} onOpenChange={setConfirmRemoveRead}> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Hapus {readCount} notifikasi yang sudah dibaca?</AlertDialogTitle> <AlertDialogDescription>Notifikasi yang dihapus tidak bisa dikembalikan.</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel autoFocus>Batal</AlertDialogCancel> <AlertDialogAction variant="destructive" onClick={() => { removeRead() setConfirmRemoveRead(false) }} > Hapus </AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> </div>
{groups.length === 0 ? ( <p ref={emptyRef} tabIndex={-1} className="px-4 py-12 text-center text-sm text-muted-foreground outline-none"> {empty} </p> ) : ( groups.map((g) => ( <section key={g.label} aria-label={g.label} className="py-2"> <h2 className="px-4 py-1 text-xs font-medium text-muted-foreground">{g.label}</h2> <ul> {g.rows.map((n) => ( <NotificationRow key={n.id} notification={n} onOpen={() => update(n.id, true)} onToggleRead={() => update(n.id, !n.read)} onRemove={() => remove(n.id)} /> ))} </ul> </section> )) )}
{filtered.length > visible ? ( <div className="border-t border-border p-2 text-center"> <Button variant="ghost" onClick={() => setVisible((v) => v + FIRST_PAGE)}> Muat lagi </Button> </div> ) : null} </div> </div> </div> )}<script setup lang="ts">import { computed, nextTick, ref, type Component } from "vue"import { CheckCheck, Disc, FileCheck, FileText, Info, MoreHorizontal, Wallet } from "@lucide/vue"import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle,} from "@/components/ui/alert-dialog"import { Button } from "@/components/ui/button"import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
/** * The notifications page: the title and "Tandai semua dibaca" for the selected category, category chips with unread * counts, then a card with the Semua / Belum dibaca switch, the page menu, rows grouped by time and "Muat lagi". * Keep the category and the switch in the URL in a real product, as list filters do. */type Category = "Pembayaran" | "Clearance" | "Laporan" | "Rilis" | "Umum"
interface Notification { id: number category: Category title: string body: string /** Relative time shown in the row. */ time: string /** Full date and time, shown as the tooltip of the relative time. */ at: string /** ISO date for the <time> element. */ iso: string group: "Hari ini" | "Sebelumnya" read: boolean /** The page the notification is about. Without one, a click only marks it read. */ href?: string}
const ICONS: Record<Category, Component> = { Pembayaran: Wallet, Clearance: FileCheck, Laporan: FileText, Rilis: Disc, Umum: Info }const CATEGORIES: Category[] = ["Pembayaran", "Clearance", "Laporan", "Rilis", "Umum"]
const NOTIFICATIONS: Notification[] = [ { id: 1, category: "Pembayaran", title: "Royalti Oktober sudah masuk", body: "Rp1.250.000,00 masuk ke saldomu.", time: "5 menit lalu", at: "17 Nov 2026, 14.20", iso: "2026-11-17T14:20", group: "Hari ini", read: false, href: "#saldo" }, { id: 2, category: "Clearance", title: 'Clearance "Langit Jingga" disetujui', body: "Videomu siap tayang.", time: "1 jam lalu", at: "17 Nov 2026, 13.25", iso: "2026-11-17T13:25", group: "Hari ini", read: false, href: "#clearance" }, { id: 3, category: "Laporan", title: "Laporan royalti Oktober siap", body: "Cek pendapatan tiap platform.", time: "3 jam lalu", at: "17 Nov 2026, 11.05", iso: "2026-11-17T11:05", group: "Hari ini", read: false, href: "#laporan" }, { id: 4, category: "Rilis", title: '"Senja di Kota" tayang di Spotify', body: "Rilismu sudah bisa diputar.", time: "Kemarin", at: "16 Nov 2026, 19.40", iso: "2026-11-16T19:40", group: "Sebelumnya", read: true, href: "#rilis" }, { id: 5, category: "Pembayaran", title: "Tagihan langganan November", body: "Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.", time: "Kemarin", at: "16 Nov 2026, 09.00", iso: "2026-11-16T09:00", group: "Sebelumnya", read: true, href: "#tagihan" }, { id: 6, category: "Clearance", title: 'Clearance "Kaset Pertama" perlu diperbaiki', body: "Cek catatan dari tim kami, lalu kirim ulang.", time: "2 hari lalu", at: "15 Nov 2026, 10.15", iso: "2026-11-15T10:15", group: "Sebelumnya", read: true, href: "#clearance" }, { id: 7, category: "Umum", title: "Kata sandimu baru saja diganti", body: "Bukan kamu? Segera hubungi kami.", time: "3 hari lalu", at: "14 Nov 2026, 08.30", iso: "2026-11-14T08:30", group: "Sebelumnya", read: true }, { id: 8, category: "Rilis", title: '"Pulang Sore" dijadwalkan 28 Nov 2026', body: "Kami kirim ke semua platform di tanggal itu.", time: "4 hari lalu", at: "13 Nov 2026, 16.45", iso: "2026-11-13T16:45", group: "Sebelumnya", read: true, href: "#rilis" }, { id: 9, category: "Laporan", title: "Laporan royalti September siap", body: "Cek pendapatan tiap platform.", time: "14 Okt 2026", at: "14 Okt 2026, 10.00", iso: "2026-10-14T10:00", group: "Sebelumnya", read: true, href: "#laporan" }, { id: 10, category: "Pembayaran", title: "Royalti September sudah masuk", body: "Rp980.000,00 masuk ke saldomu.", time: "13 Okt 2026", at: "13 Okt 2026, 15.10", iso: "2026-10-13T15:10", group: "Sebelumnya", read: true, href: "#saldo" },]
/** Rows shown before "Muat lagi". */const FIRST_PAGE = 8
const items = ref(NOTIFICATIONS.map((n) => ({ ...n })))const visible = ref(FIRST_PAGE)const category = ref<"semua" | Category>("semua")const show = ref<"semua" | "belum">("semua")const confirmRemoveRead = ref(false)const emptyText = ref<HTMLElement | null>(null)
const inCategory = (n: Notification) => category.value === "semua" || n.category === category.valueconst unread = (c: "semua" | Category) => items.value.filter((n) => !n.read && (c === "semua" || n.category === c)).lengthconst update = (id: number, read: boolean) => { items.value = items.value.map((n) => (n.id === id ? { ...n, read } : n))}/** After a delete, focus moves to the next row (or the previous one, or the empty text) instead of the page. */const remove = (id: number) => { const shown = filtered.value.slice(0, visible.value) const at = shown.findIndex((n) => n.id === id) const next = shown[at + 1] ?? shown[at - 1] items.value = items.value.filter((n) => n.id !== id) // Wait a frame: the closing menu returns focus to its trigger first, and that trigger is gone. nextTick(() => requestAnimationFrame(() => { const target = next ? document.querySelector<HTMLElement>(`[data-notification="${next.id}"]`) : emptyText.value target?.focus() }), )}const markAllRead = () => { items.value = items.value.map((n) => (inCategory(n) ? { ...n, read: true } : n))}const readCount = computed(() => items.value.filter((n) => n.read && inCategory(n)).length)const removeRead = () => { items.value = items.value.filter((n) => !(n.read && inCategory(n))) confirmRemoveRead.value = false}// A filter always has one value: clicking the active chip keeps it on.// A new filter starts again from the first page.function pickCategory(value: unknown) { if (typeof value === "string" && value) { category.value = value as "semua" | Category visible.value = FIRST_PAGE }}function pickShow(value: unknown) { if (typeof value === "string" && value) { show.value = value as "semua" | "belum" visible.value = FIRST_PAGE }}
// Filter first, then page: "Muat lagi" shows only while more of the filtered rows exist.const filtered = computed(() => items.value.filter((n) => inCategory(n) && (show.value === "semua" || !n.read)))const groups = computed(() => { const shown = filtered.value.slice(0, visible.value) return (["Hari ini", "Sebelumnya"] as const) .map((label) => ({ label, rows: shown.filter((n) => n.group === label) })) .filter((g) => g.rows.length > 0)})const empty = computed(() => (show.value === "belum" ? "Semua notifikasi sudah kamu baca." : "Belum ada notifikasi di kategori ini."))const rowClass = "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-2 py-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"</script>
<template> <div class="min-h-svh bg-background p-6 text-foreground"> <div class="mx-auto grid max-w-3xl gap-6"> <div class="flex flex-wrap items-start justify-between gap-4"> <div> <h1 class="text-2xl font-semibold">Notifikasi</h1> <p class="mt-1 text-sm text-muted-foreground">Kabar terbaru soal akunmu.</p> </div> <Button variant="outline" :disabled="unread(category) === 0" @click="markAllRead"> <CheckCheck />Tandai semua dibaca </Button> </div>
<ToggleGroup type="single" variant="outline" :spacing="2" aria-label="Filter kategori" class="-mx-1 w-full min-w-0 flex-nowrap overflow-x-auto px-1 pb-1 sm:w-fit sm:flex-wrap sm:overflow-visible" :model-value="category" @update:model-value="pickCategory" > <!-- The count reads as words: "Pembayaran (1 belum dibaca)". --> <ToggleGroupItem v-for="c in ['semua', ...CATEGORIES]" :key="c" :value="c" :aria-label="unread(c as 'semua' | Category) > 0 ? `${c === 'semua' ? 'Semua' : c} (${unread(c as 'semua' | Category)} belum dibaca)` : undefined" > {{ c === "semua" ? "Semua" : c }} <span v-if="unread(c as 'semua' | Category) > 0" class="tabular-nums text-muted-foreground">{{ unread(c as "semua" | Category) }}</span> </ToggleGroupItem> </ToggleGroup>
<div class="rounded-xl border border-border bg-card"> <div class="flex items-center justify-between gap-2 border-b border-border px-4 py-2"> <ToggleGroup type="single" size="sm" aria-label="Tampilkan" :model-value="show" @update:model-value="pickShow"> <ToggleGroupItem value="semua">Semua</ToggleGroupItem> <ToggleGroupItem value="belum">Belum dibaca</ToggleGroupItem> </ToggleGroup> <DropdownMenu> <DropdownMenuTrigger as-child> <Button variant="ghost" size="icon-sm" aria-label="Opsi notifikasi"><MoreHorizontal /></Button> </DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuItem as-child><a href="#pengaturan-notifikasi">Pengaturan notifikasi</a></DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem variant="destructive" :disabled="readCount === 0" @select="confirmRemoveRead = true">Hapus yang sudah dibaca</DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> <AlertDialog v-model:open="confirmRemoveRead"> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Hapus {{ readCount }} notifikasi yang sudah dibaca?</AlertDialogTitle> <AlertDialogDescription>Notifikasi yang dihapus tidak bisa dikembalikan.</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>Batal</AlertDialogCancel> <AlertDialogAction variant="destructive" @click="removeRead">Hapus</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> </div>
<p v-if="groups.length === 0" ref="emptyText" tabindex="-1" class="px-4 py-12 text-center text-sm text-muted-foreground outline-none">{{ empty }}</p> <section v-for="g in groups" v-else :key="g.label" :aria-label="g.label" class="py-2"> <h2 class="px-4 py-1 text-xs font-medium text-muted-foreground">{{ g.label }}</h2> <ul> <!-- One notification: the row is a link when it has a target, otherwise a button that only marks it read; the menu sits beside it, never inside. --> <li v-for="n in g.rows" :key="n.id" :class="n.read ? 'flex items-start gap-1 px-2 py-1' : 'flex items-start gap-1 bg-muted/50 px-2 py-1'" > <component :is="n.href ? 'a' : 'button'" :href="n.href" :data-notification="n.id" :type="n.href ? undefined : 'button'" :class="rowClass" @click="update(n.id, true)" > <span class="flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground"> <component :is="ICONS[n.category]" class="size-4" /> </span> <span class="min-w-0 flex-1"> <span :class="n.read ? 'block text-sm' : 'block text-sm font-semibold'">{{ n.title }}</span> <span class="mt-0.5 line-clamp-2 block text-sm text-muted-foreground">{{ n.body }}</span> <span class="mt-1 block text-xs text-muted-foreground"> <time :datetime="n.iso" :title="n.at">{{ n.time }}</time><span class="sr-only">, {{ n.at }}</span> · {{ n.category }} </span> </span> <template v-if="!n.read"> <span aria-hidden="true" class="mt-1.5 size-2 shrink-0 rounded-full bg-primary" /> <span class="sr-only">Belum dibaca</span> </template> </component> <DropdownMenu> <DropdownMenuTrigger as-child> <Button variant="ghost" size="icon-sm" class="mt-1.5" :aria-label="`Aksi untuk ${n.title}`"><MoreHorizontal /></Button> </DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuItem @select="update(n.id, !n.read)">{{ n.read ? "Tandai belum dibaca" : "Tandai dibaca" }}</DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem variant="destructive" @select="remove(n.id)">Hapus</DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> </li> </ul> </section>
<div v-if="filtered.length > visible" class="border-t border-border p-2 text-center"> <Button variant="ghost" @click="visible += FIRST_PAGE">Muat lagi</Button> </div> </div> </div> </div></template>// The notifications page: the title and "Tandai semua dibaca" for the selected category, category chips with unread// counts, then a card with the Semua / Belum dibaca switch, rows grouped by time and "Muat lagi".import 'package:flutter/widgets.dart';import 'package:shadcn_ui/shadcn_ui.dart';import 'package:sosialoka_ui/sosialoka_ui.dart';
const _categories = ['Pembayaran', 'Clearance', 'Laporan', 'Rilis', 'Umum'];const _icons = { 'Pembayaran': LucideIcons.wallet, 'Clearance': LucideIcons.fileCheck, 'Laporan': LucideIcons.fileText, 'Rilis': LucideIcons.disc, 'Umum': LucideIcons.info,};
/// One notification. `time` is relative and `at` the full date and time for its tooltip. `href` is the page it is/// about; without one, a tap only marks it read.class _Notification { _Notification( this.id, this.category, this.title, this.body, this.time, this.today, { required this.at, this.read = true, this.href, });
final int id; final String category, title, body, time, at; final bool today; final String? href; bool read;}
List<_Notification> _notifications() => [ _Notification( 1, at: '17 Nov 2026, 14.20', 'Pembayaran', 'Royalti Oktober sudah masuk', 'Rp1.250.000,00 masuk ke saldomu.', '5 menit lalu', true, read: false, href: '/saldo', ), _Notification( 2, at: '17 Nov 2026, 13.25', 'Clearance', 'Clearance "Langit Jingga" disetujui', 'Videomu siap tayang.', '1 jam lalu', true, read: false, href: '/clearance', ), _Notification( 3, at: '17 Nov 2026, 11.05', 'Laporan', 'Laporan royalti Oktober siap', 'Cek pendapatan tiap platform.', '3 jam lalu', true, read: false, href: '/laporan', ), _Notification( 4, at: '16 Nov 2026, 19.40', 'Rilis', '"Senja di Kota" tayang di Spotify', 'Rilismu sudah bisa diputar.', 'Kemarin', false, href: '/rilis', ), _Notification( 5, at: '16 Nov 2026, 09.00', 'Pembayaran', 'Tagihan langganan November', 'Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.', 'Kemarin', false, href: '/tagihan', ), _Notification( 6, at: '15 Nov 2026, 10.15', 'Clearance', 'Clearance "Kaset Pertama" perlu diperbaiki', 'Cek catatan dari tim kami, lalu kirim ulang.', '2 hari lalu', false, href: '/clearance', ), _Notification( 7, at: '14 Nov 2026, 08.30', 'Umum', 'Kata sandimu baru saja diganti', 'Bukan kamu? Segera hubungi kami.', '3 hari lalu', false, ), _Notification( 8, at: '13 Nov 2026, 16.45', 'Rilis', '"Pulang Sore" dijadwalkan 28 Nov 2026', 'Kami kirim ke semua platform di tanggal itu.', '4 hari lalu', false, href: '/rilis', ), _Notification( 9, at: '14 Okt 2026, 10.00', 'Laporan', 'Laporan royalti September siap', 'Cek pendapatan tiap platform.', '14 Okt 2026', false, href: '/laporan', ), _Notification( 10, at: '13 Okt 2026, 15.10', 'Pembayaran', 'Royalti September sudah masuk', 'Rp980.000,00 masuk ke saldomu.', '13 Okt 2026', false, href: '/saldo', ),];
class NotificationsPageDemo extends StatefulWidget { const NotificationsPageDemo({super.key});
@override State<NotificationsPageDemo> createState() => _NotificationsPageDemoState();}
class _NotificationsPageDemoState extends State<NotificationsPageDemo> { static const _pageSize = 8; final _items = _notifications(); final _pageMenu = ShadContextMenuController(); var _visible = _pageSize; var _category = 'semua'; var _unreadOnly = false;
bool _inCategory(_Notification n) => _category == 'semua' || n.category == _category; int _unread(String category) => _items .where((n) => !n.read && (category == 'semua' || n.category == category)) .length;
@override void dispose() { _pageMenu.dispose(); super.dispose(); }
/// Deleting is final, so ask first. Cancel takes the focus; the destructive action sits last. Future<void> _confirmRemoveRead() async { _pageMenu.hide(); final count = _items.where((n) => n.read && _inCategory(n)).length; final confirmed = await showShadDialog<bool>( context: context, builder: (context) => ShadDialog.alert( title: Text('Hapus $count notifikasi yang sudah dibaca?'), description: const Text( 'Notifikasi yang dihapus tidak bisa dikembalikan.', ), actions: [ ShadButton.outline( autofocus: true, child: const Text('Batal'), onPressed: () => Navigator.of(context).pop(false), ), ShadButton.destructive( child: const Text('Hapus'), onPressed: () => Navigator.of(context).pop(true), ), ], ), ); if (confirmed == true) { setState(() => _items.removeWhere((n) => n.read && _inCategory(n))); } }
@override Widget build(BuildContext context) { final theme = ShadTheme.of(context); // Filter first, then page: "Muat lagi" shows only while more of the filtered rows exist. final filtered = _items .where((n) => _inCategory(n) && (!_unreadOnly || !n.read)) .toList(); final shown = filtered.take(_visible).toList(); final groups = [ ('Hari ini', shown.where((n) => n.today).toList()), ('Sebelumnya', shown.where((n) => !n.today).toList()), ].where((g) => g.$2.isNotEmpty); return ConstrainedBox( constraints: const BoxConstraints(maxWidth: 720), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Notifikasi', style: theme.textTheme.h3), Text( 'Kabar terbaru soal akunmu.', style: theme.textTheme.muted, ), ], ), ), ShadButton.outline( leading: const Icon(LucideIcons.checkCheck, size: 16), enabled: _unread(_category) > 0, onPressed: () => setState(() { for (final n in _items.where(_inCategory)) { n.read = true; } }), child: const Text('Tandai semua dibaca'), ), ], ), const SizedBox(height: 16), // A category filter always has one value: allowDeselection keeps the active chip on. On phones the chips // scroll sideways. Semantics( label: 'Filter kategori', child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: ShadToggleGroup<String>( initialValue: 'semua', allowDeselection: false, variant: ShadToggleVariant.outline, spacing: 8, // A new filter starts again from the first page. onChanged: (value) => setState(() { _category = value ?? 'semua'; _visible = _pageSize; }), items: [ for (final c in ['semua', ..._categories]) ShadToggleGroupItem( value: c, // The count reads as words: "Pembayaran (1 belum dibaca)". child: Semantics( label: _unread(c) > 0 ? '${c == 'semua' ? 'Semua' : c} (${_unread(c)} belum dibaca)' : null, excludeSemantics: _unread(c) > 0, child: Row( mainAxisSize: MainAxisSize.min, spacing: 6, children: [ Text(c == 'semua' ? 'Semua' : c), if (_unread(c) > 0) Text( '${_unread(c)}', style: theme.textTheme.muted, ), ], ), ), ), ], ), ), ), const SizedBox(height: 16), ShadCard( padding: EdgeInsets.zero, child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Padding( padding: const EdgeInsets.fromLTRB(16, 8, 8, 8), child: Row( children: [ Expanded( child: Semantics( label: 'Tampilkan', child: Align( alignment: Alignment.centerLeft, child: ShadToggleGroup<bool>( initialValue: false, allowDeselection: false, size: ShadButtonSize.sm, onChanged: (value) => setState(() { _unreadOnly = value ?? false; _visible = _pageSize; }), items: const [ ShadToggleGroupItem( value: false, child: Text('Semua'), ), ShadToggleGroupItem( value: true, child: Text('Belum dibaca'), ), ], ), ), ), ), ShadContextMenu( controller: _pageMenu, items: [ // Opens the notification settings; call your router here. const ShadContextMenuItem( child: Text('Pengaturan notifikasi'), ), const ShadSeparator.horizontal( margin: EdgeInsets.symmetric(vertical: 4), ), ShadContextMenuItem( enabled: _items.any( (n) => n.read && _inCategory(n), ), onPressed: _confirmRemoveRead, child: Text( 'Hapus yang sudah dibaca', style: TextStyle( color: context.sosialoka.destructive, ), ), ), ], child: Semantics( label: 'Opsi notifikasi', child: ShadIconButton.ghost( icon: const Icon(LucideIcons.ellipsis), onPressed: _pageMenu.toggle, ), ), ), ], ), ), const ShadSeparator.horizontal(margin: EdgeInsets.zero), if (groups.isEmpty) Padding( padding: const EdgeInsets.symmetric(vertical: 48), child: Text( _unreadOnly ? 'Semua notifikasi sudah kamu baca.' : 'Belum ada notifikasi di kategori ini.', textAlign: TextAlign.center, style: theme.textTheme.muted, ), ), for (final (label, rows) in groups) ...[ Padding( padding: const EdgeInsets.fromLTRB(16, 8, 16, 2), child: Text( label, style: theme.textTheme.muted.copyWith(fontSize: 12), ), ), for (final n in rows) _NotificationRow( notification: n, onOpen: () => setState(() => n.read = true), onToggleRead: () => setState(() => n.read = !n.read), onRemove: () => setState(() => _items.remove(n)), ), ], if (filtered.length > _visible) Padding( padding: const EdgeInsets.all(8), child: Center( child: ShadButton.ghost( onPressed: () => setState(() => _visible += _pageSize), child: const Text('Muat lagi'), ), ), ), ], ), ), ], ), ); }}
/// One notification: category icon, title (bold while unread), body clamped to two lines, time and category, an/// unread dot, and the row menu beside it.class _NotificationRow extends StatefulWidget { const _NotificationRow({ required this.notification, required this.onOpen, required this.onToggleRead, required this.onRemove, });
final _Notification notification; final VoidCallback onOpen, onToggleRead, onRemove;
@override State<_NotificationRow> createState() => _NotificationRowState();}
class _NotificationRowState extends State<_NotificationRow> { final menu = ShadContextMenuController(); var _focused = false;
@override void dispose() { menu.dispose(); super.dispose(); }
@override Widget build(BuildContext context) { final theme = ShadTheme.of(context); final n = widget.notification; return ColoredBox( color: n.read ? const Color(0x00000000) : theme.colorScheme.muted.withValues(alpha: 0.5), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), child: Row( crossAxisAlignment: CrossAxisAlignment.start, spacing: 12, children: [ Expanded( child: Semantics( // A row with a target opens it (call your router here); every row is marked read. Enter and Space // open a focused row, as a tap does. link: n.href != null, button: n.href == null, child: FocusableActionDetector( mouseCursor: SystemMouseCursors.click, onShowFocusHighlight: (value) => setState(() => _focused = value), actions: { ActivateIntent: CallbackAction<ActivateIntent>( onInvoke: (_) => widget.onOpen(), ), }, child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: widget.onOpen, child: DecoratedBox( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: Border.all( color: _focused ? theme.colorScheme.ring : const Color(0x00000000), width: 2, ), ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, spacing: 12, children: [ Container( width: 36, height: 36, decoration: BoxDecoration( color: theme.colorScheme.muted, shape: BoxShape.circle, ), child: Icon( _icons[n.category], size: 16, color: theme.colorScheme.mutedForeground, ), ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, spacing: 2, children: [ Text( n.title, style: theme.textTheme.small.copyWith( fontWeight: n.read ? FontWeight.w400 : FontWeight.w600, ), ), Text( n.body, maxLines: 2, overflow: TextOverflow.ellipsis, style: theme.textTheme.muted, ), Row( children: [ ShadTooltip( builder: (context) => Text(n.at), child: Text( n.time, style: theme.textTheme.muted.copyWith( fontSize: 12, ), ), ), Flexible( child: Text( ' · ${n.category}', maxLines: 1, overflow: TextOverflow.ellipsis, style: theme.textTheme.muted.copyWith( fontSize: 12, ), ), ), ], ), ], ), ), if (!n.read) Semantics( label: 'Belum dibaca', child: Container( margin: const EdgeInsets.only(top: 6), width: 8, height: 8, decoration: BoxDecoration( color: theme.colorScheme.primary, shape: BoxShape.circle, ), ), ), ], ), ), ), ), ), ), ShadContextMenu( controller: menu, items: [ ShadContextMenuItem( onPressed: widget.onToggleRead, child: Text(n.read ? 'Tandai belum dibaca' : 'Tandai dibaca'), ), const ShadSeparator.horizontal( margin: EdgeInsets.symmetric(vertical: 4), ), ShadContextMenuItem( onPressed: widget.onRemove, child: Text( 'Hapus', style: TextStyle(color: context.sosialoka.destructive), ), ), ], child: Semantics( label: 'Aksi untuk ${n.title}', child: ShadIconButton.ghost( icon: const Icon(LucideIcons.ellipsis), onPressed: menu.toggle, ), ), ), ], ), ), ); }}import { useState } from "react"import { BellIcon, DiscIcon, FileCheckIcon, FileTextIcon, InfoIcon, MoreHorizontalIcon, WalletIcon, type LucideIcon,} from "lucide-react"import { DashboardIconButton } from "@/components/blocks/dashboard-shell"import { Button } from "@/components/ui/button"import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "@/components/ui/popover"import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
type Category = "Pembayaran" | "Clearance" | "Laporan" | "Rilis" | "Umum"
interface Notification { id: number category: Category title: string body: string /** Relative time shown in the row. */ time: string /** Full date and time, shown as the tooltip of the relative time. */ at: string /** ISO date for the <time> element. */ iso: string group: "Hari ini" | "Sebelumnya" read: boolean /** The page the notification is about. Without one, a click only marks it read. */ href?: string}
const ICONS: Record<Category, LucideIcon> = { Pembayaran: WalletIcon, Clearance: FileCheckIcon, Laporan: FileTextIcon, Rilis: DiscIcon, Umum: InfoIcon,}
/** The newest notifications; the panel shows at most 8, the page shows the rest. */const NOTIFICATIONS: Notification[] = [ { id: 1, category: "Pembayaran", title: "Royalti Oktober sudah masuk", body: "Rp1.250.000,00 masuk ke saldomu.", time: "5 menit lalu", at: "17 Nov 2026, 14.20", iso: "2026-11-17T14:20", group: "Hari ini", read: false, href: "#saldo" }, { id: 2, category: "Clearance", title: 'Clearance "Langit Jingga" disetujui', body: "Videomu siap tayang.", time: "1 jam lalu", at: "17 Nov 2026, 13.25", iso: "2026-11-17T13:25", group: "Hari ini", read: false, href: "#clearance" }, { id: 3, category: "Laporan", title: "Laporan royalti Oktober siap", body: "Cek pendapatan tiap platform.", time: "3 jam lalu", at: "17 Nov 2026, 11.05", iso: "2026-11-17T11:05", group: "Hari ini", read: false, href: "#laporan" }, { id: 4, category: "Rilis", title: '"Senja di Kota" tayang di Spotify', body: "Rilismu sudah bisa diputar.", time: "Kemarin", at: "16 Nov 2026, 19.40", iso: "2026-11-16T19:40", group: "Sebelumnya", read: true, href: "#rilis" }, { id: 5, category: "Pembayaran", title: "Tagihan langganan November", body: "Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.", time: "Kemarin", at: "16 Nov 2026, 09.00", iso: "2026-11-16T09:00", group: "Sebelumnya", read: true, href: "#tagihan" }, { id: 6, category: "Clearance", title: 'Clearance "Kaset Pertama" perlu diperbaiki', body: "Cek catatan dari tim kami, lalu kirim ulang.", time: "2 hari lalu", at: "15 Nov 2026, 10.15", iso: "2026-11-15T10:15", group: "Sebelumnya", read: true, href: "#clearance" }, { id: 7, category: "Umum", title: "Kata sandimu baru saja diganti", body: "Bukan kamu? Segera hubungi kami.", time: "3 hari lalu", at: "14 Nov 2026, 08.30", iso: "2026-11-14T08:30", group: "Sebelumnya", read: true }, { id: 8, category: "Rilis", title: '"Pulang Sore" dijadwalkan 28 Nov 2026', body: "Kami kirim ke semua platform di tanggal itu.", time: "4 hari lalu", at: "13 Nov 2026, 16.45", iso: "2026-11-13T16:45", group: "Sebelumnya", read: true, href: "#rilis" },]
/** The most rows the panel shows; "Lihat semua notifikasi" opens the page for the rest. */const PANEL_ROWS = 8
/** * One notification: category icon, title (bold while unread), body, time and category, an unread dot, and a menu * beside the row. The row is a link when it has a target, otherwise a button that only marks it read. */function NotificationRow({ notification: n, onOpen, onToggleRead, onRemove,}: { notification: Notification onOpen: () => void onToggleRead: () => void onRemove: () => void}) { const Icon = ICONS[n.category] const content = ( <> <span className="flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground"> <Icon className="size-4" /> </span> <span className="min-w-0 flex-1"> <span className={n.read ? "block text-sm" : "block text-sm font-semibold"}>{n.title}</span> <span className="mt-0.5 line-clamp-2 block text-xs text-muted-foreground">{n.body}</span> <span className="mt-1 block text-xs text-muted-foreground"> <time dateTime={n.iso} title={n.at}> {n.time} </time> <span className="sr-only">, {n.at}</span> {" · "} {n.category} </span> </span> {n.read ? null : ( <> <span aria-hidden="true" className="mt-1.5 size-2 shrink-0 rounded-full bg-primary" /> <span className="sr-only">Belum dibaca</span> </> )} </> ) const rowClass = "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-2 py-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50" return ( <li className={n.read ? "flex items-start gap-1 px-2 py-0.5" : "flex items-start gap-1 bg-muted/50 px-2 py-0.5"}> {n.href ? ( <a href={n.href} className={rowClass} onClick={onOpen}> {content} </a> ) : ( <button type="button" className={rowClass} onClick={onOpen}> {content} </button> )} <DropdownMenu> <DropdownMenuTrigger render={<Button variant="ghost" size="icon-sm" className="mt-1.5" aria-label={`Aksi untuk ${n.title}`} />} > <MoreHorizontalIcon /> </DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuItem onClick={onToggleRead}>{n.read ? "Tandai belum dibaca" : "Tandai dibaca"}</DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem variant="destructive" onClick={onRemove}> Hapus </DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> </li> )}
/** * The bell panel: the Dashboard header's bell with the unread count opens a 360px popover with "Tandai semua * dibaca", the Semua / Belum dibaca switch, at most 8 rows grouped by time, and a link to the notifications page. * On phones, let the bell open the page instead. */export default function NotificationPanelDemo() { const [items, setItems] = useState(NOTIFICATIONS) const [show, setShow] = useState<"semua" | "belum">("semua")
const unread = items.filter((n) => !n.read).length const update = (id: number, read: boolean) => setItems((all) => all.map((n) => (n.id === id ? { ...n, read } : n)))
// Filter first, then cap at 8 rows. const shown = items.filter((n) => show === "semua" || !n.read).slice(0, PANEL_ROWS) const groups = (["Hari ini", "Sebelumnya"] as const) .map((label) => ({ label, rows: shown.filter((n) => n.group === label) })) .filter((g) => g.rows.length > 0)
return ( <div className="flex justify-end p-4"> <Popover> <PopoverTrigger render={ <DashboardIconButton label="Notifikasi" badge={unread}> <BellIcon /> </DashboardIconButton> } /> <PopoverContent align="end" className="w-[360px] max-w-[calc(100vw-2rem)] gap-0 p-0"> <div className="flex items-center justify-between gap-2 border-b border-border px-4 py-3"> <PopoverTitle className="text-sm font-semibold">Notifikasi</PopoverTitle> <Button variant="link" size="xs" disabled={unread === 0} onClick={() => setItems((all) => all.map((n) => ({ ...n, read: true })))} > Tandai semua dibaca </Button> </div> <div className="border-b border-border px-4 py-2"> <ToggleGroup size="sm" aria-label="Tampilkan" value={[show]} onValueChange={(value) => value.length > 0 && setShow(value[value.length - 1] as "semua" | "belum")} > <ToggleGroupItem value="semua">Semua</ToggleGroupItem> <ToggleGroupItem value="belum" aria-label={unread > 0 ? `Belum dibaca (${unread})` : undefined}> Belum dibaca {unread > 0 ? <span className="tabular-nums text-muted-foreground">{unread}</span> : null} </ToggleGroupItem> </ToggleGroup> </div> <div className="max-h-[420px] overflow-y-auto"> {groups.length === 0 ? ( <p className="px-4 py-10 text-center text-sm text-muted-foreground">Semua notifikasi sudah kamu baca.</p> ) : ( groups.map((g) => ( <section key={g.label} aria-label={g.label} className="py-1.5"> <h3 className="px-4 py-1 text-xs font-medium text-muted-foreground">{g.label}</h3> <ul> {g.rows.map((n) => ( <NotificationRow key={n.id} notification={n} onOpen={() => update(n.id, true)} onToggleRead={() => update(n.id, !n.read)} onRemove={() => setItems((all) => all.filter((x) => x.id !== n.id))} /> ))} </ul> </section> )) )} </div> <a href="#notifikasi" className="block border-t border-border px-4 py-3 text-center text-sm font-medium text-primary-text hover:underline" > Lihat semua notifikasi </a> </PopoverContent> </Popover> </div> )}<script setup lang="ts">import { computed, ref, type Component } from "vue"import { Bell, Disc, FileCheck, FileText, Info, MoreHorizontal, Wallet } from "@lucide/vue"import { DashboardIconButton } from "@/components/blocks/dashboard-shell"import { Button } from "@/components/ui/button"import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"import { TooltipProvider } from "@/components/ui/tooltip"
/** * The bell panel: the Dashboard header's bell with the unread count opens a 360px popover with "Tandai semua * dibaca", the Semua / Belum dibaca switch, at most 8 rows grouped by time, and a link to the notifications page. * On phones, let the bell open the page instead. */type Category = "Pembayaran" | "Clearance" | "Laporan" | "Rilis" | "Umum"
interface Notification { id: number category: Category title: string body: string /** Relative time shown in the row. */ time: string /** Full date and time, shown as the tooltip of the relative time. */ at: string /** ISO date for the <time> element. */ iso: string group: "Hari ini" | "Sebelumnya" read: boolean /** The page the notification is about. Without one, a click only marks it read. */ href?: string}
const ICONS: Record<Category, Component> = { Pembayaran: Wallet, Clearance: FileCheck, Laporan: FileText, Rilis: Disc, Umum: Info }
/** The newest notifications; the panel shows at most 8, the page shows the rest. */const NOTIFICATIONS: Notification[] = [ { id: 1, category: "Pembayaran", title: "Royalti Oktober sudah masuk", body: "Rp1.250.000,00 masuk ke saldomu.", time: "5 menit lalu", at: "17 Nov 2026, 14.20", iso: "2026-11-17T14:20", group: "Hari ini", read: false, href: "#saldo" }, { id: 2, category: "Clearance", title: 'Clearance "Langit Jingga" disetujui', body: "Videomu siap tayang.", time: "1 jam lalu", at: "17 Nov 2026, 13.25", iso: "2026-11-17T13:25", group: "Hari ini", read: false, href: "#clearance" }, { id: 3, category: "Laporan", title: "Laporan royalti Oktober siap", body: "Cek pendapatan tiap platform.", time: "3 jam lalu", at: "17 Nov 2026, 11.05", iso: "2026-11-17T11:05", group: "Hari ini", read: false, href: "#laporan" }, { id: 4, category: "Rilis", title: '"Senja di Kota" tayang di Spotify', body: "Rilismu sudah bisa diputar.", time: "Kemarin", at: "16 Nov 2026, 19.40", iso: "2026-11-16T19:40", group: "Sebelumnya", read: true, href: "#rilis" }, { id: 5, category: "Pembayaran", title: "Tagihan langganan November", body: "Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.", time: "Kemarin", at: "16 Nov 2026, 09.00", iso: "2026-11-16T09:00", group: "Sebelumnya", read: true, href: "#tagihan" }, { id: 6, category: "Clearance", title: 'Clearance "Kaset Pertama" perlu diperbaiki', body: "Cek catatan dari tim kami, lalu kirim ulang.", time: "2 hari lalu", at: "15 Nov 2026, 10.15", iso: "2026-11-15T10:15", group: "Sebelumnya", read: true, href: "#clearance" }, { id: 7, category: "Umum", title: "Kata sandimu baru saja diganti", body: "Bukan kamu? Segera hubungi kami.", time: "3 hari lalu", at: "14 Nov 2026, 08.30", iso: "2026-11-14T08:30", group: "Sebelumnya", read: true }, { id: 8, category: "Rilis", title: '"Pulang Sore" dijadwalkan 28 Nov 2026', body: "Kami kirim ke semua platform di tanggal itu.", time: "4 hari lalu", at: "13 Nov 2026, 16.45", iso: "2026-11-13T16:45", group: "Sebelumnya", read: true, href: "#rilis" },]
/** The most rows the panel shows; "Lihat semua notifikasi" opens the page for the rest. */const PANEL_ROWS = 8
const items = ref(NOTIFICATIONS.map((n) => ({ ...n })))const show = ref<"semua" | "belum">("semua")
const unread = computed(() => items.value.filter((n) => !n.read).length)const update = (id: number, read: boolean) => { items.value = items.value.map((n) => (n.id === id ? { ...n, read } : n))}const remove = (id: number) => { items.value = items.value.filter((n) => n.id !== id)}const markAllRead = () => { items.value = items.value.map((n) => ({ ...n, read: true }))}function pickShow(value: unknown) { if (typeof value === "string" && value) show.value = value as "semua" | "belum"}
const groups = computed(() => { // Filter first, then cap at 8 rows. const shown = items.value.filter((n) => show.value === "semua" || !n.read).slice(0, PANEL_ROWS) return (["Hari ini", "Sebelumnya"] as const) .map((label) => ({ label, rows: shown.filter((n) => n.group === label) })) .filter((g) => g.rows.length > 0)})const rowClass = "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-2 py-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"</script>
<template> <!-- The Dashboard shell already provides tooltips; this demo shows the bell on its own. --> <TooltipProvider> <div class="flex justify-end p-4"> <Popover> <PopoverTrigger as-child> <DashboardIconButton label="Notifikasi" :badge="unread"><Bell /></DashboardIconButton> </PopoverTrigger> <PopoverContent align="end" class="w-[360px] max-w-[calc(100vw-2rem)] p-0"> <div class="flex items-center justify-between gap-2 border-b border-border px-4 py-3"> <h2 class="text-sm font-semibold">Notifikasi</h2> <Button variant="link" size="xs" :disabled="unread === 0" @click="markAllRead">Tandai semua dibaca</Button> </div> <div class="border-b border-border px-4 py-2"> <ToggleGroup type="single" size="sm" aria-label="Tampilkan" :model-value="show" @update:model-value="pickShow"> <ToggleGroupItem value="semua">Semua</ToggleGroupItem> <ToggleGroupItem value="belum" :aria-label="unread > 0 ? `Belum dibaca (${unread})` : undefined"> Belum dibaca <span v-if="unread > 0" class="tabular-nums text-muted-foreground">{{ unread }}</span> </ToggleGroupItem> </ToggleGroup> </div> <div class="max-h-[420px] overflow-y-auto"> <p v-if="groups.length === 0" class="px-4 py-10 text-center text-sm text-muted-foreground">Semua notifikasi sudah kamu baca.</p> <section v-for="g in groups" v-else :key="g.label" :aria-label="g.label" class="py-1.5"> <h3 class="px-4 py-1 text-xs font-medium text-muted-foreground">{{ g.label }}</h3> <ul> <!-- One notification: the row is a link when it has a target, otherwise a button that only marks it read; the menu sits beside it, never inside. --> <li v-for="n in g.rows" :key="n.id" :class="n.read ? 'flex items-start gap-1 px-2 py-0.5' : 'flex items-start gap-1 bg-muted/50 px-2 py-0.5'" > <component :is="n.href ? 'a' : 'button'" :href="n.href" :type="n.href ? undefined : 'button'" :class="rowClass" @click="update(n.id, true)" > <span class="flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground"> <component :is="ICONS[n.category]" class="size-4" /> </span> <span class="min-w-0 flex-1"> <span :class="n.read ? 'block text-sm' : 'block text-sm font-semibold'">{{ n.title }}</span> <span class="mt-0.5 line-clamp-2 block text-xs text-muted-foreground">{{ n.body }}</span> <span class="mt-1 block text-xs text-muted-foreground"> <time :datetime="n.iso" :title="n.at">{{ n.time }}</time><span class="sr-only">, {{ n.at }}</span> · {{ n.category }} </span> </span> <template v-if="!n.read"> <span aria-hidden="true" class="mt-1.5 size-2 shrink-0 rounded-full bg-primary" /> <span class="sr-only">Belum dibaca</span> </template> </component> <DropdownMenu> <DropdownMenuTrigger as-child> <Button variant="ghost" size="icon-sm" class="mt-1.5" :aria-label="`Aksi untuk ${n.title}`"><MoreHorizontal /></Button> </DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuItem @select="update(n.id, !n.read)">{{ n.read ? "Tandai belum dibaca" : "Tandai dibaca" }}</DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem variant="destructive" @select="remove(n.id)">Hapus</DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> </li> </ul> </section> </div> <a href="#notifikasi" class="block border-t border-border px-4 py-3 text-center text-sm font-medium text-primary-text hover:underline" >Lihat semua notifikasi</a> </PopoverContent> </Popover> </div> </TooltipProvider></template>// The bell panel for tablets and desktop: the bell with the unread count opens a 360-wide popover with// "Tandai semua dibaca", the Semua / Belum dibaca switch, at most 8 rows grouped by time, and a link to the page.// On phones, let the bell open the notifications page instead.import 'package:flutter/widgets.dart';import 'package:shadcn_ui/shadcn_ui.dart';import 'package:sosialoka_ui/sosialoka_ui.dart';
const _icons = { 'Pembayaran': LucideIcons.wallet, 'Clearance': LucideIcons.fileCheck, 'Laporan': LucideIcons.fileText, 'Rilis': LucideIcons.disc, 'Umum': LucideIcons.info,};
/// One notification. `time` is relative and `at` the full date and time for its tooltip. `href` is the page it is/// about; without one, a tap only marks it read.class _Notification { _Notification( this.category, this.title, this.body, this.time, this.today, { required this.at, this.read = true, this.href, });
final String category, title, body, time, at; final bool today; final String? href; bool read;}
/// The newest notifications; the panel shows at most 8, the page shows the rest.List<_Notification> _notifications() => [ _Notification( 'Pembayaran', at: '17 Nov 2026, 14.20', 'Royalti Oktober sudah masuk', 'Rp1.250.000,00 masuk ke saldomu.', '5 menit lalu', true, read: false, href: '/saldo', ), _Notification( 'Clearance', at: '17 Nov 2026, 13.25', 'Clearance "Langit Jingga" disetujui', 'Videomu siap tayang.', '1 jam lalu', true, read: false, href: '/clearance', ), _Notification( 'Laporan', at: '17 Nov 2026, 11.05', 'Laporan royalti Oktober siap', 'Cek pendapatan tiap platform.', '3 jam lalu', true, read: false, href: '/laporan', ), _Notification( 'Rilis', at: '16 Nov 2026, 19.40', '"Senja di Kota" tayang di Spotify', 'Rilismu sudah bisa diputar.', 'Kemarin', false, href: '/rilis', ), _Notification( 'Pembayaran', at: '16 Nov 2026, 09.00', 'Tagihan langganan November', 'Bayar sebelum 30 Nov 2026 supaya layananmu tetap jalan.', 'Kemarin', false, href: '/tagihan', ), _Notification( 'Clearance', at: '15 Nov 2026, 10.15', 'Clearance "Kaset Pertama" perlu diperbaiki', 'Cek catatan dari tim kami, lalu kirim ulang.', '2 hari lalu', false, href: '/clearance', ), _Notification( 'Umum', at: '14 Nov 2026, 08.30', 'Kata sandimu baru saja diganti', 'Bukan kamu? Segera hubungi kami.', '3 hari lalu', false, ), _Notification( 'Rilis', at: '13 Nov 2026, 16.45', '"Pulang Sore" dijadwalkan 28 Nov 2026', 'Kami kirim ke semua platform di tanggal itu.', '4 hari lalu', false, href: '/rilis', ),];
class NotificationPanelDemo extends StatefulWidget { const NotificationPanelDemo({super.key});
@override State<NotificationPanelDemo> createState() => _NotificationPanelDemoState();}
class _NotificationPanelDemoState extends State<NotificationPanelDemo> { final popover = ShadPopoverController(); final _items = _notifications(); var _unreadOnly = false;
int get _unread => _items.where((n) => !n.read).length;
@override void dispose() { popover.dispose(); super.dispose(); }
@override Widget build(BuildContext context) { final theme = ShadTheme.of(context); return ShadPopover( controller: popover, padding: EdgeInsets.zero, popover: (context) => StatefulBuilder( builder: (context, setPanelState) { void update(VoidCallback change) { setPanelState(change); setState(() {}); }
// Filter first, then cap at 8 rows. final shown = _items .where((n) => !_unreadOnly || !n.read) .take(8) .toList(); final groups = [ ('Hari ini', shown.where((n) => n.today).toList()), ('Sebelumnya', shown.where((n) => !n.today).toList()), ].where((g) => g.$2.isNotEmpty); return SizedBox( width: 360, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Padding( padding: const EdgeInsets.fromLTRB(16, 8, 8, 8), child: Row( children: [ Expanded( child: Text('Notifikasi', style: theme.textTheme.large), ), ShadButton.link( size: ShadButtonSize.sm, enabled: _unread > 0, onPressed: () => update(() { for (final n in _items) { n.read = true; } }), child: const Text('Tandai semua dibaca'), ), ], ), ), const ShadSeparator.horizontal(margin: EdgeInsets.zero), Padding( padding: const EdgeInsets.symmetric( horizontal: 16, vertical: 8, ), child: Semantics( label: 'Tampilkan', child: Align( alignment: Alignment.centerLeft, child: ShadToggleGroup<bool>( initialValue: _unreadOnly, allowDeselection: false, size: ShadButtonSize.sm, onChanged: (value) => update(() => _unreadOnly = value ?? false), items: [ const ShadToggleGroupItem( value: false, child: Text('Semua'), ), ShadToggleGroupItem( value: true, child: Semantics( label: _unread > 0 ? 'Belum dibaca ($_unread)' : null, excludeSemantics: _unread > 0, child: Text( _unread > 0 ? 'Belum dibaca $_unread' : 'Belum dibaca', ), ), ), ], ), ), ), ), const ShadSeparator.horizontal(margin: EdgeInsets.zero), ConstrainedBox( constraints: const BoxConstraints(maxHeight: 420), child: groups.isEmpty ? Padding( padding: const EdgeInsets.symmetric(vertical: 40), child: Text( 'Semua notifikasi sudah kamu baca.', textAlign: TextAlign.center, style: theme.textTheme.muted, ), ) : ListView( shrinkWrap: true, children: [ for (final (label, rows) in groups) ...[ Padding( padding: const EdgeInsets.fromLTRB( 16, 10, 16, 4, ), child: Text( label, style: theme.textTheme.muted.copyWith( fontSize: 12, ), ), ), for (final n in rows) _PanelRow( notification: n, onOpen: () => update(() => n.read = true), onToggleRead: () => update(() => n.read = !n.read), onRemove: () => update(() => _items.remove(n)), ), ], ], ), ), const ShadSeparator.horizontal(margin: EdgeInsets.zero), // Opens the notifications page; call your router here. ShadButton.ghost( onPressed: popover.hide, child: const Text('Lihat semua notifikasi'), ), ], ), ); }, ), child: Semantics( label: _unread > 0 ? 'Notifikasi ($_unread)' : 'Notifikasi', button: true, child: Stack( clipBehavior: Clip.none, children: [ ShadIconButton.ghost( icon: const Icon(LucideIcons.bell), onPressed: popover.toggle, ), if (_unread > 0) Positioned( top: 2, right: 2, child: ExcludeSemantics( child: Container( padding: const EdgeInsets.symmetric(horizontal: 4), constraints: const BoxConstraints( minWidth: 16, minHeight: 16, ), decoration: BoxDecoration( color: theme.colorScheme.destructive, borderRadius: BorderRadius.circular(6), ), alignment: Alignment.center, child: Text( _unread > 99 ? '99+' : '$_unread', style: TextStyle( fontSize: 10, fontWeight: FontWeight.w600, color: theme.colorScheme.destructiveForeground, ), ), ), ), ), ], ), ), ); }}
/// A panel row: category icon, title (bold while unread), body clamped to two lines, time and category, the unread/// dot, and the row menu beside it.class _PanelRow extends StatefulWidget { const _PanelRow({ required this.notification, required this.onOpen, required this.onToggleRead, required this.onRemove, });
final _Notification notification; final VoidCallback onOpen, onToggleRead, onRemove;
@override State<_PanelRow> createState() => _PanelRowState();}
class _PanelRowState extends State<_PanelRow> { final menu = ShadContextMenuController(); var _focused = false;
@override void dispose() { menu.dispose(); super.dispose(); }
@override Widget build(BuildContext context) { final theme = ShadTheme.of(context); final n = widget.notification; return ColoredBox( color: n.read ? const Color(0x00000000) : theme.colorScheme.muted.withValues(alpha: 0.5), child: Padding( padding: const EdgeInsets.fromLTRB(16, 8, 8, 8), child: Row( crossAxisAlignment: CrossAxisAlignment.start, spacing: 8, children: [ Expanded( child: Semantics( // A row with a target opens it (call your router here); every row is marked read. Enter and Space // open a focused row, as a tap does. link: n.href != null, button: n.href == null, child: FocusableActionDetector( mouseCursor: SystemMouseCursors.click, onShowFocusHighlight: (value) => setState(() => _focused = value), actions: { ActivateIntent: CallbackAction<ActivateIntent>( onInvoke: (_) => widget.onOpen(), ), }, child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: widget.onOpen, child: DecoratedBox( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: Border.all( color: _focused ? theme.colorScheme.ring : const Color(0x00000000), width: 2, ), ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, spacing: 12, children: [ Container( width: 32, height: 32, decoration: BoxDecoration( color: theme.colorScheme.muted, shape: BoxShape.circle, ), child: Icon( _icons[n.category], size: 16, color: theme.colorScheme.mutedForeground, ), ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, spacing: 2, children: [ Text( n.title, style: theme.textTheme.small.copyWith( fontWeight: n.read ? FontWeight.w400 : FontWeight.w600, ), ), Text( n.body, maxLines: 2, overflow: TextOverflow.ellipsis, style: theme.textTheme.muted.copyWith( fontSize: 12, ), ), Row( children: [ ShadTooltip( builder: (context) => Text(n.at), child: Text( n.time, style: theme.textTheme.muted.copyWith( fontSize: 12, ), ), ), Flexible( child: Text( ' · ${n.category}', maxLines: 1, overflow: TextOverflow.ellipsis, style: theme.textTheme.muted.copyWith( fontSize: 12, ), ), ), ], ), ], ), ), if (!n.read) Semantics( label: 'Belum dibaca', child: Container( margin: const EdgeInsets.only(top: 6), width: 8, height: 8, decoration: BoxDecoration( color: theme.colorScheme.primary, shape: BoxShape.circle, ), ), ), ], ), ), ), ), ), ), ShadContextMenu( controller: menu, items: [ ShadContextMenuItem( onPressed: widget.onToggleRead, child: Text(n.read ? 'Tandai belum dibaca' : 'Tandai dibaca'), ), const ShadSeparator.horizontal( margin: EdgeInsets.symmetric(vertical: 4), ), ShadContextMenuItem( onPressed: widget.onRemove, child: Text( 'Hapus', style: TextStyle(color: context.sosialoka.destructive), ), ), ], child: Semantics( label: 'Aksi untuk ${n.title}', child: ShadIconButton.ghost( icon: const Icon(LucideIcons.ellipsis), onPressed: menu.toggle, ), ), ), ], ), ), ); }}Dibangun dari
Section titled “Dibangun dari”Toggle Group, Dropdown Menu, Alert Dialog, Popover, Button, Tooltip, dan DashboardIconButton dari blok Dasbor.
Flutter
Section titled “Flutter”Chip kategori berupa ShadToggleGroup dengan allowDeselection: false, di dalam scroll horizontal supaya muat di HP. Di HP, lonceng membuka halaman; di tablet dan desktop, lonceng membuka ShadPopover. Buka aksi baris lewat ShadContextMenu, dan beri tombolnya label semantik.
