feat(ui): module settings open under their card's row; Other settings tab

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
CorfireanandClaude Sonnet 5.5 committed 2026-10-02 17:07:39 +05:00
1 parent 89be57b4e4
commit 209dbe37ac
6 files changed
+35 -20

No files matched your search

+2 -2
View File
@@ -726,7 +726,7 @@ const de: Partial<Record<keyof typeof en, string>> = {
"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<Record<keyof typeof en, string>> = {
"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…",
};
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -726,7 +726,7 @@ const es: Partial<Record<keyof typeof en, string>> = {
"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<Record<keyof typeof en, string>> = {
"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…",
};
+2 -2
View File
@@ -726,7 +726,7 @@ const fr: Partial<Record<keyof typeof en, string>> = {
"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<Record<keyof typeof en, string>> = {
"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…",
};
+2 -2
View File
@@ -726,7 +726,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
"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<Record<keyof typeof en, string>> = {
"mod.status.soon": "Скоро",
"mod.hint.soon": "В планах: пока недоступен.",
"set.tab.collections": "Коллекции",
"set.tab.all": "Все настройки",
"set.tab.all": "Остальные",
"set.searchAll": "Поиск по всем настройкам: название или описание…",
"set.search": "Поиск по настройкам…",
};
+25 -10
View File
@@ -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<string, { label: Key; hint: Key; tone: string }> = {
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<HTMLDivElement>(null);
useEffect(() => {
ref.current?.scrollIntoView({ block: "nearest", behavior: "smooth" });
}, []);
return (
<div ref={ref} className={className}>
<Card className="border-gold/50 p-5">{children}</Card>
</div>
);
}
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 (
<div className="max-w-4xl">
@@ -110,8 +123,9 @@ export function ModulesPage({ serverId, onChanged }: { serverId: string; onChang
<div className="mt-6 grid gap-4 sm:grid-cols-2">
{modules === null && !error && <p className="text-muted">{t("overview.checking")}</p>}
{modules?.length === 0 && <Card className="p-6 text-center text-muted sm:col-span-2">{t("mod.empty")}</Card>}
{modules?.map((m) => (
<Card key={m.id} className={cn("flex flex-col gap-4 p-5 transition-colors", !m.installed && "opacity-60", open === m.id && "border-gold/50")} aria-label={m.status === "soon" ? `${m.name}: ${t("mod.status.soon")}` : undefined}>
{modules?.map((m, i) => (
<Fragment key={m.id}>
<Card className={cn("flex flex-col gap-4 p-5 transition-colors", !m.installed && "opacity-60", open === m.id && "border-gold/50")} aria-label={m.status === "soon" ? `${m.name}: ${t("mod.status.soon")}` : undefined}>
<div className="flex items-start gap-4">
<Tile icon={m.icon} off={!m.enabled || !m.installed} />
<div className="min-w-0 flex-1">
@@ -151,15 +165,16 @@ export function ModulesPage({ serverId, onChanged }: { serverId: string; onChang
)}
</div>
</Card>
{/* 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) && (
<SettingsPanel key={selected.id} className="sm:col-span-2">
<h2 className="font-semibold">{t("mod.settingsOf", { name: selected.name })}</h2>
<ModuleSettings serverId={serverId} module={selected} onSaved={() => setChanged(true)} />
</SettingsPanel>
)}
</Fragment>
))}
</div>
{selected && (
<Card className="mt-4 p-5">
<h2 className="font-semibold">{t("mod.settingsOf", { name: selected.name })}</h2>
<ModuleSettings serverId={serverId} module={selected} onSaved={() => setChanged(true)} />
</Card>
)}
</div>
);
}