import { useAdminNotificationMatrix } from '../../../components/Admin/useAdminNotificationMatrix' import type { TranslationFn } from '../../../types' import type { useToast } from '../../../components/shared/Toast' import { ADMIN_EVENT_LABEL_KEYS, ADMIN_CHANNEL_LABEL_KEYS } from '../../../pages/admin/AdminPage.constants' import MToggle from '../../components/MToggle' import { MAdminCard, MAdminCardHead } from './MAdminUi' // Per-event × per-channel admin notification matrix — the mobile layout of // AdminNotificationsPanel. Loads its own data and auto-saves each toggle. export default function MAdminNotifyMatrix({ t, toast }: { t: TranslationFn; toast: ReturnType }) { const { matrix, visibleChannels, toggle } = useAdminNotificationMatrix(t, toast) if (!matrix) { return (

{t('common.loading')}

) } if (matrix.event_types.length === 0) { return (

{t('settings.notificationPreferences.noChannels')}

) } return (
{visibleChannels.map((ch) => ( {t(ADMIN_CHANNEL_LABEL_KEYS[ch])} ))}
{matrix.event_types.map((eventType) => { const implemented = matrix.implemented_combos[eventType] ?? [] // Known admin events use translated labels; anything else keeps its raw id. const labelKey = ADMIN_EVENT_LABEL_KEYS[eventType] return (
{labelKey ? t(labelKey) : eventType} {visibleChannels.map((ch) => ( {implemented.includes(ch) ? ( toggle(eventType, ch)} /> ) : ( — )} ))}
) })}
) }