🐛 fix(about): 移除重复更新日志入口 (#834)

This commit is contained in:
mango
2026-08-05 11:29:59 +08:00
parent c7ac6d8a23
commit a0f84fd6e3
3 changed files with 26 additions and 3 deletions

View File

@@ -22,6 +22,10 @@ import {
isReleaseNotesRead,
markReleaseNotesRead,
} from './utils/updateReleaseNotesReadState';
import {
shouldShowFooterReleaseNotesAction,
type AboutUpdateActionsSurface,
} from './utils/aboutUpdateActions';
import { type DataSyncEntryMode } from './components/dataSyncEntryMode';
import DriverManagerModal from './components/DriverManagerModal';
import LinuxCJKFontBanner from './components/LinuxCJKFontBanner';
@@ -5408,14 +5412,17 @@ function App() {
) : null
);
const renderAboutUpdateActions = (closeAction?: React.ReactNode) => [
const renderAboutUpdateActions = (
surface: AboutUpdateActionsSurface,
closeAction?: React.ReactNode,
) => [
isBackgroundProgressForLatestUpdate && !isLatestUpdateDownloaded ? (
<Button key="progress" icon={<DownloadOutlined />} onClick={showUpdateDownloadProgress}>{t('app.about.action.download_progress')}</Button>
) : null,
lastUpdateInfo?.hasUpdate && !isLatestUpdateDownloaded && !isBackgroundProgressForLatestUpdate ? (
<Button key="mute" onClick={muteLatestUpdate}>{t('app.about.action.mute_this_version')}</Button>
) : null,
renderReleaseNotesActionButton(),
shouldShowFooterReleaseNotesAction(surface) ? renderReleaseNotesActionButton() : null,
<Button
key="check"
icon={<CloudDownloadOutlined />}
@@ -5812,7 +5819,7 @@ function App() {
</span>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', gap: 12, flexWrap: 'wrap' }}>
{renderAboutUpdateActions()}
{renderAboutUpdateActions('settings-center')}
</div>
</>
);
@@ -9202,6 +9209,7 @@ function App() {
onCancel={() => setIsAboutOpen(false)}
styles={{ content: utilityModalShellStyle, header: { background: 'transparent', borderBottom: 'none', paddingBottom: 8 }, body: { paddingTop: 8 }, footer: { background: 'transparent', borderTop: 'none', paddingTop: 10, display: 'flex', flexWrap: 'wrap', gap: 10, justifyContent: 'flex-end' } }}
footer={renderAboutUpdateActions(
'legacy-modal',
<Button key="close" onClick={() => setIsAboutOpen(false)}>{t('common.close')}</Button>,
)}
>

View File

@@ -0,0 +1,10 @@
import { describe, expect, it } from 'vitest';
import { shouldShowFooterReleaseNotesAction } from './aboutUpdateActions';
describe('aboutUpdateActions', () => {
it('keeps release notes in the legacy modal footer only', () => {
expect(shouldShowFooterReleaseNotesAction('legacy-modal')).toBe(true);
expect(shouldShowFooterReleaseNotesAction('settings-center')).toBe(false);
});
});

View File

@@ -0,0 +1,5 @@
export type AboutUpdateActionsSurface = 'settings-center' | 'legacy-modal';
export const shouldShowFooterReleaseNotesAction = (
surface: AboutUpdateActionsSurface,
): boolean => surface === 'legacy-modal';