feat(launcher): add wordmark logo, ellipsis tooltips, auto-dismiss errors and online wording
Replace the title bar text mark with the white WTOffline wordmark SVG, add a window-level floating tooltip for truncated ellipsis text, auto-dismiss and manually close global error banners, and replace retail wording with online edition terminology across both locales and isolation patch titles.
This commit is contained in:
1 parent
db84971823
commit
ebb2937a38
16 files changed
+332
-69
No files matched your search
@@ -4,6 +4,7 @@ import type { IpcOutput } from '@shared/ipc/contract.ts';
|
||||
import type { Copies } from '@shared/schemas/install.ts';
|
||||
import type { LaunchState } from '@shared/schemas/launch.ts';
|
||||
import type { Settings } from '@shared/schemas/settings.ts';
|
||||
import { EllipsisTooltipHost } from './components/EllipsisTooltipHost.tsx';
|
||||
import { Sheet } from './components/Sheet.tsx';
|
||||
import { applyLanguage, resolveLanguage } from './i18n/index.ts';
|
||||
import { ipcInvoke, ipcOn } from './ipc.ts';
|
||||
@@ -57,7 +58,8 @@ interface View {
|
||||
*/
|
||||
export function App({ info, initialSettings, initialCopies }: AppProps) {
|
||||
const { t } = useTranslation();
|
||||
const { message, report } = useErrorMessage();
|
||||
const { error, report, clear: clearError } = useErrorMessage();
|
||||
const [errorPaused, setErrorPaused] = useState(false);
|
||||
const [settings, setSettings] = useState(initialSettings);
|
||||
const [registry, setRegistry] = useState(initialCopies);
|
||||
const record = registry.copies.find((copy) => copy.id === registry.current) ?? null;
|
||||
@@ -89,7 +91,16 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
|
||||
return () => { mounted = false; dispose(); };
|
||||
}, [report]);
|
||||
|
||||
const go = (to: Destination): void => setRoute((current) => navigate(current, to));
|
||||
useEffect(() => {
|
||||
if (!error || errorPaused) return;
|
||||
const timer = window.setTimeout(clearError, 6000);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [error, errorPaused, clearError]);
|
||||
|
||||
const go = (to: Destination): void => {
|
||||
clearError();
|
||||
setRoute((current) => navigate(current, to));
|
||||
};
|
||||
const selectCopy = (id: string, details = false): void => {
|
||||
ipcInvoke('copies:setCurrent', { id }).then(() => {
|
||||
if (details) go({ page: 'copies', section: 'summary' });
|
||||
@@ -188,7 +199,26 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
|
||||
<aside className="side">{view.side}</aside>
|
||||
<main className="main">
|
||||
{view.main}
|
||||
{message && <p className="app-error" role="alert">{message}</p>}
|
||||
{error && (
|
||||
<div
|
||||
key={error.id}
|
||||
className="app-error"
|
||||
role="alert"
|
||||
onMouseEnter={() => setErrorPaused(true)}
|
||||
onMouseLeave={() => setErrorPaused(false)}
|
||||
>
|
||||
<span className="app-error-text">{error.message}</span>
|
||||
<button
|
||||
type="button"
|
||||
className="app-error-close"
|
||||
aria-label={t('window.close')}
|
||||
title={t('window.close')}
|
||||
onClick={clearError}
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</main>
|
||||
<BottomBar model={view.bar} />
|
||||
<Footer
|
||||
@@ -199,6 +229,7 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
|
||||
appUpdate={appUpdate.check?.status === 'available' ? appUpdate.check.release.version : null}
|
||||
onOpenUpdates={() => go({ page: 'about' })}
|
||||
/>
|
||||
<EllipsisTooltipHost />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
||||
|
||||
interface TooltipState {
|
||||
readonly text: string;
|
||||
readonly anchor: DOMRect;
|
||||
readonly element: HTMLElement;
|
||||
}
|
||||
|
||||
function isTruncated(element: HTMLElement): boolean {
|
||||
return element.scrollWidth > element.clientWidth + 1 || element.scrollHeight > element.clientHeight + 1;
|
||||
}
|
||||
|
||||
function findTooltipCandidate(start: EventTarget | null): { element: HTMLElement; text: string } | null {
|
||||
let node = start instanceof Element ? start : null;
|
||||
while (node && node instanceof HTMLElement) {
|
||||
const explicit = node.getAttribute('data-ellipsis-tip');
|
||||
if (explicit !== null) {
|
||||
const text = explicit.trim();
|
||||
if (text && (isTruncated(node) || text !== (node.textContent?.trim() ?? ''))) {
|
||||
return { element: node, text };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const style = window.getComputedStyle(node);
|
||||
if (style.textOverflow === 'ellipsis' && style.overflowX !== 'visible') {
|
||||
const text = node.textContent?.trim() ?? '';
|
||||
if (text && isTruncated(node)) {
|
||||
return { element: node, text };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
node = node.parentElement;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Window-level tooltip overlay for truncated (ellipsis) text and explicit `data-ellipsis-tip`
|
||||
* elements. Positioned fixed above the shell so overflow-hidden containers never clip it.
|
||||
*/
|
||||
export function EllipsisTooltipHost() {
|
||||
const [tip, setTip] = useState<TooltipState | null>(null);
|
||||
const [position, setPosition] = useState<{ left: number; top: number } | null>(null);
|
||||
const boxRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const onPointerOver = (event: PointerEvent): void => {
|
||||
const candidate = findTooltipCandidate(event.target);
|
||||
if (!candidate) return;
|
||||
setTip({ text: candidate.text, anchor: candidate.element.getBoundingClientRect(), element: candidate.element });
|
||||
};
|
||||
|
||||
const onPointerOut = (event: PointerEvent): void => {
|
||||
setTip((current) => {
|
||||
if (!current) return null;
|
||||
const related = event.relatedTarget;
|
||||
if (related instanceof Node && current.element.contains(related)) return current;
|
||||
return null;
|
||||
});
|
||||
};
|
||||
|
||||
const clear = (): void => setTip(null);
|
||||
|
||||
document.addEventListener('pointerover', onPointerOver, true);
|
||||
document.addEventListener('pointerout', onPointerOut, true);
|
||||
document.addEventListener('pointerdown', clear, true);
|
||||
document.addEventListener('scroll', clear, true);
|
||||
window.addEventListener('blur', clear);
|
||||
window.addEventListener('resize', clear);
|
||||
return () => {
|
||||
document.removeEventListener('pointerover', onPointerOver, true);
|
||||
document.removeEventListener('pointerout', onPointerOut, true);
|
||||
document.removeEventListener('pointerdown', clear, true);
|
||||
document.removeEventListener('scroll', clear, true);
|
||||
window.removeEventListener('blur', clear);
|
||||
window.removeEventListener('resize', clear);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (!tip || !boxRef.current) {
|
||||
setPosition(null);
|
||||
return;
|
||||
}
|
||||
const margin = 10;
|
||||
const gap = 8;
|
||||
const box = boxRef.current.getBoundingClientRect();
|
||||
const preferredLeft = tip.anchor.left + (tip.anchor.width - box.width) / 2;
|
||||
const left = Math.max(margin, Math.min(preferredLeft, window.innerWidth - box.width - margin));
|
||||
const aboveTop = tip.anchor.top - box.height - gap;
|
||||
const top = aboveTop >= margin
|
||||
? aboveTop
|
||||
: Math.min(tip.anchor.bottom + gap, window.innerHeight - box.height - margin);
|
||||
setPosition({ left, top });
|
||||
}, [tip]);
|
||||
|
||||
if (!tip) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={boxRef}
|
||||
role="tooltip"
|
||||
className="ellipsis-tooltip"
|
||||
style={position ? { left: `${position.left}px`, top: `${position.top}px`, visibility: 'visible' } : { left: 0, top: 0, visibility: 'hidden' }}
|
||||
>
|
||||
{tip.text}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
interface WordmarkProps {
|
||||
readonly className?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The WTOffline wordmark (from assets/wordmark.svg), rendered with currentColor so it stays
|
||||
* crisp white over the launcher's dark crimson title bar regardless of OS light/dark mode.
|
||||
*/
|
||||
export function Wordmark({ className }: WordmarkProps) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 396 206"
|
||||
className={className}
|
||||
role="img"
|
||||
aria-label="WTOffline"
|
||||
>
|
||||
<g fill="currentColor" fillRule="evenodd">
|
||||
<path d="M62 8H101L112 72L124 24H154L166 72L178 8H214L189 123H153L139 83L124 123H88ZM220 8H337V33L329 42H297V123H251V42H214V15Z" />
|
||||
<g>
|
||||
<path d="M13 60H53V68H22ZM31 74H53V82H40Z" />
|
||||
<path transform="translate(396) scale(-1 1)" d="M13 60H53V68H22ZM31 74H53V82H40Z" />
|
||||
</g>
|
||||
<g transform="translate(14 134)">
|
||||
<path transform="translate(0)" d="M9 0H48L57 9V55L48 64H9L0 55V9ZM17 12L14 15V49L17 52H40L43 49V15L40 12Z" />
|
||||
<path transform="translate(65)" d="M0 0H50V12H14V27H42V39H14V64H0Z" />
|
||||
<path transform="translate(123)" d="M0 0H50V12H14V27H42V39H14V64H0Z" />
|
||||
<path transform="translate(181)" d="M0 0H14V52H45V64H0Z" />
|
||||
<path transform="translate(234)" d="M0 0H14V64H0Z" />
|
||||
<path transform="translate(256)" d="M0 0H12L41 39V0H55V64H43L14 25V64H0Z" />
|
||||
<path transform="translate(319)" d="M0 0H49V12H14V26H43V38H14V52H49V64H0Z" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -44,7 +44,7 @@
|
||||
"side": {
|
||||
"requirements": "Installation requirements",
|
||||
"game": "Game",
|
||||
"gameValue": "War Thunder (official client)",
|
||||
"gameValue": "War Thunder (online client)",
|
||||
"versions": "Verified versions",
|
||||
"space": "Disk space",
|
||||
"spaceValue": "About 97 GB (copy installation)",
|
||||
@@ -62,7 +62,7 @@
|
||||
},
|
||||
"bar": {
|
||||
"notInstalled": "Not installed",
|
||||
"notInstalledDetail": "Requires an installed copy of War Thunder",
|
||||
"notInstalledDetail": "Requires an installed online client of War Thunder",
|
||||
"install": "Install",
|
||||
"ready": "Ready",
|
||||
"readyMissing": "Ready · {{count}} features unavailable",
|
||||
@@ -95,7 +95,7 @@
|
||||
},
|
||||
"decals": {
|
||||
"source": "Decal source",
|
||||
"hint": "Import the game's cache/content folder. The copy uses placeholder decals when no cache is available.",
|
||||
"hint": "Import the online game's cache/content folder. The copy uses placeholder decals when no cache is available.",
|
||||
"choose": "Choose decal cache…",
|
||||
"useDefault": "Use placeholder decals",
|
||||
"importing": "Importing decal cache",
|
||||
@@ -151,13 +151,13 @@
|
||||
"noRoom": "Not enough free space: {{needed}} required, {{free}} available on the target drive.",
|
||||
"problem": {
|
||||
"not_empty": "The selected folder is not empty. Select an empty or new folder.",
|
||||
"overlaps_stock": "The folder cannot be the original installation folder, or a folder inside or above it.",
|
||||
"overlaps_stock": "The folder cannot be the online installation folder, or a folder inside or above it.",
|
||||
"not_a_folder": "The selected path is not a folder."
|
||||
},
|
||||
"copyBodyPending": "Copies the game to a new folder. Calculating the required space."
|
||||
},
|
||||
"steam": {
|
||||
"inPlaceWarning": "Launching offline will modify the game files in this Steam installation. Steam updates or file verification may overwrite the changes. Launching the official game online with modified files may result in an account ban.",
|
||||
"inPlaceWarning": "Launching offline will modify the game files in this Steam installation. Steam updates or file verification may overwrite the changes. Launching the online game with modified files may result in an account ban.",
|
||||
"copyWarning": "The destination is in a Steam library. Choose a folder outside the library to keep the offline copy separate.",
|
||||
"confirm": "Confirm this folder",
|
||||
"dataWarning": "Steam may remove saves, caches, and logs stored under the game folder when uninstalling the game.",
|
||||
@@ -204,7 +204,7 @@
|
||||
"list": { "current": "Current", "select": "Set as current" },
|
||||
"none": "The offline edition is not installed yet.",
|
||||
"maintenance": {
|
||||
"update": "Update from official installation",
|
||||
"update": "Update from online installation",
|
||||
"updateAction": "Update copy",
|
||||
"newVersion": "Version {{version}} is available from the installation source.",
|
||||
"updateDetaches": "Version {{version}} is available. Updating copies shared resources into independent files and requires additional space.",
|
||||
@@ -301,7 +301,7 @@
|
||||
"overview": "Overview",
|
||||
"battles": "Battle history",
|
||||
"vehicles": "Vehicles and research",
|
||||
"official": "Import official backup",
|
||||
"official": "Import online data",
|
||||
"backup": "Backup and restore"
|
||||
},
|
||||
"tree": {
|
||||
@@ -337,22 +337,31 @@
|
||||
}
|
||||
},
|
||||
"official": {
|
||||
"files": "Backup files",
|
||||
"fileHint": "Select copies of global.blk, machine.blk or storage.blk.",
|
||||
"auto": "Automatic import",
|
||||
"autoHint": "Locates local online data read-only, copies it into the offline folder, and imports from the copy without modifying the online files.",
|
||||
"oneClick": "Find and import",
|
||||
"discover": "Find and preview",
|
||||
"notFound": "No online data was found in the default Documents folder. Use manual file selection below.",
|
||||
"account": "Online account",
|
||||
"multipleAccounts": "{{count}} online account folders were found. Select the account to import.",
|
||||
"accountOption": "Account {{id}} ({{files}} · updated {{time}})",
|
||||
"files": "Manual selection",
|
||||
"fileHint": "Or select copied global.blk, machine.blk or storage.blk files manually.",
|
||||
"choose": "Choose files…",
|
||||
"content": "Import contents",
|
||||
"settings": "Game settings",
|
||||
"settings": "Game settings and controls",
|
||||
"unlock": "Unlock vehicles from presets",
|
||||
"equipment": "Modifications",
|
||||
"equipmentHint": "All equipment unlocks regular modifications and ammunition only, without talismans.",
|
||||
"full": "All equipment",
|
||||
"basic": "Essential equipment",
|
||||
"stock": "Stock configuration",
|
||||
"includeUsed": "Include other vehicles found in the backup",
|
||||
"includeUsed": "Include additional vehicles from per-unit settings (without prerequisite lines)",
|
||||
"preview": "Preview",
|
||||
"import": "Import",
|
||||
"summary": "{{files}} file(s) · {{presets}} preset(s) · {{vehicles}} available vehicle(s)",
|
||||
"omitted": "Unavailable vehicles to skip · {{names}}",
|
||||
"done": "Backup imported. The previous save is available in Backup and restore."
|
||||
"done": "Online data imported. The previous save is available in Backup and restore."
|
||||
},
|
||||
"archive": {
|
||||
"fromCopy": "Copy from another copy",
|
||||
@@ -592,7 +601,7 @@
|
||||
"features": {
|
||||
"A-Offline startup": "Offline startup",
|
||||
"A-Local accounts": "Local accounts",
|
||||
"A-Isolation from the official game": "Isolation from the official game",
|
||||
"A-Isolation from the official game": "Isolation from the online game",
|
||||
"A-No Gaijin connections": "Gaijin connections blocked",
|
||||
"A-Tutorials": "Tutorial",
|
||||
"B-Hangar and vehicles": "Hangar and vehicles",
|
||||
@@ -632,8 +641,8 @@
|
||||
"internal_error": "An internal launcher error occurred.",
|
||||
"logs_folder_open_failed": "The launcher log folder could not be opened.",
|
||||
"diagnostics_export_failed": "The diagnostics archive could not be saved.",
|
||||
"save_official_invalid": "The selected files are not supported official backup files.",
|
||||
"save_official_location": "Choose backup files copied outside the official game's folders.",
|
||||
"save_official_invalid": "The selected files are not supported online data files.",
|
||||
"save_official_location": "Choose data files copied outside the online game's folders.",
|
||||
"save_archive_invalid": "The selected file is not a supported WTOffline save archive.",
|
||||
"save_not_found": "The selected save could not be found.",
|
||||
"save_read_only": "Saves are read-only while the game or local server is running.",
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
"side": {
|
||||
"requirements": "安装要求",
|
||||
"game": "游戏",
|
||||
"gameValue": "战争雷霆正版客户端",
|
||||
"gameValue": "战争雷霆在线版客户端",
|
||||
"versions": "已验证版本",
|
||||
"space": "磁盘空间",
|
||||
"spaceValue": "约 97 GB(复制安装)",
|
||||
@@ -62,7 +62,7 @@
|
||||
},
|
||||
"bar": {
|
||||
"notInstalled": "未安装",
|
||||
"notInstalledDetail": "需要已安装的战争雷霆正版客户端",
|
||||
"notInstalledDetail": "需要已安装的战争雷霆在线版客户端",
|
||||
"install": "安装",
|
||||
"ready": "就绪",
|
||||
"readyMissing": "就绪 · {{count}} 项功能不可用",
|
||||
@@ -95,7 +95,7 @@
|
||||
},
|
||||
"decals": {
|
||||
"source": "贴花来源",
|
||||
"hint": "可导入正版游戏的 cache/content。未导入时使用占位贴花。",
|
||||
"hint": "可导入在线版游戏的 cache/content。未导入时使用占位贴花。",
|
||||
"choose": "选择贴花缓存…",
|
||||
"useDefault": "使用占位贴花",
|
||||
"importing": "正在导入贴花缓存",
|
||||
@@ -151,13 +151,13 @@
|
||||
"noRoom": "可用空间不足:需要 {{needed}},目标磁盘仅剩 {{free}}。",
|
||||
"problem": {
|
||||
"not_empty": "所选文件夹不为空。请选择空文件夹或新建文件夹。",
|
||||
"overlaps_stock": "不能选择正版安装文件夹本身,或其上级、下级文件夹。",
|
||||
"overlaps_stock": "不能选择在线版安装文件夹本身,或其上级、下级文件夹。",
|
||||
"not_a_folder": "所选路径不是文件夹。"
|
||||
},
|
||||
"copyBodyPending": "将游戏复制到新文件夹。正在统计所需空间。"
|
||||
},
|
||||
"steam": {
|
||||
"inPlaceWarning": "离线启动会修改此 Steam 安装中的游戏文件。Steam 更新或文件校验可能覆盖改动。使用修改后的文件联网启动正版可能导致账号封禁。",
|
||||
"inPlaceWarning": "离线启动会修改此 Steam 安装中的游戏文件。Steam 更新或文件校验可能覆盖改动。使用修改后的文件联网启动在线版可能导致账号封禁。",
|
||||
"copyWarning": "目标文件夹位于 Steam 游戏库。建议将副本放在游戏库之外。",
|
||||
"confirm": "确认使用此文件夹",
|
||||
"dataWarning": "数据目录放在 Steam 游戏文件夹内时,在 Steam 中卸载游戏可能一并删除存档、缓存和日志。",
|
||||
@@ -204,7 +204,7 @@
|
||||
"list": { "current": "当前", "select": "设为当前" },
|
||||
"none": "尚未安装离线版。",
|
||||
"maintenance": {
|
||||
"update": "从正版更新",
|
||||
"update": "从在线版更新",
|
||||
"updateAction": "更新副本",
|
||||
"newVersion": "安装来源已更新至 {{version}}。",
|
||||
"updateDetaches": "安装来源中有新版本 {{version}}。更新会把共享资源复制为独立文件,需要额外空间。",
|
||||
@@ -301,7 +301,7 @@
|
||||
"overview": "概览",
|
||||
"battles": "战绩",
|
||||
"vehicles": "载具与研发",
|
||||
"official": "导入正版备份",
|
||||
"official": "导入在线版数据",
|
||||
"backup": "备份与还原"
|
||||
},
|
||||
"tree": {
|
||||
@@ -337,22 +337,31 @@
|
||||
}
|
||||
},
|
||||
"official": {
|
||||
"files": "备份文件",
|
||||
"fileHint": "请选择复制备份的 global.blk、machine.blk 或 storage.blk。",
|
||||
"auto": "自动导入",
|
||||
"autoHint": "只读查找本机在线版数据并复制到离线目录后再导入,不修改在线版原文件。",
|
||||
"oneClick": "一键查找并导入",
|
||||
"discover": "仅查找并预览",
|
||||
"notFound": "未在默认文档目录中找到在线版数据,请使用下方手动选择。",
|
||||
"account": "在线版账号",
|
||||
"multipleAccounts": "检测到 {{count}} 个在线版账号目录,请选择要导入的账号。",
|
||||
"accountOption": "账号 {{id}}({{files}} · 更新于 {{time}})",
|
||||
"files": "手动选择文件",
|
||||
"fileHint": "也可手动选择复制备份的 global.blk、machine.blk 或 storage.blk。",
|
||||
"choose": "选择文件…",
|
||||
"content": "导入内容",
|
||||
"settings": "游戏设置",
|
||||
"settings": "游戏设置与键位",
|
||||
"unlock": "解锁预设中的载具",
|
||||
"equipment": "改装件",
|
||||
"equipmentHint": "完全体仅解锁常规改装件与弹药,不包含护身符。",
|
||||
"full": "完全体",
|
||||
"basic": "基础生存配件",
|
||||
"stock": "白板状态",
|
||||
"includeUsed": "包含备份中的其他已用载具",
|
||||
"includeUsed": "额外包含其他单车配置中的载具(不连带解锁前置科技树)",
|
||||
"preview": "预览",
|
||||
"import": "导入",
|
||||
"summary": "{{files}} 个文件 · {{presets}} 套预设 · {{vehicles}} 辆可用载具",
|
||||
"omitted": "将跳过的不可用载具 · {{names}}",
|
||||
"done": "备份已导入。原存档可在「备份与还原」中恢复。"
|
||||
"done": "在线版数据已导入。原存档可在「备份与还原」中恢复。"
|
||||
},
|
||||
"archive": {
|
||||
"fromCopy": "从其他副本复制",
|
||||
@@ -592,7 +601,7 @@
|
||||
"features": {
|
||||
"A-Offline startup": "离线启动",
|
||||
"A-Local accounts": "本地账号",
|
||||
"A-Isolation from the official game": "与正版隔离",
|
||||
"A-Isolation from the official game": "与在线版隔离",
|
||||
"A-No Gaijin connections": "阻断 Gaijin 连接",
|
||||
"A-Tutorials": "新手教程",
|
||||
"B-Hangar and vehicles": "机库与载具",
|
||||
@@ -632,8 +641,8 @@
|
||||
"internal_error": "启动器内部错误。",
|
||||
"logs_folder_open_failed": "无法打开启动器日志文件夹。",
|
||||
"diagnostics_export_failed": "无法保存诊断信息。",
|
||||
"save_official_invalid": "所选文件不是受支持的正版备份。",
|
||||
"save_official_location": "请选择复制到正版目录以外的备份文件。",
|
||||
"save_official_invalid": "所选文件不是受支持的在线版数据文件。",
|
||||
"save_official_location": "请选择复制到在线版目录以外的数据文件。",
|
||||
"save_archive_invalid": "所选文件不是受支持的 WTOffline 存档归档。",
|
||||
"save_not_found": "找不到所选存档。",
|
||||
"save_read_only": "游戏或本地服务器运行期间存档为只读。",
|
||||
@@ -655,7 +664,7 @@
|
||||
"maintenance_no_update": "安装来源没有可用的新版本。",
|
||||
"maintenance_cancelled": "副本更新已取消。",
|
||||
"maintenance_failed": "副本维护失败。请查看启动器日志。",
|
||||
"maintenance_source_changed": "安装来源在更新过程中发生变化。请在正版更新完成后重试。",
|
||||
"maintenance_source_changed": "安装来源在更新过程中发生变化。请在在线版更新完成后重试。",
|
||||
"launch_no_copy": "启动前需要安装游戏副本。",
|
||||
"launch_busy": "启动流程正在运行。",
|
||||
"launch_failed": "启动失败。请查看启动器日志。",
|
||||
|
||||
@@ -35,7 +35,7 @@ export function CopyList({ registry, supportedVersions, onSelect, onAdd }: CopyL
|
||||
: <span className="warn">{t('adaptation.unverified')}</span>}
|
||||
</dd>
|
||||
<dt>{t('copies.summary.location')}</dt>
|
||||
<dd className="folder-path" title={copy.copyPath}>{copy.copyPath}</dd>
|
||||
<dd className="folder-path" data-ellipsis-tip={copy.copyPath}>{copy.copyPath}</dd>
|
||||
</dl>
|
||||
<div className="copy-list-actions">
|
||||
{!current && <button type="button" className="button button-primary" onClick={() => onSelect(copy.id)}>{t('copies.list.select')}</button>}
|
||||
|
||||
@@ -36,7 +36,7 @@ export function CopySummary({ record, supportedVersions, onShowFeatures, onError
|
||||
};
|
||||
const folder = (path: string) => (
|
||||
<>
|
||||
<span className="folder-path" title={path}>{path}</span>
|
||||
<span className="folder-path" data-ellipsis-tip={path}>{path}</span>
|
||||
<button type="button" className="button" onClick={() => ipcInvoke('app:openFolder', { path }).catch(onError)}>{t('copies.summary.open')}</button>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -20,7 +20,9 @@ export function BackgroundSwitch({ pictures, shown, onError }: BackgroundSwitchP
|
||||
};
|
||||
return (
|
||||
<div className="background-switch">
|
||||
<span className="background-switch-label" title={backgroundLabel(t, shown)}>{t('background.current', { name: backgroundLabel(t, shown) })}</span>
|
||||
<span className="background-switch-label" data-ellipsis-tip={t('background.current', { name: backgroundLabel(t, shown) })}>
|
||||
{t('background.current', { name: backgroundLabel(t, shown) })}
|
||||
</span>
|
||||
<button type="button" title={t('background.previous')} onClick={() => step(-1)}>‹</button>
|
||||
<button type="button" title={t('background.next')} onClick={() => step(1)}>›</button>
|
||||
</div>
|
||||
|
||||
@@ -40,7 +40,9 @@ export function HomeSide({ record, copies, supportedVersions, onNavigate, onSele
|
||||
<h3 className="side-heading">{t('side.currentCopy')}</h3>
|
||||
<button type="button" className="copy-card copy-card-button" aria-expanded={choosingCopy} onClick={() => setChoosingCopy(!choosingCopy)}>
|
||||
<span className="copy-card-name">{record.name}</span>
|
||||
<span className="copy-card-meta" title={record.copyPath}>{record.gameVersion ?? t('source.versionUnknown')} · {record.copyPath}</span>
|
||||
<span className="copy-card-meta" data-ellipsis-tip={`${record.gameVersion ?? t('source.versionUnknown')} · ${record.copyPath}`}>
|
||||
{record.gameVersion ?? t('source.versionUnknown')} · {record.copyPath}
|
||||
</span>
|
||||
</button>
|
||||
{choosingCopy && (
|
||||
<div className="copy-picker">
|
||||
|
||||
@@ -11,8 +11,10 @@ export function BottomBar({ model }: { readonly model: BarModel }) {
|
||||
<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" title={typeof detail === 'string' ? detail : undefined}>{detail}</div>}
|
||||
<div className="status-title" data-ellipsis-tip={title}>{title}</div>
|
||||
{detail !== undefined && (
|
||||
<div className="status-detail" data-ellipsis-tip={typeof detail === 'string' ? detail : undefined}>{detail}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{secondary && (
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import type { LanguageChoice } from '@shared/languages.ts';
|
||||
import { Wordmark } from '../components/Wordmark.tsx';
|
||||
import { ipcInvoke } from '../ipc.ts';
|
||||
import { LanguageMenu } from './LanguageMenu.tsx';
|
||||
import { PAGES, type PageId } from './navigation.ts';
|
||||
@@ -19,7 +20,7 @@ export function TitleBar({ page, navigationEnabled, language, onNavigate, onErro
|
||||
return (
|
||||
<header className="titlebar">
|
||||
<div className="logo">
|
||||
<div className="logo-word">WT<span>OFFLINE</span></div>
|
||||
<Wordmark className="logo-mark" />
|
||||
<div className="logo-sub">{t('app.subtitle')}</div>
|
||||
</div>
|
||||
<nav className="nav">
|
||||
|
||||
@@ -88,14 +88,64 @@
|
||||
left: 16px;
|
||||
right: 16px;
|
||||
bottom: 14px;
|
||||
z-index: 2;
|
||||
z-index: 4;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin: 0;
|
||||
padding: 8px 12px;
|
||||
padding: 8px 10px 8px 14px;
|
||||
font-size: 13px;
|
||||
color: #f6cfcc;
|
||||
background: rgba(60, 16, 14, 0.92);
|
||||
background: rgba(60, 16, 14, 0.94);
|
||||
border: 1px solid rgba(255, 110, 102, 0.45);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
.app-error-text {
|
||||
min-width: 0;
|
||||
line-height: 1.5;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.app-error-close {
|
||||
flex: none;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 2px;
|
||||
background: none;
|
||||
color: rgba(246, 207, 204, 0.8);
|
||||
font-size: 17px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.app-error-close:hover {
|
||||
color: var(--white);
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
/* Floating tooltip for truncated ellipsis text across the window. */
|
||||
.ellipsis-tooltip {
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
max-width: min(480px, calc(100vw - 24px));
|
||||
padding: 6px 10px;
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
color: var(--white);
|
||||
background: rgba(14, 19, 23, 0.96);
|
||||
border: 1px solid var(--line-strong);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ===== Label / control rows ===== */
|
||||
|
||||
@@ -83,30 +83,30 @@
|
||||
width: 300px;
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 0 22px;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 0 20px;
|
||||
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);
|
||||
.logo-mark {
|
||||
height: 42px;
|
||||
width: auto;
|
||||
flex: none;
|
||||
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;
|
||||
filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
|
||||
}
|
||||
|
||||
.logo-sub {
|
||||
font: 400 11px/1 var(--font-body);
|
||||
color: rgba(255, 255, 255, 0.72);
|
||||
margin-top: 5px;
|
||||
letter-spacing: 0.05em;
|
||||
font: 500 13px/1.2 var(--font-body);
|
||||
color: rgba(255, 255, 255, 0.84);
|
||||
padding-left: 12px;
|
||||
border-left: 1px solid rgba(255, 255, 255, 0.22);
|
||||
letter-spacing: 0.06em;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.nav {
|
||||
|
||||
@@ -2,19 +2,30 @@ import { useCallback, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { AppIpcError } from './ipc.ts';
|
||||
|
||||
export interface ActiveError {
|
||||
readonly id: number;
|
||||
readonly message: string;
|
||||
}
|
||||
|
||||
/** Turns a failed call into the translated message of its error code. */
|
||||
export function useErrorMessage(): { message: string | null; report: (error: unknown) => void; clear: () => void } {
|
||||
export function useErrorMessage(): {
|
||||
message: string | null;
|
||||
error: ActiveError | null;
|
||||
report: (error: unknown) => void;
|
||||
clear: () => void;
|
||||
} {
|
||||
const { t } = useTranslation();
|
||||
const [message, setMessage] = useState<string | null>(null);
|
||||
const [error, setError] = useState<ActiveError | null>(null);
|
||||
|
||||
const report = useCallback(
|
||||
(error: unknown) => {
|
||||
console.error(error);
|
||||
setMessage(error instanceof AppIpcError ? t(`errors.${error.code}`, error.params) : t('errors.unknown'));
|
||||
(failure: unknown) => {
|
||||
console.error(failure);
|
||||
const message = failure instanceof AppIpcError ? t(`errors.${failure.code}`, failure.params) : t('errors.unknown');
|
||||
setError((previous) => ({ id: (previous?.id ?? 0) + 1, message }));
|
||||
},
|
||||
[t],
|
||||
);
|
||||
const clear = useCallback(() => setMessage(null), []);
|
||||
const clear = useCallback(() => setError(null), []);
|
||||
|
||||
return { message, report, clear };
|
||||
return { message: error?.message ?? null, error, report, clear };
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// Without it: the offline login reads and overwrites the retail client's saved credentials.
|
||||
{
|
||||
"id": "isolation/registry-key",
|
||||
"title": "把注册表位置从 Software\\Gaijin\\WarThunder 改成 Software\\WTOffline,不碰正版保存的登录信息",
|
||||
"title": "把注册表位置从 Software\\Gaijin\\WarThunder 改成 Software\\WTOffline,不碰在线版保存的登录信息",
|
||||
"features": [
|
||||
"A-Isolation from the official game"
|
||||
],
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Without it: the offline client reads and rewrites the retail client's settings.
|
||||
{
|
||||
"id": "isolation/user-data-folder-name",
|
||||
"title": "把游戏名从 WarThunder 改成 WTOffline,让离线版的用户数据目录和正版分开",
|
||||
"title": "把游戏名从 WarThunder 改成 WTOffline,让离线版的用户数据目录和在线版分开",
|
||||
"features": [
|
||||
"A-Isolation from the official game"
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user