fix(admin-web): layout, accessibility, right-to-left, plurals and dark theme
Tables become ARIA tables laid out as subgrids that drop secondary columns in narrow panels; stat tiles stay on one row; charts are named and keep their axis labels inside; paths, templates and logs stay left to right; counts use plural keys; the panel follows the system theme with a toggle. Own account: Change password instead of Reset password. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
16 files changed
+1071
-430
No files matched your search
@@ -2,6 +2,10 @@
|
||||
import { t, has } from "./i18n.js";
|
||||
import { escapeHtml, attr, bar } from "./ui.js";
|
||||
|
||||
const CODECS = { h264: "H.264", hevc: "HEVC", av1: "AV1" };
|
||||
/** Hardware encoder families as users know them, recognised in the Media Foundation encoder names. */
|
||||
const VENDORS = [[/nvidia|nvenc/i, "NVENC"], [/intel|quick ?sync|qsv/i, "QSV"], [/amd|radeon|amf/i, "AMF"]];
|
||||
|
||||
export function pascal(text) {
|
||||
return String(text).split(/[-_]/).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join("");
|
||||
}
|
||||
@@ -31,11 +35,24 @@ export function progressCell(job) {
|
||||
|
||||
export function stateCell(state) {
|
||||
const glyph = { running: "◐", queued: "○", paused: "❚❚", done: "●", failed: "✕", cancelled: "○" }[state] ?? "";
|
||||
return `<span class="state ${attr(state)}">${glyph} ${escapeHtml(stateLabel(state))}</span>`;
|
||||
return `<span class="state ${attr(state)}"><span aria-hidden="true">${glyph}</span> ${escapeHtml(stateLabel(state))}</span>`;
|
||||
}
|
||||
|
||||
/** Node encoders as "NVENC HEVC/H.264/AV1". */
|
||||
/** The job log: the tail, then the error unless the tail already ends with it. */
|
||||
export function logText(job) {
|
||||
const tail = (job.logTail ?? "").trimEnd();
|
||||
return job.error && !tail.endsWith(job.error.trim()) ? `${tail}\n${job.error}`.trim() : tail;
|
||||
}
|
||||
|
||||
/** Node encoders by family, as "NVENC HEVC/H.264/AV1" (software encoders without a family name). */
|
||||
export function encoders(node) {
|
||||
const names = [...new Set(node.encoders.map((e) => e.codec.toUpperCase()))];
|
||||
return names.join("/");
|
||||
const families = new Map();
|
||||
for (const e of node.encoders) {
|
||||
const family = e.hardware ? VENDORS.find(([pattern]) => pattern.test(e.name))?.[1] ?? "" : "";
|
||||
const codec = CODECS[e.codec] ?? e.codec.toUpperCase();
|
||||
const codecs = families.get(family) ?? [];
|
||||
if (!codecs.includes(codec)) codecs.push(codec);
|
||||
families.set(family, codecs);
|
||||
}
|
||||
return [...families].map(([family, codecs]) => `${family} ${codecs.join("/")}`.trim()).join(", ");
|
||||
}
|
||||
Reference in new issue
Block a user