Redesign the launcher window after the game's launcher and website

The window is now a fixed 1120x720 frameless window with its own title
bar: page navigation, language, minimize and close. The layout follows
the game's launcher: a side panel, the main area over the background,
and a bottom bar with the state of the current task and the primary
action. The colours and type follow the game's website: dark blue-grey,
red actions, Roboto Condensed (bundled, OFL), cyan progress.

- Pages: home (requirements before installation, the current copy
  after), copies (copy details with folders to open, feature status
  grouped by inventory section), settings (language), about.
- The install wizard is a hook shared by the side panel (step list),
  the main area (current step) and the bottom bar (back, next, install,
  cancel, copy progress).
- The adaptation shown for a game version is the version itself when
  the patches were verified on it, otherwise the nearest verified one.
- Both language packs are rewritten in consistent product wording.
- New IPC: app:openFolder, install:listFeatures (patcher's new
  patchFeatures), window:minimize, window:close; app:getInfo reports the
  supported game versions.

Launching is not built yet; its button stays disabled.

Checked: launcher typecheck (main and renderer), electron-vite build,
root typecheck. Ran the window from a scratch user data folder over the
remote debugging port: every page and section in Chinese and English,
empty and installed state, the wizard's first step, both new IPC calls,
no console errors and no overflow.
This commit is contained in:
N0VAN0M4LY committed 2026-11-29 07:39:12 +08:00
1 parent 303dbf24e6
commit b83d3e54f3
51 files changed
+2810 -771

No files matched your search

