feat(launcher): use two-column About layout and add Discord link
This commit is contained in:
1 parent
899fb5d91b
commit
fa7f68b942
6 files changed
+156
-41
No files matched your search
@@ -638,7 +638,12 @@
|
||||
}
|
||||
},
|
||||
"statement": "Project information",
|
||||
"statementBody": "WTOffline is a noncommercial hobby project independent of Gaijin. Running it requires your own War Thunder base game files."
|
||||
"statementBody": "WTOffline is a noncommercial hobby project independent of Gaijin. Running it requires your own War Thunder base game files.",
|
||||
"community": {
|
||||
"discord": "Discord",
|
||||
"discordHint": "Development discussion, general chat, troubleshooting, and bug reports.",
|
||||
"openDiscord": "Open Discord"
|
||||
}
|
||||
},
|
||||
"features": {
|
||||
"A-Offline startup": "Offline startup",
|
||||
|
||||
@@ -638,7 +638,12 @@
|
||||
}
|
||||
},
|
||||
"statement": "项目信息",
|
||||
"statementBody": "WTOffline 是一个独立于 Gaijin 的非商业兴趣项目。运行需要自备战争雷霆游戏本体文件。"
|
||||
"statementBody": "WTOffline 是一个独立于 Gaijin 的非商业兴趣项目。运行需要自备战争雷霆游戏本体文件。",
|
||||
"community": {
|
||||
"discord": "Discord",
|
||||
"discordHint": "开发讨论、日常交流、使用求助与问题反馈。",
|
||||
"openDiscord": "打开 Discord"
|
||||
}
|
||||
},
|
||||
"features": {
|
||||
"A-Offline startup": "离线启动",
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Notice } from '../../components/Notice.tsx';
|
||||
import { Row } from '../../components/Row.tsx';
|
||||
import { Sheet } from '../../components/Sheet.tsx';
|
||||
import { ipcInvoke } from '../../ipc.ts';
|
||||
import type { AppUpdateState } from '../../shell/useAppUpdate.ts';
|
||||
import { AppUpdateSection } from './AppUpdateSection.tsx';
|
||||
import type { PatchPackState } from '../../shell/usePatchPack.ts';
|
||||
|
||||
const DISCORD_INVITE_URL = 'https://discord.gg/P566xWNpEs';
|
||||
|
||||
interface AboutPageProps {
|
||||
readonly launcherVersion: string;
|
||||
readonly supportedVersions: readonly string[];
|
||||
@@ -17,7 +18,7 @@ interface AboutPageProps {
|
||||
readonly onError: (error: unknown) => void;
|
||||
}
|
||||
|
||||
/** The launcher's version, the game versions it supports, adaptation pack updates, log export, and the project statement. */
|
||||
/** The launcher's version, the game versions it supports, updates, community links, log export, and the project statement. */
|
||||
export function AboutPage({ launcherVersion, supportedVersions, patchPack, appUpdate, loggingEnabled, onError }: AboutPageProps) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
@@ -30,15 +31,41 @@ export function AboutPage({ launcherVersion, supportedVersions, patchPack, appUp
|
||||
{t('about.supported', { versions: supportedVersions.join(', ') })}
|
||||
</div>
|
||||
</div>
|
||||
<AppUpdateSection state={appUpdate} />
|
||||
<PatchPackSection state={patchPack} />
|
||||
<FeedbackLogsSection loggingEnabled={loggingEnabled} onError={onError} />
|
||||
<h3 className="section-title section-title-spaced">{t('about.statement')}</h3>
|
||||
<p className="lead">{t('about.statementBody')}</p>
|
||||
<div className="about-columns">
|
||||
<div className="about-column">
|
||||
<AppUpdateSection state={appUpdate} />
|
||||
<PatchPackSection state={patchPack} />
|
||||
</div>
|
||||
<div className="about-column">
|
||||
<CommunitySection />
|
||||
<FeedbackLogsSection loggingEnabled={loggingEnabled} onError={onError} />
|
||||
<section className="about-card">
|
||||
<h3 className="about-card-title">{t('about.statement')}</h3>
|
||||
<p className="about-card-meta">{t('about.statementBody')}</p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</Sheet>
|
||||
);
|
||||
}
|
||||
|
||||
function CommunitySection() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<section className="about-card">
|
||||
<div className="about-card-head">
|
||||
<h3 className="about-card-title">{t('about.community.discord')}</h3>
|
||||
<div className="about-card-actions">
|
||||
<a className="button" href={DISCORD_INVITE_URL} target="_blank" rel="noreferrer">
|
||||
{t('about.community.openDiscord')}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<p className="about-card-meta">{t('about.community.discordHint')}</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function FeedbackLogsSection({ loggingEnabled, onError }: {
|
||||
readonly loggingEnabled: boolean;
|
||||
readonly onError: (error: unknown) => void;
|
||||
@@ -61,16 +88,19 @@ function FeedbackLogsSection({ loggingEnabled, onError }: {
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3 className="section-title section-title-spaced">{t('about.feedback.title')}</h3>
|
||||
<Row label={t('about.feedback.export')} hint={t('about.feedback.exportHint')}>
|
||||
<button type="button" className="button" disabled={exporting} onClick={() => { void save(); }}>
|
||||
{t('about.feedback.exportButton')}
|
||||
</button>
|
||||
</Row>
|
||||
<section className="about-card">
|
||||
<div className="about-card-head">
|
||||
<h3 className="about-card-title">{t('about.feedback.title')}</h3>
|
||||
<div className="about-card-actions">
|
||||
<button type="button" className="button" disabled={exporting} onClick={() => { void save(); }}>
|
||||
{t('about.feedback.exportButton')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="about-card-meta">{t('about.feedback.exportHint')}</p>
|
||||
{!loggingEnabled && <p className="small">{t('settings.diagnostics.loggingDisabledNotice')}</p>}
|
||||
{savedPath && <p className="small" role="status">{t('settings.diagnostics.saved', { path: savedPath })}</p>}
|
||||
</>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -85,25 +115,30 @@ function PatchPackSection({ state }: { readonly state: PatchPackState }) {
|
||||
? t('about.pack.bundledVersion', { version: active.version })
|
||||
: t('about.pack.bundled');
|
||||
return (
|
||||
<>
|
||||
<h3 className="section-title">{t('about.pack.title')}</h3>
|
||||
<Row label={t('about.pack.current')} hint={t('about.pack.currentHint')}>
|
||||
<span>{current}</span>
|
||||
{active?.source === 'downloaded' && (
|
||||
<button type="button" className="button" disabled={busy !== null} onClick={state.useBundled}>
|
||||
{t('about.pack.useBundled')}
|
||||
<section className="about-card">
|
||||
<div className="about-card-head">
|
||||
<h3 className="about-card-title">{t('about.pack.title')}</h3>
|
||||
<div className="about-card-actions">
|
||||
<button type="button" className="button" disabled={busy !== null} onClick={state.checkNow}>
|
||||
{busy === 'checking' ? t('about.pack.checking') : t('about.pack.checkButton')}
|
||||
</button>
|
||||
)}
|
||||
</Row>
|
||||
<Row label={t('about.pack.check')} hint={t('about.pack.checkHint')}>
|
||||
<button type="button" className="button" disabled={busy !== null} onClick={state.checkNow}>
|
||||
{busy === 'checking' ? t('about.pack.checking') : t('about.pack.checkButton')}
|
||||
</button>
|
||||
</Row>
|
||||
{active?.source === 'downloaded' && (
|
||||
<button type="button" className="button" disabled={busy !== null} onClick={state.useBundled}>
|
||||
{t('about.pack.useBundled')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<p className="about-card-meta">
|
||||
<span className="about-card-label">{t('about.pack.current')}</span>
|
||||
{' · '}
|
||||
{current}
|
||||
</p>
|
||||
<p className="small">{t('about.pack.currentHint')}</p>
|
||||
{busy === 'applying' && <p className="small">{t('about.pack.applying')}</p>}
|
||||
{state.applyFailure && <Notice tone="error"><p>{t(`about.pack.applyFailed.${state.applyFailure}`)}</p></Notice>}
|
||||
{check && busy !== 'checking' && <CheckResult state={state} />}
|
||||
</>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Notice } from '../../components/Notice.tsx';
|
||||
import { ProgressBar } from '../../components/ProgressBar.tsx';
|
||||
import { Row } from '../../components/Row.tsx';
|
||||
import { formatBytes } from '../../format.ts';
|
||||
import type { AppUpdateState } from '../../shell/useAppUpdate.ts';
|
||||
|
||||
@@ -10,13 +9,16 @@ export function AppUpdateSection({ state }: { readonly state: AppUpdateState })
|
||||
if (!state.supported) return null;
|
||||
const { check, busy, progress } = state;
|
||||
return (
|
||||
<>
|
||||
<h3 className="section-title">{t('about.update.title')}</h3>
|
||||
<Row label={t('about.update.check')}>
|
||||
<button type="button" className="button" disabled={busy !== null} onClick={state.checkNow}>
|
||||
{t(busy === 'checking' ? 'about.update.checking' : 'about.pack.checkButton')}
|
||||
</button>
|
||||
</Row>
|
||||
<section className="about-card">
|
||||
<div className="about-card-head">
|
||||
<h3 className="about-card-title">{t('about.update.title')}</h3>
|
||||
<div className="about-card-actions">
|
||||
<button type="button" className="button" disabled={busy !== null} onClick={state.checkNow}>
|
||||
{t(busy === 'checking' ? 'about.update.checking' : 'about.pack.checkButton')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="about-card-meta">{t('about.update.check')}</p>
|
||||
{check?.status === 'current' && busy !== 'checking' && <Notice tone="info"><p>{t('about.update.current')}</p></Notice>}
|
||||
{check?.status === 'failed' && busy !== 'checking' && <Notice tone="error"><p>{t(`about.update.errors.${check.problem}`)}</p></Notice>}
|
||||
{check?.status === 'available' && busy !== 'checking' && (
|
||||
@@ -43,6 +45,6 @@ export function AppUpdateSection({ state }: { readonly state: AppUpdateState })
|
||||
)}
|
||||
</Notice>
|
||||
)}
|
||||
</>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -215,9 +215,13 @@
|
||||
|
||||
/* ===== Buttons and links ===== */
|
||||
.button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font: 500 14px var(--font-display);
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
padding: 7px 16px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -371,3 +371,67 @@
|
||||
line-height: 1.6;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.about-columns {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.about-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.about-card {
|
||||
min-width: 0;
|
||||
padding: 14px 16px;
|
||||
background: rgba(0, 0, 0, 0.14);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.about-card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.about-card-title {
|
||||
margin: 0;
|
||||
font: 500 14px var(--font-display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--white);
|
||||
}
|
||||
|
||||
.about-card-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.about-card-meta {
|
||||
margin: 8px 0 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.about-card-label {
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.about-card .notice {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.about-card .notice .button {
|
||||
margin-top: 8px;
|
||||
}
|
||||
Reference in new issue
Block a user