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({