settings: move Server info into its own section (separate from IRCv3 capabilities)

This commit is contained in:
reverse 2026-06-20 02:44:54 +00:00
parent a57f5e2faf
commit 45124dd4c2
12 changed files with 41 additions and 20 deletions

View file

@ -1,7 +1,7 @@
// Tchatou service worker — installable PWA + offline app shell.
// Scope: /app/. Only handles same-origin /app/ GETs; the IRC websocket and all
// API calls (cloudflare, change_password, upload) pass straight through.
const CACHE = 'tchatou-v27';
const CACHE = 'tchatou-v28';
const SHELL = ['/app/', '/app/index.html', '/app/favicon.svg', '/app/manifest.webmanifest'];
self.addEventListener('install', (e) => {

View file

@ -15,6 +15,7 @@ const SETTINGS_SECTIONS = [
{ id: 'apparence', icon: '🎨' },
{ id: 'notifs', icon: '🔔' },
{ id: 'compte', icon: '🔑' },
{ id: 'server', icon: '🖥️' },
{ id: 'ircv3', icon: '🛰️' },
] as const;
type SettingsSection = (typeof SETTINGS_SECTIONS)[number]['id'];
@ -24,6 +25,7 @@ const SEC_KEY: Record<SettingsSection, string> = {
apparence: 'settings.sections.appearance',
notifs: 'settings.sections.notifications',
compte: 'settings.sections.account',
server: 'caps.server.title',
ircv3: 'caps.navLabel',
};
@ -32,6 +34,7 @@ const SEC_DESC: Record<SettingsSection, string> = {
apparence: 'settings.sectionDesc.appearance',
notifs: 'settings.sectionDesc.notifications',
compte: 'settings.sectionDesc.account',
server: 'caps.server.navDesc',
ircv3: 'caps.navDesc',
};
@ -96,6 +99,7 @@ export function SettingsModal() {
{section === 'apparence' && <AppearanceSection />}
{section === 'notifs' && <NotificationsSection />}
{section === 'compte' && <LoginTab />}
{section === 'server' && <ServerSection />}
{section === 'ircv3' && <CapabilitiesSection />}
</div>
</section>
@ -324,17 +328,13 @@ function NotificationsSection() {
);
}
// IRCv3 capabilities panel — shows every cap Orbit negotiates and whether the
// connected server actually supports it (live, from the client's CAP state).
function CapabilitiesSection() {
// Server / IRCd facts, pulled live from the registration numerics + ISUPPORT.
function ServerSection() {
const { t } = useTranslation();
const client = useChat((s) => s.client);
const status = useChat((s) => s.status);
const connected = status === 'registered' && !!client;
const caps = client ? client.listCaps() : CAP_KEYS.map((name) => ({ name, available: false, enabled: false }));
const active = caps.filter((c) => c.enabled).length;
// ── Server facts, pulled live from registration numerics + ISUPPORT ──────────
const dash = '—';
let host = '', secure = false;
try { const u = new URL(getConfig().server.url); host = u.host; secure = u.protocol === 'wss:'; } catch { /* bad url */ }
@ -354,9 +354,7 @@ function CapabilitiesSection() {
];
return (
<>
<div className="scard">
<div className="scard__h">🖥 {t('caps.server.title')}</div>
<div className="scard__body">
<dl className="srv-info">
{srv.map((r) => (
@ -368,6 +366,20 @@ function CapabilitiesSection() {
</dl>
</div>
</div>
);
}
// IRCv3 capabilities panel — shows every cap Orbit negotiates and whether the
// connected server actually supports it (live, from the client's CAP state).
function CapabilitiesSection() {
const { t } = useTranslation();
const client = useChat((s) => s.client);
const status = useChat((s) => s.status);
const connected = status === 'registered' && !!client;
const caps = client ? client.listCaps() : CAP_KEYS.map((name) => ({ name, available: false, enabled: false }));
const active = caps.filter((c) => c.enabled).length;
return (
<div className="scard">
<div className="scard__body">
<div className="sfield"><div className="sfield__intro">{t('caps.intro')}</div></div>
@ -391,7 +403,6 @@ function CapabilitiesSection() {
</ul>
</div>
</div>
</>
);
}
const CAP_KEYS = Object.keys(CAP_INFO);

View file

@ -616,7 +616,8 @@
"channelTypes": "Kanaltypen",
"roles": "Rollen",
"limits": "Limits",
"limitsValue": "Spitzname {{nick}} · Kanal {{chan}} · Thema {{topic}}"
"limitsValue": "Spitzname {{nick}} · Kanal {{chan}} · Thema {{topic}}",
"navDesc": "Netzwerk & Verbindung"
}
}
}

View file

@ -616,7 +616,8 @@
"channelTypes": "Channel types",
"roles": "Roles",
"limits": "Limits",
"limitsValue": "nick {{nick}} · channel {{chan}} · topic {{topic}}"
"limitsValue": "nick {{nick}} · channel {{chan}} · topic {{topic}}",
"navDesc": "Network & connection"
}
}
}

View file

@ -616,7 +616,8 @@
"channelTypes": "Tipos de canal",
"roles": "Roles",
"limits": "Límites",
"limitsValue": "apodo {{nick}} · canal {{chan}} · tema {{topic}}"
"limitsValue": "apodo {{nick}} · canal {{chan}} · tema {{topic}}",
"navDesc": "Red y conexión"
}
}
}

