fix(ui): 统一下载页主题与智能路由页签间距

This commit is contained in:
zhanjunhao
2026-11-18 17:39:19 +08:00
parent 4c6e9acb6e
commit d076fb5325
12 changed files with 253 additions and 324 deletions
+76 -96
View File
@@ -32,7 +32,7 @@ import {
} from '@/components/common/icons/ActionIcons';
import React, { useContext, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Button, Skeleton, Tag } from '@/components/ui';
import { Button, Skeleton, Tag } from 'antd';
import {
AlertTriangle,
Cpu,
@@ -49,8 +49,7 @@ import {
import { API } from '../../helpers/api';
import { StatusContext } from '../../context/Status';
import { UserContext } from '../../context/User';
import PageBackground from '../../components/common/PageBackground';
import UserCenterBreadcrumb from '../../components/common/UserCenterBreadcrumb';
import UserCenterPageHeader from '../../components/common/UserCenterPageHeader';
import { useWeyAiWebEntry } from '../../hooks/common/useWeyAiWebEntry';
import {
PLATFORMS,
@@ -247,9 +246,12 @@ const WeyAiDownload = ({ embedded = false }) => {
);
const scrollToAll = () => {
document
.getElementById(ALL_PACKAGES_ID)
?.scrollIntoView({ behavior: 'smooth', block: 'start' });
document.getElementById(ALL_PACKAGES_ID)?.scrollIntoView({
behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches
? 'instant'
: 'smooth',
block: 'start',
});
};
const download = (url) => window.open(url, '_self');
@@ -275,21 +277,16 @@ const WeyAiDownload = ({ embedded = false }) => {
<div className='wd-file__main'>
<div className='wd-file__title'>
<span>{archLabel(file.arch) || file.name}</span>
{file.kind && <Tag size='small'>{file.kind}</Tag>}
{isReco && (
<Tag size='small' color='blue'>
{t('推荐')}
</Tag>
)}
{file.kind && <Tag>{file.kind}</Tag>}
{isReco && <Tag className='wd-recommended-tag'>{t('推荐')}</Tag>}
</div>
<span className='wd-file__meta' title={file.name}>
{fileMeta(file)}
</span>
</div>
<Button
icon={<ActionDownload size={14} />}
theme={isReco ? 'solid' : 'light'}
type='primary'
icon={<ActionDownload size={16} aria-hidden />}
type={isReco ? 'primary' : 'default'}
aria-label={`${t('下载')} ${file.name}`}
onClick={() => download(file.url)}
>
@@ -322,7 +319,7 @@ const WeyAiDownload = ({ embedded = false }) => {
</h2>
<div className='wd-reco__meta'>
<code>{recommended.name}</code>
{recommended.size && (
{recommended.size > 0 && (
<span>{formatSize(recommended.size)}</span>
)}
{release?.version && <span>v{release.version}</span>}
@@ -342,15 +339,13 @@ const WeyAiDownload = ({ embedded = false }) => {
</div>
<div className='wd-reco__actions'>
<Button
size='large'
theme='solid'
type='primary'
icon={<ActionDownload size={16} />}
icon={<ActionDownload size={16} aria-hidden />}
onClick={() => download(recommended.url)}
>
{t('下载 WeyAi')}
</Button>
<Button theme='borderless' type='tertiary' onClick={scrollToAll}>
<Button type='text' onClick={scrollToAll}>
{t('其他平台与架构')}
</Button>
</div>
@@ -387,10 +382,8 @@ const WeyAiDownload = ({ embedded = false }) => {
</div>
<div className='wd-reco__actions'>
<Button
size='large'
theme='solid'
type='primary'
icon={<ActionDownload size={16} />}
icon={<ActionDownload size={16} aria-hidden />}
onClick={() => download(androidApk.url)}
>
{t('下载 Android 版')}
@@ -431,7 +424,7 @@ const WeyAiDownload = ({ embedded = false }) => {
</div>
{client.os !== 'mobile' && (
<div className='wd-reco__actions'>
<Button theme='solid' type='primary' onClick={scrollToAll}>
<Button type='primary' onClick={scrollToAll}>
{t('查看全部安装包')}
</Button>
</div>
@@ -445,17 +438,8 @@ const WeyAiDownload = ({ embedded = false }) => {
if (!statusLoaded || loading) {
return (
<section className='wd-card wd-skeleton' aria-busy='true'>
<Skeleton
loading
active
placeholder={
<>
<Skeleton.Title style={{ width: 240 }} />
<Skeleton.Paragraph rows={2} style={{ marginTop: 12 }} />
<Skeleton.Button style={{ width: 160, marginTop: 12 }} />
</>
}
/>
<Skeleton active title={{ width: '40%' }} paragraph={{ rows: 2 }} />
<Skeleton.Button active style={{ width: 160, maxWidth: '100%' }} />
</section>
);
}
@@ -477,9 +461,8 @@ const WeyAiDownload = ({ embedded = false }) => {
desc={loadError}
actions={
<Button
theme='solid'
type='primary'
icon={<ActionRefreshCw size={14} />}
icon={<ActionRefreshCw size={16} aria-hidden />}
onClick={load}
>
{t('重试')}
@@ -542,16 +525,14 @@ const WeyAiDownload = ({ embedded = false }) => {
<div className='wd-file__main'>
<div className='wd-file__title'>
<span>{I18N_TECHNICAL_TEXT.ANDROID}</span>
<Tag size='small'>apk</Tag>
<Tag>apk</Tag>
</div>
<span className='wd-file__meta' title={androidApk.name}>
{androidMeta}
</span>
</div>
<Button
icon={<ActionDownload size={14} />}
theme='light'
type='primary'
icon={<ActionDownload size={16} aria-hidden />}
aria-label={`${t('下载')} ${androidApk.name}`}
onClick={() => download(androidApk.url)}
>
@@ -572,72 +553,71 @@ const WeyAiDownload = ({ embedded = false }) => {
};
const rootClass = `weyai-download ${
embedded
? 'weyai-download--embedded'
: 'weyai-download--standalone mt-[60px]'
embedded ? 'weyai-download--embedded' : 'weyai-download--standalone'
}`;
const heroActions = (
<div className='wd-hero-actions'>
{isLoggedIn && webVisible && webUrl && (
<Button
icon={<ActionGlobe size={16} aria-hidden />}
onClick={() => window.open(webUrl, '_blank', 'noopener')}
>
{t('使用网页版')}
</Button>
)}
<Button
icon={<ActionExternalLink size={16} aria-hidden />}
onClick={() => {
window.location.href = OPEN_APP_URL;
}}
>
{t('已安装?打开 WeyAi')}
</Button>
</div>
);
return (
<div className={rootClass}>
{!embedded && <PageBackground grid />}
<div className='weyai-download__inner'>
{embedded && <UserCenterBreadcrumb />}
<header className='wd-hero'>
<div className='min-w-0'>
<div className='wd-hero'>
{!embedded && (
<div className='wd-eyebrow'>
<MonitorDown size={14} aria-hidden='true' />
<MonitorDown size={16} aria-hidden='true' />
{I18N_TECHNICAL_TEXT.WEYAI_DESKTOP}
</div>
<h1>{t('下载 WeyAi 桌面端')}</h1>
<p>{t('用你的账号登录,直接使用平台提供的模型和余额')}</p>
<div className='wd-hero-meta'>
{release?.version && (
<span className='wd-chip'>
{t('最新版本 v{{version}}', { version: release.version })}
</span>
)}
{release?.releaseDate && (
<span className='wd-chip wd-chip--muted'>
{t('发布于 {{date}}', {
date: formatReleaseDate(release.releaseDate),
})}
</span>
)}
{/* 有清单时按实际有安装包的平台展示,别在缺某平台 feed 时还声称支持 */}
<span className='wd-chip wd-chip--muted'>
{[
...(platformsWithFiles.length
? platformsWithFiles
: PLATFORMS
).map((platform) => PLATFORM_LABEL[platform]),
...(androidApk ? ['Android'] : []),
].join(' · ')}
)}
<UserCenterPageHeader
title={t('下载 WeyAi 桌面端')}
subtitle={t('用你的账号登录,直接使用平台提供的模型和余额')}
breadcrumb={embedded ? undefined : null}
extra={heroActions}
/>
<div className='wd-hero-meta'>
{release?.version && (
<span className='wd-chip'>
{t('最新版本 v{{version}}', { version: release.version })}
</span>
</div>
</div>
<div className='wd-hero-actions'>
{/* 未登录访客不给网页版按钮:hook 对匿名恒可见,点了会直接打到网关的
/sso/start 再被弹回登录,不如顶栏那样先引导登录 */}
{isLoggedIn && webVisible && webUrl && (
<Button
icon={<ActionGlobe size={14} />}
theme='light'
type='primary'
onClick={() => window.open(webUrl, '_blank', 'noopener')}
>
{t('使用网页版')}
</Button>
)}
<Button
icon={<ActionExternalLink size={14} />}
onClick={() => {
window.location.href = OPEN_APP_URL;
}}
>
{t('已安装?打开 WeyAi')}
</Button>
{release?.releaseDate && (
<span className='wd-chip wd-chip--muted'>
{t('发布于 {{date}}', {
date: formatReleaseDate(release.releaseDate),
})}
</span>
)}
{/* 有清单时按实际有安装包的平台展示,别在缺某平台 feed 时还声称支持 */}
<span className='wd-chip wd-chip--muted'>
{[
...(platformsWithFiles.length
? platformsWithFiles
: PLATFORMS
).map((platform) => PLATFORM_LABEL[platform]),
...(androidApk ? ['Android'] : []),
].join(' · ')}
</span>
</div>
</header>
</div>
{renderPackages()}