From 209dbe37acc3b483acd4821adf1e5726dc38abb6 Mon Sep 17 00:00:00 2001 From: Corfirean Date: Fri, 2 Oct 2026 17:07:39 +0500 Subject: [PATCH] feat(ui): module settings open under their card's row; Other settings tab Co-Authored-By: Claude Sonnet 5.5 --- src/i18n/locales/de.ts | 4 ++-- src/i18n/locales/en.ts | 4 ++-- src/i18n/locales/es.ts | 4 ++-- src/i18n/locales/fr.ts | 4 ++-- src/i18n/locales/ru.ts | 4 ++-- src/screens/ModulesPage.tsx | 35 +++++++++++++++++++++++++---------- 6 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 1868b9e..a9808db 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -726,7 +726,7 @@ const de: Partial> = { "mod.empty": "Hier ist noch nichts. Optionale Module erscheinen auf dieser Seite, sobald sie hinzugefügt werden.", // Settings page: the full searchable list "all.title": "Alle Servereinstellungen", - "all.intro": "Jede dokumentierte Einstellung des Weltservers mit Erklärung. Ändere nur, was du verstehst: Ein falscher Wert kann den Server beschädigen. Die bisherige Konfiguration wird vorher gesichert und kann wiederhergestellt werden.", + "all.intro": "Alle weiteren dokumentierten Einstellungen des Weltservers mit Erklärung. Was auf den anderen Reitern steht, wird hier nicht wiederholt, die Suche oben findet aber alles. Ändere nur, was du verstehst: Ein falscher Wert kann den Server beschädigen. Die bisherige Konfiguration wird vorher gesichert und kann wiederhergestellt werden.", "all.search": "Nach Name oder Beschreibung suchen…", "all.onlyChanged": "Nur geänderte", "all.count": "{shown} von {total} werden angezeigt. Suche, um die Liste einzugrenzen.", @@ -769,7 +769,7 @@ const de: Partial> = { "mod.status.soon": "Bald", "mod.hint.soon": "Geplant: noch nicht verfügbar.", "set.tab.collections": "Sammlungen", - "set.tab.all": "Alle Einstellungen", + "set.tab.all": "Weitere", "set.searchAll": "Alle Einstellungen nach Name oder Beschreibung durchsuchen…", "set.search": "Einstellungen durchsuchen…", }; diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index f751a52..0003bca 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -726,7 +726,7 @@ const en = { "mod.empty": "There is nothing here yet. Optional modules will appear on this page as they are added.", // Settings page: the full searchable list "all.title": "All server settings", - "all.intro": "Every documented setting of the world server, with its explanation. Change only what you understand: a wrong value can break the server. The previous configuration is saved first and can be restored.", + "all.intro": "All other documented settings of the world server, with their explanations. The ones shown on the other tabs are not repeated here, but the search above finds everything. Change only what you understand: a wrong value can break the server. The previous configuration is saved first and can be restored.", "all.search": "Search by name or description…", "all.onlyChanged": "Only changed", "all.count": "Showing {shown} of {total}. Search to narrow it down.", @@ -769,7 +769,7 @@ const en = { "mod.status.soon": "Soon", "mod.hint.soon": "Planned: not available yet.", "set.tab.collections": "Collections", - "set.tab.all": "All settings", + "set.tab.all": "Other settings", "set.searchAll": "Search all settings by name or description…", "set.search": "Search settings…", } as const; diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 14f2668..ea11f38 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -726,7 +726,7 @@ const es: Partial> = { "mod.empty": "Aquí todavía no hay nada. Los módulos opcionales aparecerán en esta página a medida que se añadan.", // Settings page: the full searchable list "all.title": "Todos los ajustes del servidor", - "all.intro": "Cada ajuste documentado del servidor del mundo, con su explicación. Cambia solo lo que entiendas: un valor incorrecto puede romper el servidor. La configuración anterior se guarda antes y se puede restaurar.", + "all.intro": "Todos los demás ajustes documentados del servidor del mundo, con su explicación. Los de las otras pestañas no se repiten aquí, pero la búsqueda de arriba lo encuentra todo. Cambia solo lo que entiendas: un valor incorrecto puede romper el servidor. La configuración anterior se guarda antes y se puede restaurar.", "all.search": "Buscar por nombre o descripción…", "all.onlyChanged": "Solo los cambiados", "all.count": "Mostrando {shown} de {total}. Usa la búsqueda para acotar.", @@ -769,7 +769,7 @@ const es: Partial> = { "mod.status.soon": "Pronto", "mod.hint.soon": "Previsto: aún no disponible.", "set.tab.collections": "Colecciones", - "set.tab.all": "Todos los ajustes", + "set.tab.all": "Otros", "set.searchAll": "Buscar en todos los ajustes por nombre o descripción…", "set.search": "Buscar ajustes…", }; diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 56e7830..7a07a1d 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -726,7 +726,7 @@ const fr: Partial> = { "mod.empty": "Il n’y a encore rien ici. Les modules optionnels apparaîtront sur cette page au fur et à mesure de leur ajout.", // Settings page: the full searchable list "all.title": "Tous les réglages du serveur", - "all.intro": "Chaque réglage documenté du serveur de monde, avec son explication. Ne modifiez que ce que vous comprenez : une mauvaise valeur peut casser le serveur. La configuration précédente est sauvegardée d'abord et peut être restaurée.", + "all.intro": "Tous les autres réglages documentés du serveur de monde, avec leur explication. Ceux des autres onglets ne sont pas répétés ici, mais la recherche ci-dessus trouve tout. Ne modifiez que ce que vous comprenez : une mauvaise valeur peut casser le serveur. La configuration précédente est sauvegardée d'abord et peut être restaurée.", "all.search": "Rechercher par nom ou description…", "all.onlyChanged": "Seulement les modifiés", "all.count": "{shown} sur {total} affichés. Utilisez la recherche pour affiner.", @@ -769,7 +769,7 @@ const fr: Partial> = { "mod.status.soon": "Bientôt", "mod.hint.soon": "Prévu : pas encore disponible.", "set.tab.collections": "Collections", - "set.tab.all": "Tous les réglages", + "set.tab.all": "Autres", "set.searchAll": "Rechercher dans tous les réglages par nom ou description…", "set.search": "Rechercher un réglage…", }; diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index ddc1e21..e148681 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -726,7 +726,7 @@ const ru: Partial> = { "mod.empty": "Здесь пока пусто. Дополнительные модули появятся на этой странице по мере добавления.", // Settings page: the full searchable list "all.title": "Все настройки сервера", - "all.intro": "Все документированные настройки мирового сервера с пояснениями. Меняйте только то, что понимаете: неверное значение может сломать сервер. Прежняя конфигурация сохраняется заранее, её можно восстановить.", + "all.intro": "Все остальные документированные настройки мирового сервера с пояснениями. Те, что есть на других вкладках, здесь не повторяются, а поиск сверху находит всё. Меняйте только то, что понимаете: неверное значение может сломать сервер. Прежняя конфигурация сохраняется заранее, её можно восстановить.", "all.search": "Поиск по названию или описанию…", "all.onlyChanged": "Только изменённые", "all.count": "Показано {shown} из {total}. Используйте поиск, чтобы сузить список.", @@ -769,7 +769,7 @@ const ru: Partial> = { "mod.status.soon": "Скоро", "mod.hint.soon": "В планах: пока недоступен.", "set.tab.collections": "Коллекции", - "set.tab.all": "Все настройки", + "set.tab.all": "Остальные", "set.searchAll": "Поиск по всем настройкам: название или описание…", "set.search": "Поиск по настройкам…", }; diff --git a/src/screens/ModulesPage.tsx b/src/screens/ModulesPage.tsx index 937db02..875db60 100644 --- a/src/screens/ModulesPage.tsx +++ b/src/screens/ModulesPage.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useState, type ComponentType } from "react"; +import { Fragment, useCallback, useEffect, useRef, useState, type ComponentType, type ReactNode } from "react"; import { Bot, Flame, Gavel, Loader2, Plug, Puzzle, Scaling, Settings2, Snowflake, Sparkles, Swords, type LucideProps } from "lucide-react"; import { api, asUiError, type ModuleSetting, type ModuleView, type UiError } from "@/lib/api"; import { cn } from "@/lib/utils"; @@ -35,6 +35,18 @@ const STATUS: Record = { release: { label: "mod.status.release", hint: "mod.hint.release", tone: "border-ok/50 bg-ok/10 text-ok" }, }; +function SettingsPanel({ className, children }: { className?: string; children: ReactNode }) { + const ref = useRef(null); + useEffect(() => { + ref.current?.scrollIntoView({ block: "nearest", behavior: "smooth" }); + }, []); + return ( +
+ {children} +
+ ); +} + function StatusBadge({ status }: { status: string }) { const { t } = useI18n(); const s = STATUS[status] ?? STATUS.release; @@ -97,6 +109,7 @@ export function ModulesPage({ serverId, onChanged }: { serverId: string; onChang } const selected = modules?.find((m) => m.id === open) ?? null; + const selectedAt = modules?.findIndex((m) => m.id === open) ?? -1; return (
@@ -110,8 +123,9 @@ export function ModulesPage({ serverId, onChanged }: { serverId: string; onChang
{modules === null && !error &&

{t("overview.checking")}

} {modules?.length === 0 && {t("mod.empty")}} - {modules?.map((m) => ( - + {modules?.map((m, i) => ( + +
@@ -151,15 +165,16 @@ export function ModulesPage({ serverId, onChanged }: { serverId: string; onChang )}
+ {/* The settings open right under the row of the card they belong to, so they are never out of sight below a long grid. */} + {selected && selectedAt >= 0 && Math.floor(selectedAt / 2) === Math.floor(i / 2) && (i % 2 === 1 || i === modules.length - 1) && ( + +

{t("mod.settingsOf", { name: selected.name })}

+ setChanged(true)} /> +
+ )} + ))}
- - {selected && ( - -

{t("mod.settingsOf", { name: selected.name })}

- setChanged(true)} /> -
- )}
); }