Skip to content

Notifications

Download .md

Every Sosialoka product tells people what changed in the same two places: a panel under the bell in the header, and a notifications page with everything. Both use the same row, so a notification looks the same wherever it shows up.

  • Use the panel for a quick look: the newest notifications and a way to clear the badge.
  • Use the page to go through everything, by category or unread only.
  • For a message about the page someone is on, use an Alert or a toast instead of a notification.
  1. Header: the title “Notifikasi”, one line of copy and “Tandai semua dibaca”.
  2. Category chips: Toggle Group chips, “Semua” first, each with its unread count.
  3. Card: the Semua / Belum dibaca switch and the page menu on top, then the rows grouped as “Hari ini” and “Sebelumnya”, then “Muat lagi”.
  1. Icon: the category’s icon in a neutral circle.
  2. Title: bold while unread.
  3. Body: one or two lines.
  4. Time and category: “5 menit lalu · Pembayaran”. The full date and time show as a tooltip.
  5. Unread dot at the end, then the row menu beside the row.
  1. Bell: DashboardIconButton from the Dashboard header, with the unread count as its badge.
  2. Popover: 360px wide, with “Notifikasi”, “Tandai semua dibaca” and the Semua / Belum dibaca switch on top.
  3. Rows: at most 8, grouped by time, the same row as on the page.
  4. Footer: “Lihat semua notifikasi” opens the page.
  • Mark all read applies to the category that is on. Disable it when nothing there is unread.
  • Category chips always have one category on: “Semua” by default, and a click on the active chip keeps it on. Each count is read as words, such as “Pembayaran (1 belum dibaca)”. On phones the chips stay on one line that scrolls sideways; from sm they wrap. The category and the switch live in the URL, as list filters do.
  • Badge: the unread count, “99+” above 99, and none at zero. The bell’s name carries the count, such as “Notifikasi (3)”.
  • Panel: at most 8 rows. On phones the bell opens the page instead of a popover.
  • A click marks the notification read and opens the page it is about. A notification without a target is only marked read.
  • Row menu: name the button after the row (“Aksi untuk Royalti Oktober sudah masuk”). “Tandai dibaca” or “Tandai belum dibaca” first, then “Hapus” last, after a separator. Delete is optional: leave it out when the product can’t delete notifications. After a delete, focus moves to the next row.
  • Hapus yang sudah dibaca asks first in an Alert Dialog, since deleted notifications don’t come back. It is off when nothing read is left.
  • Icons name the category in neutral colors, never the brand color, so unread stays the only thing that stands out.
  • Time: relative (“5 menit lalu”, “Kemarin”). The full date and time show on hover and are read by screen readers.
  • More: “Muat lagi” under the rows instead of page numbers; notifications are read newest first.
  • States: an empty category says “Belum ada notifikasi di kategori ini.” and an empty unread view says “Semua notifikasi sudah kamu baca.”. Loading and errors follow Empty, loading and 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>
)
}
React
Vue
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>
)
}

Toggle Group, Dropdown Menu, Alert Dialog, Popover, Button, Tooltip and the Dashboard block’s DashboardIconButton.

The category chips are a ShadToggleGroup with allowDeselection: false, in a horizontal scroll so they fit a phone. On phones the bell opens the page; on tablets and desktop it opens a ShadPopover. Open the row actions from a ShadContextMenu and give the button a semantic label.