Design tab: native TS3 layout, icon packs, channel tree and GIF options

Style/theme/icon pack dropdowns, a manage view for designs and icon packs
(.ts3_iconpack import), channel tree options (expand depth/own channel,
clients below, flags, commander lamp, away message, tooltips, group icons
in menus) and GIF animation toggles. Overwolf, badges and inaccessible
groups are greyed out until the connector forwards that data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-10-23 18:27:23 +00:00
1 parent ced63fdb2a
commit ae7c24bd37
10 files changed
+731 -53

No files matched your search

+4 -1
View File
@@ -1,4 +1,5 @@
import { Fragment, type ReactNode } from "react";
import { StillImg } from "./still";
// TeamSpeak chat text -> React elements (never HTML strings, so message text
// can't inject markup). Understands the TS3/TS6 BBCode tags plus the basic
@@ -44,6 +45,8 @@ interface Node {
export interface RenderOptions {
/** Load [img] / ![](...) inline. Off: they render as links, so no remote host sees the reader's IP. */
images?: boolean;
/** GIF animation off: show only the first frame of inline images. */
stillImages?: boolean;
}
function emphasis(s: string): string {
@@ -263,7 +266,7 @@ function render(node: Node, key: number, opts: RenderOptions): ReactNode {
const label = textOf(node);
if (!href) return <span key={key}>{label}</span>;
if (node.tag === "img" && opts.images)
return link(href, <img className="ts-bb-img" src={href} alt="" loading="lazy" referrerPolicy="no-referrer" />, key);
return link(href, <StillImg still={!!opts.stillImages} className="ts-bb-img" src={href} alt="" loading="lazy" referrerPolicy="no-referrer" />, key);
return link(href, label, key);
}
default:
+50
View File
@@ -0,0 +1,50 @@
import { useEffect, useState, type ImgHTMLAttributes } from "react";
const stills = new Map<string, string | null>();
/** First frame of an (animated) image as a PNG data URL, or null when the
* browser won't let us read it (cross-origin image without CORS). */
function freeze(src: string): Promise<string | null> {
return new Promise((resolve) => {
const img = new Image();
img.crossOrigin = "anonymous";
img.referrerPolicy = "no-referrer";
img.onload = () => {
try {
const canvas = document.createElement("canvas");
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
canvas.getContext("2d")!.drawImage(img, 0, 0);
resolve(canvas.toDataURL());
} catch {
resolve(null);
}
};
img.onerror = () => resolve(null);
img.src = src;
});
}
/** <img> that shows only the first frame when `still` is set (GIF animation off).
* Falls back to the original image when it can't be frozen. */
export function StillImg({ still, src, ...rest }: ImgHTMLAttributes<HTMLImageElement> & { still: boolean; src: string }) {
const [frozen, setFrozen] = useState(() => (still ? stills.get(src) : undefined));
useEffect(() => {
if (!still) return;
if (stills.has(src)) {
setFrozen(stills.get(src));
return;
}
let live = true;
void freeze(src).then((url) => {
stills.set(src, url);
if (live) setFrozen(url);
});
return () => {
live = false;
};
}, [src, still]);
// While freezing, render nothing rather than letting the animation start.
if (still && frozen === undefined) return null;
return <img src={still && frozen ? frozen : src} {...rest} />;
}