UI: translate Import and Install screens

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Sonnet 5.5 committed 2026-09-30 11:51:51 +05:00
1 parent 0a9be3d800
commit 9dee0ce8b1
7 files changed
+305 -56

No files matched your search

+49
View File
@@ -98,6 +98,55 @@ const de: Partial<Record<keyof typeof en, string>> = {
"err.path_rejected.message": "Der angeforderte Dateipfad liegt außerhalb des Serverordners.",
"err.unknown.title": "Etwas ist schiefgelaufen",
"err.unknown.message": "Siehe die technischen Details.",
// Import server
"import.title": "Vorhandenen Server hinzufügen",
"import.subtitle": "Wähle den Ordner, aus dem dein Server läuft. Er wird nur gelesen.",
"import.dialogTitle": "Serverordner auswählen",
"import.choose": "Ordner wählen …",
"import.chooseAnother": "Anderen Ordner wählen",
"import.looking": "Server wird untersucht …",
"import.healthy.title": "Vorhandener Server erkannt",
"import.healthy.text": "Alles, was zum Betrieb dieses Servers nötig ist, wurde gefunden.",
"import.partial.title": "Server teilweise gefunden",
"import.partial.text": "Einige Teile fehlen. Du kannst ihn trotzdem hinzufügen; es wird nichts automatisch repariert.",
"import.custom.title": "Angepasster Server erkannt",
"import.custom.text": "Dieser Build wird nicht erkannt. Einige Update- und Installationsfunktionen sind deaktiviert.",
"import.incompatible.title": "Das ist kein Serverordner",
"import.incompatible.text": "Wähle den Ordner, der Core, Data und mysql (oder deine worldserver.exe) enthält.",
"import.techDetails": "Technische Details anzeigen",
"import.detected": "Erkannt",
"import.notInstalled": "Nicht installiert",
"import.notFound": "Nicht gefunden",
"import.noChanges": "Beim Import werden keine Dateien verändert.",
"import.add": "Server hinzufügen",
// Install server
"install.title": "Neuen Server installieren",
"install.subtitle": "Wähle einen Ordner oder behalte den vorgeschlagenen. Alles andere wird für dich eingerichtet.",
"install.installTo": "Installieren nach",
"install.browse": "Durchsuchen …",
"install.dialogTitle": "Wähle den Installationsort für deinen Server",
"install.pkgDialogTitle": "Wähle einen Serverpaket-Ordner",
"install.ready": "Dieser Ordner ist bereit. {gb} GB frei.",
"install.failedTitle": "Die Installation konnte nicht abgeschlossen werden",
"install.nothingInstalled": "Es wurde nichts installiert. Du kannst es erneut versuchen; heruntergeladene Dateien bleiben erhalten.",
"install.showTech": "Technische Details anzeigen",
"install.hideTech": "Technische Details ausblenden",
"install.advanced": "Erweitert",
"install.localPkg": "Aus einem lokalen Paketordner installieren statt herunterzuladen",
"install.localPkgHint": "(leer lassen zum Herunterladen)",
"install.button": "Installieren",
"install.progressTitle": "Server wird vorbereitet",
"install.progressText": "Das kann einige Minuten dauern. Du kannst dieses Fenster geöffnet lassen.",
"install.step.checking": "Computer wird geprüft",
"install.step.downloading": "Server wird heruntergeladen",
"install.step.unpacking": "Entpacken",
"install.step.database": "Datenbank wird vorbereitet",
"install.step.finishing": "Abschluss",
"install.doneTitle": "Dein Server ist bereit",
"install.doneText": "Alles ist installiert. Starte ihn auf dem nächsten Bildschirm.",
"install.open": "MEINEN SERVER ÖFFNEN",
};
export default de;
+49
View File
@@ -98,6 +98,55 @@ const en = {
"err.path_rejected.message": "The requested file location is outside the server folder.",
"err.unknown.title": "Something went wrong",
"err.unknown.message": "See the technical details.",
// Import server
"import.title": "Add an existing server",
"import.subtitle": "Pick the folder your server runs from. It will only be read.",
"import.dialogTitle": "Choose your server folder",
"import.choose": "Choose folder…",
"import.chooseAnother": "Choose another folder",
"import.looking": "Looking at your server…",
"import.healthy.title": "Existing server detected",
"import.healthy.text": "Everything needed to run this server was found.",
"import.partial.title": "Server partly found",
"import.partial.text": "Some parts are missing. You can still add it; nothing will be fixed automatically.",
"import.custom.title": "Custom server detected",
"import.custom.text": "This build is not recognised. Some update and install features will be disabled.",
"import.incompatible.title": "This is not a server folder",
"import.incompatible.text": "Choose the folder that contains Core, Data and mysql (or your worldserver.exe).",
"import.techDetails": "Show technical details",
"import.detected": "Detected",
"import.notInstalled": "Not installed",
"import.notFound": "Not found",
"import.noChanges": "No files will be changed during import.",
"import.add": "Add server",
// Install server
"install.title": "Install a new server",
"install.subtitle": "Choose a folder, or keep the suggested one. Everything else is set up for you.",
"install.installTo": "Install to",
"install.browse": "Browse…",
"install.dialogTitle": "Choose where to install your server",
"install.pkgDialogTitle": "Choose a server package folder",
"install.ready": "This folder is ready. {gb} GB free.",
"install.failedTitle": "The installation could not finish",
"install.nothingInstalled": "Nothing was installed. You can try again; downloaded files are kept.",
"install.showTech": "Show technical details",
"install.hideTech": "Hide technical details",
"install.advanced": "Advanced",
"install.localPkg": "Install from a local package folder instead of downloading",
"install.localPkgHint": "(leave empty to download)",
"install.button": "Install",
"install.progressTitle": "Preparing your server",
"install.progressText": "This can take a few minutes. You can leave this window open.",
"install.step.checking": "Checking your computer",
"install.step.downloading": "Downloading server",
"install.step.unpacking": "Unpacking",
"install.step.database": "Preparing database",
"install.step.finishing": "Finishing",
"install.doneTitle": "Your server is ready",
"install.doneText": "Everything is installed. Start it from the next screen.",
"install.open": "OPEN MY SERVER",
} as const;
export default en;
+49
View File
@@ -98,6 +98,55 @@ const es: Partial<Record<keyof typeof en, string>> = {
"err.path_rejected.message": "La ubicación solicitada está fuera de la carpeta del servidor.",
"err.unknown.title": "Algo salió mal",
"err.unknown.message": "Consulta los detalles técnicos.",
// Import server
"import.title": "Añadir un servidor existente",
"import.subtitle": "Elige la carpeta desde la que se ejecuta tu servidor. Solo se leerá.",
"import.dialogTitle": "Elige la carpeta del servidor",
"import.choose": "Elegir carpeta…",
"import.chooseAnother": "Elegir otra carpeta",
"import.looking": "Examinando tu servidor…",
"import.healthy.title": "Servidor existente detectado",
"import.healthy.text": "Se encontró todo lo necesario para ejecutar este servidor.",
"import.partial.title": "Servidor encontrado parcialmente",
"import.partial.text": "Faltan algunas partes. Aun así puedes añadirlo; no se corregirá nada automáticamente.",
"import.custom.title": "Servidor personalizado detectado",
"import.custom.text": "Esta versión no se reconoce. Algunas funciones de actualización e instalación estarán desactivadas.",
"import.incompatible.title": "Esta no es una carpeta de servidor",
"import.incompatible.text": "Elige la carpeta que contiene Core, Data y mysql (o tu worldserver.exe).",
"import.techDetails": "Mostrar detalles técnicos",
"import.detected": "Detectado",
"import.notInstalled": "No instalado",
"import.notFound": "No encontrado",
"import.noChanges": "No se modificará ningún archivo durante la importación.",
"import.add": "Añadir servidor",
// Install server
"install.title": "Instalar un servidor nuevo",
"install.subtitle": "Elige una carpeta o mantén la sugerida. Todo lo demás se configura por ti.",
"install.installTo": "Instalar en",
"install.browse": "Examinar…",
"install.dialogTitle": "Elige dónde instalar tu servidor",
"install.pkgDialogTitle": "Elige una carpeta de paquete del servidor",
"install.ready": "Esta carpeta está lista. {gb} GB libres.",
"install.failedTitle": "La instalación no pudo terminar",
"install.nothingInstalled": "No se instaló nada. Puedes intentarlo de nuevo; los archivos descargados se conservan.",
"install.showTech": "Mostrar detalles técnicos",
"install.hideTech": "Ocultar detalles técnicos",
"install.advanced": "Avanzado",
"install.localPkg": "Instalar desde una carpeta de paquete local en lugar de descargar",
"install.localPkgHint": "(déjalo vacío para descargar)",
"install.button": "Instalar",
"install.progressTitle": "Preparando tu servidor",
"install.progressText": "Esto puede tardar unos minutos. Puedes dejar esta ventana abierta.",
"install.step.checking": "Comprobando tu equipo",
"install.step.downloading": "Descargando el servidor",
"install.step.unpacking": "Descomprimiendo",
"install.step.database": "Preparando la base de datos",
"install.step.finishing": "Finalizando",
"install.doneTitle": "Tu servidor está listo",
"install.doneText": "Todo está instalado. Inícialo desde la siguiente pantalla.",
"install.open": "ABRIR MI SERVIDOR",
};
export default es;
+49
View File
@@ -98,6 +98,55 @@ const fr: Partial<Record<keyof typeof en, string>> = {
"err.path_rejected.message": "L’emplacement demandé est en dehors du dossier du serveur.",
"err.unknown.title": "Une erreur s’est produite",
"err.unknown.message": "Consultez les détails techniques.",
// Import server
"import.title": "Ajouter un serveur existant",
"import.subtitle": "Choisissez le dossier depuis lequel votre serveur fonctionne. Il sera seulement lu.",
"import.dialogTitle": "Choisissez le dossier du serveur",
"import.choose": "Choisir le dossier…",
"import.chooseAnother": "Choisir un autre dossier",
"import.looking": "Analyse de votre serveur…",
"import.healthy.title": "Serveur existant détecté",
"import.healthy.text": "Tout ce qui est nécessaire pour faire fonctionner ce serveur a été trouvé.",
"import.partial.title": "Serveur partiellement trouvé",
"import.partial.text": "Certaines parties manquent. Vous pouvez quand même l’ajouter ; rien ne sera réparé automatiquement.",
"import.custom.title": "Serveur personnalisé détecté",
"import.custom.text": "Cette version n’est pas reconnue. Certaines fonctions de mise à jour et d’installation seront désactivées.",
"import.incompatible.title": "Ce n’est pas un dossier de serveur",
"import.incompatible.text": "Choisissez le dossier qui contient Core, Data et mysql (ou votre worldserver.exe).",
"import.techDetails": "Afficher les détails techniques",
"import.detected": "Détecté",
"import.notInstalled": "Non installé",
"import.notFound": "Introuvable",
"import.noChanges": "Aucun fichier ne sera modifié pendant l’importation.",
"import.add": "Ajouter le serveur",
// Install server
"install.title": "Installer un nouveau serveur",
"install.subtitle": "Choisissez un dossier ou gardez celui proposé. Le reste est configuré pour vous.",
"install.installTo": "Installer dans",
"install.browse": "Parcourir…",
"install.dialogTitle": "Choisissez où installer votre serveur",
"install.pkgDialogTitle": "Choisissez un dossier de paquet serveur",
"install.ready": "Ce dossier est prêt. {gb} Go libres.",
"install.failedTitle": "L’installation n’a pas pu se terminer",
"install.nothingInstalled": "Rien n’a été installé. Vous pouvez réessayer ; les fichiers téléchargés sont conservés.",
"install.showTech": "Afficher les détails techniques",
"install.hideTech": "Masquer les détails techniques",
"install.advanced": "Avancé",
"install.localPkg": "Installer depuis un dossier de paquet local au lieu de télécharger",
"install.localPkgHint": "(laisser vide pour télécharger)",
"install.button": "Installer",
"install.progressTitle": "Préparation de votre serveur",
"install.progressText": "Cela peut prendre quelques minutes. Vous pouvez laisser cette fenêtre ouverte.",
"install.step.checking": "Vérification de votre ordinateur",
"install.step.downloading": "Téléchargement du serveur",
"install.step.unpacking": "Décompression",
"install.step.database": "Préparation de la base de données",
"install.step.finishing": "Finalisation",
"install.doneTitle": "Votre serveur est prêt",
"install.doneText": "Tout est installé. Démarrez-le depuis l’écran suivant.",
"install.open": "OUVRIR MON SERVEUR",
};
export default fr;
+49
View File
@@ -98,6 +98,55 @@ const ru: Partial<Record<keyof typeof en, string>> = {
"err.path_rejected.message": "Запрошенный файл находится за пределами папки сервера.",
"err.unknown.title": "Что-то пошло не так",
"err.unknown.message": "Смотрите технические подробности.",
// Import server
"import.title": "Добавить существующий сервер",
"import.subtitle": "Выберите папку, из которой запускается ваш сервер. Она будет только прочитана.",
"import.dialogTitle": "Выберите папку сервера",
"import.choose": "Выбрать папку…",
"import.chooseAnother": "Выбрать другую папку",
"import.looking": "Изучаю ваш сервер…",
"import.healthy.title": "Найден существующий сервер",
"import.healthy.text": "Найдено всё необходимое для запуска этого сервера.",
"import.partial.title": "Сервер найден частично",
"import.partial.text": "Некоторых частей не хватает. Сервер всё равно можно добавить; автоматически ничего исправляться не будет.",
"import.custom.title": "Найден нестандартный сервер",
"import.custom.text": "Эта сборка не распознана. Часть функций обновления и установки будет отключена.",
"import.incompatible.title": "Это не папка сервера",
"import.incompatible.text": "Выберите папку, в которой лежат Core, Data и mysql (или ваш worldserver.exe).",
"import.techDetails": "Показать технические подробности",
"import.detected": "Найдено",
"import.notInstalled": "Не установлено",
"import.notFound": "Не найдено",
"import.noChanges": "При импорте никакие файлы не изменяются.",
"import.add": "Добавить сервер",
// Install server
"install.title": "Установка нового сервера",
"install.subtitle": "Выберите папку или оставьте предложенную. Всё остальное настроится само.",
"install.installTo": "Куда установить",
"install.browse": "Обзор…",
"install.dialogTitle": "Выберите, куда установить сервер",
"install.pkgDialogTitle": "Выберите папку с пакетом сервера",
"install.ready": "Папка подходит. Свободно {gb} ГБ.",
"install.failedTitle": "Не удалось завершить установку",
"install.nothingInstalled": "Ничего не установлено. Можно попробовать ещё раз; скачанные файлы сохранены.",
"install.showTech": "Показать технические подробности",
"install.hideTech": "Скрыть технические подробности",
"install.advanced": "Дополнительно",
"install.localPkg": "Установить из локальной папки с пакетом вместо скачивания",
"install.localPkgHint": "(оставьте пустым, чтобы скачать)",
"install.button": "Установить",
"install.progressTitle": "Подготовка сервера",
"install.progressText": "Это может занять несколько минут. Окно можно не закрывать.",
"install.step.checking": "Проверка компьютера",
"install.step.downloading": "Загрузка сервера",
"install.step.unpacking": "Распаковка",
"install.step.database": "Подготовка базы данных",
"install.step.finishing": "Завершение",
"install.doneTitle": "Ваш сервер готов",
"install.doneText": "Всё установлено. Запустите сервер на следующем экране.",
"install.open": "ОТКРЫТЬ МОЙ СЕРВЕР",
};
export default ru;
+23 -32
View File
@@ -4,24 +4,13 @@ import { AlertTriangle, Check, Minus } from "lucide-react";
import { api, asUiError, type Classification, type ScanReport, type ServerSummary, type UiError } from "@/lib/api";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { useHuman, useT, type Key } from "@/i18n";
const HEADLINE: Record<Classification, { title: string; tone: string; text: string }> = {
healthy: { title: "Existing server detected", tone: "text-ok", text: "Everything needed to run this server was found." },
partial: {
title: "Server partly found",
tone: "text-warn",
text: "Some parts are missing. You can still add it; nothing will be fixed automatically.",
},
"unknown-custom": {
title: "Custom server detected",
tone: "text-warn",
text: "This build is not recognised. Some update and install features will be disabled.",
},
incompatible: {
title: "This is not a server folder",
tone: "text-bad",
text: "Choose the folder that contains Core, Data and mysql (or your worldserver.exe).",
},
const HEADLINE: Record<Classification, { title: Key; tone: string; text: Key }> = {
healthy: { title: "import.healthy.title", tone: "text-ok", text: "import.healthy.text" },
partial: { title: "import.partial.title", tone: "text-warn", text: "import.partial.text" },
"unknown-custom": { title: "import.custom.title", tone: "text-warn", text: "import.custom.text" },
incompatible: { title: "import.incompatible.title", tone: "text-bad", text: "import.incompatible.text" },
};
export function ImportServer(props: {
@@ -29,13 +18,15 @@ export function ImportServer(props: {
onCancel: () => void;
onAdded: (s: ServerSummary) => void | Promise<void>;
}) {
const t = useT();
const human = useHuman();
const [report, setReport] = useState<ScanReport | null>(null);
const [error, setError] = useState<UiError | null>(null);
const [busy, setBusy] = useState(false);
async function choose() {
setError(null);
const picked = await open({ directory: true, multiple: false, title: "Choose your server folder" });
const picked = await open({ directory: true, multiple: false, title: t("import.dialogTitle") });
if (typeof picked !== "string") return;
setBusy(true);
setReport(null);
@@ -64,29 +55,29 @@ export function ImportServer(props: {
return (
<main className="mx-auto flex h-full max-w-2xl flex-col justify-center gap-5 px-8 py-10">
<div>
<h1 className="text-2xl font-semibold">Add an existing server</h1>
<p className="mt-1 text-muted">Pick the folder your server runs from. It will only be read.</p>
<h1 className="text-2xl font-semibold">{t("import.title")}</h1>
<p className="mt-1 text-muted">{t("import.subtitle")}</p>
</div>
<div className="flex gap-3">
<Button variant="secondary" onClick={choose} disabled={busy}>
{report ? "Choose another folder" : "Choose folder…"}
{report ? t("import.chooseAnother") : t("import.choose")}
</Button>
{props.canCancel && (
<Button variant="ghost" onClick={props.onCancel}>
Cancel
{t("common.cancel")}
</Button>
)}
</div>
{busy && !report && <p className="text-muted">Looking at your server…</p>}
{busy && !report && <p className="text-muted">{t("import.looking")}</p>}
{error && (
<Card className="border-bad/40 p-4" role="alert">
<p className="font-medium text-bad">{error.human.title}</p>
<p className="mt-1 text-sm text-muted">{error.human.message}</p>
<p className="font-medium text-bad">{human(error.human).title}</p>
<p className="mt-1 text-sm text-muted">{human(error.human).message}</p>
<details className="mt-2 text-xs text-muted">
<summary className="cursor-pointer">Show technical details</summary>
<summary className="cursor-pointer">{t("import.techDetails")}</summary>
<pre className="mt-1 whitespace-pre-wrap">{error.technical}</pre>
</details>
</Card>
@@ -101,8 +92,8 @@ export function ImportServer(props: {
<AlertTriangle className={`mt-0.5 h-5 w-5 ${head.tone}`} aria-hidden />
)}
<div>
<h2 className="font-semibold">{head.title}</h2>
<p className="text-sm text-muted">{head.text}</p>
<h2 className="font-semibold">{t(head.title)}</h2>
<p className="text-sm text-muted">{t(head.text)}</p>
<p className="selectable mt-1 break-all text-xs text-muted">{report.path}</p>
</div>
</div>
@@ -115,11 +106,11 @@ export function ImportServer(props: {
{it.detail && <span className="text-xs">{it.detail}</span>}
{it.status === "found" ? (
<span className="flex items-center gap-1 text-ok">
<Check className="h-4 w-4" aria-hidden /> Detected
<Check className="h-4 w-4" aria-hidden /> {t("import.detected")}
</span>
) : (
<span className="flex items-center gap-1">
<Minus className="h-4 w-4" aria-hidden /> {it.key === "companions" ? "Not installed" : "Not found"}
<Minus className="h-4 w-4" aria-hidden /> {it.key === "companions" ? t("import.notInstalled") : t("import.notFound")}
</span>
)}
</span>
@@ -134,13 +125,13 @@ export function ImportServer(props: {
))}
<div className="mt-5 flex items-center justify-between border-t border-line pt-4">
<p className="text-sm text-muted">No files will be changed during import.</p>
<p className="text-sm text-muted">{t("import.noChanges")}</p>
<Button
variant="primary"
onClick={add}
disabled={busy || report.classification === "incompatible"}
>
Add server
{t("import.add")}
</Button>
</div>
</Card>
+37 -24
View File
@@ -5,10 +5,23 @@ import { Check, ChevronDown, ChevronRight, Loader2 } from "lucide-react";
import { api, asUiError, type InstallStep, type Preflight, type ServerSummary, type UiError } from "@/lib/api";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { useHuman, useT, type Key } from "@/i18n";
// The backend reports progress with these English step names; map the known ones to translations.
const STEP_KEYS: Record<string, Key> = {
"Preparing your server": "install.progressTitle",
"Checking your computer": "install.step.checking",
"Downloading server": "install.step.downloading",
Unpacking: "install.step.unpacking",
"Preparing database": "install.step.database",
Finishing: "install.step.finishing",
};
type Phase = "choose" | "installing" | "done";
export function InstallServer(props: { canCancel: boolean; onCancel: () => void; onDone: (s: ServerSummary) => void | Promise<void> }) {
const t = useT();
const human = useHuman();
const [dest, setDest] = useState("C:\\Games\\CoA Server");
const [pre, setPre] = useState<Preflight | null>(null);
const [phase, setPhase] = useState<Phase>("choose");
@@ -32,12 +45,12 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
}, []);
async function browse() {
const picked = await open({ directory: true, multiple: false, title: "Choose where to install your server" });
const picked = await open({ directory: true, multiple: false, title: t("install.dialogTitle") });
if (typeof picked === "string") setDest(picked.replace(/[\\/]+$/, "") + (picked.toLowerCase().includes("coa") ? "" : "\\CoA Server"));
}
async function browsePackage() {
const picked = await open({ directory: true, multiple: false, title: "Choose a server package folder" });
const picked = await open({ directory: true, multiple: false, title: t("install.pkgDialogTitle") });
if (typeof picked === "string") setPkg(picked);
}
@@ -58,12 +71,12 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
if (phase === "installing") {
return (
<main className="mx-auto flex h-full max-w-xl flex-col justify-center px-8">
<h1 className="text-2xl font-semibold">Preparing your server</h1>
<p className="mt-1 text-muted">This can take a few minutes. You can leave this window open.</p>
<h1 className="text-2xl font-semibold">{t("install.progressTitle")}</h1>
<p className="mt-1 text-muted">{t("install.progressText")}</p>
<Card className="mt-8 p-6">
<div className="flex items-center justify-between">
<span className="flex items-center gap-2 font-medium">
<Loader2 className="h-4 w-4 animate-spin text-gold" aria-hidden /> {step.step}
<Loader2 className="h-4 w-4 animate-spin text-gold" aria-hidden /> {STEP_KEYS[step.step] ? t(STEP_KEYS[step.step]) : step.step}
</span>
<span className="text-sm text-muted" role="status">{step.percent}%</span>
</div>
@@ -74,7 +87,7 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
</Card>
{step.step === "Downloading server" && (
<Button className="mt-4 self-start" variant="ghost" size="sm" onClick={() => void api.cancelInstall()}>
Cancel
{t("common.cancel")}
</Button>
)}
</main>
@@ -87,10 +100,10 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
<div className="flex h-14 w-14 items-center justify-center rounded-full bg-ok/15">
<Check className="h-7 w-7 text-ok" aria-hidden />
</div>
<h1 className="mt-5 text-2xl font-semibold">Your server is ready</h1>
<p className="mt-1 text-muted">Everything is installed. Start it from the next screen.</p>
<h1 className="mt-5 text-2xl font-semibold">{t("install.doneTitle")}</h1>
<p className="mt-1 text-muted">{t("install.doneText")}</p>
<Button className="mt-8" variant="primary" size="xl" onClick={() => void props.onDone(installed)}>
OPEN MY SERVER
{t("install.open")}
</Button>
</main>
);
@@ -99,12 +112,12 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
return (
<main className="mx-auto flex h-full max-w-2xl flex-col justify-center gap-5 px-8 py-10">
<div>
<h1 className="text-2xl font-semibold">Install a new server</h1>
<p className="mt-1 text-muted">Choose a folder, or keep the suggested one. Everything else is set up for you.</p>
<h1 className="text-2xl font-semibold">{t("install.title")}</h1>
<p className="mt-1 text-muted">{t("install.subtitle")}</p>
</div>
<div>
<label htmlFor="dest" className="text-sm text-muted">Install to</label>
<label htmlFor="dest" className="text-sm text-muted">{t("install.installTo")}</label>
<div className="mt-1 flex gap-2">
<input
id="dest"
@@ -112,7 +125,7 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
onChange={(e) => setDest(e.target.value)}
className="selectable flex-1 rounded-md border border-line bg-card px-3 py-2.5 text-[15px] outline-none focus:border-gold"
/>
<Button onClick={browse}>Browse…</Button>
<Button onClick={browse}>{t("install.browse")}</Button>
</div>
</div>
@@ -123,15 +136,15 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
))}
</Card>
)}
{pre?.ok && <p className="text-sm text-ok">This folder is ready. {Math.round(pre.free_bytes / (1 << 30))} GB free.</p>}
{pre?.ok && <p className="text-sm text-ok">{t("install.ready", { gb: Math.round(pre.free_bytes / (1 << 30)) })}</p>}
{error && (
<Card className="border-bad/40 p-4" role="alert">
<p className="font-medium text-bad">{error.human.code === "unknown" ? "The installation could not finish" : error.human.title}</p>
<p className="mt-1 text-sm text-muted">{error.human.code === "unknown" ? error.technical : error.human.message}</p>
<p className="mt-1 text-sm text-muted">Nothing was installed. You can try again; downloaded files are kept.</p>
<p className="font-medium text-bad">{error.human.code === "unknown" ? t("install.failedTitle") : human(error.human).title}</p>
<p className="mt-1 text-sm text-muted">{error.human.code === "unknown" ? error.technical : human(error.human).message}</p>
<p className="mt-1 text-sm text-muted">{t("install.nothingInstalled")}</p>
<button className="mt-2 cursor-pointer text-xs text-muted underline" onClick={() => setShowDetails((v) => !v)}>
{showDetails ? "Hide" : "Show"} technical details
{showDetails ? t("install.hideTech") : t("install.showTech")}
</button>
{showDetails && <pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap rounded bg-black/40 p-2 text-xs">{error.technical}</pre>}
</Card>
@@ -140,14 +153,14 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
<div>
<button onClick={() => setShowAdvanced((v) => !v)} aria-expanded={showAdvanced} className="flex cursor-pointer items-center gap-1 text-sm text-muted hover:text-ink">
{showAdvanced ? <ChevronDown className="h-4 w-4" aria-hidden /> : <ChevronRight className="h-4 w-4" aria-hidden />}
Advanced
{t("install.advanced")}
</button>
{showAdvanced && (
<div className="mt-2">
<label htmlFor="pkg" className="text-sm text-muted">Install from a local package folder instead of downloading</label>
<label htmlFor="pkg" className="text-sm text-muted">{t("install.localPkg")}</label>
<div className="mt-1 flex gap-2">
<input id="pkg" value={pkg} onChange={(e) => setPkg(e.target.value)} placeholder="(leave empty to download)" className="selectable flex-1 rounded-md border border-line bg-card px-3 py-2 text-sm outline-none focus:border-gold" />
<Button size="sm" onClick={browsePackage}>Browse…</Button>
<input id="pkg" value={pkg} onChange={(e) => setPkg(e.target.value)} placeholder={t("install.localPkgHint")} className="selectable flex-1 rounded-md border border-line bg-card px-3 py-2 text-sm outline-none focus:border-gold" />
<Button size="sm" onClick={browsePackage}>{t("install.browse")}</Button>
</div>
</div>
)}
@@ -155,11 +168,11 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
<div className="flex items-center gap-3">
<Button variant="primary" size="md" disabled={!pre?.ok} onClick={() => void install()}>
Install
{t("install.button")}
</Button>
{props.canCancel && (
<Button variant="ghost" onClick={props.onCancel}>
Cancel
{t("common.cancel")}
</Button>
)}
</div>