From b4bd62c1b50a4a63ef866f73746d772fb08f1c02 Mon Sep 17 00:00:00 2001 From: Moepchi Date: Fri, 23 Oct 2026 20:26:40 +0000 Subject: [PATCH] Options: Meldungen tab (TS3 notification tree, sound packs, text position) All 93 TS3 notification keys in the native tree layout (Aktion / Sound Skript / Text Position), per-row and per-group checkboxes, editable scripts (play/say), customized rows in bold. Sound packs: WebSpeak3 default, no sounds, or an imported .ts3_soundpack (settings.ini parsed 1:1). "Wenn Ausgabe stumm", and a per-favorite sound pack override in the favorites dialog. Existing sound triggers now go through the keys; server log lines follow Text Position. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- web/src/App.css | 83 +++++++++ web/src/App.tsx | 353 ++++++++++++++++++++++++++++++++++--- web/src/locales/cs-CZ.json | 96 +++++++++- web/src/locales/de.json | 96 +++++++++- web/src/locales/en.json | 96 +++++++++- web/src/locales/fa.json | 96 +++++++++- web/src/locales/zh-CN.json | 96 +++++++++- web/src/notifications.ts | 306 ++++++++++++++++++++++++++++++++ web/src/sounds.ts | 6 + 9 files changed, 1195 insertions(+), 33 deletions(-) create mode 100644 web/src/notifications.ts diff --git a/web/src/App.css b/web/src/App.css index d6c2223..eaa36c5 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -4768,3 +4768,86 @@ gap: 8px; flex-wrap: wrap; } + +/* Options -> Meldungen */ +.ts-notify-row { + display: flex; + align-items: center; + gap: 6px; +} +.ts-notify-row > label { + min-width: 140px; +} +.ts-notify-row > select { + flex: 1; + min-width: 0; +} +.ts-notify-hint { + margin: 0; + font-size: 0.9em; +} +.ts-notify-tree { + max-height: 360px; + overflow: auto; + border: 1px solid var(--border); + background: var(--input-bg); +} +.ts-notify-tree table { + width: 100%; + border-collapse: collapse; + font-size: 0.9em; +} +.ts-notify-tree th { + position: sticky; + top: 0; + z-index: 1; + text-align: left; + font-weight: normal; + padding: 2px 6px; + background: var(--bg-toolbar-1); + border-bottom: 1px solid var(--border); +} +.ts-notify-tree td { + padding: 1px 4px; + white-space: nowrap; +} +.ts-notify-custom > td:first-child { + font-weight: bold; +} +.ts-notify-action { + display: inline-flex; + align-items: center; + gap: 4px; +} +.ts-notify-twisty { + border: none; + background: none; + padding: 0 2px; + min-width: 0; + color: inherit; + cursor: pointer; +} +.ts-notify-script { + display: flex; + align-items: center; + gap: 2px; +} +.ts-notify-script input { + flex: 1; + min-width: 140px; + border: 1px solid transparent; + background: transparent; + color: inherit; + font-family: monospace; +} +.ts-notify-script input:focus { + border-color: var(--border); + background: var(--input-bg); +} +.ts-notify-script button { + padding: 0 4px; + min-width: 0; +} +.ts-notify-tree select { + font-size: 1em; +} diff --git a/web/src/App.tsx b/web/src/App.tsx index fdc47bf..8e12776 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1,4 +1,4 @@ -import { createContext, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from "react"; +import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from "react"; import { useRegisterSW } from "virtual:pwa-register/react"; import "./App.css"; // After App.css: its :where() base variables have the same (zero) specificity. @@ -141,6 +141,27 @@ import { type SoundEventId, } from "./sounds"; import { parseSoundpack } from "./soundpack"; +import { + BUILTIN_PACK, + NO_SOUNDS_PACK, + NOTIFICATION_TREE, + deleteSoundPack, + getNotificationSettings, + importSoundPack, + isSpecialKey, + loadSoundPacks, + notificationTextPosition, + notify, + packScript, + runSoundScript, + saveNotificationSettings, + setNotificationPlaybackMuted, + setSessionSoundPack, + type NotificationNode, + type NotificationSettings, + type SoundPack, + type TextPosition, +} from "./notifications"; import { iconPackCss, loadIconPacks, @@ -592,6 +613,8 @@ interface Favorite { defaultChannelPassword: string; /** When true, ServerQuery clients appear in the channel tree. Default: false. */ showServerQueryClients: boolean; + /** Overrides Options -> Meldungen's sound pack for this server; unset = that one. */ + soundPack?: string; } function normalizeFavorite(raw: Partial & Pick): Favorite { @@ -605,6 +628,7 @@ function normalizeFavorite(raw: Partial & Pick): Favor defaultChannelPassword: typeof raw.defaultChannelPassword === "string" ? raw.defaultChannelPassword : "", showServerQueryClients: raw.showServerQueryClients === true, + ...(typeof raw.soundPack === "string" && raw.soundPack ? { soundPack: raw.soundPack } : {}), }; } @@ -1931,6 +1955,19 @@ function InfoPanel({ ); } +/** Gateway serverLog kind -> Options -> Meldungen key. The server doesn't say who did it, so "by other". */ +const SERVER_LOG_NOTIFICATIONS = { + clientJoin: "CLIENT_CONNECTION_CONNECTED_SERVER", + clientLeave: "CLIENT_CONNECTION_DISCONNECTED_SERVER", + clientChannelSwitch: "CLIENT_SWITCHED_TO_OTHER_CHANNEL_STAYS", + clientChannelGroupAssigned: "CLIENT_CHANNELGROUP_CHANGED_BY_USER", + channelCreated: "CHANNEL_CREATED_BY_OTHER", + channelDeleted: "CHANNEL_DELETED_BY_OTHER", + channelEdited: "CHANNEL_EDITED_OTHER_BY_OTHER", + serverEdited: "SERVER_EDITED_BY_OTHER", + permissionError: "SERVER_INSUFFICIENT_PERMISSIONS", +} as const; + interface ChatEntry { from: string; message: string; @@ -3432,8 +3469,13 @@ function FavoritesDialog({