import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2024-2025 GoodData Corporation
import { useCallback, useMemo } from "react";
import { defineMessages, useIntl } from "react-intl";
import { Tabs, UiButton } from "@gooddata/sdk-ui-kit";
import { bem } from "../bem.js";
const { b, e } = bem("gd-ui-ext-notifications-panel-header");
/**
 * Default implementation of the notifications panel header.
 *
 * @public
 */
export function DefaultNotificationsPanelHeader({ activeView, changeActiveView, markAllNotificationsAsRead, hasUnreadNotifications, unreadNotificationsCount, }) {
    const intl = useIntl();
    const tabs = useMemo(() => getTabs(unreadNotificationsCount), [unreadNotificationsCount]);
    const activeTabId = activeView === "unread" ? messages.tabUnread.id : messages.tabAll.id;
    const onTabSelect = useCallback((tab) => {
        const targetView = tab.id === messages.tabUnread.id ? "unread" : "all";
        changeActiveView(targetView);
    }, [changeActiveView]);
    return (_jsxs("div", { className: b(), children: [_jsx("div", { className: e("tabs"), children: _jsx(Tabs, { tabs: tabs, selectedTabId: activeTabId, onTabSelect: onTabSelect }) }), _jsx("div", { className: e("mark-all-as-read-button"), children: _jsx(UiButton, { variant: "popout", size: "small", label: intl.formatMessage(messages.markAllAsRead), onClick: markAllNotificationsAsRead, isDisabled: !hasUnreadNotifications }) })] }));
}
function getTabs(unreadNotificationsCount = 0) {
    return [
        { id: messages.tabUnread.id, values: { count: unreadNotificationsCount } },
        { id: messages.tabAll.id },
    ];
}
const messages = defineMessages({
    tabUnread: {
        id: "notifications.panel.tab.unread",
    },
    tabAll: {
        id: "notifications.panel.tab.all",
    },
    markAllAsRead: {
        id: "notifications.panel.markAllAsRead",
    },
});
//# sourceMappingURL=DefaultNotificationsPanelHeader.js.map