+1
View File
@@ -12,6 +12,7 @@
"typecheck": "tsc --noEmit -p tsconfig.node.json && tsc --noEmit -p tsconfig.web.json" "typecheck": "tsc --noEmit -p tsconfig.node.json && tsc --noEmit -p tsconfig.web.json"
}, },
"dependencies": { "dependencies": {
"@fontsource/roboto-condensed": "^5.3.0",
"@wto/patcher": "*", "@wto/patcher": "*",
"@wto/server": "*", "@wto/server": "*",
"i18next": "^26.3.6", "i18next": "^26.3.6",
+29 -7
View File
@@ -1,4 +1,5 @@
import { app, BrowserWindow, dialog } from 'electron'; import { app, BrowserWindow, dialog, shell } from 'electron';
import { patchFeatures, verifiedGameVersions } from '@wto/patcher';
import { AppError } from '@shared/errors.ts'; import { AppError } from '@shared/errors.ts';
import { getSettings, updateSettings } from '../services/config/settings-store.ts'; import { getSettings, updateSettings } from '../services/config/settings-store.ts';
import { measureFolder } from '../services/game-folder/folder-size.ts'; import { measureFolder } from '../services/game-folder/folder-size.ts';
@@ -6,16 +7,33 @@ import { inspectGameFolder, requireFolder } from '../services/game-folder/inspec
import { inspectTargetFolder } from '../services/game-folder/inspect-target-folder.ts'; import { inspectTargetFolder } from '../services/game-folder/inspect-target-folder.ts';
import { cancelInstall, checkGameFolder, installGame } from '../services/install/install-game.ts'; import { cancelInstall, checkGameFolder, installGame } from '../services/install/install-game.ts';
import { defaultDataPath, readInstallRecord } from '../services/install/install-record.ts'; import { defaultDataPath, readInstallRecord } from '../services/install/install-record.ts';
import { resourcePaths } from '../services/resources/resource-paths.ts';
import { broadcast, handle } from './register.ts'; import { broadcast, handle } from './register.ts';
/** Registers the handler of every contract channel. One line per channel; the work is in services/. */ /** Registers the handler of every contract channel. One line per channel; the work is in services/. */
export function registerIpcHandlers(): void { export function registerIpcHandlers(): void {
handle('app:getInfo', () => ({ handle('app:getInfo', () => {
version: app.getVersion(), const resources = resourcePaths();
electron: process.versions.electron, return {
systemLocale: app.getLocale(), version: app.getVersion(),
userDataPath: app.getPath('userData'), electron: process.versions.electron,
})); systemLocale: app.getLocale(),
userDataPath: app.getPath('userData'),
supportedGameVersions: verifiedGameVersions(resources.exePatches, resources.guiPatches),
};
});
handle('app:openFolder', async ({ path }) => {
await requireFolder(path);
const failure = await shell.openPath(path);
if (failure) console.warn('[app] opening the folder failed:', path, failure);
});
handle('window:minimize', (_input, sender) => {
BrowserWindow.fromWebContents(sender)?.minimize();
});
handle('window:close', (_input, sender) => {
BrowserWindow.fromWebContents(sender)?.close();
});
handle('dialog:pickFolder', async ({ title }, sender) => { handle('dialog:pickFolder', async ({ title }, sender) => {
const window = BrowserWindow.fromWebContents(sender); const window = BrowserWindow.fromWebContents(sender);
@@ -40,6 +58,10 @@ export function registerIpcHandlers(): void {
handle('install:start', (request) => installGame(request, (progress) => broadcast('event:install-progress', progress))); handle('install:start', (request) => installGame(request, (progress) => broadcast('event:install-progress', progress)));
handle('install:cancel', () => ({ cancelled: cancelInstall() })); handle('install:cancel', () => ({ cancelled: cancelInstall() }));
handle('install:getRecord', async () => ({ record: await readInstallRecord(), defaultDataPath: defaultDataPath() })); handle('install:getRecord', async () => ({ record: await readInstallRecord(), defaultDataPath: defaultDataPath() }));
handle('install:listFeatures', () => {
const resources = resourcePaths();
return patchFeatures(resources.exePatches, resources.guiPatches).map((feature) => ({ ...feature, patchIds: [...feature.patchIds] }));
});
handle('settings:get', () => getSettings()); handle('settings:get', () => getSettings());
handle('settings:update', async (patch) => { handle('settings:update', async (patch) => {
+18 -6
View File
@@ -1,18 +1,30 @@
import { join } from 'node:path'; import { join } from 'node:path';
import { BrowserWindow, shell } from 'electron'; import { BrowserWindow, shell } from 'electron';
/** The launcher's single window. */ /**
* The launcher's single window: a fixed size without the system frame, like the game's own
* launcher. The window draws its title bar and asks for minimize and close over IPC.
*/
/** The layout is drawn for exactly this content size. */
const CONTENT_WIDTH = 1120;
const CONTENT_HEIGHT = 720;
/** The window background before the page paints (--bg in the window's styles). */
const BACKGROUND = '#13191b';
let mainWindow: BrowserWindow | null = null; let mainWindow: BrowserWindow | null = null;
export function createMainWindow(): BrowserWindow { export function createMainWindow(): BrowserWindow {
const window = new BrowserWindow({ const window = new BrowserWindow({
width: 960, width: CONTENT_WIDTH,
height: 640, height: CONTENT_HEIGHT,
minWidth: 720, useContentSize: true,
minHeight: 480, resizable: false,
maximizable: false,
fullscreenable: false,
frame: false,
backgroundColor: BACKGROUND,
show: false, show: false,
autoHideMenuBar: true,
webPreferences: { webPreferences: {
preload: join(import.meta.dirname, '../preload/index.cjs'), preload: join(import.meta.dirname, '../preload/index.cjs'),
sandbox: true, sandbox: true,
+105 -23
View File
@@ -1,46 +1,128 @@
import { useEffect, useState } from 'react'; import { useEffect, useState, type ReactNode } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import type { IpcOutput } from '@shared/ipc/contract.ts';
import type { InstallRecord } from '@shared/schemas/install.ts'; import type { InstallRecord } from '@shared/schemas/install.ts';
import type { Settings } from '@shared/schemas/settings.ts'; import type { Settings } from '@shared/schemas/settings.ts';
import { LanguageMenu } from './components/LanguageMenu.tsx'; import { Sheet } from './components/Sheet.tsx';
import { applyLanguage, resolveLanguage } from './i18n/index.ts'; import { applyLanguage, resolveLanguage } from './i18n/index.ts';
import { ipcOn } from './ipc.ts'; import { ipcOn } from './ipc.ts';
import { InstallWizard } from './pages/install/InstallWizard.tsx'; import { AboutPage } from './pages/about/AboutPage.tsx';
import { WelcomePage } from './pages/WelcomePage.tsx'; import { CopySummary } from './pages/copies/CopySummary.tsx';
import { FeatureStatus } from './pages/copies/FeatureStatus.tsx';
import { HomeMain } from './pages/home/HomeMain.tsx';
import { HomeSide } from './pages/home/HomeSide.tsx';
import { homeBar } from './pages/home/home-bar.ts';
import { useInstallWizard } from './pages/install/useInstallWizard.ts';
import { WizardMain } from './pages/install/WizardMain.tsx';
import { WizardSide } from './pages/install/WizardSide.tsx';
import { wizardBar } from './pages/install/wizard-bar.ts';
import { GeneralSettings } from './pages/settings/GeneralSettings.tsx';
import { Background } from './shell/Background.tsx';
import { BottomBar } from './shell/BottomBar.tsx';
import type { BarModel } from './shell/bar-model.ts';
import { Footer } from './shell/Footer.tsx';
import { COPY_SECTIONS, navigate, SETTINGS_SECTIONS, START_ROUTE, type Destination, type Route } from './shell/navigation.ts';
import { SubNav } from './shell/SubNav.tsx';
import { TitleBar } from './shell/TitleBar.tsx';
import { useErrorMessage } from './useErrorMessage.ts';
interface AppProps { interface AppProps {
readonly info: IpcOutput<'app:getInfo'>;
readonly initialSettings: Settings; readonly initialSettings: Settings;
readonly systemLocale: string;
readonly initialRecord: InstallRecord | null; readonly initialRecord: InstallRecord | null;
readonly defaultDataPath: string; readonly defaultDataPath: string;
} }
export function App({ initialSettings, systemLocale, initialRecord, defaultDataPath }: AppProps) { interface View {
readonly side: ReactNode;
readonly main: ReactNode;
readonly bar: BarModel;
}
/**
* The window: title bar, side panel, main area, bottom bar, footer. Each page fills the side
* panel and the main area; the bottom bar belongs to the current task (the install wizard while
* it runs, otherwise install / launch).
*/
export function App({ info, initialSettings, initialRecord, defaultDataPath }: AppProps) {
const { t } = useTranslation(); const { t } = useTranslation();
const { message, report } = useErrorMessage();
const [settings, setSettings] = useState(initialSettings); const [settings, setSettings] = useState(initialSettings);
const [record, setRecord] = useState(initialRecord); const [record, setRecord] = useState(initialRecord);
const [installing, setInstalling] = useState(false); const [route, setRoute] = useState<Route>(START_ROUTE);
const supported = info.supportedGameVersions;
const wizard = useInstallWizard({
defaultDataPath: record?.dataPath ?? defaultDataPath,
onInstalled: (installed) => {
setRecord(installed);
setRoute(START_ROUTE);
},
});
useEffect(() => ipcOn('event:settings-changed', setSettings), []); useEffect(() => ipcOn('event:settings-changed', setSettings), []);
useEffect(() => applyLanguage(resolveLanguage(settings.language, systemLocale)), [settings.language, systemLocale]); useEffect(() => applyLanguage(resolveLanguage(settings.language, info.systemLocale)), [settings.language, info.systemLocale]);
const go = (to: Destination): void => setRoute((current) => navigate(current, to));
const home = homeBar(record, t, wizard.start);
const view = ((): View => {
if (wizard.active) {
return { side: <WizardSide step={wizard.step} />, main: <WizardMain wizard={wizard} supportedVersions={supported} />, bar: wizardBar(wizard, t) };
}
const homeSide = <HomeSide record={record} supportedVersions={supported} onNavigate={go} />;
switch (route.page) {
case 'home':
return { side: homeSide, main: <HomeMain record={record} />, bar: home };
case 'about':
return { side: homeSide, main: <AboutPage launcherVersion={info.version} supportedVersions={supported} />, bar: home };
case 'settings':
return {
side: <SubNav sections={SETTINGS_SECTIONS} active={route.settings} label={(section) => t(`settings.sections.${section}`)} onSelect={(section) => go({ page: 'settings', section })} />,
main: <GeneralSettings settings={settings} onError={report} />,
bar: home,
};
case 'copies': {
const side = (
<>
<SubNav sections={COPY_SECTIONS} active={route.copies} label={(section) => t(`copies.sections.${section}`)} onSelect={(section) => go({ page: 'copies', section })} />
<div className="side-foot">
<button type="button" className="button" onClick={wizard.start}>{record ? t('copies.reinstall') : t('bar.install')}</button>
</div>
</>
);
if (!record) {
return {
side,
main: (
<Sheet title={t(`copies.sections.${route.copies}`)}>
<p className="lead">{t('copies.none')}</p>
<button type="button" className="button button-primary" onClick={wizard.start}>{t('bar.install')}</button>
</Sheet>
),
bar: home,
};
}
const main = route.copies === 'features'
? <FeatureStatus record={record} supportedVersions={supported} onError={report} />
: <CopySummary record={record} supportedVersions={supported} onShowFeatures={() => go({ page: 'copies', section: 'features' })} onReinstall={wizard.start} onError={report} />;
return { side, main, bar: home };
}
}
})();
const paged = wizard.active || route.page !== 'home';
return ( return (
<div className="app"> <div className={paged ? 'shell shell-paged' : 'shell'}>
<header className="app-header"> <Background artUrl={null} />
<h1 className="app-title">{t('app.title')}</h1> <TitleBar page={route.page} navigationEnabled={!wizard.active} language={settings.language} onNavigate={(page) => go({ page })} onError={report} />
<LanguageMenu value={settings.language} /> <aside className="side">{view.side}</aside>
</header> <main className="main">
<main className="app-main"> {view.main}
{installing ? ( {message && <p className="app-error" role="alert">{message}</p>}
<InstallWizard
defaultDataPath={record?.dataPath ?? defaultDataPath}
onInstalled={(installed) => { setRecord(installed); setInstalling(false); }}
onClose={() => setInstalling(false)}
/>
) : (
<WelcomePage record={record} onInstall={() => setInstalling(true)} />
)}
</main> </main>
<BottomBar model={view.bar} />
<Footer launcherVersion={info.version} gameVersion={record?.gameVersion ?? null} installed={record !== null} />
</div> </div>
); );
} }
@@ -1,29 +0,0 @@
import { useTranslation } from 'react-i18next';
import { LANGUAGE_CHOICES, type LanguageChoice } from '@shared/languages.ts';
import { ipcInvoke } from '../ipc.ts';
import { useErrorMessage } from '../useErrorMessage.ts';
export function LanguageMenu({ value }: { readonly value: LanguageChoice }) {
const { t } = useTranslation();
const { message, report } = useErrorMessage();
return (
<label className="language-menu">
<span>{t('language.label')}</span>
<select
value={value}
onChange={(event) => {
const language = event.target.value as LanguageChoice;
ipcInvoke('settings:update', { language }).catch(report);
}}
>
{LANGUAGE_CHOICES.map((choice) => (
<option key={choice} value={choice}>
{t(`language.${choice}`)}
</option>
))}
</select>
{message && <span className="error-text">{message}</span>}
</label>
);
}
@@ -1,6 +1,15 @@
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
/** A boxed message: information, a warning the player can go past, or a problem that stops them. */ type Tone = 'info' | 'warning' | 'error';
export function Notice({ tone, children }: { readonly tone: 'info' | 'warning' | 'error'; readonly children: ReactNode }) {
return <div className={`notice notice-${tone}`}>{children}</div>; const ICONS: Record<Tone, string> = { info: '✓', warning: '⚠', error: '✕' };
/** A boxed message: a result, a warning the player can go past, or a problem that stops them. */
export function Notice({ tone, children }: { readonly tone: Tone; readonly children: ReactNode }) {
return (
<div className={`notice notice-${tone}`} role={tone === 'error' ? 'alert' : 'status'}>
<span className="notice-icon" aria-hidden="true">{ICONS[tone]}</span>
<div className="notice-body">{children}</div>
</div>
);
} }
@@ -1,8 +1,21 @@
/** A bar filled to `value` of `max`; without a max it shows that work is going on. */ interface ProgressBarProps {
export function ProgressBar({ value, max }: { readonly value: number; readonly max: number | null }) { readonly value: number;
/** Without a max the bar shows that work is going on. */
readonly max: number | null;
readonly large?: boolean;
}
/** A thin bar filled to `value` of `max`. */
export function ProgressBar({ value, max, large = false }: ProgressBarProps) {
const fraction = max ? Math.min(1, value / max) : null; const fraction = max ? Math.min(1, value / max) : null;
return ( return (
<div className="progress" role="progressbar" aria-valuemin={0} aria-valuemax={100} aria-valuenow={fraction === null ? undefined : Math.round(fraction * 100)}> <div
className={large ? 'progress progress-large' : 'progress'}
role="progressbar"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={fraction === null ? undefined : Math.round(fraction * 100)}
>
<div className={fraction === null ? 'progress-fill progress-busy' : 'progress-fill'} style={fraction === null ? undefined : { width: `${fraction * 100}%` }} /> <div className={fraction === null ? 'progress-fill progress-busy' : 'progress-fill'} style={fraction === null ? undefined : { width: `${fraction * 100}%` }} />
</div> </div>
); );
@@ -0,0 +1,20 @@
import type { ReactNode } from 'react';
interface RowProps {
readonly label: ReactNode;
readonly hint?: ReactNode;
readonly children: ReactNode;
}
/** A label with an optional hint on the left, its value or controls on the right. */
export function Row({ label, hint, children }: RowProps) {
return (
<div className="row">
<div className="row-label">
{label}
{hint !== undefined && <small>{hint}</small>}
</div>
<div className="row-control">{children}</div>
</div>
);
}
@@ -0,0 +1,24 @@
import type { ReactNode } from 'react';
interface SheetProps {
readonly title: string;
/** Short context at the right of the heading. */
readonly aside?: ReactNode;
/** Actions and notes under the content. */
readonly foot?: ReactNode;
readonly children: ReactNode;
}
/** A page's content panel over the dimmed background art. */
export function Sheet({ title, aside, foot, children }: SheetProps) {
return (
<section className="sheet">
<header className="sheet-head">
<h2>{title}</h2>
{aside !== undefined && <span className="sheet-aside">{aside}</span>}
</header>
<div className="sheet-body">{children}</div>
{foot !== undefined && <footer className="sheet-foot">{foot}</footer>}
</section>
);
}
@@ -1,158 +1,272 @@
{ {
"app": { "app": {
"title": "War Thunder Offline" "title": "War Thunder Offline",
"subtitle": "War Thunder offline edition"
},
"nav": {
"home": "Home",
"copies": "Copies",
"settings": "Settings",
"about": "About"
},
"window": {
"minimize": "Minimize",
"close": "Close"
}, },
"language": { "language": {
"label": "Language", "label": "Language",
"system": "System", "system": "System default",
"zh-CN": "简体中文", "zh-CN": "简体中文",
"en": "English" "en": "English"
}, },
"welcome": { "footer": {
"title": "Not installed yet", "launcher": "Launcher {{version}}",
"body": "Install the offline version from your own War Thunder. By default it works on a copy; your original game is only read, never changed.", "game": "Game {{version}}",
"install": "Install" "notInstalled": "Not installed",
"disclaimer": "Unofficial fan project, not affiliated with Gaijin Entertainment"
}, },
"installed": { "home": {
"title": "The offline version is installed", "kicker": "Offline edition · Local server",
"launchLater": "Starting the game comes in the next version.", "installedKicker": "Game {{version}}",
"reinstall": "Install again" "body": "Play complete battles against AI without a network connection or an account. Hangar, research, store and battle results are provided by the local server.",
"steps": {
"choose": "1 · Select game",
"chooseBody": "Locate your War Thunder installation",
"copy": "2 · Create copy",
"copyBody": "Copy the game files; the original stays unchanged",
"launch": "3 · Launch",
"launchBody": "Start the game from the launcher from then on"
}
}, },
"summary": { "side": {
"copy": "Game copy", "requirements": "Requirements",
"data": "Data folder", "game": "Game",
"version": "Game version", "gameValue": "War Thunder (official client)",
"method": "Installed", "versions": "Versions",
"methods": { "space": "Disk space",
"copy": "as a copy in a new folder", "spaceValue": "About 97 GB (copy installation)",
"in-place": "in the original folder" "about": "About the offline edition",
}, "aboutBody": "The local server provides profiles, hangar, store, battles and results on this computer. No network connection and no account are used. Installation only reads the original game files and changes nothing.",
"missing": "These features do not work with your game version:" "statement": "Statement and terms",
"currentCopy": "Current copy",
"copyName": "Game copy",
"adaptation": "Adaptation",
"features": "Features",
"allAvailable": "✓ All available",
"someMissing": "⚠ {{count}} unavailable",
"details": "Details",
"disclaimer": "Unofficial fan project, not affiliated with Gaijin Entertainment."
},
"adaptation": {
"verified": "✓ Verified",
"nearest": "⚠ Nearest version"
},
"bar": {
"notInstalled": "Not installed",
"notInstalledDetail": "Requires an installed copy of War Thunder",
"install": "Install",
"ready": "Ready",
"readyMissing": "Ready · {{count}} features unavailable",
"readyDetail": "Game {{version}} · Launching will be available in a later version",
"launch": "Launch"
}, },
"folder": { "folder": {
"none": "Not chosen", "none": "Not selected",
"choose": "Choose folder", "choose": "Browse…",
"change": "Change" "change": "Change…"
}, },
"wizard": { "wizard": {
"title": "Install the offline edition",
"note": "Installation does not modify the original game. Patched files are not written during installation; they are generated each time the game is launched.",
"steps": { "steps": {
"source": "Game", "source": "Game location",
"method": "Method", "method": "Installation type",
"data": "Data", "data": "Data folder",
"check": "Check", "check": "Patch check",
"installing": "Install" "installing": "Install"
}, },
"barTitle": "Install · {{step}}",
"stepOf": "Step {{index}} of {{total}}",
"back": "Back", "back": "Back",
"next": "Next", "next": "Next",
"cancel": "Cancel", "cancel": "Cancel",
"install": "Install" "install": "Install",
"installing": "Installing",
"checking": "Checking patches",
"checkingDetail": "Checking which patches apply to the selected game"
}, },
"source": { "source": {
"title": "Choose your War Thunder folder", "body": "Select the War Thunder installation folder (the one containing aces.vromfs.bin and the win64 folder).",
"body": "The one holding aces.vromfs.bin and the win64 folder, such as the War Thunder folder in Steam.", "dialogTitle": "Select the War Thunder installation folder",
"notAGame": "This is not a War Thunder folder. Missing: {{files}}", "notAGame": "The selected folder is not a War Thunder installation. Missing: {{files}}",
"versionVerified": "Game version {{version}}. The offline version is made for it.", "versionVerified": "Game version {{version}} · Adaptation {{version}} (verified)",
"versionUnverified": "Game version {{version}}. The offline version is made for {{verified}}, so some features may not work. The next steps check which.", "versionUnverified": "No adaptation exists for game version {{version}}; the nearest version, {{nearest}}, will be used. Some features may be unavailable; step 4 lists the results.",
"versionUnknown": "unknown" "versionUnknown": "unknown",
"size": "Size {{size}} · {{files}} files",
"measuring": "Calculating size…",
"readOnly": "Installation only reads this folder and changes nothing in it."
}, },
"method": { "method": {
"title": "How to install", "copy": "Copy installation (recommended)",
"copy": "Copy into a new folder (recommended)", "copyBody": "Copies the complete game to a new folder and installs into the copy. The original is not affected. Requires about {{size}} of free space.",
"copyBody": "The whole game is copied and the offline version goes into the copy. Your original stays as it is. Needs about {{size}}.", "measuring": "(calculating size)",
"measuring": "(measuring)", "targetTitle": "Select a folder for the copy",
"targetTitle": "Choose a folder for the game copy", "inPlace": "In-place installation",
"inPlace": "Install into this folder", "inPlaceBody": "Installs directly into the selected folder, for a game copy you prepared yourself. Replaces 4 files in it; the originals are backed up to wtoffline\\stock.",
"inPlaceBody": "For a copy of the game you prepared yourself. Four files in {{path}} are replaced; the originals are kept in its wtoffline\\stock folder.", "room": "Free space on target drive: {{free}}",
"room": "{{free}} free on this drive.", "noRoom": "Not enough free space: {{needed}} required, {{free}} available on the target drive.",
"noRoom": "Not enough room: {{needed}} needed, {{free}} free on this drive.",
"problem": { "problem": {
"not_empty": "This folder already holds files. Choose an empty or a new folder.", "not_empty": "The selected folder is not empty. Select an empty or new folder.",
"overlaps_stock": "Choose a folder other than the original game folder, outside it and not containing it.", "overlaps_stock": "The folder cannot be the original installation folder, or a folder inside or above it.",
"not_a_folder": "This is not a folder." "not_a_folder": "The selected path is not a folder."
} }
}, },
"steam": { "steam": {
"title": "This folder is in a Steam library. Installing here:", "title": "The selected folder is in a Steam library. Installing here will:",
"risk1": "changes your online game client directly;", "risk1": "modify the files of the official client;",
"risk2": "can be undone when Steam verifies or updates the game;", "risk2": "possibly be overwritten by Steam file verification or updates;",
"risk3": "risks a ban if the online game is started with the changed files.", "risk3": "risk an account ban if the official game is launched online with the modified files.",
"advice": "Copying into a new folder is the safer choice.", "advice": "A copy installation is recommended instead.",
"confirm": "I understand these risks and want to install here" "confirm": "I understand these risks and want to install in this folder"
}, },
"data": { "data": {
"title": "Choose the data folder", "body": "Saves, caches and logs are stored in this folder. Moving the folder moves the saves.",
"body": "Saves, caches and logs of the offline version go here. Take this folder along to take your saves." "dialogTitle": "Select the data folder"
}, },
"check": { "check": {
"title": "Checking your game", "running": "Checking which patches apply to the selected game. This takes a few seconds.",
"running": "Checking that the offline version's changes fit your game. This takes a few seconds…", "allFit": "All {{count}} patches apply to this game version.",
"allFit": "All {{count}} changes fit your game.", "essentialMissing": "Patches required by the offline edition do not apply to this game version. Installation is not possible. Affected features:",
"essentialMissing": "Your game version lacks changes the offline version cannot run without, so it cannot be installed. Affected:", "someMissing": "{{count}} patches do not apply to this game version. The following features will be unavailable:",
"someMissing": "Some changes do not fit your game version. These features will not work:", "details": "Patch details",
"details": "Which changes", "accept": "Continue without these features"
"accept": "Install without these features"
}, },
"progress": { "progress": {
"title": "Installing",
"phase": { "phase": {
"checking": "Checking the game files…", "checking": "Checking game files",
"measuring": "Counting the files to copy…", "measuring": "Counting files",
"copying": "Copying the game…", "copying": "Copying game files",
"backing-up": "Keeping the original files…", "backing-up": "Backing up original files",
"recording": "Finishing…" "recording": "Finishing installation"
}, },
"copied": "{{done}} of {{total}} copied ({{doneFiles}} of {{totalFiles}} files)", "copied": "Copied {{done}} / {{total}} · {{doneFiles}} / {{totalFiles}} files",
"cancelHint": "Can be cancelled at any time; copied files will be deleted",
"cancel": "Cancel installation", "cancel": "Cancel installation",
"cancelling": "Cancelling…" "cancelling": "Cancelling…"
}, },
"copies": {
"sections": {
"summary": "Copy details",
"features": "Feature status"
},
"reinstall": "Reinstall…",
"none": "The offline edition is not installed yet.",
"summary": {
"version": "Game version",
"adaptation": "Adaptation",
"adaptationHint": "Selected automatically by game version",
"location": "Location",
"method": "Installation type",
"methods": {
"copy": "Copy installation",
"in-place": "In-place installation"
},
"stock": "Original file backup",
"stockHint": "Patched files are generated from it at each launch",
"data": "Data folder",
"dataHint": "Saves, caches and logs",
"installedAt": "Installed",
"features": "Features",
"open": "Open"
},
"features": {
"lead": "Each feature depends on one or more patches. When a patch does not apply, its features are unavailable; installation is not possible while a feature marked \"Required\" is unavailable.",
"essential": "Required",
"verifiedOn": "Verified: {{version}}",
"unavailable": "Patch does not apply: {{patches}}",
"allAvailable": "All available",
"someMissing": "{{count}} unavailable",
"checkedAt": "Checked {{time}} (at installation)"
}
},
"featureSections": {
"A": "Startup and account",
"B": "Hangar and vehicles",
"C": "Tech tree and research",
"D": "Modifications, weapons and ammunition",
"E": "Crew",
"F": "Customization",
"G": "Economy and store",
"H": "Items and inventory",
"I": "Squadrons",
"J": "Game modes",
"K": "In battle",
"L": "After battle and statistics",
"M": "Replays",
"N": "Settings, controls and mods",
"O": "Multiplayer social features"
},
"settings": {
"sections": {
"general": "General"
},
"language": "Language",
"languageHint": "Display language of the launcher"
},
"about": {
"launcher": "Launcher {{version}}",
"supported": "Supported game versions: {{versions}}",
"statement": "Statement",
"statementBody": "This is an unofficial fan project, not affiliated with Gaijin Entertainment. WTOffline contains no game files; an official War Thunder client is required. No network connection and no account are used."
},
"features": { "features": {
"A-离线启动": "Starting offline", "A-离线启动": "Offline startup",
"A-与正版隔离": "Kept apart from the online game", "A-与正版隔离": "Isolation from the official game",
"A-不连 Gaijin": "No connection to Gaijin", "A-不连 Gaijin": "Gaijin connections blocked",
"A-新手流程": "Tutorials", "A-新手流程": "Tutorial",
"B-机库与载具": "Hangar and vehicles", "B-机库与载具": "Hangar and vehicles",
"G-礼包商店": "Pack store", "G-礼包商店": "Pack store",
"G-兑换码": "Redeem codes", "G-兑换码": "Redeem codes",
"G-市场": "Marketplace", "G-市场": "Marketplace",
"G-Marketplace": "Marketplace", "G-Marketplace": "Marketplace",
"G-货币": "Currency purchases", "G-货币": "Currency purchase",
"G-高级账户": "Premium account", "G-高级账户": "Premium account",
"G-Premium Account": "Premium account", "G-Premium Account": "Premium account",
"G-Store": "Store", "G-Store": "Store",
"G-加成道具": "Boosters", "G-加成道具": "Boosters",
"H-合同 / 赌注": "Battle contracts", "H-合同 / 赌注": "Battle contracts",
"H-补给箱": "Supply chests", "H-补给箱": "Supply chests",
"H-物品回收与合成": "Recycling and crafting", "H-物品回收与合成": "Item recycling and crafting",
"H-兑换券": "Coupons", "H-兑换券": "Coupons",
"H-External inventory": "External inventory items", "H-External inventory": "External inventory items",
"J-对局模式": "Battle modes", "J-对局模式": "Game modes",
"J-陆战 街机 / 历史": "Ground battles (arcade, realistic)", "J-陆战 街机 / 历史": "Ground battles (arcade, realistic)",
"J-空战 街机 / 历史": "Air battles (arcade, realistic)", "J-空战 街机 / 历史": "Air battles (arcade, realistic)",
"J-海战 街机 / 历史": "Naval battles (arcade, realistic)", "J-海战 街机 / 历史": "Naval battles (arcade, realistic)",
"J-附加子模式": "Extra modes (such as night battles)", "J-附加子模式": "Additional modes (such as night battles)",
"K-AI 对手与队友": "AI opponents and teammates", "K-AI 对手与队友": "AI opponents and allies",
"K-出生点数 / 重生": "Spawn points and respawning", "K-出生点数 / 重生": "Spawn points and respawning",
"K-侦察": "Scouting and drones", "K-侦察": "Scouting and drones",
"K-击杀、助攻、占点计分": "Kill, assist and capture scoring", "K-击杀、助攻、占点计分": "Kill, assist and capture scoring",
"K-补充载具": "Extra vehicles", "K-补充载具": "Additional vehicles",
"K-计分板": "Scoreboard", "K-计分板": "Scoreboard",
"L-结算页": "Battle results", "L-结算页": "Battle results",
"L-战斗奖章": "Battle awards" "L-战斗奖章": "Battle awards"
}, },
"errors": { "errors": {
"internal_error": "Something went wrong inside the launcher.", "internal_error": "An internal launcher error occurred.",
"settings_write_failed": "Could not save the settings.", "settings_write_failed": "The settings could not be saved.",
"folder_unreadable": "Cannot read the folder: {{path}}", "folder_unreadable": "The folder cannot be read: {{path}}",
"not_a_game_folder": "This is not a War Thunder game folder: {{path}}", "not_a_game_folder": "The selected folder is not a War Thunder installation: {{path}}",
"target_not_usable": "This folder cannot be used for the installation.", "target_not_usable": "The selected folder cannot be used for installation.",
"steam_library_not_confirmed": "The folder is in a Steam library. Confirm the warning first.", "steam_library_not_confirmed": "The installation folder is in a Steam library. Confirm the risk notice first.",
"not_enough_space": "Not enough disk space: {{neededGb}} GB needed, {{freeGb}} GB free.", "not_enough_space": "Not enough disk space: {{neededGb}} GB required, {{freeGb}} GB available.",
"essential_patches_unavailable": "Your game version lacks changes the offline version cannot run without: {{patches}}", "essential_patches_unavailable": "Patches required by the offline edition do not apply to this game version. Installation is not possible: {{patches}}",
"missing_features_not_accepted": "Some changes do not fit. Confirm whether to go on without those features first.", "missing_features_not_accepted": "Some patches do not apply. Confirm whether to continue without the affected features.",
"patch_check_failed": "Checking the game files failed.", "patch_check_failed": "An error occurred while checking patches.",
"copy_failed": "Copying the game failed. What was copied has been removed.", "copy_failed": "Copying the game files failed. The copied files have been deleted.",
"install_cancelled": "Installation cancelled. What was copied has been removed.", "install_cancelled": "Installation cancelled. The copied files have been deleted.",
"install_busy": "An installation is already running.", "install_busy": "An installation is already in progress.",
"unknown": "Something went wrong." "unknown": "An unknown error occurred."
} }
} }
@@ -1,6 +1,17 @@
{ {
"app": { "app": {
"title": "战争雷霆离线版" "title": "战争雷霆离线版",
"subtitle": "战争雷霆离线版"
},
"nav": {
"home": "首页",
"copies": "副本",
"settings": "设置",
"about": "关于"
},
"window": {
"minimize": "最小化",
"close": "关闭"
}, },
"language": { "language": {
"label": "语言", "label": "语言",
@@ -8,107 +19,210 @@
"zh-CN": "简体中文", "zh-CN": "简体中文",
"en": "English" "en": "English"
}, },
"welcome": { "footer": {
"title": "尚未安装", "launcher": "启动器 {{version}}",
"body": "用你自己的战争雷霆安装离线版。默认会复制一份游戏,原版只读取、不修改。", "game": "游戏 {{version}}",
"install": "开始安装" "notInstalled": "未安装",
"disclaimer": "非官方爱好者项目,与 Gaijin Entertainment 无关"
}, },
"installed": { "home": {
"title": "离线版已安装", "kicker": "单机离线版 · 本地服务器",
"launchLater": "启动游戏的功能将在下一版加入。", "installedKicker": "游戏 {{version}}",
"reinstall": "重新安装" "body": "无需联网与账号,即可与 AI 进行完整对局。机库、研发、商店与结算均由本地服务器提供。",
"steps": {
"choose": "1 · 选择游戏",
"chooseBody": "指定正版战争雷霆的安装位置",
"copy": "2 · 创建副本",
"copyBody": "复制游戏文件,正版保持不变",
"launch": "3 · 启动",
"launchBody": "此后从启动器直接进入游戏"
}
}, },
"summary": { "side": {
"copy": "游戏副本", "requirements": "系统要求",
"data": "数据目录", "game": "游戏",
"version": "游戏版本", "gameValue": "战争雷霆正版客户端",
"method": "安装方式", "versions": "支持版本",
"methods": { "space": "磁盘空间",
"copy": "复制到新文件夹", "spaceValue": "约 97 GB(复制安装)",
"in-place": "直接在原文件夹里安装" "about": "关于离线版",
}, "aboutBody": "本地服务器在本机提供档案、机库、商店、对局与结算等服务。运行期间不联网,不使用任何账号。安装过程仅读取正版文件,不作任何修改。",
"missing": "你的游戏版本用不上以下功能:" "statement": "声明与协议",
"currentCopy": "当前副本",
"copyName": "游戏副本",
"adaptation": "适配版本",
"features": "功能",
"allAvailable": "✓ 全部可用",
"someMissing": "⚠ {{count}} 项不可用",
"details": "详情",
"disclaimer": "非官方爱好者项目,与 Gaijin Entertainment 无关。"
},
"adaptation": {
"verified": "✓ 已核对",
"nearest": "⚠ 就近适配"
},
"bar": {
"notInstalled": "未安装",
"notInstalledDetail": "需要已安装的战争雷霆正版客户端",
"install": "安装",
"ready": "就绪",
"readyMissing": "就绪 · {{count}} 项功能不可用",
"readyDetail": "游戏 {{version}} · 启动功能将在后续版本提供",
"launch": "启动"
}, },
"folder": { "folder": {
"none": "尚未选择", "none": "未选择",
"choose": "选择文件夹", "choose": "浏览…",
"change": "更改" "change": "更改…"
}, },
"wizard": { "wizard": {
"title": "安装离线版",
"note": "安装过程不会修改正版游戏。补丁文件不在安装时写入,而是在每次启动时生成。",
"steps": { "steps": {
"source": "游戏位置", "source": "游戏位置",
"method": "安装方式", "method": "安装方式",
"data": "数据目录", "data": "数据目录",
"check": "检查", "check": "补丁检查",
"installing": "安装" "installing": "安装"
}, },
"barTitle": "安装 · {{step}}",
"stepOf": "第 {{index}} 步,共 {{total}} 步",
"back": "上一步", "back": "上一步",
"next": "下一步", "next": "下一步",
"cancel": "取消", "cancel": "取消",
"install": "开始安装" "install": "开始安装",
"installing": "安装中",
"checking": "正在检查补丁",
"checkingDetail": "正在核对补丁对所选游戏的适用情况"
}, },
"source": { "source": {
"title": "选择你的战争雷霆游戏文件夹", "body": "选择战争雷霆的安装文件夹(包含 aces.vromfs.bin 与 win64 文件夹)。",
"body": "就是装有 aces.vromfs.bin 和 win64 文件夹的那个,例如 Steam 里的 War Thunder 文件夹。", "dialogTitle": "选择战争雷霆的安装文件夹",
"notAGame": "这不是战争雷霆的游戏文件夹,缺少:{{files}}", "notAGame": "所选文件夹不是战争雷霆的安装文件夹,缺少:{{files}}",
"versionVerified": "游戏版本 {{version}},离线版已适配这个版本。", "versionVerified": "游戏版本 {{version}} · 适配版本 {{version}}(已核对)",
"versionUnverified": "游戏版本 {{version}}。离线版适配的是 {{verified}},其他版本可能有部分功能用不了。下一步会检查具体哪些。", "versionUnverified": "游戏版本 {{version}} 暂无对应适配,将使用最接近的 {{nearest}}。部分功能可能不可用,检查结果将在第 4 步列出。",
"versionUnknown": "未知" "versionUnknown": "未知",
"size": "大小 {{size}} · {{files}} 个文件",
"measuring": "正在统计大小…",
"readOnly": "安装过程仅读取此文件夹,不作任何修改。"
}, },
"method": { "method": {
"title": "怎么安装", "copy": "复制安装(推荐)",
"copy": "复制到新文件夹(推荐)", "copyBody": "将游戏完整复制到新文件夹,并在副本中安装。正版不受影响。需要约 {{size}} 可用空间。",
"copyBody": "把游戏完整复制一份,离线版装在副本里,原版不受影响。需要约 {{size}} 空间。", "measuring": "(正在统计大小)",
"measuring": "(正在计算大小)", "targetTitle": "选择存放副本的文件夹",
"targetTitle": "选择存放游戏副本的文件夹", "inPlace": "原位安装",
"inPlace": "直接在这个文件夹里安装", "inPlaceBody": "在所选文件夹中直接安装,适用于自行准备的游戏副本。将替换其中 4 个文件,原文件备份至 wtoffline\\stock。",
"inPlaceBody": "适合你已经自己准备好一份游戏副本的情况。会替换 {{path}} 里的 4 个文件,原文件备份在其中的 wtoffline\\stock 文件夹。", "room": "目标磁盘可用空间:{{free}}",
"room": "这个盘还有 {{free}} 空间。", "noRoom": "可用空间不足:需要 {{needed}},目标磁盘仅剩 {{free}}。",
"noRoom": "空间不够:需要 {{needed}},这个盘只剩 {{free}}。",
"problem": { "problem": {
"not_empty": "这个文件夹里已经有文件了,请选一个空文件夹或新文件夹。", "not_empty": "所选文件夹不为空。请选择空文件夹或新建文件夹。",
"overlaps_stock": "不能选原版游戏文件夹本身,也不能选它里面或包含它的文件夹。", "overlaps_stock": "不能选择正版安装文件夹本身,或其上级、下级文件夹。",
"not_a_folder": "这不是一个文件夹。" "not_a_folder": "所选路径不是文件夹。"
} }
}, },
"steam": { "steam": {
"title": "这个文件夹在 Steam 游戏库里。在这里安装:", "title": "所选文件夹位于 Steam 游戏库中。在此安装将:",
"risk1": "等于直接改动你的正版客户端;", "risk1": "修改正版客户端的文件;",
"risk2": "Steam 校验文件或更新时,改动可能被覆盖;", "risk2": "可能被 Steam 文件校验或更新覆盖;",
"risk3": "带着改过的文件联网启动正版,有被封号的风险。", "risk3": "若以修改后的文件联网启动正版,存在账号封禁风险。",
"advice": "建议改用“复制到新文件夹”。", "advice": "建议改用复制安装。",
"confirm": "我了解这些风险,仍要在这里安装" "confirm": "我已了解上述风险,仍在此文件夹中安装"
}, },
"data": { "data": {
"title": "选择数据目录", "body": "存档、缓存与日志保存在此文件夹。迁移该文件夹即可迁移存档。",
"body": "离线版的存档、缓存和日志都放在这里。拷走这个文件夹就能带走存档。" "dialogTitle": "选择数据目录"
}, },
"check": { "check": {
"title": "检查你的游戏", "running": "正在核对补丁对所选游戏的适用情况,约需数秒。",
"running": "正在核对离线版的改动是否都适用于你的游戏,需要几秒钟……", "allFit": "全部 {{count}} 个补丁均适用于此游戏版本。",
"allFit": "全部 {{count}} 项改动都适用于你的游戏。", "essentialMissing": "此游戏版本缺少离线版运行所必需的补丁,无法安装。受影响的功能:",
"essentialMissing": "你的游戏版本缺少离线版运行所必需的改动,无法安装。受影响的是:", "someMissing": "{{count}} 个补丁不适用于此游戏版本,以下功能将不可用:",
"someMissing": "有些改动不适用于你的游戏版本,下面这些功能会用不了:", "details": "查看补丁详情",
"details": "具体是哪些改动", "accept": "在缺少上述功能的情况下继续安装"
"accept": "缺少这些功能也继续安装"
}, },
"progress": { "progress": {
"title": "正在安装",
"phase": { "phase": {
"checking": "正在检查游戏文件……", "checking": "检查游戏文件",
"measuring": "正在统计要复制的文件……", "measuring": "统计文件",
"copying": "正在复制游戏……", "copying": "复制游戏文件",
"backing-up": "正在备份原版文件……", "backing-up": "备份原版文件",
"recording": "正在完成安装……" "recording": "完成安装"
}, },
"copied": "已复制 {{done}} / {{total}}({{doneFiles}} / {{totalFiles}} 个文件)", "copied": "已复制 {{done}} / {{total}} · {{doneFiles}} / {{totalFiles}} 个文件",
"cancelHint": "可随时取消,已复制的文件将被删除",
"cancel": "取消安装", "cancel": "取消安装",
"cancelling": "正在取消……" "cancelling": "正在取消…"
},
"copies": {
"sections": {
"summary": "副本详情",
"features": "功能状态"
},
"reinstall": "重新安装…",
"none": "尚未安装离线版。",
"summary": {
"version": "游戏版本",
"adaptation": "适配版本",
"adaptationHint": "按游戏版本自动选择",
"location": "位置",
"method": "安装方式",
"methods": {
"copy": "复制安装",
"in-place": "原位安装"
},
"stock": "原版文件备份",
"stockHint": "每次启动时据此生成补丁文件",
"data": "数据目录",
"dataHint": "存档、缓存与日志",
"installedAt": "安装时间",
"features": "功能",
"open": "打开"
},
"features": {
"lead": "每项功能依赖一个或多个补丁。补丁不适用时,对应功能不可用;标记为“必需”的功能不可用时无法安装。",
"essential": "必需",
"verifiedOn": "已核对:{{version}}",
"unavailable": "补丁不适用:{{patches}}",
"allAvailable": "全部可用",
"someMissing": "{{count}} 项不可用",
"checkedAt": "检查时间:{{time}}(安装时)"
}
},
"featureSections": {
"A": "启动与账号",
"B": "机库与载具",
"C": "科技树与研发",
"D": "改装、武器与弹药",
"E": "乘员",
"F": "外观定制",
"G": "经济与商店",
"H": "道具与库存",
"I": "联队",
"J": "对局模式",
"K": "对局内",
"L": "战后与统计",
"M": "回放",
"N": "设置、操控与模组",
"O": "多人社交"
},
"settings": {
"sections": {
"general": "常规"
},
"language": "语言",
"languageHint": "启动器界面的显示语言"
},
"about": {
"launcher": "启动器 {{version}}",
"supported": "支持的游戏版本:{{versions}}",
"statement": "声明",
"statementBody": "本项目为非官方爱好者项目,与 Gaijin Entertainment 无关。WTOffline 不包含任何游戏文件,使用前需拥有战争雷霆正版客户端。运行期间不联网,不使用任何账号。"
}, },
"features": { "features": {
"A-离线启动": "离线启动", "A-离线启动": "离线启动",
"A-与正版隔离": "与正版游戏隔离", "A-与正版隔离": "与正版隔离",
"A-不连 Gaijin": "不连接 Gaijin", "A-不连 Gaijin": "阻断 Gaijin 连接",
"A-新手流程": "新手教程", "A-新手流程": "新手教程",
"B-机库与载具": "机库与载具", "B-机库与载具": "机库与载具",
"G-礼包商店": "礼包商店", "G-礼包商店": "礼包商店",
@@ -133,26 +247,26 @@
"K-AI 对手与队友": "AI 对手与队友", "K-AI 对手与队友": "AI 对手与队友",
"K-出生点数 / 重生": "出生点数与重生", "K-出生点数 / 重生": "出生点数与重生",
"K-侦察": "侦察与无人机", "K-侦察": "侦察与无人机",
"K-击杀、助攻、占点计分": "击杀、助攻和占点计分", "K-击杀、助攻、占点计分": "击杀、助攻与占点计分",
"K-补充载具": "补充载具", "K-补充载具": "补充载具",
"K-计分板": "计分板", "K-计分板": "计分板",
"L-结算页": "战后结算", "L-结算页": "战后结算",
"L-战斗奖章": "战斗嘉奖" "L-战斗奖章": "战斗嘉奖"
}, },
"errors": { "errors": {
"internal_error": "启动器内部出错了。", "internal_error": "启动器内部错误。",
"settings_write_failed": "设置保存失败。", "settings_write_failed": "无法保存设置。",
"folder_unreadable": "无法读取文件夹:{{path}}", "folder_unreadable": "无法读取文件夹:{{path}}",
"not_a_game_folder": "这不是战争雷霆的游戏文件夹:{{path}}", "not_a_game_folder": "所选文件夹不是战争雷霆的安装文件夹:{{path}}",
"target_not_usable": "这个文件夹不能用来安装。", "target_not_usable": "所选文件夹不能用于安装。",
"steam_library_not_confirmed": "安装位置在 Steam 游戏库里,需要先确认风险提示。", "steam_library_not_confirmed": "安装位置位于 Steam 游戏库中,请先确认风险提示。",
"not_enough_space": "磁盘空间不够:需要 {{neededGb}} GB,只剩 {{freeGb}} GB。", "not_enough_space": "磁盘空间不足:需要 {{neededGb}} GB,仅剩 {{freeGb}} GB。",
"essential_patches_unavailable": "你的游戏版本缺少离线版必需的改动,无法安装:{{patches}}", "essential_patches_unavailable": "此游戏版本缺少离线版运行所必需的补丁,无法安装:{{patches}}",
"missing_features_not_accepted": "有些改动用不上,需要先确认是否在缺少这些功能的情况下继续。", "missing_features_not_accepted": "部分补丁不适用,请先确认是否在缺少相应功能的情况下继续。",
"patch_check_failed": "检查游戏文件时出错了。", "patch_check_failed": "检查补丁时出错。",
"copy_failed": "复制游戏失败,已复制的部分已删除。", "copy_failed": "复制游戏文件失败,已复制的文件已删除。",
"install_cancelled": "安装已取消,已复制的部分已删除。", "install_cancelled": "安装已取消,已复制的文件已删除。",
"install_busy": "已经有一个安装在进行。", "install_busy": "已有安装正在进行。",
"unknown": "出错了。" "unknown": "发生未知错误。"
} }
} }
+8 -2
View File
@@ -1,9 +1,15 @@
import { StrictMode } from 'react'; import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client'; import { createRoot } from 'react-dom/client';
import '@fontsource/roboto-condensed/400.css';
import '@fontsource/roboto-condensed/500.css';
import '@fontsource/roboto-condensed/700.css';
import { App } from './App.tsx'; import { App } from './App.tsx';
import { initI18n, resolveLanguage } from './i18n/index.ts'; import { initI18n, resolveLanguage } from './i18n/index.ts';
import { ipcInvoke } from './ipc.ts'; import { ipcInvoke } from './ipc.ts';
import './styles/app.css'; import './styles/tokens.css';
import './styles/shell.css';
import './styles/controls.css';
import './styles/pages.css';
async function start(): Promise<void> { async function start(): Promise<void> {
const [settings, info, install] = await Promise.all([ipcInvoke('settings:get'), ipcInvoke('app:getInfo'), ipcInvoke('install:getRecord')]); const [settings, info, install] = await Promise.all([ipcInvoke('settings:get'), ipcInvoke('app:getInfo'), ipcInvoke('install:getRecord')]);
@@ -14,7 +20,7 @@ async function start(): Promise<void> {
if (!root) throw new Error('#root is missing from index.html'); if (!root) throw new Error('#root is missing from index.html');
createRoot(root).render( createRoot(root).render(
<StrictMode> <StrictMode>
<App initialSettings={settings} systemLocale={info.systemLocale} initialRecord={install.record} defaultDataPath={install.defaultDataPath} /> <App info={info} initialSettings={settings} initialRecord={install.record} defaultDataPath={install.defaultDataPath} />
</StrictMode>, </StrictMode>,
); );
} }
@@ -1,31 +0,0 @@
import { useTranslation } from 'react-i18next';
import type { InstallRecord } from '@shared/schemas/install.ts';
import { featureName } from '../features.ts';
/** What is installed where, and which features are missing. */
export function InstallSummary({ record }: { readonly record: InstallRecord }) {
const { t } = useTranslation();
const missing = [...new Set(record.unavailablePatches.flatMap((patch) => patch.features))];
return (
<>
<dl className="summary">
<dt>{t('summary.copy')}</dt>
<dd>{record.copyPath}</dd>
<dt>{t('summary.data')}</dt>
<dd>{record.dataPath}</dd>
<dt>{t('summary.version')}</dt>
<dd>{record.gameVersion ?? t('source.versionUnknown')}</dd>
<dt>{t('summary.method')}</dt>
<dd>{t(`summary.methods.${record.method}`)}</dd>
</dl>
{missing.length > 0 && (
<div className="muted">
<p>{t('summary.missing')}</p>
<ul>
{missing.map((feature) => <li key={feature}>{featureName(t, feature)}</li>)}
</ul>
</div>
)}
</>
);
}
@@ -1,31 +0,0 @@
import { useTranslation } from 'react-i18next';
import type { InstallRecord } from '@shared/schemas/install.ts';
import { InstallSummary } from './InstallSummary.tsx';
interface WelcomePageProps {
/** The installed copy, or null before the first installation. */
readonly record: InstallRecord | null;
readonly onInstall: () => void;
}
/** The first screen: an invitation to install, or what is installed. */
export function WelcomePage({ record, onInstall }: WelcomePageProps) {
const { t } = useTranslation();
if (!record) {
return (
<section className="welcome">
<h2>{t('welcome.title')}</h2>
<p>{t('welcome.body')}</p>
<button type="button" className="button button-primary" onClick={onInstall}>{t('welcome.install')}</button>
</section>
);
}
return (
<section className="welcome">
<h2>{t('installed.title')}</h2>
<InstallSummary record={record} />
<p className="muted">{t('installed.launchLater')}</p>
<button type="button" className="button" onClick={onInstall}>{t('installed.reinstall')}</button>
</section>
);
}
@@ -0,0 +1,21 @@
import { useTranslation } from 'react-i18next';
import { Sheet } from '../../components/Sheet.tsx';
/** The launcher's version, the game versions it supports, and the project statement. */
export function AboutPage({ launcherVersion, supportedVersions }: { readonly launcherVersion: string; readonly supportedVersions: readonly string[] }) {
const { t } = useTranslation();
return (
<Sheet title={t('nav.about')}>
<div className="about-head">
<div className="about-word">WT<span>OFFLINE</span></div>
<div className="about-versions">
{t('about.launcher', { version: launcherVersion })}
<br />
{t('about.supported', { versions: supportedVersions.join(', ') })}
</div>
</div>
<h3 className="section-title">{t('about.statement')}</h3>
<p className="lead">{t('about.statementBody')}</p>
</Sheet>
);
}
@@ -0,0 +1,55 @@
import { useTranslation } from 'react-i18next';
import type { InstallRecord } from '@shared/schemas/install.ts';
import { Row } from '../../components/Row.tsx';
import { Sheet } from '../../components/Sheet.tsx';
import { ipcInvoke } from '../../ipc.ts';
import { adaptationFor, isVerified } from '../../versions.ts';
import { missingFeatures } from './missing-features.ts';
interface CopySummaryProps {
readonly record: InstallRecord;
readonly supportedVersions: readonly string[];
readonly onShowFeatures: () => void;
readonly onReinstall: () => void;
readonly onError: (error: unknown) => void;
}
/** What is installed where: version, adaptation, folders, installation type. */
export function CopySummary({ record, supportedVersions, onShowFeatures, onReinstall, onError }: CopySummaryProps) {
const { t, i18n } = useTranslation();
const missing = missingFeatures(record).length;
const verified = isVerified(record.gameVersion, supportedVersions);
const folder = (path: string) => (
<>
<span className="folder-path" title={path}>{path}</span>
<button type="button" className="button" onClick={() => ipcInvoke('app:openFolder', { path }).catch(onError)}>{t('copies.summary.open')}</button>
</>
);
return (
<Sheet
title={t('copies.sections.summary')}
foot={<button type="button" className="button" onClick={onReinstall}>{t('copies.reinstall')}</button>}
>
<Row label={t('copies.summary.version')}>{record.gameVersion ?? t('source.versionUnknown')}</Row>
<Row label={t('copies.summary.adaptation')} hint={t('copies.summary.adaptationHint')}>
{adaptationFor(record.gameVersion, supportedVersions) ?? t('source.versionUnknown')}
<span className={verified ? 'ok' : 'warn'}>{verified ? t('adaptation.verified') : t('adaptation.nearest')}</span>
</Row>
<Row label={t('copies.summary.location')}>{folder(record.copyPath)}</Row>
<Row label={t('copies.summary.method')}>{t(`copies.summary.methods.${record.method}`)}</Row>
<Row label={t('copies.summary.stock')} hint={t('copies.summary.stockHint')}>{folder(record.stockBackupPath)}</Row>
<Row label={t('copies.summary.data')} hint={t('copies.summary.dataHint')}>{folder(record.dataPath)}</Row>
<Row label={t('copies.summary.installedAt')}>{new Date(record.installedAt).toLocaleString(i18n.language)}</Row>
<Row label={t('copies.summary.features')}>
{missing === 0 ? (
<span className="ok">{t('side.allAvailable')}</span>
) : (
<>
<span className="warn">{t('side.someMissing', { count: missing })}</span>
<button type="button" className="link" onClick={onShowFeatures}>{t('side.details')}</button>
</>
)}
</Row>
</Sheet>
);
}
@@ -0,0 +1,76 @@
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import type { InstallRecord, PatchFeature } from '@shared/schemas/install.ts';
import { Sheet } from '../../components/Sheet.tsx';
import { featureName } from '../../features.ts';
import { ipcInvoke } from '../../ipc.ts';
import { adaptationFor } from '../../versions.ts';
interface FeatureStatusProps {
readonly record: InstallRecord;
readonly supportedVersions: readonly string[];
readonly onError: (error: unknown) => void;
}
/** Every feature the patches cover, grouped by inventory section, with what the copy lacks and why. */
export function FeatureStatus({ record, supportedVersions, onError }: FeatureStatusProps) {
const { t, i18n } = useTranslation();
const [features, setFeatures] = useState<PatchFeature[] | null>(null);
useEffect(() => {
let current = true;
ipcInvoke('install:listFeatures')
.then((list) => current && setFeatures(list))
.catch((error: unknown) => current && onError(error));
return () => {
current = false;
};
}, [onError]);
const unavailable = new Map<string, string[]>();
for (const patch of record.unavailablePatches) {
for (const tag of patch.features) unavailable.set(tag, [...(unavailable.get(tag) ?? []), patch.patchId]);
}
const adaptation = adaptationFor(record.gameVersion, supportedVersions) ?? t('source.versionUnknown');
const sections = groupBySection(features ?? []);
return (
<Sheet
title={t('copies.sections.features')}
aside={unavailable.size === 0 ? t('copies.features.allAvailable') : t('copies.features.someMissing', { count: unavailable.size })}
foot={<span>{t('copies.features.checkedAt', { time: new Date(record.installedAt).toLocaleString(i18n.language) })}</span>}
>
<p className="lead">{t('copies.features.lead')}</p>
{sections.map(([section, list]) => (
<div key={section} className="feature-group">
<h3>{section} · {t(`featureSections.${section}`, { defaultValue: section })}</h3>
{list.map((feature) => {
const failed = unavailable.get(feature.tag);
return (
<div key={feature.tag} className="feature">
<span className={failed ? 'warn' : 'ok'} aria-hidden="true">{failed ? '⚠' : '✓'}</span>
<span>
{featureName(t, feature.tag)}
{feature.essential && <> <span className="tag">{t('copies.features.essential')}</span></>}
</span>
<span className={failed ? 'feature-note feature-note-warning' : 'feature-note'}>
{failed ? t('copies.features.unavailable', { patches: failed.join(', ') }) : t('copies.features.verifiedOn', { version: adaptation })}
</span>
</div>
);
})}
</div>
))}
</Sheet>
);
}
/** Features by the inventory section letter before the dash in their tag, sections in order. */
function groupBySection(features: readonly PatchFeature[]): Array<[string, PatchFeature[]]> {
const groups = new Map<string, PatchFeature[]>();
for (const feature of features) {
const section = feature.tag.split('-')[0] ?? '';
groups.set(section, [...(groups.get(section) ?? []), feature]);
}
return [...groups.entries()].sort(([a], [b]) => a.localeCompare(b));
}
@@ -0,0 +1,6 @@
import type { InstallRecord } from '@shared/schemas/install.ts';
/** The feature tags a copy lacks because their patches did not apply when it was installed, each once. */
export function missingFeatures(record: InstallRecord): string[] {
return [...new Set(record.unavailablePatches.flatMap((patch) => patch.features))];
}
@@ -0,0 +1,27 @@
import { useTranslation } from 'react-i18next';
import type { InstallRecord } from '@shared/schemas/install.ts';
/** The home page's main area: the background art with the title, and before installation the three steps. */
export function HomeMain({ record }: { readonly record: InstallRecord | null }) {
const { t } = useTranslation();
if (record) {
return (
<div className="hero">
<div className="hero-kicker">{t('home.installedKicker', { version: record.gameVersion ?? t('source.versionUnknown') })}</div>
<h1 className="hero-title">{t('app.title')}</h1>
</div>
);
}
return (
<div className="hero">
<div className="hero-kicker">{t('home.kicker')}</div>
<h1 className="hero-title">{t('app.title')}</h1>
<p className="hero-body">{t('home.body')}</p>
<ol className="welcome-steps">
<li><b>{t('home.steps.choose')}</b>{t('home.steps.chooseBody')}</li>
<li><b>{t('home.steps.copy')}</b>{t('home.steps.copyBody')}</li>
<li><b>{t('home.steps.launch')}</b>{t('home.steps.launchBody')}</li>
</ol>
</div>
);
}
@@ -0,0 +1,73 @@
import { useTranslation } from 'react-i18next';
import type { InstallRecord } from '@shared/schemas/install.ts';
import type { Destination } from '../../shell/navigation.ts';
import { adaptationFor, isVerified } from '../../versions.ts';
import { missingFeatures } from '../copies/missing-features.ts';
interface HomeSideProps {
readonly record: InstallRecord | null;
readonly supportedVersions: readonly string[];
readonly onNavigate: (to: Destination) => void;
}
/** The side panel of the home and about pages: requirements before installation, the current copy after. */
export function HomeSide({ record, supportedVersions, onNavigate }: HomeSideProps) {
const { t } = useTranslation();
if (!record) {
return (
<>
<h3 className="side-heading">{t('side.requirements')}</h3>
<div className="side-block">
<dl className="kv">
<dt>{t('side.game')}</dt>
<dd>{t('side.gameValue')}</dd>
<dt>{t('side.versions')}</dt>
<dd>{supportedVersions.join(', ')}</dd>
<dt>{t('side.space')}</dt>
<dd>{t('side.spaceValue')}</dd>
</dl>
</div>
<h3 className="side-heading">{t('side.about')}</h3>
<div className="side-block side-text">
{t('side.aboutBody')}
<div><button type="button" className="more" onClick={() => onNavigate({ page: 'about' })}>{t('side.statement')} ›</button></div>
</div>
<div className="side-foot">{t('side.disclaimer')}</div>
</>
);
}
const missing = missingFeatures(record).length;
const adaptation = adaptationFor(record.gameVersion, supportedVersions);
return (
<>
<h3 className="side-heading">{t('side.currentCopy')}</h3>
<div className="copy-card">
<div className="copy-card-name">{t('side.copyName')}</div>
<div className="copy-card-meta" title={record.copyPath}>{record.gameVersion ?? t('source.versionUnknown')} · {record.copyPath}</div>
</div>
<div className="side-block">
<dl className="kv">
<dt>{t('side.adaptation')}</dt>
<dd>
{adaptation ?? t('source.versionUnknown')}{' '}
{isVerified(record.gameVersion, supportedVersions)
? <span className="ok">{t('adaptation.verified')}</span>
: <span className="warn">{t('adaptation.nearest')}</span>}
</dd>
<dt>{t('side.features')}</dt>
<dd>
{missing === 0 ? (
<span className="ok">{t('side.allAvailable')}</span>
) : (
<>
<span className="warn">{t('side.someMissing', { count: missing })}</span>{' '}
<button type="button" className="link" onClick={() => onNavigate({ page: 'copies', section: 'features' })}>{t('side.details')}</button>
</>
)}
</dd>
</dl>
</div>
<div className="side-foot">{t('side.disclaimer')}</div>
</>
);
}
@@ -0,0 +1,26 @@
import type { TFunction } from 'i18next';
import type { InstallRecord } from '@shared/schemas/install.ts';
import type { BarModel } from '../../shell/bar-model.ts';
import { missingFeatures } from '../copies/missing-features.ts';
/**
* The bottom bar outside the wizard: install before the first installation, launch after it.
* Launching (local verification) is not built yet, so the button stays disabled and the detail says so.
*/
export function homeBar(record: InstallRecord | null, t: TFunction, onInstall: () => void): BarModel {
if (!record) {
return {
tone: 'idle',
title: t('bar.notInstalled'),
detail: t('bar.notInstalledDetail'),
primary: { label: t('bar.install'), onClick: onInstall },
};
}
const missing = missingFeatures(record).length;
return {
tone: missing ? 'warn' : 'ok',
title: missing ? t('bar.readyMissing', { count: missing }) : t('bar.ready'),
detail: t('bar.readyDetail', { version: record.gameVersion ?? t('source.versionUnknown') }),
primary: { label: t('bar.launch'), disabled: true },
};
}
@@ -11,40 +11,38 @@ interface CheckStepProps {
readonly onMissingAccepted: (accepted: boolean) => void; readonly onMissingAccepted: (accepted: boolean) => void;
} }
/** Step 4: which of the offline version's changes fit the player's game build. */ /** Step 4: which of the offline version's patches apply to the player's game build. */
export function CheckStep({ check, missingAccepted, onMissingAccepted }: CheckStepProps) { export function CheckStep({ check, missingAccepted, onMissingAccepted }: CheckStepProps) {
const { t } = useTranslation(); const { t } = useTranslation();
if (!check) { if (!check) {
return ( return (
<section className="step"> <>
<h2>{t('check.title')}</h2> <p className="lead">{t('check.running')}</p>
<p className="muted">{t('check.running')}</p> <ProgressBar value={0} max={null} large />
<ProgressBar value={0} max={null} /> </>
</section>
); );
} }
const essential = check.unavailable.filter((patch) => patch.essential); const essential = check.unavailable.filter((patch) => patch.essential);
if (check.unavailable.length === 0) {
return <Notice tone="info">{t('check.allFit', { count: check.exePatchesReady + check.guiPatchesReady })}</Notice>;
}
if (essential.length > 0) {
return (
<Notice tone="error">
<p>{t('check.essentialMissing')}</p>
<PatchList patches={essential} />
</Notice>
);
}
return ( return (
<section className="step"> <Notice tone="warning">
<h2>{t('check.title')}</h2> <p>{t('check.someMissing', { count: check.unavailable.length })}</p>
{check.unavailable.length === 0 && <Notice tone="info">{t('check.allFit', { count: check.exePatchesReady + check.guiPatchesReady })}</Notice>} <PatchList patches={check.unavailable} />
{essential.length > 0 && ( <label className="check">
<Notice tone="error"> <input type="checkbox" checked={missingAccepted} onChange={(event) => onMissingAccepted(event.target.checked)} />
<p>{t('check.essentialMissing')}</p> {t('check.accept')}
<PatchList patches={essential} /> </label>
</Notice> </Notice>
)}
{essential.length === 0 && check.unavailable.length > 0 && (
<Notice tone="warning">
<p>{t('check.someMissing')}</p>
<PatchList patches={check.unavailable} />
<label className="check">
<input type="checkbox" checked={missingAccepted} onChange={(event) => onMissingAccepted(event.target.checked)} />
{t('check.accept')}
</label>
</Notice>
)}
</section>
); );
} }
@@ -11,10 +11,9 @@ interface DataStepProps {
export function DataStep({ dataPath, onDataPath, onError }: DataStepProps) { export function DataStep({ dataPath, onDataPath, onError }: DataStepProps) {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<section className="step"> <>
<h2>{t('data.title')}</h2> <p className="lead">{t('data.body')}</p>
<p className="muted">{t('data.body')}</p> <FolderField path={dataPath} dialogTitle={t('data.dialogTitle')} onChosen={onDataPath} onError={onError} />
<FolderField path={dataPath} dialogTitle={t('data.title')} onChosen={onDataPath} onError={onError} /> </>
</section>
); );
} }
@@ -1,3 +1,4 @@
import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import type { FolderSize, GameFolderInspection, InstallMethod, TargetFolderInspection } from '@shared/schemas/install.ts'; import type { FolderSize, GameFolderInspection, InstallMethod, TargetFolderInspection } from '@shared/schemas/install.ts';
import { FolderField } from '../../components/FolderField.tsx'; import { FolderField } from '../../components/FolderField.tsx';
@@ -33,35 +34,50 @@ export function MethodStep({ source, sourceSize, choice, onChoice, onError }: Me
.then((target) => onChoice({ method: 'copy', target, steamConfirmed: false })) .then((target) => onChoice({ method: 'copy', target, steamConfirmed: false }))
.catch(onError); .catch(onError);
}; };
const steamWarning = steamLibraryInvolved(source, choice)
? <SteamWarning confirmed={choice.steamConfirmed} onConfirmed={(steamConfirmed) => onChoice({ ...choice, steamConfirmed })} />
: null;
return ( return (
<section className="step"> <>
<h2>{t('method.title')}</h2> <Choice
<label className="choice"> selected={choice.method === 'copy'}
<input type="radio" name="method" checked={choice.method === 'copy'} onChange={() => choose('copy')} /> title={t('method.copy')}
<span> body={t('method.copyBody', { size: sourceSize ? formatBytes(sourceSize.bytes) : t('method.measuring') })}
<strong>{t('method.copy')}</strong> onSelect={() => choose('copy')}
<span className="muted"> >
{t('method.copyBody', { size: sourceSize ? formatBytes(sourceSize.bytes) : t('method.measuring') })} <FolderField path={choice.target?.path ?? null} dialogTitle={t('method.targetTitle')} onChosen={inspectTarget} onError={onError} />
</span> {choice.target && <TargetVerdict target={choice.target} sourceSize={sourceSize} />}
</span> {steamWarning}
</label> </Choice>
{choice.method === 'copy' && ( <Choice
<div className="choice-detail"> selected={choice.method === 'in-place'}
<FolderField path={choice.target?.path ?? null} dialogTitle={t('method.targetTitle')} onChosen={inspectTarget} onError={onError} /> title={t('method.inPlace')}
{choice.target && <TargetVerdict target={choice.target} sourceSize={sourceSize} />} body={t('method.inPlaceBody')}
</div> onSelect={() => choose('in-place')}
)} >
<label className="choice"> {steamWarning}
<input type="radio" name="method" checked={choice.method === 'in-place'} onChange={() => choose('in-place')} /> </Choice>
<span> </>
<strong>{t('method.inPlace')}</strong> );
<span className="muted">{t('method.inPlaceBody', { path: source.path })}</span> }
</span>
</label> interface ChoiceProps {
{steamLibraryInvolved(source, choice) && ( readonly selected: boolean;
<SteamWarning confirmed={choice.steamConfirmed} onConfirmed={(steamConfirmed) => onChoice({ ...choice, steamConfirmed })} /> readonly title: string;
)} readonly body: string;
</section> readonly onSelect: () => void;
/** Shown under the description while the choice is selected. */
readonly children: ReactNode;
}
function Choice({ selected, title, body, onSelect, children }: ChoiceProps) {
return (
<div className={selected ? 'choice choice-selected' : 'choice'} onClick={selected ? undefined : onSelect}>
<input type="radio" name="method" checked={selected} onChange={onSelect} aria-label={title} />
<span className="choice-title">{title}</span>
<div className="choice-body">{body}</div>
{selected && <div className="choice-detail">{children}</div>}
</div>
); );
} }
@@ -1,39 +1,39 @@
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import type { InstallProgress } from '@shared/schemas/install.ts'; import { INSTALL_PHASES, type InstallProgress } from '@shared/schemas/install.ts';
import { ProgressBar } from '../../components/ProgressBar.tsx'; import { ProgressBar } from '../../components/ProgressBar.tsx';
import { formatBytes } from '../../format.ts'; import { formatBytes } from '../../format.ts';
interface ProgressStepProps { /**
readonly progress: InstallProgress | null; * Step 5: the installation running, phase by phase. Cancelling is in the bottom bar; only the
readonly cancelling: boolean; * copy can be stopped, the other phases take seconds.
readonly onCancel: () => void; */
} export function ProgressStep({ progress }: { readonly progress: InstallProgress | null }) {
/** Step 5: the installation running. Only the copy can be stopped; the other phases take seconds. */
export function ProgressStep({ progress, cancelling, onCancel }: ProgressStepProps) {
const { t } = useTranslation(); const { t } = useTranslation();
const phase = progress?.phase ?? 'checking'; const phase = progress?.phase ?? 'checking';
const current = INSTALL_PHASES.indexOf(phase);
const copying = phase === 'copying' && progress !== null; const copying = phase === 'copying' && progress !== null;
return ( return (
<section className="step"> <>
<h2>{t('progress.title')}</h2> {INSTALL_PHASES.map((name, position) => {
<p>{t(`progress.phase.${phase}`)}</p> const state = position < current ? 'done' : position === current ? 'current' : 'pending';
<ProgressBar value={copying ? progress.doneBytes : 0} max={copying ? progress.totalBytes : null} /> return (
<div key={name} className={`phase phase-${state}`}>
<span className="phase-mark" aria-hidden="true">{state === 'done' ? '✓' : state === 'current' ? '›' : '·'}</span>
{t(`progress.phase.${name}`)}
</div>
);
})}
<ProgressBar value={copying ? progress.doneBytes : 0} max={copying ? progress.totalBytes : null} large />
{copying && ( {copying && (
<p className="muted"> <div className="progress-caption">
{t('progress.copied', { {t('progress.copied', {
done: formatBytes(progress.doneBytes), done: formatBytes(progress.doneBytes),
total: formatBytes(progress.totalBytes), total: formatBytes(progress.totalBytes),
doneFiles: progress.doneFiles, doneFiles: progress.doneFiles.toLocaleString(),
totalFiles: progress.totalFiles, totalFiles: progress.totalFiles.toLocaleString(),
})} })}
</p> </div>
)} )}
{copying && ( </>
<button type="button" className="button" onClick={onCancel} disabled={cancelling}>
{cancelling ? t('progress.cancelling') : t('progress.cancel')}
</button>
)}
</section>
); );
} }
@@ -1,43 +1,60 @@
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import type { GameFolderInspection } from '@shared/schemas/install.ts'; import type { FolderSize, GameFolderInspection } from '@shared/schemas/install.ts';
import { FolderField } from '../../components/FolderField.tsx'; import { FolderField } from '../../components/FolderField.tsx';
import { Notice } from '../../components/Notice.tsx'; import { Notice } from '../../components/Notice.tsx';
import { formatBytes } from '../../format.ts';
import { ipcInvoke } from '../../ipc.ts'; import { ipcInvoke } from '../../ipc.ts';
import { adaptationFor, isVerified } from '../../versions.ts';
interface SourceStepProps { interface SourceStepProps {
readonly source: GameFolderInspection | null; readonly source: GameFolderInspection | null;
/** Null while the folder is measured. */
readonly sourceSize: FolderSize | null;
readonly supportedVersions: readonly string[];
readonly onSource: (source: GameFolderInspection | null) => void; readonly onSource: (source: GameFolderInspection | null) => void;
readonly onError: (error: unknown) => void; readonly onError: (error: unknown) => void;
} }
/** Step 1: the player's War Thunder installation. */ /** Step 1: the player's War Thunder installation, its version and the adaptation used for it. */
export function SourceStep({ source, onSource, onError }: SourceStepProps) { export function SourceStep({ source, sourceSize, supportedVersions, onSource, onError }: SourceStepProps) {
const { t } = useTranslation(); const { t } = useTranslation();
const inspect = (path: string): void => { const inspect = (path: string): void => {
onSource(null); onSource(null);
ipcInvoke('install:inspectGameFolder', { path }).then(onSource).catch(onError); ipcInvoke('install:inspectGameFolder', { path }).then(onSource).catch(onError);
}; };
return ( return (
<section className="step"> <>
<h2>{t('source.title')}</h2> <p className="lead">{t('source.body')}</p>
<p className="muted">{t('source.body')}</p> <FolderField path={source?.path ?? null} dialogTitle={t('source.dialogTitle')} onChosen={inspect} onError={onError} />
<FolderField path={source?.path ?? null} dialogTitle={t('source.title')} onChosen={inspect} onError={onError} /> {source && <SourceVerdict source={source} sourceSize={sourceSize} supportedVersions={supportedVersions} />}
{source && <SourceVerdict source={source} />} <p className="small">{t('source.readOnly')}</p>
</section> </>
); );
} }
function SourceVerdict({ source }: { readonly source: GameFolderInspection }) { function SourceVerdict({ source, sourceSize, supportedVersions }: { readonly source: GameFolderInspection; readonly sourceSize: FolderSize | null; readonly supportedVersions: readonly string[] }) {
const { t } = useTranslation(); const { t } = useTranslation();
if (source.missingFiles.length) { if (source.missingFiles.length) {
return <Notice tone="error">{t('source.notAGame', { files: source.missingFiles.join(', ') })}</Notice>; return <Notice tone="error">{t('source.notAGame', { files: source.missingFiles.join(', ') })}</Notice>;
} }
const verified = source.version !== null && source.verifiedVersions.includes(source.version); const size = sourceSize ? t('source.size', { size: formatBytes(sourceSize.bytes), files: sourceSize.files.toLocaleString() }) : t('source.measuring');
return verified ? ( if (isVerified(source.version, supportedVersions)) {
<Notice tone="info">{t('source.versionVerified', { version: source.version })}</Notice> return (
) : ( <Notice tone="info">
<p>{t('source.versionVerified', { version: source.version })}</p>
<p className="small">{size}</p>
</Notice>
);
}
return (
<Notice tone="warning"> <Notice tone="warning">
{t('source.versionUnverified', { version: source.version ?? t('source.versionUnknown'), verified: source.verifiedVersions.join(', ') })} <p>
{t('source.versionUnverified', {
version: source.version ?? t('source.versionUnknown'),
nearest: adaptationFor(source.version, supportedVersions) ?? t('source.versionUnknown'),
})}
</p>
<p className="small">{size}</p>
</Notice> </Notice>
); );
} }
@@ -0,0 +1,28 @@
import { useTranslation } from 'react-i18next';
import { Sheet } from '../../components/Sheet.tsx';
import { CheckStep } from './CheckStep.tsx';
import { DataStep } from './DataStep.tsx';
import { MethodStep } from './MethodStep.tsx';
import { ProgressStep } from './ProgressStep.tsx';
import { SourceStep, sourceUsable } from './SourceStep.tsx';
import { WIZARD_STEPS, type InstallWizard } from './useInstallWizard.ts';
/** The current wizard step in the main area. */
export function WizardMain({ wizard, supportedVersions }: { readonly wizard: InstallWizard; readonly supportedVersions: readonly string[] }) {
const { t } = useTranslation();
const { step, source } = wizard;
return (
<Sheet title={t(`wizard.steps.${step}`)} aside={t('wizard.stepOf', { index: wizard.index + 1, total: WIZARD_STEPS.length })}>
{step === 'source' && (
<SourceStep source={source} sourceSize={wizard.sourceSize} supportedVersions={supportedVersions} onSource={wizard.chooseSource} onError={wizard.report} />
)}
{step === 'method' && sourceUsable(source) && (
<MethodStep source={source} sourceSize={wizard.sourceSize} choice={wizard.choice} onChoice={wizard.setChoice} onError={wizard.report} />
)}
{step === 'data' && <DataStep dataPath={wizard.dataPath} onDataPath={wizard.setDataPath} onError={wizard.report} />}
{step === 'check' && <CheckStep check={wizard.check} missingAccepted={wizard.missingAccepted} onMissingAccepted={wizard.setMissingAccepted} />}
{step === 'installing' && <ProgressStep progress={wizard.progress} />}
{wizard.message && <p className="error-text" role="alert">{wizard.message}</p>}
</Sheet>
);
}
@@ -0,0 +1,21 @@
import { useTranslation } from 'react-i18next';
import { WIZARD_STEPS, type WizardStep } from './useInstallWizard.ts';
/** The wizard's step list in the side panel. */
export function WizardSide({ step }: { readonly step: WizardStep }) {
const { t } = useTranslation();
const index = WIZARD_STEPS.indexOf(step);
return (
<>
<h3 className="side-heading">{t('wizard.title')}</h3>
<ol className="wizard-steps">
{WIZARD_STEPS.map((name, position) => (
<li key={name} className={position === index ? 'current' : position < index ? 'done' : undefined}>
{t(`wizard.steps.${name}`)}
</li>
))}
</ol>
<div className="side-foot">{t('wizard.note')}</div>
</>
);
}
@@ -1,31 +1,33 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import type { FolderSize, GameFolderInspection, InstallProgress, InstallRecord, InstallRequest, PatchCheck } from '@shared/schemas/install.ts'; import type { FolderSize, GameFolderInspection, InstallProgress, InstallRecord, InstallRequest, PatchCheck } from '@shared/schemas/install.ts';
import { ipcInvoke, ipcOn } from '../../ipc.ts'; import { ipcInvoke, ipcOn } from '../../ipc.ts';
import { useErrorMessage } from '../../useErrorMessage.ts'; import { useErrorMessage } from '../../useErrorMessage.ts';
import { CheckStep, checkUsable } from './CheckStep.tsx'; import { checkUsable } from './CheckStep.tsx';
import { DataStep } from './DataStep.tsx'; import { methodUsable, type MethodChoice } from './MethodStep.tsx';
import { MethodStep, methodUsable, type MethodChoice } from './MethodStep.tsx'; import { sourceUsable } from './SourceStep.tsx';
import { ProgressStep } from './ProgressStep.tsx';
import { SourceStep, sourceUsable } from './SourceStep.tsx';
const STEPS = ['source', 'method', 'data', 'check', 'installing'] as const; export const WIZARD_STEPS = ['source', 'method', 'data', 'check', 'installing'] as const;
type Step = (typeof STEPS)[number]; export type WizardStep = (typeof WIZARD_STEPS)[number];
interface InstallWizardProps { const NO_CHOICE: MethodChoice = { method: 'copy', target: null, steamConfirmed: false };
interface WizardOptions {
readonly defaultDataPath: string; readonly defaultDataPath: string;
readonly onInstalled: (record: InstallRecord) => void; readonly onInstalled: (record: InstallRecord) => void;
readonly onClose: () => void;
} }
/** The install wizard: one screen per step, the work done by the main process over IPC. */ /**
export function InstallWizard({ defaultDataPath, onInstalled, onClose }: InstallWizardProps) { * The install wizard's state and actions. The window shows it in three places: the step list in
const { t } = useTranslation(); * the side panel, the current step in the main area, and back / next in the bottom bar. The work
* is done by the main process over IPC.
*/
export function useInstallWizard({ defaultDataPath, onInstalled }: WizardOptions) {
const { message, report, clear } = useErrorMessage(); const { message, report, clear } = useErrorMessage();
const [step, setStep] = useState<Step>('source'); const [active, setActive] = useState(false);
const [step, setStep] = useState<WizardStep>('source');
const [source, setSource] = useState<GameFolderInspection | null>(null); const [source, setSource] = useState<GameFolderInspection | null>(null);
const [sourceSize, setSourceSize] = useState<FolderSize | null>(null); const [sourceSize, setSourceSize] = useState<FolderSize | null>(null);
const [choice, setChoice] = useState<MethodChoice>({ method: 'copy', target: null, steamConfirmed: false }); const [choice, setChoice] = useState<MethodChoice>(NO_CHOICE);
const [dataPath, setDataPath] = useState(defaultDataPath); const [dataPath, setDataPath] = useState(defaultDataPath);
const [check, setCheck] = useState<PatchCheck | null>(null); const [check, setCheck] = useState<PatchCheck | null>(null);
const [missingAccepted, setMissingAccepted] = useState(false); const [missingAccepted, setMissingAccepted] = useState(false);
@@ -40,12 +42,14 @@ export function InstallWizard({ defaultDataPath, onInstalled, onClose }: Install
ipcInvoke('install:measureFolder', { path: source.path }) ipcInvoke('install:measureFolder', { path: source.path })
.then((size) => current && setSourceSize(size)) .then((size) => current && setSourceSize(size))
.catch((error: unknown) => current && report(error)); .catch((error: unknown) => current && report(error));
return () => { current = false; }; return () => {
current = false;
};
}, [source, report]); }, [source, report]);
// The check runs every time the step is entered: the choices before it may have changed. // The check runs every time the step is entered: the choices before it may have changed.
useEffect(() => { useEffect(() => {
if (step !== 'check' || !sourceUsable(source)) return; if (!active || step !== 'check' || !sourceUsable(source)) return;
let current = true; let current = true;
setCheck(null); setCheck(null);
setMissingAccepted(false); setMissingAccepted(false);
@@ -56,11 +60,24 @@ export function InstallWizard({ defaultDataPath, onInstalled, onClose }: Install
report(error); report(error);
setStep('data'); setStep('data');
}); });
return () => { current = false; }; return () => {
}, [step, source, dataPath, report]); current = false;
};
}, [active, step, source, dataPath, report]);
useEffect(() => ipcOn('event:install-progress', setProgress), []); useEffect(() => ipcOn('event:install-progress', setProgress), []);
const start = (): void => {
clear();
setStep('source');
setActive(true);
};
const chooseSource = (found: GameFolderInspection | null): void => {
setSource(found);
setChoice(NO_CHOICE);
};
const install = (): void => { const install = (): void => {
if (!sourceUsable(source)) return; if (!sourceUsable(source)) return;
const choices = { dataPath, steamLibraryConfirmed: choice.steamConfirmed, missingFeaturesAccepted: missingAccepted }; const choices = { dataPath, steamLibraryConfirmed: choice.steamConfirmed, missingFeaturesAccepted: missingAccepted };
@@ -72,19 +89,17 @@ export function InstallWizard({ defaultDataPath, onInstalled, onClose }: Install
setCancelling(false); setCancelling(false);
setStep('installing'); setStep('installing');
ipcInvoke('install:start', request) ipcInvoke('install:start', request)
.then(onInstalled) .then((record) => {
setActive(false);
onInstalled(record);
})
.catch((error: unknown) => { .catch((error: unknown) => {
report(error); report(error);
setStep('check'); setStep('check');
}); });
}; };
const cancel = (): void => { const canGoOn = ((): boolean => {
setCancelling(true);
ipcInvoke('install:cancel').catch(report);
};
const canGoOn = (() => {
switch (step) { switch (step) {
case 'source': return sourceUsable(source); case 'source': return sourceUsable(source);
case 'method': return sourceUsable(source) && methodUsable(source, sourceSize, choice); case 'method': return sourceUsable(source) && methodUsable(source, sourceSize, choice);
@@ -93,41 +108,31 @@ export function InstallWizard({ defaultDataPath, onInstalled, onClose }: Install
case 'installing': return false; case 'installing': return false;
} }
})(); })();
const index = STEPS.indexOf(step);
const index = WIZARD_STEPS.indexOf(step);
const back = (): void => { const back = (): void => {
clear(); clear();
if (index === 0) onClose(); if (index === 0) setActive(false);
else setStep(STEPS[index - 1]!); else setStep(WIZARD_STEPS[index - 1]!);
};
const next = (): void => {
clear();
if (step === 'check') install();
else setStep(STEPS[index + 1]!);
}; };
return ( const next = (): void => {
<div className="wizard"> if (!canGoOn) return;
<ol className="wizard-steps"> clear();
{STEPS.map((name, position) => ( if (step === 'check') install();
<li key={name} className={position === index ? 'current' : position < index ? 'done' : ''}>{t(`wizard.steps.${name}`)}</li> else setStep(WIZARD_STEPS[index + 1]!);
))} };
</ol>
<div className="wizard-body"> const cancel = (): void => {
{step === 'source' && <SourceStep source={source} onSource={(found) => { setSource(found); setChoice({ method: 'copy', target: null, steamConfirmed: false }); }} onError={report} />} setCancelling(true);
{step === 'method' && sourceUsable(source) && <MethodStep source={source} sourceSize={sourceSize} choice={choice} onChoice={setChoice} onError={report} />} ipcInvoke('install:cancel').catch(report);
{step === 'data' && <DataStep dataPath={dataPath} onDataPath={setDataPath} onError={report} />} };
{step === 'check' && <CheckStep check={check} missingAccepted={missingAccepted} onMissingAccepted={setMissingAccepted} />}
{step === 'installing' && <ProgressStep progress={progress} cancelling={cancelling} onCancel={cancel} />} return {
{message && <p className="error-text">{message}</p>} active, step, index, source, sourceSize, choice, dataPath, check, missingAccepted, progress, cancelling, message, canGoOn,
</div> start, back, next, cancel, report, chooseSource, setChoice, setDataPath, setMissingAccepted,
{step !== 'installing' && ( };
<div className="wizard-actions">
<button type="button" className="button" onClick={back}>{index === 0 ? t('wizard.cancel') : t('wizard.back')}</button>
<button type="button" className="button button-primary" onClick={next} disabled={!canGoOn}>
{step === 'check' ? t('wizard.install') : t('wizard.next')}
</button>
</div>
)}
</div>
);
} }
export type InstallWizard = ReturnType<typeof useInstallWizard>;
@@ -0,0 +1,49 @@
import type { TFunction } from 'i18next';
import type { BarModel } from '../../shell/bar-model.ts';
import { formatBytes } from '../../format.ts';
import { WIZARD_STEPS, type InstallWizard } from './useInstallWizard.ts';
/** The bottom bar while the wizard runs: back on the left, next / install as the primary action. */
export function wizardBar(wizard: InstallWizard, t: TFunction): BarModel {
const { step, index, check, progress, cancelling } = wizard;
const stepOf = t('wizard.stepOf', { index: index + 1, total: WIZARD_STEPS.length });
if (step === 'installing') {
const phase = progress?.phase ?? 'checking';
const copying = phase === 'copying' && progress !== null;
return {
tone: 'busy',
title: t(`progress.phase.${phase}`),
detail: copying ? t('progress.cancelHint') : stepOf,
progress: copying
? {
value: progress.doneBytes,
max: progress.totalBytes,
start: `${Math.floor((progress.doneBytes / Math.max(1, progress.totalBytes)) * 100)}%`,
end: `${formatBytes(progress.doneBytes)} / ${formatBytes(progress.totalBytes)}`,
}
: { value: 0, max: null },
primary: { label: t('wizard.installing'), disabled: true },
...(copying ? { secondary: { label: cancelling ? t('progress.cancelling') : t('progress.cancel'), disabled: cancelling, onClick: wizard.cancel } } : {}),
};
}
const back = { label: index === 0 ? t('wizard.cancel') : t('wizard.back'), onClick: wizard.back };
if (step === 'check' && check === null) {
return {
tone: 'busy',
title: t('wizard.checking'),
detail: t('wizard.checkingDetail'),
progress: { value: 0, max: null },
primary: { label: t('wizard.install'), disabled: true },
secondary: back,
};
}
return {
tone: 'idle',
title: t('wizard.barTitle', { step: t(`wizard.steps.${step}`) }),
detail: stepOf,
primary: { label: step === 'check' ? t('wizard.install') : t('wizard.next'), disabled: !wizard.canGoOn, onClick: wizard.next },
secondary: back,
};
}
@@ -0,0 +1,17 @@
import { useTranslation } from 'react-i18next';
import type { Settings } from '@shared/schemas/settings.ts';
import { Row } from '../../components/Row.tsx';
import { Sheet } from '../../components/Sheet.tsx';
import { LanguageMenu } from '../../shell/LanguageMenu.tsx';
/** General launcher settings. */
export function GeneralSettings({ settings, onError }: { readonly settings: Settings; readonly onError: (error: unknown) => void }) {
const { t } = useTranslation();
return (
<Sheet title={t('settings.sections.general')}>
<Row label={t('settings.language')} hint={t('settings.languageHint')}>
<LanguageMenu value={settings.language} onError={onError} plain />
</Row>
</Sheet>
);
}
@@ -0,0 +1,14 @@
/** The window background: the art read from the game copy, or the launcher's own drawing. */
export function Background({ artUrl }: { readonly artUrl: string | null }) {
return (
<>
<div
className={artUrl ? 'background' : 'background background-drawn'}
style={artUrl ? { backgroundImage: `url("${artUrl}")` } : undefined}
aria-hidden="true"
/>
<div className="background-stripes" aria-hidden="true" />
<div className="background-dim" aria-hidden="true" />
</>
);
}
@@ -0,0 +1,37 @@
import { ProgressBar } from '../components/ProgressBar.tsx';
import type { BarModel, StatusTone } from './bar-model.ts';
const TONE_MARKS: Record<StatusTone, string> = { ok: '✓', warn: '!', bad: '✕', idle: '·', busy: '' };
/** Status, progress and the primary action, at the bottom of every page. */
export function BottomBar({ model }: { readonly model: BarModel }) {
const { tone, title, detail, progress, primary, secondary } = model;
return (
<section className="bottom-bar">
<div className="status" role="status">
<span className={`status-icon status-icon-${tone}`} aria-hidden="true">{TONE_MARKS[tone]}</span>
<div className="status-text">
<div className="status-title">{title}</div>
{detail !== undefined && <div className="status-detail">{detail}</div>}
</div>
</div>
{secondary && (
<button type="button" className="secondary-action" onClick={secondary.onClick} disabled={secondary.disabled}>
{secondary.label}
</button>
)}
{progress && (
<div className="bar-progress">
<ProgressBar value={progress.value} max={progress.max} />
<div className="bar-progress-label">
<span>{progress.start}</span>
<span>{progress.end}</span>
</div>
</div>
)}
<button type="button" className="primary-action" onClick={primary.onClick} disabled={primary.disabled}>
{primary.label}
</button>
</section>
);
}
@@ -0,0 +1,21 @@
import { useTranslation } from 'react-i18next';
interface FooterProps {
readonly launcherVersion: string;
/** The installed copy's game version; null before installation, or when it is unknown. */
readonly gameVersion: string | null;
readonly installed: boolean;
}
/** Versions and the project statement along the bottom edge. */
export function Footer({ launcherVersion, gameVersion, installed }: FooterProps) {
const { t } = useTranslation();
return (
<footer className="footer">
<span>{t('footer.launcher', { version: launcherVersion })}</span>
<span className="footer-separator">|</span>
<span>{installed ? t('footer.game', { version: gameVersion ?? t('source.versionUnknown') }) : t('footer.notInstalled')}</span>
<span className="footer-end">{t('footer.disclaimer')}</span>
</footer>
);
}
@@ -0,0 +1,39 @@
import { useTranslation } from 'react-i18next';
import { LANGUAGE_CHOICES, type LanguageChoice } from '@shared/languages.ts';
import { ipcInvoke } from '../ipc.ts';
interface LanguageMenuProps {
readonly value: LanguageChoice;
readonly onError: (error: unknown) => void;
/** Plain select for a settings row; the title bar draws it with a globe. */
readonly plain?: boolean;
}
/** The launcher's display language; the change comes back as event:settings-changed. */
export function LanguageMenu({ value, onError, plain = false }: LanguageMenuProps) {
const { t } = useTranslation();
const select = (
<select
className={plain ? 'select' : undefined}
value={value}
aria-label={t('language.label')}
onChange={(event) => {
ipcInvoke('settings:update', { language: event.target.value as LanguageChoice }).catch(onError);
}}
>
{LANGUAGE_CHOICES.map((choice) => (
<option key={choice} value={choice}>{t(`language.${choice}`)}</option>
))}
</select>
);
if (plain) return select;
return (
<label className="language-menu" title={t('language.label')}>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" aria-hidden="true">
<circle cx="12" cy="12" r="9" />
<path d="M3 12h18M12 3c2.5 2.6 3.8 5.6 3.8 9s-1.3 6.4-3.8 9c-2.5-2.6-3.8-5.6-3.8-9S9.5 5.6 12 3z" />
</svg>
{select}
</label>
);
}
@@ -0,0 +1,21 @@
interface SubNavProps<S extends string> {
readonly sections: readonly S[];
readonly active: S;
readonly label: (section: S) => string;
readonly onSelect: (section: S) => void;
}
/** The section list of a page, in the side panel. */
export function SubNav<S extends string>({ sections, active, label, onSelect }: SubNavProps<S>) {
return (
<ul className="subnav">
{sections.map((section) => (
<li key={section}>
<button type="button" className={section === active ? 'active' : undefined} onClick={() => onSelect(section)}>
{label(section)}
</button>
</li>
))}
</ul>
);
}
@@ -0,0 +1,49 @@
import { useTranslation } from 'react-i18next';
import type { LanguageChoice } from '@shared/languages.ts';
import { ipcInvoke } from '../ipc.ts';
import { LanguageMenu } from './LanguageMenu.tsx';
import { PAGES, type PageId } from './navigation.ts';
interface TitleBarProps {
readonly page: PageId;
/** False while a task such as the install wizard holds the window. */
readonly navigationEnabled: boolean;
readonly language: LanguageChoice;
readonly onNavigate: (page: PageId) => void;
readonly onError: (error: unknown) => void;
}
/** The window's own title bar: logo, page navigation, language, minimize and close. */
export function TitleBar({ page, navigationEnabled, language, onNavigate, onError }: TitleBarProps) {
const { t } = useTranslation();
return (
<header className="titlebar">
<div className="logo">
<div className="logo-word">WT<span>OFFLINE</span></div>
<div className="logo-sub">{t('app.subtitle')}</div>
</div>
<nav className="nav">
{PAGES.map((id) => (
<button
key={id}
type="button"
className={navigationEnabled && id === page ? 'active' : undefined}
disabled={!navigationEnabled}
onClick={() => onNavigate(id)}
>
{t(`nav.${id}`)}
</button>
))}
</nav>
<div className="titlebar-end">
<LanguageMenu value={language} onError={onError} />
<button type="button" className="window-button" title={t('window.minimize')} onClick={() => ipcInvoke('window:minimize').catch(onError)}>
<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M1 6h10" stroke="currentColor" strokeWidth="1.4" /></svg>
</button>
<button type="button" className="window-button window-button-close" title={t('window.close')} onClick={() => ipcInvoke('window:close').catch(onError)}>
<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M1.5 1.5l9 9M10.5 1.5l-9 9" stroke="currentColor" strokeWidth="1.4" /></svg>
</button>
</div>
</header>
);
}
@@ -0,0 +1,31 @@
import type { ReactNode } from 'react';
/**
* What the bottom bar shows: the state of the current task, its progress, and the primary action
* (the large red button), which is always the most important next step.
*/
export type StatusTone = 'ok' | 'warn' | 'bad' | 'idle' | 'busy';
export interface BarAction {
readonly label: string;
readonly disabled?: boolean;
readonly onClick?: () => void;
}
export interface BarProgress {
readonly value: number;
/** Null for work without a measurable end. */
readonly max: number | null;
readonly start?: string;
readonly end?: string;
}
export interface BarModel {
readonly tone: StatusTone;
readonly title: string;
readonly detail?: ReactNode;
readonly progress?: BarProgress;
readonly primary: BarAction;
readonly secondary?: BarAction;
}
@@ -0,0 +1,38 @@
/**
* The window's pages and the sections of those that have a section list in the side panel.
* Pages for later features (saves, tuning) join this list when they are built.
*/
export const PAGES = ['home', 'copies', 'settings', 'about'] as const;
export type PageId = (typeof PAGES)[number];
export const COPY_SECTIONS = ['summary', 'features'] as const;
export type CopySection = (typeof COPY_SECTIONS)[number];
export const SETTINGS_SECTIONS = ['general'] as const;
export type SettingsSection = (typeof SETTINGS_SECTIONS)[number];
export interface Route {
readonly page: PageId;
readonly copies: CopySection;
readonly settings: SettingsSection;
}
export const START_ROUTE: Route = { page: 'home', copies: 'summary', settings: 'general' };
/** Where a link points: a page, and for pages with sections, which one. */
export type Destination =
| { readonly page: 'home' | 'about' }
| { readonly page: 'copies'; readonly section?: CopySection }
| { readonly page: 'settings'; readonly section?: SettingsSection };
export function navigate(route: Route, to: Destination): Route {
switch (to.page) {
case 'copies':
return { ...route, page: 'copies', copies: to.section ?? route.copies };
case 'settings':
return { ...route, page: 'settings', settings: to.section ?? route.settings };
default:
return { ...route, page: to.page };
}
}
@@ -1,307 +0,0 @@
:root {
color-scheme: light dark;
--bg: #f6f6f4;
--surface: #ffffff;
--text: #1d1f21;
--text-muted: #5c6166;
--border: #d9dbdd;
--accent: #b5541c;
--danger: #b3261e;
--radius: 8px;
font-family: 'Segoe UI', 'Microsoft YaHei UI', system-ui, sans-serif;
font-size: 14px;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #17191b;
--surface: #212427;
--text: #e8e9ea;
--text-muted: #a2a7ac;
--border: #363a3e;
--accent: #e0864c;
--danger: #f2a49e;
}
}
* {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--bg);
color: var(--text);
}
.app {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.app-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 20px;
border-bottom: 1px solid var(--border);
background: var(--surface);
}
.app-title {
margin: 0;
font-size: 16px;
font-weight: 600;
}
.app-main {
flex: 1;
padding: 24px 20px;
}
.language-menu {
display: flex;
align-items: center;
gap: 8px;
color: var(--text-muted);
}
.language-menu select {
font: inherit;
color: var(--text);
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 4px 8px;
}
.welcome {
max-width: 640px;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 12px;
}
.welcome h2,
.step h2 {
margin: 0;
font-size: 20px;
}
.welcome p,
.step p {
margin: 0;
line-height: 1.6;
}
.muted {
color: var(--text-muted);
}
.error-text {
color: var(--danger);
margin: 0;
}
/* Buttons */
.button {
font: inherit;
color: var(--text);
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 6px 16px;
cursor: pointer;
}
.button:hover:not(:disabled) {
border-color: var(--accent);
}
.button:disabled {
opacity: 0.5;
cursor: default;
}
.button-primary {
background: var(--accent);
border-color: var(--accent);
color: #ffffff;
}
/* Install wizard */
.wizard {
display: flex;
flex-direction: column;
gap: 20px;
max-width: 720px;
}
.wizard-steps {
display: flex;
gap: 8px;
margin: 0;
padding: 0;
list-style: none;
counter-reset: step;
}
.wizard-steps li {
counter-increment: step;
color: var(--text-muted);
padding: 4px 10px;
border-radius: var(--radius);
}
.wizard-steps li::before {
content: counter(step) '. ';
}
.wizard-steps li.current {
color: var(--text);
background: var(--surface);
border: 1px solid var(--border);
font-weight: 600;
}
.wizard-steps li.done {
color: var(--text);
}
.wizard-body,
.step {
display: flex;
flex-direction: column;
gap: 12px;
}
.wizard-actions {
display: flex;
justify-content: space-between;
}
.folder-field {
display: flex;
align-items: center;
gap: 12px;
padding: 8px 12px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
}
.folder-path {
flex: 1;
overflow-wrap: anywhere;
}
.folder-path-empty {
color: var(--text-muted);
}
.choice {
display: flex;
align-items: flex-start;
gap: 10px;
cursor: pointer;
}
.choice > span {
display: flex;
flex-direction: column;
gap: 2px;
line-height: 1.5;
}
.choice-detail {
display: flex;
flex-direction: column;
gap: 8px;
margin-left: 26px;
}
.check {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
}
.notice {
display: flex;
flex-direction: column;
gap: 6px;
padding: 10px 14px;
border-radius: var(--radius);
border: 1px solid var(--border);
line-height: 1.5;
}
.notice ul {
margin: 0;
padding-left: 20px;
}
.notice-info {
background: var(--surface);
}
.notice-warning {
border-color: var(--accent);
}
.notice-error {
border-color: var(--danger);
color: var(--danger);
}
.patch-details {
font-size: 12px;
color: var(--text-muted);
overflow-wrap: anywhere;
}
.progress {
height: 8px;
border-radius: 4px;
background: var(--border);
overflow: hidden;
}
.progress-fill {
height: 100%;
background: var(--accent);
transition: width 0.2s;
}
.progress-busy {
width: 30%;
animation: progress-busy 1.2s ease-in-out infinite;
}
@keyframes progress-busy {
from {
transform: translateX(-100%);
}
to {
transform: translateX(340%);
}
}
.summary {
display: grid;
grid-template-columns: max-content 1fr;
gap: 6px 16px;
margin: 0;
}
.summary dt {
color: var(--text-muted);
}
.summary dd {
margin: 0;
overflow-wrap: anywhere;
}
@@ -0,0 +1,432 @@
/* Building blocks shared by the pages: sheets, rows, buttons, fields, notices, choices, progress. */
/* ===== Sheet: page content over the dimmed art (the game launcher's dialog look) ===== */
.sheet {
position: absolute;
inset: 16px 16px 14px 16px;
display: flex;
flex-direction: column;
overflow: hidden;
background: var(--sheet);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.sheet-head {
display: flex;
align-items: center;
gap: 12px;
padding: 14px 22px;
background: linear-gradient(180deg, #343a40, #2b3136);
border-bottom: 1px solid #000;
}
.sheet-head h2 {
margin: 0;
font: 500 21px var(--font-display);
color: var(--white);
letter-spacing: 0.02em;
}
.sheet-aside {
margin-left: auto;
font-size: 12px;
color: var(--text-dim);
}
.sheet-body {
flex: 1;
overflow: auto;
padding: 18px 22px 22px;
user-select: text;
}
.sheet-foot {
display: flex;
gap: 10px;
align-items: center;
padding: 12px 22px;
border-top: 1px solid var(--line);
background: rgba(0, 0, 0, 0.15);
font-size: 12.5px;
color: var(--text-dim);
}
.lead {
margin: 0 0 14px;
line-height: 1.6;
color: var(--text);
}
.small {
margin: 6px 0 0;
font-size: 12.5px;
line-height: 1.6;
color: var(--text-dim);
}
.section-title {
margin: 18px 0 8px;
font: 500 14px var(--font-display);
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-dim);
}
.section-title:first-child {
margin-top: 0;
}
.error-text {
margin: 12px 0 0;
color: var(--danger);
}
/* An error outside the wizard (opening a folder, reading the feature list) over the main area. */
.app-error {
position: absolute;
left: 16px;
right: 16px;
bottom: 14px;
z-index: 2;
margin: 0;
padding: 8px 12px;
font-size: 13px;
color: #f6cfcc;
background: rgba(60, 16, 14, 0.92);
border: 1px solid rgba(255, 110, 102, 0.45);
border-radius: var(--radius);
}
/* ===== Label / control rows ===== */
.row {
display: grid;
grid-template-columns: 220px minmax(0, 1fr);
gap: 16px;
align-items: center;
padding: 12px 0;
border-top: 1px solid var(--line-soft);
}
.row:first-child {
border-top: 0;
}
.row-label small {
display: block;
margin-top: 2px;
font-size: 12px;
line-height: 1.45;
color: var(--text-faint);
}
.row-control {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
min-width: 0;
}
.path {
font-family: var(--font-mono);
font-size: 12.5px;
overflow-wrap: anywhere;
}
/* ===== Key / value lists ===== */
.kv {
display: grid;
grid-template-columns: 64px minmax(0, 1fr);
gap: 6px 10px;
margin: 0;
font-size: 13px;
}
.kv dt {
color: var(--text-dim);
}
.kv dd {
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* ===== Buttons and links ===== */
.button {
font: 500 14px var(--font-display);
letter-spacing: 0.04em;
text-transform: uppercase;
padding: 7px 16px;
cursor: pointer;
white-space: nowrap;
color: var(--text);
background: rgba(255, 255, 255, 0.06);
border: 1px solid var(--line-strong);
border-radius: var(--radius);
}
.button:hover:not(:disabled) {
color: var(--white);
background: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.45);
}
.button:disabled {
opacity: 0.45;
cursor: default;
}
.button-primary {
color: var(--white);
background: var(--red-soft);
border-color: var(--red);
}
.button-primary:hover:not(:disabled) {
background: var(--red);
}
.link {
font: inherit;
color: var(--white);
background: none;
border: 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.25);
padding: 0;
cursor: pointer;
}
.link:hover {
border-bottom-color: var(--white);
}
.more {
display: inline-flex;
margin-top: 8px;
padding: 0;
font: 500 13px var(--font-display);
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-dim);
background: none;
border: 0;
cursor: pointer;
}
.more:hover {
color: var(--white);
}
/* ===== Fields ===== */
.folder-field {
display: flex;
align-items: center;
gap: 10px;
flex: 1;
min-width: 0;
}
.folder-path {
flex: 1;
min-width: 0;
padding: 7px 10px;
font-family: var(--font-mono);
font-size: 12.5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--text);
background: rgba(0, 0, 0, 0.3);
border: 1px solid var(--line-strong);
border-radius: var(--radius);
user-select: text;
}
.folder-path-empty {
color: var(--text-faint);
}
.check {
display: flex;
gap: 8px;
align-items: center;
margin-top: 10px;
cursor: pointer;
}
.check input {
accent-color: var(--red);
}
.select {
font: inherit;
color: var(--text);
background: rgba(0, 0, 0, 0.3);
border: 1px solid var(--line-strong);
border-radius: var(--radius);
padding: 6px 10px;
}
.select option {
background: var(--dialog);
}
/* ===== Tags ===== */
.tag {
display: inline-block;
padding: 1px 6px;
font: 500 11px/16px var(--font-body);
white-space: nowrap;
color: var(--text-dim);
background: rgba(255, 255, 255, 0.06);
border: 1px solid var(--line);
border-radius: 2px;
}
/* ===== Notices ===== */
.notice {
display: flex;
gap: 10px;
align-items: flex-start;
margin-top: 12px;
padding: 10px 12px;
font-size: 13px;
line-height: 1.6;
border-radius: var(--radius);
}
.notice-icon {
flex: none;
font-weight: 700;
}
.notice-body {
min-width: 0;
}
.notice-body p,
.notice-body ul {
margin: 0;
}
.notice-body ul {
padding-left: 18px;
}
.notice-info {
color: #cfeed6;
background: rgba(123, 216, 143, 0.08);
border: 1px solid rgba(123, 216, 143, 0.3);
}
.notice-warning {
color: #f1dcb8;
background: rgba(255, 183, 77, 0.08);
border: 1px solid rgba(255, 183, 77, 0.35);
}
.notice-error {
color: #f6cfcc;
background: rgba(255, 110, 102, 0.08);
border: 1px solid rgba(255, 110, 102, 0.35);
}
.notice details {
margin-top: 6px;
}
.notice summary {
cursor: pointer;
color: var(--white);
}
.patch-details {
margin-top: 4px;
font-size: 12px;
color: var(--text-dim);
}
/* ===== Choices (radio cards) ===== */
.choice {
display: grid;
grid-template-columns: 22px minmax(0, 1fr);
gap: 4px 12px;
margin-bottom: 10px;
padding: 14px 16px;
cursor: pointer;
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.choice:hover {
border-color: var(--line-strong);
}
.choice-selected {
border-color: var(--red);
background: rgba(229, 57, 53, 0.08);
}
.choice input {
margin: 3px 0 0;
accent-color: var(--red);
}
.choice-title {
font: 500 16px var(--font-display);
color: var(--white);
}
.choice-body,
.choice-detail {
grid-column: 2;
}
.choice-body {
font-size: 12.5px;
line-height: 1.55;
color: var(--text-dim);
}
.choice-detail {
margin-top: 8px;
}
/* ===== Progress ===== */
.progress {
position: relative;
height: 5px;
overflow: hidden;
background: rgba(255, 255, 255, 0.1);
}
.progress-large {
height: 8px;
margin: 16px 0 6px;
}
.progress-fill {
height: 100%;
background: var(--cyan);
transition: width 0.15s;
}
.progress-busy {
position: absolute;
width: 35%;
animation: progress-busy 1.2s ease-in-out infinite;
}
@keyframes progress-busy {
from {
left: -35%;
}
to {
left: 100%;
}
}
@@ -0,0 +1,151 @@
/* Page-specific layout. */
/* ===== Home ===== */
.hero {
position: absolute;
left: 36px;
right: 36px;
bottom: 26px;
}
.hero-kicker {
font: 500 14px var(--font-display);
letter-spacing: 0.12em;
text-transform: uppercase;
color: rgba(255, 255, 255, 0.7);
text-shadow: 0 1px 6px #000;
}
.hero-title {
margin: 4px 0 0;
font: 700 54px/1.05 var(--font-display);
letter-spacing: 0.01em;
color: var(--white);
text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}
.hero-body {
max-width: 520px;
margin: 10px 0 0;
line-height: 1.6;
color: rgba(255, 255, 255, 0.82);
text-shadow: 0 1px 6px #000;
}
.welcome-steps {
display: flex;
gap: 12px;
margin: 22px 0 0;
padding: 0;
list-style: none;
}
.welcome-steps li {
flex: 1;
max-width: 200px;
padding: 10px 12px;
font-size: 12.5px;
line-height: 1.5;
color: var(--text-dim);
background: rgba(12, 16, 19, 0.72);
border: 1px solid var(--line);
border-top: 2px solid var(--red);
}
.welcome-steps b {
display: block;
margin-bottom: 2px;
font: 500 15px var(--font-display);
color: var(--white);
}
/* ===== Feature status ===== */
.feature-group {
margin-bottom: 14px;
}
.feature-group h3 {
margin: 0 0 4px;
font: 500 13px var(--font-display);
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--text-dim);
}
.feature {
display: grid;
grid-template-columns: 22px minmax(0, 1fr) auto;
gap: 8px;
align-items: center;
padding: 6px 0;
font-size: 13px;
border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.feature-note {
font-size: 12px;
color: var(--text-faint);
text-align: right;
}
.feature-note-warning {
color: #e9c58c;
}
/* ===== Install progress ===== */
.phase {
display: flex;
gap: 10px;
align-items: center;
padding: 7px 0;
font-size: 13.5px;
color: var(--text-faint);
}
.phase-done {
color: var(--text-dim);
}
.phase-done .phase-mark {
color: var(--green);
}
.phase-current {
color: var(--white);
}
.phase-mark {
width: 18px;
text-align: center;
}
.progress-caption {
display: flex;
justify-content: space-between;
font-size: 12.5px;
color: var(--text-dim);
}
/* ===== About ===== */
.about-head {
display: flex;
gap: 18px;
align-items: center;
margin-bottom: 16px;
}
.about-word {
font: 700 34px/1 var(--font-display);
color: var(--white);
}
.about-word span {
color: #ffb3ad;
font-weight: 400;
}
.about-versions {
font-size: 13px;
line-height: 1.6;
color: var(--text-dim);
}
@@ -0,0 +1,552 @@
/*
* The window frame: title bar with navigation, side panel, main area over the background art,
* bottom bar with the primary action, footer.
*/
.shell {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
display: grid;
grid-template-columns: 300px minmax(0, 1fr);
grid-template-rows: 60px minmax(0, 1fr) 84px 30px;
}
.shell > * {
min-width: 0;
}
/* ===== Background ===== */
.background {
position: absolute;
inset: 0;
background-color: var(--bg-deep);
background-size: cover;
background-position: 62% 45%;
}
.background-drawn {
background-image:
radial-gradient(ellipse 60% 55% at 64% 48%, rgba(120, 30, 24, 0.35), transparent 70%),
radial-gradient(ellipse 80% 70% at 70% 60%, #1d272c, var(--bg-deep) 75%);
}
.background-drawn::after {
content: 'WTOFFLINE';
position: absolute;
right: 40px;
top: 210px;
font: 700 150px/1 var(--font-display);
letter-spacing: 0.02em;
color: transparent;
-webkit-text-stroke: 1px rgba(255, 255, 255, 0.06);
}
/* The website's diagonal stripe texture. */
.background-stripes {
position: absolute;
inset: 0;
pointer-events: none;
background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 4px);
}
.background-dim {
position: absolute;
inset: 0;
pointer-events: none;
transition: background 0.3s;
}
.shell-paged .background-dim {
background: rgba(10, 14, 16, 0.55);
}
/* ===== Title bar ===== */
.titlebar {
grid-column: 1 / -1;
grid-row: 1;
position: relative;
z-index: 3;
display: flex;
align-items: stretch;
background: var(--bar);
border-bottom: 1px solid var(--line);
-webkit-app-region: drag;
}
.titlebar button,
.titlebar select {
-webkit-app-region: no-drag;
}
.logo {
width: 300px;
flex: none;
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 22px;
background: linear-gradient(180deg, #a00000 0%, rgba(120, 0, 0, 0.55) 55%, rgba(18, 23, 29, 0.2) 100%);
border-right: 1px solid var(--line);
}
.logo-word {
font: 700 26px/1 var(--font-display);
color: var(--white);
letter-spacing: 0.04em;
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.logo-word span {
color: #ffd7d3;
font-weight: 400;
}
.logo-sub {
font: 400 11px/1 var(--font-body);
color: rgba(255, 255, 255, 0.72);
margin-top: 5px;
letter-spacing: 0.05em;
}
.nav {
display: flex;
align-items: stretch;
padding-left: 8px;
}
.nav button {
position: relative;
background: none;
border: 0;
cursor: pointer;
padding: 0 16px;
font: 500 17px var(--font-display);
text-transform: uppercase;
letter-spacing: 0.03em;
color: var(--text);
}
.nav button:hover,
.nav button.active {
color: var(--white);
}
.nav button.active::after {
content: '';
position: absolute;
left: 12px;
right: 12px;
bottom: 0;
height: 3px;
background: var(--red);
}
.nav button:disabled {
color: var(--text-faint);
cursor: default;
}
.titlebar-end {
margin-left: auto;
display: flex;
align-items: center;
gap: 4px;
padding-right: 6px;
}
.language-menu {
display: flex;
align-items: center;
gap: 6px;
margin-right: 8px;
padding: 0 4px 0 10px;
color: var(--text-dim);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.language-menu:hover {
color: var(--text);
border-color: var(--line-strong);
}
.language-menu select {
font: 400 13px var(--font-display);
color: inherit;
background: transparent;
border: 0;
padding: 5px 2px;
outline: none;
cursor: pointer;
}
.language-menu option {
background: var(--dialog);
color: var(--text);
}
.window-button {
width: 40px;
height: 40px;
display: grid;
place-items: center;
background: none;
border: 0;
color: var(--text-dim);
cursor: pointer;
border-radius: var(--radius);
}
.window-button:hover {
background: rgba(255, 255, 255, 0.08);
color: var(--white);
}
.window-button-close:hover {
background: var(--run-top);
}
/* ===== Side panel ===== */
.side {
grid-column: 1;
grid-row: 2 / 4;
position: relative;
z-index: 2;
background: var(--panel);
border-right: 1px solid var(--line);
overflow: hidden;
display: flex;
flex-direction: column;
}
.side > * {
flex: none;
}
.side-heading {
margin: 0;
padding: 16px 20px 8px;
font: 500 13px var(--font-display);
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--text-dim);
}
.side-block {
padding: 0 20px 14px;
border-bottom: 1px solid var(--line);
font-size: 13px;
line-height: 1.7;
}
.side-block:last-child {
border-bottom: 0;
}
.side-text {
color: var(--text-dim);
}
.side-foot {
margin-top: auto;
padding: 14px 20px;
font-size: 12px;
color: var(--text-faint);
line-height: 1.6;
border-top: 1px solid var(--line);
}
.copy-card {
margin: 0 20px 12px;
padding: 9px 12px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.copy-card-name {
font: 500 16px var(--font-display);
color: var(--white);
}
.copy-card-meta {
font-size: 12px;
color: var(--text-dim);
margin-top: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.subnav {
list-style: none;
margin: 0;
padding: 6px 0;
}
.subnav button {
width: 100%;
text-align: left;
background: none;
border: 0;
border-left: 3px solid transparent;
padding: 11px 20px 11px 22px;
cursor: pointer;
font: 500 15px var(--font-display);
letter-spacing: 0.02em;
color: var(--text);
}
.subnav button:hover {
background: rgba(255, 255, 255, 0.04);
color: var(--white);
}
.subnav button.active {
border-left-color: var(--red);
background: rgba(255, 255, 255, 0.06);
color: var(--white);
}
.wizard-steps {
list-style: none;
margin: 0;
padding: 6px 0;
counter-reset: step;
}
.wizard-steps li {
counter-increment: step;
display: flex;
align-items: center;
gap: 12px;
padding: 10px 20px;
font: 500 15px var(--font-display);
color: var(--text-faint);
}
.wizard-steps li::before {
content: counter(step);
width: 24px;
height: 24px;
flex: none;
display: grid;
place-items: center;
font-size: 13px;
border: 1px solid var(--line-strong);
border-radius: 50%;
}
.wizard-steps li.done {
color: var(--text-dim);
}
.wizard-steps li.done::before {
content: '✓';
border-color: var(--green);
color: var(--green);
}
.wizard-steps li.current {
color: var(--white);
background: rgba(255, 255, 255, 0.06);
}
.wizard-steps li.current::before {
border-color: var(--red);
background: var(--red);
color: var(--white);
}
/* ===== Main area ===== */
.main {
grid-column: 2;
grid-row: 2;
position: relative;
z-index: 1;
overflow: hidden;
}
/* ===== Bottom bar ===== */
.bottom-bar {
grid-column: 2;
grid-row: 3;
position: relative;
z-index: 2;
display: flex;
align-items: center;
gap: 22px;
padding: 0 18px 0 24px;
background: linear-gradient(180deg, rgba(12, 16, 19, 0.55), rgba(12, 16, 19, 0.9));
border-top: 1px solid var(--line);
}
.status {
flex: 1;
min-width: 0;
display: flex;
gap: 12px;
align-items: center;
}
.status-icon {
width: 30px;
height: 30px;
flex: none;
display: grid;
place-items: center;
border-radius: 50%;
font-weight: 700;
font-size: 15px;
}
.status-icon-ok {
background: rgba(123, 216, 143, 0.14);
color: var(--green);
}
.status-icon-warn {
background: rgba(255, 183, 77, 0.14);
color: var(--amber);
}
.status-icon-bad {
background: rgba(255, 110, 102, 0.14);
color: var(--danger);
}
.status-icon-idle {
background: rgba(255, 255, 255, 0.08);
color: var(--text-dim);
}
.status-icon-busy {
border: 2px solid rgba(49, 227, 238, 0.25);
border-top-color: var(--cyan);
animation: spin 0.9s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.status-text {
min-width: 0;
}
.status-title {
font: 500 17px var(--font-display);
color: var(--white);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.status-detail {
font-size: 12.5px;
color: var(--text-dim);
margin-top: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.bar-progress {
width: 220px;
flex: none;
}
.bar-progress-label {
display: flex;
justify-content: space-between;
font: 400 11.5px var(--font-display);
color: var(--text-dim);
margin-top: 5px;
}
.secondary-action {
font: 500 13px var(--font-display);
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-dim);
background: none;
border: 1px solid var(--line-strong);
border-radius: var(--radius);
padding: 6px 12px;
cursor: pointer;
white-space: nowrap;
}
.secondary-action:hover:not(:disabled) {
color: var(--white);
border-color: rgba(255, 255, 255, 0.45);
}
.secondary-action:disabled {
opacity: 0.45;
cursor: default;
}
.primary-action {
width: 236px;
height: 52px;
flex: none;
cursor: pointer;
font: 700 23px var(--font-display);
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--white);
text-shadow: 0 0 5px rgba(0, 0, 0, 0.75);
background: linear-gradient(180deg, var(--run-top), var(--run-bottom));
border: 2px solid rgba(255, 180, 180, 0.25);
border-top: 3px solid rgba(255, 120, 110, 0.55);
border-radius: var(--radius);
box-shadow: 0 4px 18px rgba(164, 0, 0, 0.35);
}
.primary-action:hover:not(:disabled) {
background: linear-gradient(180deg, #e01010, #a70c05);
border-color: rgba(255, 60, 60, 0.7);
}
.primary-action:active:not(:disabled) {
background: linear-gradient(180deg, #a70c05, #e01010);
}
.primary-action:disabled {
cursor: default;
color: #a0a0a0;
text-shadow: none;
box-shadow: none;
background: linear-gradient(180deg, #3f4143, #383a3c);
border-color: rgba(180, 180, 180, 0.25);
}
/* ===== Footer ===== */
.footer {
grid-column: 1 / -1;
grid-row: 4;
position: relative;
z-index: 2;
display: flex;
align-items: center;
gap: 16px;
padding: 0 14px 0 20px;
font-size: 11.5px;
color: var(--text-faint);
background: rgba(8, 11, 13, 0.95);
border-top: 1px solid var(--line);
white-space: nowrap;
overflow: hidden;
}
.footer-separator {
opacity: 0.5;
}
.footer-end {
margin-left: auto;
}
@@ -0,0 +1,96 @@
/*
* Design tokens. The look follows the War Thunder website and the game's own launcher: a dark
* blue-grey base, red primary actions, condensed upper-case headings, cyan progress.
*/
:root {
color-scheme: dark;
--font-display: 'Roboto Condensed', 'Bahnschrift SemiCondensed', 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;
--font-body: 'Segoe UI', 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;
--font-mono: Consolas, 'Microsoft YaHei UI', monospace;
--bg: #13191b;
--bg-deep: #0b0f11;
--panel: rgba(18, 23, 29, 0.78);
--panel-strong: rgba(18, 23, 29, 0.96);
--bar: rgba(12, 16, 19, 0.82);
--sheet: rgba(27, 34, 39, 0.94);
--surface: #222a30;
--dialog: #292f36;
--line: rgba(255, 255, 255, 0.11);
--line-soft: rgba(255, 255, 255, 0.06);
--line-strong: rgba(255, 255, 255, 0.22);
--text: #cfd8dc;
--text-dim: rgba(207, 216, 220, 0.58);
--text-faint: rgba(207, 216, 220, 0.38);
--white: #ffffff;
--red: #e53935;
--red-soft: rgba(229, 57, 53, 0.7);
--run-top: #a40000;
--run-bottom: #5c0000;
--cyan: #31e3ee;
--amber: #ffb74d;
--green: #7bd88f;
--danger: #ff6e66;
--gold: #f5a623;
--radius: 3px;
font-family: var(--font-body);
font-size: 14px;
}
* {
box-sizing: border-box;
}
html,
body,
#root {
margin: 0;
height: 100%;
overflow: hidden;
}
body {
background: var(--bg);
color: var(--text);
user-select: none;
}
/* Thin dark scrollbars everywhere. */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.16);
background-clip: padding-box;
border: 2px solid transparent;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.32);
background-clip: padding-box;
}
.ok {
color: var(--green);
}
.warn {
color: var(--amber);
}
.bad {
color: var(--danger);
}
@@ -0,0 +1,31 @@
/**
* Game versions against the versions the patches were verified on (multi-version adaptation:
* the adaptation is chosen by the copy's version; without one for it, the nearest is used).
*/
/** Whether the patches were verified on this game version. */
export function isVerified(version: string | null, supported: readonly string[]): boolean {
return version !== null && supported.includes(version);
}
/**
* The adaptation used for a game version: the version itself when verified, otherwise the
* newest verified version not above it, otherwise the oldest verified version.
*/
export function adaptationFor(version: string | null, supported: readonly string[]): string | null {
const sorted = [...supported].sort(compareVersions);
if (sorted.length === 0) return null;
if (version === null) return sorted.at(-1) ?? null;
const notAbove = sorted.filter((candidate) => compareVersions(candidate, version) <= 0);
return notAbove.at(-1) ?? sorted[0] ?? null;
}
function compareVersions(a: string, b: string): number {
const left = a.split('.').map(Number);
const right = b.split('.').map(Number);
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
const difference = (left[index] ?? 0) - (right[index] ?? 0);
if (difference !== 0) return difference;
}
return 0;
}
+2
View File
@@ -14,6 +14,8 @@ export const IPC_CHANNEL_PREFIXES = [
'install:', 'install:',
/** The launcher's own settings. */ /** The launcher's own settings. */
'settings:', 'settings:',
/** The launcher window itself (it draws its own title bar). */
'window:',
] as const; ] as const;
/** Prefix of main → renderer event channels. */ /** Prefix of main → renderer event channels. */
+21
View File
@@ -6,6 +6,7 @@ import {
InstallRecordSchema, InstallRecordSchema,
InstallRequestSchema, InstallRequestSchema,
PatchCheckSchema, PatchCheckSchema,
PatchFeatureSchema,
TargetFolderInspectionSchema, TargetFolderInspectionSchema,
} from '../schemas/install.ts'; } from '../schemas/install.ts';
import { SettingsPatchSchema, SettingsSchema } from '../schemas/settings.ts'; import { SettingsPatchSchema, SettingsSchema } from '../schemas/settings.ts';
@@ -26,8 +27,15 @@ export const ipcContract = {
/** The operating system's preferred language, as Electron reports it (e.g. "zh-CN"). */ /** The operating system's preferred language, as Electron reports it (e.g. "zh-CN"). */
systemLocale: z.string(), systemLocale: z.string(),
userDataPath: z.string(), userDataPath: z.string(),
/** The game versions every patch was verified on. */
supportedGameVersions: z.array(z.string()),
}), }),
}, },
'app:openFolder': {
/** Opens a folder in the file manager; refused unless it exists. */
input: z.object({ path: z.string().min(1) }),
output: z.void(),
},
'dialog:pickFolder': { 'dialog:pickFolder': {
/** The dialog title, already translated by the window. */ /** The dialog title, already translated by the window. */
input: z.object({ title: z.string().optional() }), input: z.object({ title: z.string().optional() }),
@@ -65,6 +73,11 @@ export const ipcContract = {
input: z.void(), input: z.void(),
output: z.object({ record: InstallRecordSchema.nullable(), defaultDataPath: z.string() }), output: z.object({ record: InstallRecordSchema.nullable(), defaultDataPath: z.string() }),
}, },
'install:listFeatures': {
/** Every feature the patches cover; which of them a copy lacks is in its install record. */
input: z.void(),
output: z.array(PatchFeatureSchema),
},
'settings:get': { 'settings:get': {
input: z.void(), input: z.void(),
output: SettingsSchema, output: SettingsSchema,
@@ -73,6 +86,14 @@ export const ipcContract = {
input: SettingsPatchSchema, input: SettingsPatchSchema,
output: SettingsSchema, output: SettingsSchema,
}, },
'window:minimize': {
input: z.void(),
output: z.void(),
},
'window:close': {
input: z.void(),
output: z.void(),
},
} as const; } as const;
export const ipcEvents = { export const ipcEvents = {
@@ -51,6 +51,16 @@ export const UnavailablePatchSchema = z.object({
}); });
export type UnavailablePatch = z.output<typeof UnavailablePatchSchema>; export type UnavailablePatch = z.output<typeof UnavailablePatchSchema>;
/** A feature inventory row the patches cover, with the patches behind it. */
export const PatchFeatureSchema = z.object({
/** The feature tag, e.g. "K-侦察"; the letter before the dash is the inventory section. */
tag: z.string(),
/** A copy cannot run, or cannot stay apart from the online game, without it. */
essential: z.boolean(),
patchIds: z.array(z.string()),
});
export type PatchFeature = z.output<typeof PatchFeatureSchema>;
/** Which patches fit the game build; nothing is written by the check. */ /** Which patches fit the game build; nothing is written by the check. */
export const PatchCheckSchema = z.object({ export const PatchCheckSchema = z.object({
exePatchesReady: z.number(), exePatchesReady: z.number(),
+10
View File
@@ -21,6 +21,7 @@
"name": "@wto/launcher", "name": "@wto/launcher",
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"@fontsource/roboto-condensed": "^5.3.0",
"@wto/patcher": "*", "@wto/patcher": "*",
"@wto/server": "*", "@wto/server": "*",
"i18next": "^26.3.6", "i18next": "^26.3.6",
@@ -840,6 +841,15 @@
"node": ">=18" "node": ">=18"
} }
}, },
"node_modules/@fontsource/roboto-condensed": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@fontsource/roboto-condensed/-/roboto-condensed-5.3.0.tgz",
"integrity": "sha512-Vbh5pesre/M/Jspd10btdKRqLSTe3yn4l6B2tXHGElCeASfA7Pgdpu1mb8wTG8E72J4Xk6FUfqnSe46UN2QAog==",
"license": "OFL-1.1",
"funding": {
"url": "https://github.com/sponsors/ayuhito"
}
},
"node_modules/@jridgewell/gen-mapping": { "node_modules/@jridgewell/gen-mapping": {
"version": "0.3.13", "version": "0.3.13",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+1
View File
@@ -25,5 +25,6 @@ export { redirectAddresses, type AddressChange } from './network/address-rewrite
export { hostPort, localEndpoint, localUrl, type LocalEndpoint } from './network/local-endpoint.ts'; export { hostPort, localEndpoint, localUrl, type LocalEndpoint } from './network/local-endpoint.ts';
export { NETWORK_HOOK_LIBRARY, networkHookSettings } from './network/network-hook.ts'; export { NETWORK_HOOK_LIBRARY, networkHookSettings } from './network/network-hook.ts';
export { redirectNetworkConfig, type NetworkRedirectReport } from './network/redirect-network-config.ts'; export { redirectNetworkConfig, type NetworkRedirectReport } from './network/redirect-network-config.ts';
export { patchFeatures, type PatchFeature } from './patch-features.ts';
export { offlinePackBundleGuids } from './store/offline-bundles.ts'; export { offlinePackBundleGuids } from './store/offline-bundles.ts';
export { writeGameCopy } from './write-game-copy.ts'; export { writeGameCopy } from './write-game-copy.ts';
+30
View File
@@ -0,0 +1,30 @@
/**
* The features the patch definitions cover (feature inventory rows named in `features`), each
* once, with the patches behind it. The launcher lists them to show which features a copy has.
*/
import { loadPatches } from '@wto/exepatch';
import { ESSENTIAL_FEATURES } from './essential-features.ts';
import { loadGuiPatches } from './gui-patch-definition.ts';
export interface PatchFeature {
/** The feature tag, e.g. "K-侦察"; the letter before the dash is the inventory section. */
readonly tag: string;
/** A copy cannot run, or cannot stay apart from the online game, without it. */
readonly essential: boolean;
/** Ids of the exe and GUI patches tagged with it. */
readonly patchIds: readonly string[];
}
export function patchFeatures(exePatches: string, guiPatches: string): PatchFeature[] {
const byTag = new Map<string, string[]>();
for (const patch of [...loadPatches(exePatches), ...loadGuiPatches(guiPatches)]) {
for (const tag of patch.features) {
const ids = byTag.get(tag) ?? [];
ids.push(patch.id);
byTag.set(tag, ids);
}
}
return [...byTag.entries()]
.map(([tag, patchIds]) => ({ tag, essential: ESSENTIAL_FEATURES.has(tag), patchIds }))
.sort((a, b) => a.tag.localeCompare(b.tag));
}