fix(ui,i18n): E30 review round 3 — the stored language follows the screen, a fresh text starts collapsed, Retry waits again

This commit is contained in:
2026-10-01 10:43:59 +02:00
parent 08e62bbb16
commit 3563858fd1
14 changed files with 147 additions and 32 deletions
+5 -2
View File
@@ -1,4 +1,5 @@
import { compareText } from "./collate";
import { serverOrderLang } from "./saveLanguage";
// The channel manager's list order, and the priority steps its menu offers (E28 S3e3b).
@@ -32,14 +33,16 @@ function before(a: Ordered, b: Ordered, lang: string): boolean {
/** `rows` with the channel `id` taken out and put back where its priority now places it, every
* other row left exactly where it was — the server's order, without a refetch that would reorder
* anything the reader did not touch. */
* anything the reader did not touch. It takes the account's `preferences`, not a language: the
* server sorts in the STORED language (`serverOrderLang`), which a UI language is not always. */
export function placeByPriority<T extends Ordered>(
rows: readonly T[],
id: string,
lang: string,
preferences: Record<string, unknown> | null | undefined,
): T[] {
const moved = rows.find((r) => r.id === id);
if (!moved) return [...rows];
const lang = serverOrderLang(preferences);
const rest = rows.filter((r) => r !== moved);
const at = rest.findIndex((r) => before(moved, r, lang));
rest.splice(at < 0 ? rest.length : at, 0, moved);