feat(launcher): add Mods page, per-client presets, custom repo folder, and launch integration
This commit is contained in:
1 parent
aa7a6e7d02
commit
dbc21182a2
21 files changed
+1961
-21
No files matched your search
@@ -22,6 +22,7 @@ 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 { ModsPage } from './pages/mods/ModsPage.tsx';
|
||||
import { TuningPage } from './pages/tuning/TuningPage.tsx';
|
||||
import { SavesPage } from './pages/saves/SavesPage.tsx';
|
||||
import { DeveloperSettings } from './pages/settings/DeveloperSettings.tsx';
|
||||
@@ -32,7 +33,7 @@ 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, SAVE_SECTIONS, SETTINGS_SECTIONS, START_ROUTE, TUNING_SECTIONS, type Destination, type Route } from './shell/navigation.ts';
|
||||
import { COPY_SECTIONS, MODS_SECTIONS, navigate, SAVE_SECTIONS, SETTINGS_SECTIONS, START_ROUTE, TUNING_SECTIONS, type Destination, type Route } from './shell/navigation.ts';
|
||||
import { SubNav } from './shell/SubNav.tsx';
|
||||
import { TitleBar } from './shell/TitleBar.tsx';
|
||||
import { useBackgrounds } from './shell/useBackgrounds.ts';
|
||||
@@ -195,6 +196,14 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
|
||||
: <Sheet title={t(`tuning.sections.${route.tuning}`)}><p className="lead">{t('tuning.noCopy')}</p></Sheet>,
|
||||
bar: home,
|
||||
};
|
||||
case 'mods':
|
||||
return {
|
||||
side: <SubNav sections={MODS_SECTIONS} active={route.mods} label={(section) => t(`mods.sections.${section}`)} onSelect={(section) => go({ page: 'mods', section })} />,
|
||||
main: record
|
||||
? <ModsPage key={record.id} copy={record} section={route.mods} readOnly={['checking', 'building', 'starting-server', 'starting-game', 'running', 'server-running', 'stopping'].includes(launch.phase)} onError={report} />
|
||||
: <Sheet title={t(`mods.sections.${route.mods}`)}><p className="lead">{t('mods.noCopy')}</p></Sheet>,
|
||||
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 })} />;
|
||||
if (route.copies === 'list') {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"home": "Home",
|
||||
"saves": "Saves",
|
||||
"tuning": "Tuning",
|
||||
"mods": "Mods",
|
||||
"copies": "Clients",
|
||||
"settings": "Settings",
|
||||
"about": "About"
|
||||
@@ -629,7 +630,95 @@
|
||||
"download": "Download update",
|
||||
"install": "Quit and install",
|
||||
"installing": "Opening the installer…",
|
||||
"errors": {
|
||||
"mods": {
|
||||
"sections": {
|
||||
"list": "Mod list",
|
||||
"presets": "Presets & repository"
|
||||
},
|
||||
"loading": "Loading mods…",
|
||||
"noCopy": "Install or select an offline client first to configure its mods.",
|
||||
"enabledSummary": "{{enabled}} / {{total}} enabled",
|
||||
"experimentalTitle": "Experimental mod API notice:",
|
||||
"experimentalBody": "WTOffline is in early development (API {{api}}). Server script hooks, internal data structures, and declarative exe patch contracts may change at any time without backwards compatibility; only enable mods from trusted sources.",
|
||||
"readOnlyNotice": "Mod toggles, load order, and presets are read-only while the game, local server, or maintenance is running.",
|
||||
"searchPlaceholder": "Filter by mod name, ID, or author…",
|
||||
"autoSort": "Auto-sort by dependencies",
|
||||
"autoSorted": "Reordered mods based on dependencies and load-order hints.",
|
||||
"refresh": "Refresh",
|
||||
"openFolder": "Open mods folder",
|
||||
"discoveryErrorsTitle": "{{count}} mod folder(s) could not be loaded:",
|
||||
"blockingIssuesTitle": "{{count}} blocking mod error(s) prevent launching:",
|
||||
"issuesTitle": "{{count}} mod notice(s) or overlap(s):",
|
||||
"severity": {
|
||||
"error": "Error",
|
||||
"warning": "Warning",
|
||||
"info": "Info"
|
||||
},
|
||||
"emptyTitle": "No mods found in the global mods folder yet.",
|
||||
"emptyHint": "Place mod folders containing mod.jsonc into {{path}}, then click Refresh. Standalone skins, sights, and user missions continue to work directly via the game's native UserSkins / UserSights / UserMissions folders.",
|
||||
"noSearchMatch": "No mods match the current search filter.",
|
||||
"loadOrderHint": "Load order: lower items load later and take higher priority (drag or use arrows)",
|
||||
"moveUp": "Move up",
|
||||
"moveDown": "Move down",
|
||||
"showDetails": "Details",
|
||||
"hideDetails": "Hide",
|
||||
"errorCount": "{{count}} error",
|
||||
"warnCount": "{{count}} warn",
|
||||
"badges": {
|
||||
"data": "Data / Assets",
|
||||
"gui": "GUI Patch",
|
||||
"script": "Server Script",
|
||||
"exe": "Exe Patch"
|
||||
},
|
||||
"details": {
|
||||
"folder": "Folder",
|
||||
"gameVersions": "Declared game versions",
|
||||
"requires": "Requires",
|
||||
"conflicts": "Conflicts",
|
||||
"tuning": "Server tuning overlays: {{count}}",
|
||||
"serverScript": "Executable server JS/TS script",
|
||||
"packOps": "Client pack operations: {{count}}",
|
||||
"addon": "3D model / texture addon: {{count}} file(s)",
|
||||
"guiPatches": "GUI script patches: {{count}}",
|
||||
"exePatches": "Declarative exe patches: {{count}}",
|
||||
"companionFiles": "Companion files: {{count}}",
|
||||
"configBlk": "Includes config.blk patch"
|
||||
},
|
||||
"presets": {
|
||||
"heading": "Mod presets (saved per client)",
|
||||
"description": "Save the current mod toggles and load order as named presets for quick switching or JSON export/import.",
|
||||
"quickSwitch": "Switch mod preset",
|
||||
"customOption": "Custom active selection",
|
||||
"namePlaceholder": "New preset name, e.g. Modern Vehicles",
|
||||
"saveCurrent": "Save preset",
|
||||
"import": "Import preset…",
|
||||
"empty": "No presets saved for this client yet.",
|
||||
"activeTag": "Active",
|
||||
"summary": "{{count}} enabled / {{total}} tracked",
|
||||
"apply": "Apply",
|
||||
"overwrite": "Update",
|
||||
"export": "Export",
|
||||
"delete": "Delete",
|
||||
"saved": "Saved preset \"{{name}}\".",
|
||||
"applied": "Applied preset \"{{name}}\".",
|
||||
"updated": "Updated preset \"{{name}}\" with current setup.",
|
||||
"exported": "Exported preset to: {{path}}",
|
||||
"imported": "Imported mod preset."
|
||||
},
|
||||
"repo": {
|
||||
"heading": "Global mods repository",
|
||||
"description": "All clients share one mod folder (large 3D model and texture addons mount across drives via NTFS Junctions with zero copying), while each client keeps its own toggles, load order, and presets.",
|
||||
"pathLabel": "Repository folder",
|
||||
"defaultNote": "Using launcher default mods folder",
|
||||
"customNote": "Using custom mods folder (can live on a larger drive or the same drive as your client)",
|
||||
"changeFolder": "Change folder…",
|
||||
"resetDefault": "Reset to default",
|
||||
"pickTitle": "Select global mods repository folder",
|
||||
"updated": "Updated global mods repository folder.",
|
||||
"resetDone": "Reset to default mods repository folder."
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"network": "The update source could not be reached.",
|
||||
"page_limit": "Could not confirm whether a newer version is available.",
|
||||
"contents": "The launcher release information is invalid.",
|
||||
@@ -680,6 +769,94 @@
|
||||
"L-Debriefing": "Battle results",
|
||||
"L-Battle awards": "Battle awards"
|
||||
},
|
||||
"mods": {
|
||||
"sections": {
|
||||
"list": "Mod list",
|
||||
"presets": "Presets & repository"
|
||||
},
|
||||
"loading": "Loading mods…",
|
||||
"noCopy": "Install or select an offline client first to configure its mods.",
|
||||
"enabledSummary": "{{enabled}} / {{total}} enabled",
|
||||
"experimentalTitle": "Experimental mod API notice:",
|
||||
"experimentalBody": "WTOffline is in early development (API {{api}}). Server script hooks, internal data structures, and declarative exe patch contracts may change at any time without backwards compatibility; only enable mods from trusted sources.",
|
||||
"readOnlyNotice": "Mod toggles, load order, and presets are read-only while the game, local server, or maintenance is running.",
|
||||
"searchPlaceholder": "Filter by mod name, ID, or author…",
|
||||
"autoSort": "Auto-sort by dependencies",
|
||||
"autoSorted": "Reordered mods based on dependencies and load-order hints.",
|
||||
"refresh": "Refresh",
|
||||
"openFolder": "Open mods folder",
|
||||
"discoveryErrorsTitle": "{{count}} mod folder(s) could not be loaded:",
|
||||
"blockingIssuesTitle": "{{count}} blocking mod error(s) prevent launching:",
|
||||
"issuesTitle": "{{count}} mod notice(s) or overlap(s):",
|
||||
"severity": {
|
||||
"error": "Error",
|
||||
"warning": "Warning",
|
||||
"info": "Info"
|
||||
},
|
||||
"emptyTitle": "No mods found in the global mods folder yet.",
|
||||
"emptyHint": "Place mod folders containing mod.jsonc into {{path}}, then click Refresh. Standalone skins, sights, and user missions continue to work directly via the game's native UserSkins / UserSights / UserMissions folders.",
|
||||
"noSearchMatch": "No mods match the current search filter.",
|
||||
"loadOrderHint": "Load order: lower items load later and take higher priority (drag or use arrows)",
|
||||
"moveUp": "Move up",
|
||||
"moveDown": "Move down",
|
||||
"showDetails": "Details",
|
||||
"hideDetails": "Hide",
|
||||
"errorCount": "{{count}} error",
|
||||
"warnCount": "{{count}} warn",
|
||||
"badges": {
|
||||
"data": "Data / Assets",
|
||||
"gui": "GUI Patch",
|
||||
"script": "Server Script",
|
||||
"exe": "Exe Patch"
|
||||
},
|
||||
"details": {
|
||||
"folder": "Folder",
|
||||
"gameVersions": "Declared game versions",
|
||||
"requires": "Requires",
|
||||
"conflicts": "Conflicts",
|
||||
"tuning": "Server tuning overlays: {{count}}",
|
||||
"serverScript": "Executable server JS/TS script",
|
||||
"packOps": "Client pack operations: {{count}}",
|
||||
"addon": "3D model / texture addon: {{count}} file(s)",
|
||||
"guiPatches": "GUI script patches: {{count}}",
|
||||
"exePatches": "Declarative exe patches: {{count}}",
|
||||
"companionFiles": "Companion files: {{count}}",
|
||||
"configBlk": "Includes config.blk patch"
|
||||
},
|
||||
"presets": {
|
||||
"heading": "Mod presets (saved per client)",
|
||||
"description": "Save the current mod toggles and load order as named presets for quick switching or JSON export/import.",
|
||||
"quickSwitch": "Switch mod preset",
|
||||
"customOption": "Custom active selection",
|
||||
"namePlaceholder": "New preset name, e.g. Modern Vehicles",
|
||||
"saveCurrent": "Save preset",
|
||||
"import": "Import preset…",
|
||||
"empty": "No presets saved for this client yet.",
|
||||
"activeTag": "Active",
|
||||
"summary": "{{count}} enabled / {{total}} tracked",
|
||||
"apply": "Apply",
|
||||
"overwrite": "Update",
|
||||
"export": "Export",
|
||||
"delete": "Delete",
|
||||
"saved": "Saved preset \"{{name}}\".",
|
||||
"applied": "Applied preset \"{{name}}\".",
|
||||
"updated": "Updated preset \"{{name}}\" with current setup.",
|
||||
"exported": "Exported preset to: {{path}}",
|
||||
"imported": "Imported mod preset."
|
||||
},
|
||||
"repo": {
|
||||
"heading": "Global mods repository",
|
||||
"description": "All clients share one mod folder (large 3D model and texture addons mount across drives via NTFS Junctions with zero copying), while each client keeps its own toggles, load order, and presets.",
|
||||
"pathLabel": "Repository folder",
|
||||
"defaultNote": "Using launcher default mods folder",
|
||||
"customNote": "Using custom mods folder (can live on a larger drive or the same drive as your client)",
|
||||
"changeFolder": "Change folder…",
|
||||
"resetDefault": "Reset to default",
|
||||
"pickTitle": "Select global mods repository folder",
|
||||
"updated": "Updated global mods repository folder.",
|
||||
"resetDone": "Reset to default mods repository folder."
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"app_update_unavailable": "There is no launcher update available to install.",
|
||||
"app_update_busy": "A launcher update operation is already in progress.",
|
||||
@@ -703,6 +880,11 @@
|
||||
"save_avatar_invalid": "Select an avatar available in this client.",
|
||||
"save_level_invalid": "Enter a level supported by this client.",
|
||||
"tuning_invalid": "The tuning values could not be read or saved. Check the session limits and the launcher log.",
|
||||
"mods_read_only": "Mods cannot be changed while the game, local server, or maintenance is running.",
|
||||
"mods_write_failed": "The mod configuration could not be saved. See the launcher log.",
|
||||
"mods_preset_invalid": "The selected file is not a valid WTOffline mod preset.",
|
||||
"mods_blocking_issues": "Enabled mods have missing dependencies or conflicts. Resolve them on the Mods page before launching.",
|
||||
"mods_folder_invalid": "The selected global mods folder is invalid or not writable.",
|
||||
"copy_not_found": "The selected client is no longer available.",
|
||||
"copies_write_failed": "The client registry could not be saved.",
|
||||
"copy_location_in_use": "The client or data location overlaps an existing client.",
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"home": "首页",
|
||||
"saves": "存档",
|
||||
"tuning": "数值",
|
||||
"mods": "模组",
|
||||
"copies": "客户端",
|
||||
"settings": "设置",
|
||||
"about": "关于"
|
||||
@@ -629,7 +630,95 @@
|
||||
"download": "下载更新",
|
||||
"install": "退出并安装",
|
||||
"installing": "正在打开安装包…",
|
||||
"errors": {
|
||||
"mods": {
|
||||
"sections": {
|
||||
"list": "模组列表",
|
||||
"presets": "预设与仓库"
|
||||
},
|
||||
"loading": "正在读取模组信息…",
|
||||
"noCopy": "请先安装或选择一个离线客户端,再为它配置模组。",
|
||||
"enabledSummary": "已启用 {{enabled}} / {{total}}",
|
||||
"experimentalTitle": "实验期模组接口提示:",
|
||||
"experimentalBody": "离线版当前处于极初期开发阶段(API {{api}})。服务端脚本钩子、内部数据结构及声明式 exe 补丁契约随时可能随本体更新变动且不保证向下兼容;请仅启用来源可信的模组。",
|
||||
"readOnlyNotice": "游戏、本地服务器或维护任务运行期间,模组开关、排序与预设为只读。",
|
||||
"searchPlaceholder": "搜索模组名称、ID 或作者…",
|
||||
"autoSort": "按依赖自动排序",
|
||||
"autoSorted": "已按前置与排序建议重新排列模组顺序。",
|
||||
"refresh": "刷新",
|
||||
"openFolder": "打开模组目录",
|
||||
"discoveryErrorsTitle": "有 {{count}} 个模组目录读取失败:",
|
||||
"blockingIssuesTitle": "存在 {{count}} 项阻塞性模组错误(处理前无法启动):",
|
||||
"issuesTitle": "检测到 {{count}} 项模组提示或冲突:",
|
||||
"severity": {
|
||||
"error": "错误",
|
||||
"warning": "警告",
|
||||
"info": "提示"
|
||||
},
|
||||
"emptyTitle": "当前模组目录里还没有模组。",
|
||||
"emptyHint": "将包含 mod.jsonc 的模组文件夹放入 {{path}},点击「刷新」即可识别。独立涂装、瞄具与单人任务继续沿用游戏原生的 UserSkins / UserSights / UserMissions 目录即可。",
|
||||
"noSearchMatch": "没有匹配当前搜索条件的模组。",
|
||||
"loadOrderHint": "加载顺序:越靠后优先级越高(可拖动或使用上下按钮调整)",
|
||||
"moveUp": "上移",
|
||||
"moveDown": "下移",
|
||||
"showDetails": "详情",
|
||||
"hideDetails": "收起",
|
||||
"errorCount": "{{count}} 错误",
|
||||
"warnCount": "{{count}} 警告",
|
||||
"badges": {
|
||||
"data": "数据/资源",
|
||||
"gui": "界面补丁",
|
||||
"script": "服务端脚本",
|
||||
"exe": "二进制补丁"
|
||||
},
|
||||
"details": {
|
||||
"folder": "目录",
|
||||
"gameVersions": "声明适配版本",
|
||||
"requires": "前置依赖",
|
||||
"conflicts": "已知互斥",
|
||||
"tuning": "服务端数值叠加:{{count}} 份",
|
||||
"serverScript": "含可执行服务端 JS/TS 脚本",
|
||||
"packOps": "客户端数据包操作:{{count}} 项",
|
||||
"addon": "独立 3D 模型/贴图扩展包:{{count}} 个文件",
|
||||
"guiPatches": "界面脚本补丁:{{count}} 项",
|
||||
"exePatches": "声明式 exe 补丁:{{count}} 项",
|
||||
"companionFiles": "附带外置文件:{{count}} 个",
|
||||
"configBlk": "含 config.blk 增量补丁"
|
||||
},
|
||||
"presets": {
|
||||
"heading": "模组序列预设(当前客户端独立保存)",
|
||||
"description": "将当前的启用开关与加载顺序保存为预设,方便在不同玩法配置间一键切换,或导出 JSON 分享给其他玩家。",
|
||||
"quickSwitch": "快速切换模组预设",
|
||||
"customOption": "当前自定义配置",
|
||||
"namePlaceholder": "输入新预设名称,例如:现代载具包",
|
||||
"saveCurrent": "保存为预设",
|
||||
"import": "导入预设…",
|
||||
"empty": "当前客户端尚未保存任何模组预设。",
|
||||
"activeTag": "当前使用",
|
||||
"summary": "启用 {{count}} / 共 {{total}} 个模组",
|
||||
"apply": "应用",
|
||||
"overwrite": "覆盖更新",
|
||||
"export": "导出",
|
||||
"delete": "删除",
|
||||
"saved": "已保存预设「{{name}}」。",
|
||||
"applied": "已切换至预设「{{name}}」。",
|
||||
"updated": "已用当前配置覆盖预设「{{name}}」。",
|
||||
"exported": "预设已导出到:{{path}}",
|
||||
"imported": "已导入模组预设。"
|
||||
},
|
||||
"repo": {
|
||||
"heading": "全局模组仓库位置",
|
||||
"description": "所有客户端共享同一份模组文件仓库(大体积 3D 模型与贴图包通过跨盘目录联接点零拷贝挂载,不重复占用磁盘);每个客户端独立保存自己的开关、排序和预设。",
|
||||
"pathLabel": "当前仓库目录",
|
||||
"defaultNote": "使用启动器默认模组目录",
|
||||
"customNote": "使用自定义模组目录(可放在大容量硬盘或游戏同盘)",
|
||||
"changeFolder": "更改目录…",
|
||||
"resetDefault": "恢复默认目录",
|
||||
"pickTitle": "选择全局模组仓库目录",
|
||||
"updated": "已更新全局模组仓库目录。",
|
||||
"resetDone": "已恢复为默认模组仓库目录。"
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"network": "暂时无法访问更新源。",
|
||||
"page_limit": "无法确认是否有新版本。",
|
||||
"contents": "本体更新的发布信息无效。",
|
||||
@@ -680,6 +769,94 @@
|
||||
"L-Debriefing": "战后结算",
|
||||
"L-Battle awards": "战斗嘉奖"
|
||||
},
|
||||
"mods": {
|
||||
"sections": {
|
||||
"list": "模组列表",
|
||||
"presets": "预设与仓库"
|
||||
},
|
||||
"loading": "正在读取模组信息…",
|
||||
"noCopy": "请先安装或选择一个离线客户端,再为它配置模组。",
|
||||
"enabledSummary": "已启用 {{enabled}} / {{total}}",
|
||||
"experimentalTitle": "实验期模组接口提示:",
|
||||
"experimentalBody": "离线版当前处于极初期开发阶段(API {{api}})。服务端脚本钩子、内部数据结构及声明式 exe 补丁契约随时可能随本体更新变动且不保证向下兼容;请仅启用来源可信的模组。",
|
||||
"readOnlyNotice": "游戏、本地服务器或维护任务运行期间,模组开关、排序与预设为只读。",
|
||||
"searchPlaceholder": "搜索模组名称、ID 或作者…",
|
||||
"autoSort": "按依赖自动排序",
|
||||
"autoSorted": "已按前置与排序建议重新排列模组顺序。",
|
||||
"refresh": "刷新",
|
||||
"openFolder": "打开模组目录",
|
||||
"discoveryErrorsTitle": "有 {{count}} 个模组目录读取失败:",
|
||||
"blockingIssuesTitle": "存在 {{count}} 项阻塞性模组错误(处理前无法启动):",
|
||||
"issuesTitle": "检测到 {{count}} 项模组提示或冲突:",
|
||||
"severity": {
|
||||
"error": "错误",
|
||||
"warning": "警告",
|
||||
"info": "提示"
|
||||
},
|
||||
"emptyTitle": "当前模组目录里还没有模组。",
|
||||
"emptyHint": "将包含 mod.jsonc 的模组文件夹放入 {{path}},点击「刷新」即可识别。独立涂装、瞄具与单人任务继续沿用游戏原生的 UserSkins / UserSights / UserMissions 目录即可。",
|
||||
"noSearchMatch": "没有匹配当前搜索条件的模组。",
|
||||
"loadOrderHint": "加载顺序:越靠后优先级越高(可拖动或使用上下按钮调整)",
|
||||
"moveUp": "上移",
|
||||
"moveDown": "下移",
|
||||
"showDetails": "详情",
|
||||
"hideDetails": "收起",
|
||||
"errorCount": "{{count}} 错误",
|
||||
"warnCount": "{{count}} 警告",
|
||||
"badges": {
|
||||
"data": "数据/资源",
|
||||
"gui": "界面补丁",
|
||||
"script": "服务端脚本",
|
||||
"exe": "二进制补丁"
|
||||
},
|
||||
"details": {
|
||||
"folder": "目录",
|
||||
"gameVersions": "声明适配版本",
|
||||
"requires": "前置依赖",
|
||||
"conflicts": "已知互斥",
|
||||
"tuning": "服务端数值叠加:{{count}} 份",
|
||||
"serverScript": "含可执行服务端 JS/TS 脚本",
|
||||
"packOps": "客户端数据包操作:{{count}} 项",
|
||||
"addon": "独立 3D 模型/贴图扩展包:{{count}} 个文件",
|
||||
"guiPatches": "界面脚本补丁:{{count}} 项",
|
||||
"exePatches": "声明式 exe 补丁:{{count}} 项",
|
||||
"companionFiles": "附带外置文件:{{count}} 个",
|
||||
"configBlk": "含 config.blk 增量补丁"
|
||||
},
|
||||
"presets": {
|
||||
"heading": "模组序列预设(当前客户端独立保存)",
|
||||
"description": "将当前的启用开关与加载顺序保存为预设,方便在不同玩法配置间一键切换,或导出 JSON 分享给其他玩家。",
|
||||
"quickSwitch": "快速切换模组预设",
|
||||
"customOption": "当前自定义配置",
|
||||
"namePlaceholder": "输入新预设名称,例如:现代载具包",
|
||||
"saveCurrent": "保存为预设",
|
||||
"import": "导入预设…",
|
||||
"empty": "当前客户端尚未保存任何模组预设。",
|
||||
"activeTag": "当前使用",
|
||||
"summary": "启用 {{count}} / 共 {{total}} 个模组",
|
||||
"apply": "应用",
|
||||
"overwrite": "覆盖更新",
|
||||
"export": "导出",
|
||||
"delete": "删除",
|
||||
"saved": "已保存预设「{{name}}」。",
|
||||
"applied": "已切换至预设「{{name}}」。",
|
||||
"updated": "已用当前配置覆盖预设「{{name}}」。",
|
||||
"exported": "预设已导出到:{{path}}",
|
||||
"imported": "已导入模组预设。"
|
||||
},
|
||||
"repo": {
|
||||
"heading": "全局模组仓库位置",
|
||||
"description": "所有客户端共享同一份模组文件仓库(大体积 3D 模型与贴图包通过跨盘目录联接点零拷贝挂载,不重复占用磁盘);每个客户端独立保存自己的开关、排序和预设。",
|
||||
"pathLabel": "当前仓库目录",
|
||||
"defaultNote": "使用启动器默认模组目录",
|
||||
"customNote": "使用自定义模组目录(可放在大容量硬盘或游戏同盘)",
|
||||
"changeFolder": "更改目录…",
|
||||
"resetDefault": "恢复默认目录",
|
||||
"pickTitle": "选择全局模组仓库目录",
|
||||
"updated": "已更新全局模组仓库目录。",
|
||||
"resetDone": "已恢复为默认模组仓库目录。"
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"app_update_unavailable": "当前没有可安装的本体更新。",
|
||||
"app_update_busy": "本体更新操作正在进行。",
|
||||
@@ -703,6 +880,11 @@
|
||||
"save_avatar_invalid": "请选择此客户端中可用的头像。",
|
||||
"save_level_invalid": "请输入此客户端支持的账号等级。",
|
||||
"tuning_invalid": "无法读取或保存数值。请核对对局人数限制和启动器日志。",
|
||||
"mods_read_only": "游戏、本地服务器或维护任务运行期间无法修改模组配置。",
|
||||
"mods_write_failed": "无法保存模组配置,请查看启动器日志。",
|
||||
"mods_preset_invalid": "所选文件不是有效的 WTOffline 模组预设。",
|
||||
"mods_blocking_issues": "当前启用的模组存在缺失前置或互斥冲突,请先在「模组」页面处理后再启动。",
|
||||
"mods_folder_invalid": "所选全局模组目录无效或无法写入。",
|
||||
"copy_not_found": "所选客户端已不可用。",
|
||||
"copies_write_failed": "无法保存客户端记录。",
|
||||
"copy_location_in_use": "客户端位置或数据目录与已有客户端重叠。",
|
||||
|
||||
@@ -0,0 +1,565 @@
|
||||
import { useCallback, useEffect, useMemo, useState, type DragEvent, type FormEvent } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import type { InstallRecord } from '@shared/schemas/install.ts';
|
||||
import type { ModIssueView, ModListItem, ModsStateView } from '@shared/schemas/mods.ts';
|
||||
import { Row } from '../../components/Row.tsx';
|
||||
import { Sheet } from '../../components/Sheet.tsx';
|
||||
import { ipcInvoke } from '../../ipc.ts';
|
||||
import type { ModsSection } from '../../shell/navigation.ts';
|
||||
|
||||
interface Props {
|
||||
readonly copy: InstallRecord;
|
||||
readonly section: ModsSection;
|
||||
readonly readOnly: boolean;
|
||||
readonly onError: (error: unknown) => void;
|
||||
}
|
||||
|
||||
function localized(value: string | Readonly<Record<string, string>> | undefined, language: string): string {
|
||||
if (!value) return '';
|
||||
if (typeof value === 'string') return value;
|
||||
const exact = value[language];
|
||||
if (exact) return exact;
|
||||
const prefix = language.split('-')[0];
|
||||
if (prefix) {
|
||||
const match = Object.entries(value).find(([key]) => key === prefix || key.startsWith(`${prefix}-`));
|
||||
if (match?.[1]) return match[1];
|
||||
}
|
||||
return value.en ?? value['en-US'] ?? Object.values(value)[0] ?? '';
|
||||
}
|
||||
|
||||
export function ModsPage({ copy, section, readOnly, onError }: Props) {
|
||||
const { t, i18n } = useTranslation();
|
||||
const [state, setState] = useState<ModsStateView | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [query, setQuery] = useState('');
|
||||
const [expandedId, setExpandedId] = useState<string | null>(null);
|
||||
const [draggedId, setDraggedId] = useState<string | null>(null);
|
||||
const [presetName, setPresetName] = useState('');
|
||||
const [notice, setNotice] = useState<string | null>(null);
|
||||
|
||||
const load = useCallback(() => {
|
||||
setBusy(true);
|
||||
ipcInvoke('mods:getState', { copyId: copy.id })
|
||||
.then(setState)
|
||||
.catch(onError)
|
||||
.finally(() => setBusy(false));
|
||||
}, [copy.id, onError]);
|
||||
|
||||
useEffect(() => {
|
||||
let mounted = true;
|
||||
ipcInvoke('mods:getState', { copyId: copy.id })
|
||||
.then((result) => { if (mounted) setState(result); })
|
||||
.catch(onError);
|
||||
return () => { mounted = false; };
|
||||
}, [copy.id, onError]);
|
||||
|
||||
const runAction = (action: Promise<ModsStateView>, successNotice?: string): void => {
|
||||
setBusy(true);
|
||||
setNotice(null);
|
||||
action
|
||||
.then((next) => {
|
||||
setState(next);
|
||||
if (successNotice) setNotice(successNotice);
|
||||
})
|
||||
.catch(onError)
|
||||
.finally(() => setBusy(false));
|
||||
};
|
||||
|
||||
const issuesByMod = useMemo(() => {
|
||||
const map = new Map<string, ModIssueView[]>();
|
||||
for (const issue of state?.issues ?? []) {
|
||||
const list = map.get(issue.modId) ?? [];
|
||||
list.push(issue);
|
||||
map.set(issue.modId, list);
|
||||
}
|
||||
return map;
|
||||
}, [state]);
|
||||
|
||||
const title = t(`mods.sections.${section}`);
|
||||
if (!state) {
|
||||
return <Sheet title={title} aside={copy.name}><p className="lead">{t('mods.loading')}</p></Sheet>;
|
||||
}
|
||||
|
||||
const disabled = readOnly || busy;
|
||||
const enabledCount = state.mods.filter((mod) => state.enabled[mod.id] === true).length;
|
||||
|
||||
const toggleMod = (modId: string, nextEnabled: boolean): void => {
|
||||
runAction(ipcInvoke('mods:setEnabled', { copyId: copy.id, modId, enabled: nextEnabled }));
|
||||
};
|
||||
|
||||
const reorder = (nextOrder: string[]): void => {
|
||||
runAction(ipcInvoke('mods:setOrder', { copyId: copy.id, order: nextOrder }));
|
||||
};
|
||||
|
||||
const moveMod = (modId: string, delta: -1 | 1): void => {
|
||||
const idx = state.order.indexOf(modId);
|
||||
const target = idx + delta;
|
||||
if (idx < 0 || target < 0 || target >= state.order.length) return;
|
||||
const next = [...state.order];
|
||||
const [item] = next.splice(idx, 1);
|
||||
next.splice(target, 0, item!);
|
||||
reorder(next);
|
||||
};
|
||||
|
||||
const handleDrop = (targetId: string, event: DragEvent<HTMLDivElement>): void => {
|
||||
event.preventDefault();
|
||||
const sourceId = draggedId;
|
||||
setDraggedId(null);
|
||||
if (!sourceId || sourceId === targetId || disabled) return;
|
||||
const from = state.order.indexOf(sourceId);
|
||||
const to = state.order.indexOf(targetId);
|
||||
if (from < 0 || to < 0) return;
|
||||
const next = [...state.order];
|
||||
const [moved] = next.splice(from, 1);
|
||||
next.splice(to, 0, moved!);
|
||||
reorder(next);
|
||||
};
|
||||
|
||||
const savePreset = (event: FormEvent<HTMLFormElement>): void => {
|
||||
event.preventDefault();
|
||||
const trimmed = presetName.trim();
|
||||
if (!trimmed) return;
|
||||
runAction(
|
||||
ipcInvoke('mods:savePreset', { copyId: copy.id, name: trimmed }),
|
||||
t('mods.presets.saved', { name: trimmed }),
|
||||
);
|
||||
setPresetName('');
|
||||
};
|
||||
|
||||
const pickCustomFolder = (): void => {
|
||||
ipcInvoke('dialog:pickFolder', { title: t('mods.repo.pickTitle') })
|
||||
.then(({ path }) => {
|
||||
if (!path) return;
|
||||
runAction(ipcInvoke('mods:setFolder', { copyId: copy.id, path }), t('mods.repo.updated'));
|
||||
})
|
||||
.catch(onError);
|
||||
};
|
||||
|
||||
const resetFolder = (): void => {
|
||||
runAction(ipcInvoke('mods:setFolder', { copyId: copy.id, path: null }), t('mods.repo.resetDone'));
|
||||
};
|
||||
|
||||
const exportPreset = (presetId: string): void => {
|
||||
setBusy(true);
|
||||
setNotice(null);
|
||||
ipcInvoke('mods:exportPreset', { copyId: copy.id, presetId })
|
||||
.then(({ path }) => {
|
||||
if (path) setNotice(t('mods.presets.exported', { path }));
|
||||
})
|
||||
.catch(onError)
|
||||
.finally(() => setBusy(false));
|
||||
};
|
||||
|
||||
const importPreset = (): void => {
|
||||
setBusy(true);
|
||||
setNotice(null);
|
||||
ipcInvoke('mods:importPreset', { copyId: copy.id })
|
||||
.then(({ imported, state: next }) => {
|
||||
setState(next);
|
||||
if (imported) setNotice(t('mods.presets.imported'));
|
||||
})
|
||||
.catch(onError)
|
||||
.finally(() => setBusy(false));
|
||||
};
|
||||
|
||||
const normalizedQuery = query.trim().toLowerCase();
|
||||
const visibleMods = normalizedQuery
|
||||
? state.mods.filter((mod) => {
|
||||
const displayName = localized(mod.name, i18n.language).toLowerCase();
|
||||
return displayName.includes(normalizedQuery)
|
||||
|| mod.id.toLowerCase().includes(normalizedQuery)
|
||||
|| mod.author.toLowerCase().includes(normalizedQuery);
|
||||
})
|
||||
: state.mods;
|
||||
|
||||
const canDrag = !disabled && normalizedQuery.length === 0;
|
||||
|
||||
return (
|
||||
<Sheet title={title} aside={`${copy.name} · ${t('mods.enabledSummary', { enabled: enabledCount, total: state.mods.length })}`}>
|
||||
<div className="mods-banner mods-banner-experimental" role="note">
|
||||
<strong>{t('mods.experimentalTitle')}</strong>
|
||||
<span>{t('mods.experimentalBody', { api: state.apiVersion })}</span>
|
||||
</div>
|
||||
|
||||
{readOnly && (
|
||||
<div className="mods-banner mods-banner-warn" role="status">
|
||||
{t('mods.readOnlyNotice')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{notice && (
|
||||
<div className="mods-banner mods-banner-ok" role="status">
|
||||
{notice}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{section === 'list' ? (
|
||||
<>
|
||||
<div className="mods-toolbar">
|
||||
<input
|
||||
type="search"
|
||||
className="input mods-search"
|
||||
placeholder={t('mods.searchPlaceholder')}
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
/>
|
||||
{state.presets.length > 0 && (
|
||||
<select
|
||||
className="select mods-preset-select"
|
||||
aria-label={t('mods.presets.quickSwitch')}
|
||||
disabled={disabled}
|
||||
value={state.activePresetId ?? ''}
|
||||
onChange={(event) => {
|
||||
const id = event.target.value;
|
||||
if (id) runAction(ipcInvoke('mods:applyPreset', { copyId: copy.id, presetId: id }));
|
||||
}}
|
||||
>
|
||||
<option value="">{t('mods.presets.customOption')}</option>
|
||||
{state.presets.map((preset) => (
|
||||
<option key={preset.id} value={preset.id}>{preset.name}</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="button"
|
||||
disabled={disabled || state.mods.length < 2}
|
||||
onClick={() => runAction(ipcInvoke('mods:autoSort', { copyId: copy.id }), t('mods.autoSorted'))}
|
||||
>
|
||||
{t('mods.autoSort')}
|
||||
</button>
|
||||
<button type="button" className="button" disabled={busy} onClick={load}>
|
||||
{t('mods.refresh')}
|
||||
</button>
|
||||
<button type="button" className="button" onClick={() => ipcInvoke('mods:openFolder').catch(onError)}>
|
||||
{t('mods.openFolder')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{state.discoveryErrors.length > 0 && (
|
||||
<div className="mods-issues-box mods-issues-error">
|
||||
<div className="mods-issues-title">{t('mods.discoveryErrorsTitle', { count: state.discoveryErrors.length })}</div>
|
||||
<ul>
|
||||
{state.discoveryErrors.map((err) => (
|
||||
<li key={err.folderName}>
|
||||
<code>{err.folderName}</code>: {err.reason}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{state.issues.length > 0 && (
|
||||
<div className={state.hasBlockingErrors ? 'mods-issues-box mods-issues-error' : 'mods-issues-box mods-issues-warn'}>
|
||||
<div className="mods-issues-title">
|
||||
{state.hasBlockingErrors
|
||||
? t('mods.blockingIssuesTitle', { count: state.issues.filter((i) => i.severity === 'error').length })
|
||||
: t('mods.issuesTitle', { count: state.issues.length })}
|
||||
</div>
|
||||
<ul>
|
||||
{state.issues.map((issue, idx) => (
|
||||
<li key={`${issue.modId}-${issue.kind}-${idx}`} className={`mods-issue-${issue.severity}`}>
|
||||
<span className="mods-issue-tag">{t(`mods.severity.${issue.severity}`)}</span>
|
||||
<strong>{issue.modId}</strong>: {issue.detail}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{visibleMods.length === 0 ? (
|
||||
<div className="mods-empty">
|
||||
<p className="lead">{state.mods.length === 0 ? t('mods.emptyTitle') : t('mods.noSearchMatch')}</p>
|
||||
{state.mods.length === 0 && (
|
||||
<>
|
||||
<p className="mods-hint">{t('mods.emptyHint', { path: state.modsDir })}</p>
|
||||
<button type="button" className="button button-primary" onClick={() => ipcInvoke('mods:openFolder').catch(onError)}>
|
||||
{t('mods.openFolder')}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="mods-list">
|
||||
{visibleMods.map((mod) => {
|
||||
const index = state.order.indexOf(mod.id);
|
||||
const isEnabled = state.enabled[mod.id] === true;
|
||||
const isExpanded = expandedId === mod.id;
|
||||
const modIssues = issuesByMod.get(mod.id) ?? [];
|
||||
return (
|
||||
<ModCard
|
||||
key={mod.id}
|
||||
mod={mod}
|
||||
index={index}
|
||||
total={state.order.length}
|
||||
enabled={isEnabled}
|
||||
expanded={isExpanded}
|
||||
disabled={disabled}
|
||||
canDrag={canDrag}
|
||||
language={i18n.language}
|
||||
issues={modIssues}
|
||||
onToggle={(next) => toggleMod(mod.id, next)}
|
||||
onMove={(delta) => moveMod(mod.id, delta)}
|
||||
onToggleExpand={() => setExpandedId(isExpanded ? null : mod.id)}
|
||||
onDragStart={() => setDraggedId(mod.id)}
|
||||
onDrop={(event) => handleDrop(mod.id, event)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<section className="mods-section">
|
||||
<h3 className="mods-subheading">{t('mods.presets.heading')}</h3>
|
||||
<p className="mods-hint">{t('mods.presets.description')}</p>
|
||||
<form className="mods-preset-form" onSubmit={savePreset}>
|
||||
<input
|
||||
type="text"
|
||||
className="input"
|
||||
maxLength={80}
|
||||
disabled={disabled}
|
||||
placeholder={t('mods.presets.namePlaceholder')}
|
||||
value={presetName}
|
||||
onChange={(event) => setPresetName(event.target.value)}
|
||||
/>
|
||||
<button type="submit" className="button button-primary" disabled={disabled || !presetName.trim()}>
|
||||
{t('mods.presets.saveCurrent')}
|
||||
</button>
|
||||
<button type="button" className="button" disabled={disabled} onClick={importPreset}>
|
||||
{t('mods.presets.import')}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
{state.presets.length === 0 ? (
|
||||
<p className="mods-hint">{t('mods.presets.empty')}</p>
|
||||
) : (
|
||||
<div className="mods-preset-list">
|
||||
{state.presets.map((preset) => {
|
||||
const active = state.activePresetId === preset.id;
|
||||
const count = Object.values(preset.enabled).filter(Boolean).length;
|
||||
return (
|
||||
<div key={preset.id} className={active ? 'mods-preset-item mods-preset-active' : 'mods-preset-item'}>
|
||||
<div className="mods-preset-meta">
|
||||
<div className="mods-preset-name">
|
||||
{preset.name}
|
||||
{active && <span className="mods-badge mods-badge-data">{t('mods.presets.activeTag')}</span>}
|
||||
</div>
|
||||
<div className="mods-preset-sub">
|
||||
{t('mods.presets.summary', { count, total: preset.order.length })}
|
||||
</div>
|
||||
</div>
|
||||
<div className="copy-list-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="button button-primary"
|
||||
disabled={disabled}
|
||||
onClick={() => runAction(
|
||||
ipcInvoke('mods:applyPreset', { copyId: copy.id, presetId: preset.id }),
|
||||
t('mods.presets.applied', { name: preset.name }),
|
||||
)}
|
||||
>
|
||||
{t('mods.presets.apply')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="button"
|
||||
disabled={disabled}
|
||||
onClick={() => runAction(
|
||||
ipcInvoke('mods:savePreset', { copyId: copy.id, name: preset.name, overwriteId: preset.id }),
|
||||
t('mods.presets.updated', { name: preset.name }),
|
||||
)}
|
||||
>
|
||||
{t('mods.presets.overwrite')}
|
||||
</button>
|
||||
<button type="button" className="button" disabled={busy} onClick={() => exportPreset(preset.id)}>
|
||||
{t('mods.presets.export')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="button"
|
||||
disabled={disabled}
|
||||
onClick={() => runAction(ipcInvoke('mods:deletePreset', { copyId: copy.id, presetId: preset.id }))}
|
||||
>
|
||||
{t('mods.presets.delete')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="mods-section">
|
||||
<h3 className="mods-subheading">{t('mods.repo.heading')}</h3>
|
||||
<p className="mods-hint">{t('mods.repo.description')}</p>
|
||||
<Row
|
||||
label={t('mods.repo.pathLabel')}
|
||||
hint={state.isCustomModsDir ? t('mods.repo.customNote') : t('mods.repo.defaultNote')}
|
||||
>
|
||||
<code className="mods-path">{state.modsDir}</code>
|
||||
</Row>
|
||||
<div className="copy-list-actions" style={{ marginTop: 12 }}>
|
||||
<button type="button" className="button" onClick={() => ipcInvoke('mods:openFolder').catch(onError)}>
|
||||
{t('mods.openFolder')}
|
||||
</button>
|
||||
<button type="button" className="button" disabled={disabled} onClick={pickCustomFolder}>
|
||||
{t('mods.repo.changeFolder')}
|
||||
</button>
|
||||
{state.isCustomModsDir && (
|
||||
<button type="button" className="button" disabled={disabled} onClick={resetFolder}>
|
||||
{t('mods.repo.resetDefault')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
)}
|
||||
</Sheet>
|
||||
);
|
||||
}
|
||||
|
||||
interface ModCardProps {
|
||||
readonly mod: ModListItem;
|
||||
readonly index: number;
|
||||
readonly total: number;
|
||||
readonly enabled: boolean;
|
||||
readonly expanded: boolean;
|
||||
readonly disabled: boolean;
|
||||
readonly canDrag: boolean;
|
||||
readonly language: string;
|
||||
readonly issues: readonly ModIssueView[];
|
||||
readonly onToggle: (next: boolean) => void;
|
||||
readonly onMove: (delta: -1 | 1) => void;
|
||||
readonly onToggleExpand: () => void;
|
||||
readonly onDragStart: () => void;
|
||||
readonly onDrop: (event: DragEvent<HTMLDivElement>) => void;
|
||||
}
|
||||
|
||||
function ModCard({
|
||||
mod,
|
||||
index,
|
||||
total,
|
||||
enabled,
|
||||
expanded,
|
||||
disabled,
|
||||
canDrag,
|
||||
language,
|
||||
issues,
|
||||
onToggle,
|
||||
onMove,
|
||||
onToggleExpand,
|
||||
onDragStart,
|
||||
onDrop,
|
||||
}: ModCardProps) {
|
||||
const { t } = useTranslation();
|
||||
const displayName = localized(mod.name, language) || mod.id;
|
||||
const description = localized(mod.description, language);
|
||||
const errorCount = issues.filter((i) => i.severity === 'error').length;
|
||||
const warnCount = issues.filter((i) => i.severity === 'warning').length;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`mods-card${enabled ? ' mods-card-enabled' : ''}`}
|
||||
draggable={canDrag}
|
||||
onDragStart={onDragStart}
|
||||
onDragOver={(event) => { if (canDrag) event.preventDefault(); }}
|
||||
onDrop={onDrop}
|
||||
>
|
||||
<div className="mods-card-row">
|
||||
<span className="mods-order-num" title={t('mods.loadOrderHint')}>#{index + 1}</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
className="mods-checkbox"
|
||||
checked={enabled}
|
||||
disabled={disabled}
|
||||
aria-label={displayName}
|
||||
onChange={(event) => onToggle(event.target.checked)}
|
||||
/>
|
||||
<div className="mods-card-main" onClick={onToggleExpand}>
|
||||
<div className="mods-card-title">
|
||||
<span className="mods-name">{displayName}</span>
|
||||
<span className="mods-version">v{mod.version}</span>
|
||||
<span className="mods-author">· {mod.author}</span>
|
||||
<div className="mods-badges">
|
||||
{mod.badges.map((badge) => (
|
||||
<span key={badge} className={`mods-badge mods-badge-${badge}`}>
|
||||
{t(`mods.badges.${badge}`)}
|
||||
</span>
|
||||
))}
|
||||
{errorCount > 0 && <span className="mods-badge mods-badge-error">{t('mods.errorCount', { count: errorCount })}</span>}
|
||||
{warnCount > 0 && <span className="mods-badge mods-badge-warn">{t('mods.warnCount', { count: warnCount })}</span>}
|
||||
</div>
|
||||
</div>
|
||||
{description && <div className="mods-card-desc">{description}</div>}
|
||||
</div>
|
||||
<div className="mods-card-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="button mods-move-btn"
|
||||
disabled={disabled || index <= 0}
|
||||
title={t('mods.moveUp')}
|
||||
onClick={() => onMove(-1)}
|
||||
>
|
||||
↑
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="button mods-move-btn"
|
||||
disabled={disabled || index < 0 || index >= total - 1}
|
||||
title={t('mods.moveDown')}
|
||||
onClick={() => onMove(1)}
|
||||
>
|
||||
↓
|
||||
</button>
|
||||
<button type="button" className="button" onClick={onToggleExpand}>
|
||||
{expanded ? t('mods.hideDetails') : t('mods.showDetails')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{expanded && (
|
||||
<div className="mods-card-details">
|
||||
<div className="mods-detail-grid">
|
||||
<div><span>ID:</span> <code>{mod.id}</code></div>
|
||||
<div><span>API:</span> <code>{mod.apiVersion}</code></div>
|
||||
<div><span>{t('mods.details.folder')}:</span> <code>{mod.folderName}</code></div>
|
||||
{mod.gameVersions.length > 0 && (
|
||||
<div><span>{t('mods.details.gameVersions')}:</span> <code>{mod.gameVersions.join(', ')}</code></div>
|
||||
)}
|
||||
{mod.requires.length > 0 && (
|
||||
<div><span>{t('mods.details.requires')}:</span> <code>{mod.requires.join(', ')}</code></div>
|
||||
)}
|
||||
{mod.conflicts.length > 0 && (
|
||||
<div><span>{t('mods.details.conflicts')}:</span> <code>{mod.conflicts.join(', ')}</code></div>
|
||||
)}
|
||||
</div>
|
||||
<div className="mods-detail-summary">
|
||||
{mod.serverTuningFiles.length > 0 && (
|
||||
<span>{t('mods.details.tuning', { count: mod.serverTuningFiles.length })}</span>
|
||||
)}
|
||||
{mod.hasServerScript && <span>{t('mods.details.serverScript')}</span>}
|
||||
{mod.packOperations.length > 0 && (
|
||||
<span>{t('mods.details.packOps', { count: mod.packOperations.length })}</span>
|
||||
)}
|
||||
{mod.hasClientAddon && (
|
||||
<span>{t('mods.details.addon', { count: mod.addonFileCount })}</span>
|
||||
)}
|
||||
{mod.guiPatchCount > 0 && (
|
||||
<span>{t('mods.details.guiPatches', { count: mod.guiPatchCount })}</span>
|
||||
)}
|
||||
{mod.exePatchCount > 0 && (
|
||||
<span>{t('mods.details.exePatches', { count: mod.exePatchCount })}</span>
|
||||
)}
|
||||
{mod.clientFileCount > 0 && (
|
||||
<span>{t('mods.details.companionFiles', { count: mod.clientFileCount })}</span>
|
||||
)}
|
||||
{mod.hasConfigBlkPatch && <span>{t('mods.details.configBlk')}</span>}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* 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', 'saves', 'tuning', 'copies', 'settings', 'about'] as const;
|
||||
export const PAGES = ['home', 'saves', 'tuning', 'mods', 'copies', 'settings', 'about'] as const;
|
||||
export type PageId = (typeof PAGES)[number];
|
||||
|
||||
export const SAVE_SECTIONS = ['list', 'overview', 'battles', 'vehicles', 'official', 'backup'] as const;
|
||||
@@ -12,6 +11,9 @@ export type SaveSection = (typeof SAVE_SECTIONS)[number];
|
||||
export const TUNING_SECTIONS = ['rewards', 'battle', 'newProfile', 'research'] as const;
|
||||
export type TuningSection = (typeof TUNING_SECTIONS)[number];
|
||||
|
||||
export const MODS_SECTIONS = ['list', 'presets'] as const;
|
||||
export type ModsSection = (typeof MODS_SECTIONS)[number];
|
||||
|
||||
export const COPY_SECTIONS = ['list', 'summary', 'features', 'maintain'] as const;
|
||||
export type CopySection = (typeof COPY_SECTIONS)[number];
|
||||
|
||||
@@ -23,16 +25,25 @@ export interface Route {
|
||||
readonly copies: CopySection;
|
||||
readonly saves: SaveSection;
|
||||
readonly tuning: TuningSection;
|
||||
readonly mods: ModsSection;
|
||||
readonly settings: SettingsSection;
|
||||
}
|
||||
|
||||
export const START_ROUTE: Route = { page: 'home', saves: 'list', tuning: 'rewards', copies: 'list', settings: 'general' };
|
||||
export const START_ROUTE: Route = {
|
||||
page: 'home',
|
||||
saves: 'list',
|
||||
tuning: 'rewards',
|
||||
mods: 'list',
|
||||
copies: 'list',
|
||||
settings: 'general',
|
||||
};
|
||||
|
||||
/** Where a link points: a page, and for pages with sections, which one. */
|
||||
export type Destination =
|
||||
| { readonly page: 'home' | 'about' }
|
||||
| { readonly page: 'saves'; readonly section?: SaveSection }
|
||||
| { readonly page: 'tuning'; readonly section?: TuningSection }
|
||||
| { readonly page: 'mods'; readonly section?: ModsSection }
|
||||
| { readonly page: 'copies'; readonly section?: CopySection }
|
||||
| { readonly page: 'settings'; readonly section?: SettingsSection };
|
||||
|
||||
@@ -42,6 +53,8 @@ export function navigate(route: Route, to: Destination): Route {
|
||||
return { ...route, page: 'saves', saves: to.section ?? route.saves };
|
||||
case 'tuning':
|
||||
return { ...route, page: 'tuning', tuning: to.section ?? route.tuning };
|
||||
case 'mods':
|
||||
return { ...route, page: 'mods', mods: to.section ?? route.mods };
|
||||
case 'copies':
|
||||
return { ...route, page: 'copies', copies: to.section ?? route.copies };
|
||||
case 'settings':
|
||||
|
||||
@@ -435,3 +435,327 @@
|
||||
.about-card .notice .button {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* ===== Mods ===== */
|
||||
.mods-banner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 12px;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.5;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.mods-banner-experimental {
|
||||
background: rgba(214, 158, 46, 0.14);
|
||||
border-color: rgba(214, 158, 46, 0.45);
|
||||
color: rgba(255, 241, 204, 0.94);
|
||||
}
|
||||
|
||||
.mods-banner-warn {
|
||||
background: rgba(206, 65, 55, 0.16);
|
||||
border-color: rgba(206, 65, 55, 0.5);
|
||||
color: #ffd7d4;
|
||||
}
|
||||
|
||||
.mods-banner-ok {
|
||||
background: rgba(68, 170, 102, 0.16);
|
||||
border-color: rgba(68, 170, 102, 0.5);
|
||||
color: #d7ffe4;
|
||||
}
|
||||
|
||||
.mods-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.mods-search {
|
||||
flex: 1 1 180px;
|
||||
min-width: 140px;
|
||||
}
|
||||
|
||||
.mods-preset-select {
|
||||
max-width: 210px;
|
||||
}
|
||||
|
||||
.mods-issues-box {
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 12px;
|
||||
font-size: 12.5px;
|
||||
border-radius: var(--radius);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.mods-issues-error {
|
||||
background: rgba(206, 65, 55, 0.15);
|
||||
border-color: rgba(206, 65, 55, 0.55);
|
||||
}
|
||||
|
||||
.mods-issues-warn {
|
||||
background: rgba(214, 158, 46, 0.13);
|
||||
border-color: rgba(214, 158, 46, 0.45);
|
||||
}
|
||||
|
||||
.mods-issues-title {
|
||||
font-weight: 600;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.mods-issues-box ul {
|
||||
margin: 0;
|
||||
padding-left: 18px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.mods-issue-tag {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
padding: 1px 5px;
|
||||
font-size: 11px;
|
||||
border-radius: 2px;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
.mods-empty {
|
||||
padding: 20px 14px;
|
||||
text-align: center;
|
||||
border: 1px dashed var(--line);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.mods-hint {
|
||||
font-size: 12.5px;
|
||||
color: var(--text-dim);
|
||||
line-height: 1.5;
|
||||
margin: 6px 0 12px;
|
||||
}
|
||||
|
||||
.mods-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.mods-card {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
background: rgba(12, 16, 19, 0.62);
|
||||
transition: border-color 120ms ease;
|
||||
}
|
||||
|
||||
.mods-card-enabled {
|
||||
border-left: 3px solid var(--red);
|
||||
background: rgba(18, 24, 29, 0.78);
|
||||
}
|
||||
|
||||
.mods-card-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.mods-order-num {
|
||||
min-width: 26px;
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
text-align: right;
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.mods-checkbox {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
flex: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mods-card-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mods-card-title {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.mods-name {
|
||||
font-weight: 600;
|
||||
color: var(--white);
|
||||
}
|
||||
|
||||
.mods-version,
|
||||
.mods-author {
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.mods-card-desc {
|
||||
margin-top: 3px;
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.mods-badges {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.mods-badge {
|
||||
padding: 1px 6px;
|
||||
font-size: 11px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.16);
|
||||
}
|
||||
|
||||
.mods-badge-data {
|
||||
background: rgba(88, 166, 255, 0.16);
|
||||
color: #b7d7ff;
|
||||
}
|
||||
|
||||
.mods-badge-gui {
|
||||
background: rgba(163, 113, 247, 0.18);
|
||||
color: #dec8ff;
|
||||
}
|
||||
|
||||
.mods-badge-script {
|
||||
background: rgba(214, 158, 46, 0.22);
|
||||
color: #ffe3a3;
|
||||
}
|
||||
|
||||
.mods-badge-exe {
|
||||
background: rgba(206, 65, 55, 0.28);
|
||||
color: #ffc2be;
|
||||
border-color: rgba(206, 65, 55, 0.55);
|
||||
}
|
||||
|
||||
.mods-badge-error {
|
||||
background: rgba(206, 65, 55, 0.35);
|
||||
color: #ffd5d2;
|
||||
}
|
||||
|
||||
.mods-badge-warn {
|
||||
background: rgba(214, 158, 46, 0.25);
|
||||
color: #ffe8b3;
|
||||
}
|
||||
|
||||
.mods-card-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.mods-move-btn {
|
||||
min-width: 28px;
|
||||
padding: 4px 6px;
|
||||
}
|
||||
|
||||
.mods-card-details {
|
||||
padding: 10px 12px 12px 48px;
|
||||
border-top: 1px solid var(--line);
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.mods-detail-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 4px 12px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.mods-detail-summary {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.mods-detail-summary span {
|
||||
padding: 2px 7px;
|
||||
border-radius: 2px;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
|
||||
.mods-section {
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
.mods-subheading {
|
||||
margin: 0 0 4px;
|
||||
font: 600 15px var(--font-display);
|
||||
color: var(--white);
|
||||
}
|
||||
|
||||
.mods-preset-form {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin: 10px 0 14px;
|
||||
}
|
||||
|
||||
.mods-preset-form .input {
|
||||
flex: 1 1 200px;
|
||||
}
|
||||
|
||||
.mods-preset-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.mods-preset-item {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
background: rgba(12, 16, 19, 0.62);
|
||||
}
|
||||
|
||||
.mods-preset-active {
|
||||
border-left: 3px solid var(--red);
|
||||
}
|
||||
|
||||
.mods-preset-meta {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.mods-preset-name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-weight: 600;
|
||||
color: var(--white);
|
||||
}
|
||||
|
||||
.mods-preset-sub {
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.mods-path {
|
||||
font-size: 12px;
|
||||
word-break: break-all;
|
||||
}
|
||||
Reference in new issue
Block a user