import { useTranslation } from 'react-i18next'; import { useAuthorDirectory } from '@/components/chat/useAuthorDirectory'; import { useSoundboardStore } from '@/stores/soundboard'; /** * Всплывающая подпись «{имя} включил звук {name}» (AGENT.md 7.13). * * Живёт в оболочке приложения — рядом с подсказкой о выключенном микрофоне, * поэтому её видно с любого экрана. Гаснет сама: время жизни держит * `stores/soundboard` (3 секунды), компонент только рисует текст. */ export function SoundboardNotice() { const { t } = useTranslation(); const notice = useSoundboardStore((state) => state.notice); const clear = useSoundboardStore((state) => state.clearNotice); // Имя того, кто сыграл звук, резолвит общий справочник авторов. const authors = useAuthorDirectory( notice?.guildId ?? null, notice === null ? [] : [notice.userId], ); if (notice === null) { return null; } return (
{t('voice.soundboard.playedBy', { name: authors.resolve(notice.userId).name, sound: notice.soundName, })}