import TxAnchor from '@/components/TxAnchor'; import SwitchText from '@/components/SwitchText'; import InlineCode from '@/components/InlineCode'; import { SettingItem, SettingItemDesc } from '../settingsItems'; import { useEffect, useMemo, useReducer } from "react"; import { getConfigEmptyState, getConfigAccessors, SettingsCardProps, getPageConfig, configsReducer, getConfigDiff } from "../utils"; import SettingsCardShell from '../SettingsCardShell'; export const pageConfigs = { hideAdminInPunishments: getPageConfig('gameFeatures', 'hideAdminInPunishments'), hideAdminInMessages: getPageConfig('gameFeatures', 'hideAdminInMessages'), hideDefaultAnnouncement: getPageConfig('gameFeatures', 'hideDefaultAnnouncement'), hideDefaultDirectMessage: getPageConfig('gameFeatures', 'hideDefaultDirectMessage'), hideDefaultWarning: getPageConfig('gameFeatures', 'hideDefaultWarning'), hideScheduledRestartWarnings: getPageConfig('gameFeatures', 'hideDefaultScheduledRestartWarning'), } as const; export default function ConfigCardGameNotifications({ cardCtx, pageCtx }: SettingsCardProps) { const [states, dispatch] = useReducer( configsReducer, null, () => getConfigEmptyState(pageConfigs), ); const cfg = useMemo(() => { return getConfigAccessors(cardCtx.cardId, pageConfigs, pageCtx.apiData, dispatch); }, [pageCtx.apiData, dispatch]); //Effects - handle changes and reset advanced settings useEffect(() => { updatePageState(); }, [states]); //Processes the state of the page and sets the card as pending save if needed const updatePageState = () => { const overwrites = {}; const res = getConfigDiff(cfg, states, overwrites, false); pageCtx.setCardPendingSave(res.hasChanges ? cardCtx : null); return res; } //Validate changes (for UX only) and trigger the save API const handleOnSave = () => { const { hasChanges, localConfigs } = updatePageState(); if (!hasChanges) return; //NOTE: nothing to validate pageCtx.saveChanges(cardCtx, localConfigs); } return ( Never show to the players the admin name on Bans or Warns.
This information will still be available in the history and logs.
Do not show the admin name on Announcements or DMs.
This information will still be available in the live console and logs.
Suppresses the display of announcements, allowing you to implement your own announcement via the event txAdmin:events:announcement.  Documentation Suppresses the display of direct messages, allowing you to implement your own direct message notification via the event txAdmin:events:playerDirectMessage.  Documentation Suppresses the display of warnings, allowing you to implement your own warning via the event txAdmin:events:playerWarned.  Documentation Suppresses the display of scheduled restart warnings, allowing you to implement your own warning via the event txAdmin:events:scheduledRestart.  Documentation
) }