View file

@ -616,7 +616,8 @@
"channelTypes": "Types de salons",
"roles": "Rôles",
"limits": "Limites",
"limitsValue": "pseudo {{nick}} · salon {{chan}} · sujet {{topic}}"
"limitsValue": "pseudo {{nick}} · salon {{chan}} · sujet {{topic}}",
"navDesc": "Réseau & connexion"
}
}
}

View file

@ -616,7 +616,8 @@
"channelTypes": "Tipi di canale",
"roles": "Ruoli",
"limits": "Limiti",
"limitsValue": "soprannome {{nick}} · canale {{chan}} · argomento {{topic}}"
"limitsValue": "soprannome {{nick}} · canale {{chan}} · argomento {{topic}}",
"navDesc": "Rete e connessione"
}
}
}

View file

@ -616,7 +616,8 @@
"channelTypes": "च्यानल प्रकार",
"roles": "भूमिका",
"limits": "सीमा",
"limitsValue": "उपनाम {{nick}} · च्यानल {{chan}} · विषय {{topic}}"
"limitsValue": "उपनाम {{nick}} · च्यानल {{chan}} · विषय {{topic}}",
"navDesc": "नेटवर्क र जडान"
}
}
}

View file

@ -616,7 +616,8 @@
"channelTypes": "Tipos de canal",
"roles": "Funções",
"limits": "Limites",
"limitsValue": "apelido {{nick}} · canal {{chan}} · tópico {{topic}}"
"limitsValue": "apelido {{nick}} · canal {{chan}} · tópico {{topic}}",
"navDesc": "Rede e conexão"
}
}
}

View file

@ -616,7 +616,8 @@
"channelTypes": "Tipos de canal",
"roles": "Funções",
"limits": "Limites",
"limitsValue": "alcunha {{nick}} · canal {{chan}} · tópico {{topic}}"
"limitsValue": "alcunha {{nick}} · canal {{chan}} · tópico {{topic}}",
"navDesc": "Rede e ligação"
}
}
}

View file

@ -616,7 +616,8 @@
"channelTypes": "Типы каналов",
"roles": "Роли",
"limits": "Ограничения",
"limitsValue": "ник {{nick}} · канал {{chan}} · тема {{topic}}"
"limitsValue": "ник {{nick}} · канал {{chan}} · тема {{topic}}",
"navDesc": "Сеть и соединение"
}
}
}

View file

@ -616,7 +616,8 @@
"channelTypes": "Kanal türleri",
"roles": "Roller",
"limits": "Sınırlar",
"limitsValue": "takma ad {{nick}} · kanal {{chan}} · konu {{topic}}"
"limitsValue": "takma ad {{nick}} · kanal {{chan}} · konu {{topic}}",
"navDesc": "Ağ ve bağlantı"
}
}
}