2026-09-25 11:36:25 -03:00
|
|
|
import { isDismissable } from "@/domain/notifications/utils/visible-notification-sections";
|
2026-09-18 12:55:54 -03:00
|
|
|
import type { NotificationCenter } from "./use-notification-center";
|
|
|
|
|
|
|
|
|
|
type NotificationFeedActionsProps = {
|
|
|
|
|
center: NotificationCenter;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export function NotificationFeedActions({ center }: NotificationFeedActionsProps) {
|
|
|
|
|
const hasUnread = center.unreadIds.size > 0;
|
2026-09-25 11:36:25 -03:00
|
|
|
// Rows that need acknowledging are never cleared, so they alone do not enable "Clear all".
|
|
|
|
|
const hasItems = center.sections.some((section) => section.items.some(isDismissable));
|
2026-09-18 12:55:54 -03:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={center.markAllRead}
|
|
|
|
|
disabled={!hasUnread}
|
|
|
|
|
className="cursor-pointer transition-opacity disabled:cursor-not-allowed disabled:opacity-50"
|
|
|
|
|
style={{ fontSize: 12, fontWeight: 500, color: "var(--color-primary)" }}
|
|
|
|
|
>
|
|
|
|
|
Mark all read
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={center.dismissAll}
|
|
|
|
|
disabled={!hasItems}
|
|
|
|
|
className="cursor-pointer transition-opacity disabled:cursor-not-allowed disabled:opacity-50"
|
|
|
|
|
style={{ fontSize: 12, fontWeight: 500, color: "var(--color-text-muted)" }}
|
|
|
|
|
>
|
|
|
|
|
Clear all
|
|
|
|
|
</button>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|