Merge pull request #4837 from deepseek-harness/feat/desktop-update-ui-2
fix(desktop): polish the Windows update copy, app icon and About dialog
No files matched your search
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -119,6 +119,8 @@ static LRESULT CALLBACK ProgressProc(HWND window, UINT message, WPARAM wparam, L
|
||||
graphics.ScaleTransform(page->dpi / 96.0f, page->dpi / 96.0f);
|
||||
graphics.Clear(page->dark ? Color(255, 21, 21, 23) : Color(255, 255, 255, 255));
|
||||
graphics.SetSmoothingMode(SmoothingModeAntiAlias);
|
||||
graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);
|
||||
graphics.SetPixelOffsetMode(PixelOffsetModeHalf);
|
||||
graphics.DrawImage(page->brand, Rect(0, 174, 600, 196));
|
||||
const int stage = static_cast<int>(reinterpret_cast<INT_PTR>(GetPropW(GetParent(window), L"HarnessInstaller.Stage")));
|
||||
const double fraction = reinterpret_cast<UINT_PTR>(GetPropW(GetParent(window), L"HarnessInstaller.ExtractProgress")) / 100.0;
|
||||
|
||||
|
Before Width: | Height: | Size: 325 KiB After Width: | Height: | Size: 126 KiB |
@@ -1,8 +1,8 @@
|
||||
<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(32 32) scale(0.9375) translate(-40 -32)"><g filter="url(#filter0_d_1637_371)">
|
||||
<rect rx="44" width="1024" height="1024" transform="translate(40 32)" fill="#FBFBFB"/>
|
||||
<rect rx="44" width="1024" height="1024" transform="translate(40 32)" fill="url(#paint0_linear_1637_371)" fill-opacity="0.4"/>
|
||||
<rect rx="44" width="1024" height="1024" transform="translate(40 32)" fill="url(#paint1_linear_1637_371)" fill-opacity="0.8"/>
|
||||
<rect rx="192" width="1024" height="1024" transform="translate(40 32)" fill="#FBFBFB"/>
|
||||
<rect rx="192" width="1024" height="1024" transform="translate(40 32)" fill="url(#paint0_linear_1637_371)" fill-opacity="0.4"/>
|
||||
<rect rx="192" width="1024" height="1024" transform="translate(40 32)" fill="url(#paint1_linear_1637_371)" fill-opacity="0.8"/>
|
||||
<g filter="url(#filter1_ddi_1637_371)">
|
||||
<path d="M968.002 326.025C959.5 321.85 955.842 329.804 950.865 333.835C949.162 335.143 947.722 336.834 946.283 338.393C933.859 351.673 919.336 360.407 900.376 359.363C872.649 357.804 848.963 366.525 828.035 387.759C823.586 361.583 808.812 345.951 786.313 335.936C774.536 330.729 762.64 325.51 754.401 314.186C748.645 306.112 747.074 297.127 744.195 288.274C742.36 282.936 740.538 277.465 734.385 276.554C727.718 275.51 725.103 281.112 722.476 285.803C712.006 304.95 707.952 326.039 708.349 347.405C709.26 395.463 729.54 433.742 769.823 460.962C774.404 464.094 775.579 467.212 774.14 471.771C771.394 481.153 768.119 490.257 765.241 499.639C763.406 505.624 760.66 506.933 754.256 504.329C732.154 495.08 713.049 481.417 696.175 464.874C667.524 437.138 641.633 406.536 609.325 382.566C601.733 376.964 594.154 371.758 586.298 366.802C553.33 334.773 590.616 308.464 599.251 305.333C608.282 302.082 602.393 290.877 573.214 291.009C544.048 291.141 517.364 300.906 483.353 313.935C478.389 315.891 473.147 317.318 467.786 318.494C436.917 312.64 404.873 311.332 371.377 315.111C308.332 322.141 257.975 351.964 220.953 402.876C176.471 464.081 166.014 533.624 178.835 606.153C192.302 682.594 231.291 745.887 291.194 795.372C353.328 846.68 424.876 871.813 506.498 866.99C556.076 864.122 611.279 857.489 673.532 804.74C689.23 812.55 705.708 815.681 733.052 818.02C754.111 819.976 774.391 816.976 790.076 813.726C814.674 808.519 812.971 785.726 804.072 781.564C731.995 747.962 747.826 761.638 733.435 750.565C770.06 707.198 825.263 662.139 846.85 516.156C848.553 504.567 847.114 497.273 846.85 487.892C846.718 482.157 848.025 479.95 854.574 479.303C872.623 477.215 890.156 472.273 906.238 463.42C952.938 437.892 971.765 395.965 976.215 345.7C976.875 338.01 976.083 330.069 967.976 326.039L968.002 326.025ZM561.067 778.432C491.222 723.477 457.343 705.374 443.347 706.154C430.263 706.933 432.626 721.918 435.505 731.682C438.515 741.315 442.436 747.962 447.929 756.418C451.718 762.021 454.346 770.345 444.14 776.609C421.641 790.549 382.533 771.918 380.698 771.006C335.174 744.182 297.109 708.757 270.293 660.316C244.389 613.698 229.35 563.685 226.868 510.302C226.208 497.406 230.01 492.847 242.831 490.508C259.704 487.376 277.106 486.729 293.98 489.2C365.264 499.625 425.959 531.523 476.844 582.052C505.878 610.831 527.861 645.213 550.491 678.815C574.561 714.492 600.452 748.49 633.42 776.358C645.066 786.122 654.348 793.548 663.247 799.019C636.431 802.018 591.698 802.666 561.08 778.445L561.067 778.432ZM594.55 562.905C594.55 557.171 599.132 552.625 604.888 552.625C606.195 552.625 607.371 552.876 608.414 553.273C609.853 553.801 611.16 554.581 612.203 555.744C614.038 557.567 615.081 560.17 615.081 562.905C615.081 568.64 610.5 573.185 604.743 573.185C598.987 573.185 594.537 568.627 594.537 562.905H594.55ZM698.539 616.301C691.871 619.037 685.19 621.375 678.787 621.64C668.845 622.155 657.992 618.125 652.103 613.17C642.953 605.479 636.404 601.185 633.658 587.773C632.483 582.039 633.13 573.185 634.186 568.111C636.536 557.171 633.922 550.141 626.212 543.759C619.927 538.553 611.952 537.112 603.185 537.112C599.911 537.112 596.914 535.685 594.682 534.509C591.025 532.686 588.015 528.127 590.893 522.525C591.804 520.701 596.254 516.275 597.297 515.495C609.206 508.716 622.937 510.936 635.625 516.01C647.403 520.833 656.288 529.686 669.109 542.186C682.193 557.289 684.543 561.465 692.003 572.789C697.892 581.642 703.252 590.759 706.909 601.185C709.128 607.699 706.249 613.038 698.539 616.288V616.301Z" fill="url(#paint2_linear_1637_371)" fill-opacity="0.9"/>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
@@ -3,6 +3,8 @@
|
||||
export const en = {
|
||||
application: 'Application',
|
||||
aboutMenu: 'About DeepSeek Harness',
|
||||
aboutProduct: 'DeepSeek Harness',
|
||||
aboutVersion: 'Version V{version}',
|
||||
hideApplication: 'Hide DeepSeek Harness',
|
||||
hideOtherApplications: 'Hide Others',
|
||||
showAllApplications: 'Show All',
|
||||
@@ -88,7 +90,7 @@ export const en = {
|
||||
updateTechnicalDetails: 'View technical details',
|
||||
updateTitle: 'DeepSeek Harness Update',
|
||||
updateAvailable: 'An update is available',
|
||||
updateDetail: 'DeepSeek Harness {version}\n\nThis release includes its matching dsh version. The application will restart after installation.',
|
||||
updateDetail: 'DeepSeek Harness {version}\n\nDeepSeek Harness will restart to complete the update.',
|
||||
installAndRestart: 'Install and Restart',
|
||||
later: 'Later',
|
||||
updateFailedTitle: 'Update Failed',
|
||||
@@ -130,6 +132,8 @@ export type DesktopMessages = { readonly [Key in keyof typeof en]: string }
|
||||
export const zh = {
|
||||
application: '应用',
|
||||
aboutMenu: '关于 DeepSeek Harness',
|
||||
aboutProduct: 'DeepSeek Harness',
|
||||
aboutVersion: '版本 V{version}',
|
||||
hideApplication: '隐藏 DeepSeek Harness',
|
||||
hideOtherApplications: '隐藏其他',
|
||||
showAllApplications: '显示全部',
|
||||
@@ -215,7 +219,7 @@ export const zh = {
|
||||
updateTechnicalDetails: '查看技术详情',
|
||||
updateTitle: 'DeepSeek Harness 更新',
|
||||
updateAvailable: '发现可用更新',
|
||||
updateDetail: 'DeepSeek Harness {version}\n\n新版本绑定匹配的 dsh,安装后将重新启动。',
|
||||
updateDetail: 'DeepSeek Harness {version}\n\nDeepSeek Harness 将重启以完成更新。',
|
||||
installAndRestart: '安装并重启',
|
||||
later: '稍后',
|
||||
updateFailedTitle: '更新失败',
|
||||
|
||||
@@ -276,6 +276,13 @@ async function main(): Promise<void> {
|
||||
}
|
||||
finally { ordinaryDialogs.delete(controller) }
|
||||
}
|
||||
// Copy comes from the same locale as the update prompts so the dialog
|
||||
// chrome and its content never mix languages.
|
||||
const showAbout = async (): Promise<void> => {
|
||||
await ordinaryMessageBox({ type: 'info', title: locale.messages.aboutMenu, message: locale.messages.aboutProduct,
|
||||
detail: formatDesktopMessage(locale.messages.aboutVersion, { version: app.getVersion() }),
|
||||
buttons: [locale.messages.updateAcknowledge], cancelId: 0 })
|
||||
}
|
||||
const appPreload = fileURLToPath(new URL('./preload-app.cjs', import.meta.url))
|
||||
const applicationUrl = `${SCHEME}://app/`
|
||||
let hostUrl: string | undefined
|
||||
@@ -753,7 +760,12 @@ async function main(): Promise<void> {
|
||||
{ role: 'unhide', label: currentDesktopLocale().messages.showAllApplications }, { type: 'separator' }]
|
||||
: []
|
||||
const applicationItems = (): MenuItemConstructorOptions[] => [
|
||||
{ label: currentDesktopLocale().messages.aboutMenu, role: 'about' },
|
||||
// Windows has no system About panel; Electron's fallback is a plain
|
||||
// message box, so the shell shows its own dimmed dialog instead.
|
||||
process.platform === 'win32'
|
||||
? { label: currentDesktopLocale().messages.aboutMenu,
|
||||
click: () => { void showAbout().catch((error: unknown) => { console.error(error) }) } }
|
||||
: { label: currentDesktopLocale().messages.aboutMenu, role: 'about' },
|
||||
{ type: 'separator' },
|
||||
{ label: currentDesktopLocale().messages.checkUpdatesMenu, click: () => { void openUpdatePrompt(true) } },
|
||||
...development ? [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"en-US": {
|
||||
"darwin:en-US": {
|
||||
"menu": [
|
||||
{ "label": "About DeepSeek Harness", "role": "about" },
|
||||
{ "type": "separator" }
|
||||
@@ -12,7 +12,7 @@
|
||||
"iconPath": "<app icon>"
|
||||
}
|
||||
},
|
||||
"zh-CN": {
|
||||
"darwin:zh-CN": {
|
||||
"menu": [
|
||||
{ "label": "关于 DeepSeek Harness", "role": "about" },
|
||||
{ "type": "separator" }
|
||||
@@ -24,5 +24,31 @@
|
||||
"copyright": "",
|
||||
"iconPath": "<app icon>"
|
||||
}
|
||||
},
|
||||
"win32:zh-CN": {
|
||||
"menu": [
|
||||
{ "label": "关于 DeepSeek Harness" },
|
||||
{ "type": "separator" }
|
||||
],
|
||||
"options": {
|
||||
"applicationName": "DeepSeek Harness",
|
||||
"applicationVersion": "1.0.0",
|
||||
"version": "",
|
||||
"copyright": "",
|
||||
"iconPath": "<app icon>"
|
||||
}
|
||||
},
|
||||
"win32:en-US": {
|
||||
"menu": [
|
||||
{ "label": "About DeepSeek Harness" },
|
||||
{ "type": "separator" }
|
||||
],
|
||||
"options": {
|
||||
"applicationName": "DeepSeek Harness",
|
||||
"applicationVersion": "1.0.0",
|
||||
"version": "",
|
||||
"copyright": "",
|
||||
"iconPath": "<app icon>"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,7 +405,7 @@ describe('desktop main startup', () => {
|
||||
['darwin', false, 'zh-CN'],
|
||||
['win32', true, 'zh-CN'],
|
||||
['win32', false, 'en-US'],
|
||||
] as const)('offers the native About panel before other commands on %s (packaged=%s, locale=%s)', async (platform, packaged, locale) => {
|
||||
] as const)('offers the About command before other commands on %s (packaged=%s, locale=%s)', async (platform, packaged, locale) => {
|
||||
vi.stubGlobal('process', { ...process, platform })
|
||||
harness.app.isPackaged = packaged
|
||||
vi.spyOn(harness.app, 'getLocale').mockReturnValue(locale)
|
||||
@@ -415,9 +415,26 @@ describe('desktop main startup', () => {
|
||||
const submenu = applicationMenuItems()
|
||||
const options = harness.app.setAboutPanelOptions.mock.calls[0]![0]
|
||||
const expected = JSON.parse(readFileSync(new URL('./expected/about-panel.json', import.meta.url), 'utf8')) as Record<string, unknown>
|
||||
expect({ menu: submenu.slice(0, 2), options: { ...options, iconPath: '<app icon>' } }).toEqual(expected[locale])
|
||||
const [about, separator] = submenu
|
||||
expect({ menu: [{ label: about!.label, role: about!.role }, separator], options: { ...options, iconPath: '<app icon>' } })
|
||||
.toEqual(expected[`${platform}:${locale}`])
|
||||
expect(options.iconPath).toBe(packaged ? join('desktop-test-resources', 'icon.png')
|
||||
: join('desktop-test-app', 'resources', 'icon-windows.png'))
|
||||
if (platform !== 'win32') { expect(about!.click).toBeUndefined(); return }
|
||||
// Windows reuses the dimmed update dialog because Electron's fallback is a bare message box.
|
||||
harness.dialog.showMessageBox.mockResolvedValueOnce({ response: 0 })
|
||||
;(about!.click as () => void)()
|
||||
await vi.advanceTimersByTimeAsync(0)
|
||||
const zh = locale === 'zh-CN'
|
||||
expect(harness.dialog.showMessageBox).toHaveBeenLastCalledWith(expect.objectContaining({
|
||||
type: 'info', title: zh ? '关于 DeepSeek Harness' : 'About DeepSeek Harness', message: 'DeepSeek Harness',
|
||||
detail: zh ? '版本 V1.0.0' : 'Version V1.0.0', buttons: [zh ? '确定' : 'OK'], cancelId: 0,
|
||||
}))
|
||||
// A dialog that cannot open is logged, not surfaced as an unhandled rejection.
|
||||
harness.dialog.showMessageBox.mockRejectedValueOnce(new Error('overlay unavailable'))
|
||||
;(about!.click as () => void)()
|
||||
await vi.advanceTimersByTimeAsync(0)
|
||||
expect(console.error).toHaveBeenLastCalledWith(expect.objectContaining({ message: 'overlay unavailable' }))
|
||||
})
|
||||
|
||||
it('shows one explained startup login before Host readiness and joins concurrent checks without reopening it', async () => {
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('web e2e: Desktop update workspace chrome', () => {
|
||||
|
||||
const progress = presentDesktopUpdate({ phase: 'downloading', version, percent: 58 }, en)
|
||||
await publish(progress)
|
||||
const downloading = page.getByRole('button', { name: '58%…', exact: true })
|
||||
const downloading = page.getByRole('button', { name: '58%', exact: true })
|
||||
await downloading.waitFor()
|
||||
expect(await downloading.getAttribute('aria-disabled')).toBe('true')
|
||||
expect(await downloading.locator('svg').count()).toBe(1)
|
||||
@@ -86,20 +86,20 @@ describe('web e2e: Desktop update workspace chrome', () => {
|
||||
const expand = locale === 'zh-CN' ? '打开侧边栏' : 'Open sidebar'
|
||||
await page.getByRole('button', { name: collapse, exact: true }).click()
|
||||
const toggle = page.getByRole('button', { name: expand, exact: true })
|
||||
const badge = toggle.getByRole('img', { name: '58%…', exact: true })
|
||||
const badge = toggle.getByRole('img', { name: '58%', exact: true })
|
||||
await badge.waitFor()
|
||||
await expect.poll(() => downloading.count()).toBe(0)
|
||||
expect(await page.getByRole('img', { name: '58%…', exact: true }).count()).toBe(1)
|
||||
const blue = await badge.evaluate(element => getComputedStyle(element).backgroundColor)
|
||||
expect(await page.getByRole('img', { name: '58%', exact: true }).count()).toBe(1)
|
||||
const updateBackground = await badge.evaluate(element => getComputedStyle(element).backgroundColor)
|
||||
await page.screenshot({ path: join(evidence, 'collapsed.png') })
|
||||
|
||||
const error = presentDesktopUpdate({ phase: 'error', version, failedOperation: 'download', message: 'HTTP 503' }, en)
|
||||
await publish(error)
|
||||
const errorBadge = toggle.getByRole('img', { name: retryLabel, exact: true })
|
||||
await errorBadge.waitFor()
|
||||
expect(await errorBadge.getAttribute('data-error')).toBe('true')
|
||||
const red = await errorBadge.evaluate(element => getComputedStyle(element).backgroundColor)
|
||||
expect(red).not.toBe(blue)
|
||||
// A failure keeps the update palette; only the label distinguishes it.
|
||||
const failedBackground = await errorBadge.evaluate(element => getComputedStyle(element).backgroundColor)
|
||||
expect(failedBackground).toBe(updateBackground)
|
||||
await errorBadge.hover()
|
||||
const tooltip = page.getByRole('tooltip', { name: errorDetail, exact: true })
|
||||
await expect.poll(() => tooltip.evaluateAll(elements => elements.map(element => getComputedStyle(element).opacity))).toEqual(['1'])
|
||||
@@ -132,7 +132,7 @@ describe('web e2e: Desktop update workspace chrome', () => {
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
expect(await page.evaluate(() => (window as FixtureWindow).updateFixture.listeners.size)).toBe(1)
|
||||
await writeFile(join(evidence, 'result.json'), JSON.stringify({ locale, geometry, blue, red,
|
||||
await writeFile(join(evidence, 'result.json'), JSON.stringify({ locale, geometry, updateBackground, failedBackground,
|
||||
passed: true, explicitActions: 3, carrier: 'substituted', host: 'real Web composition',
|
||||
electron: false, installerExecuted: false }, null, 2) + '\n')
|
||||
console.log(`Desktop workspace chrome evidence: ${evidence}`)
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/client/ui-settings-general/README.md
|
||||
README.md: 266fe837899f13d33e7a098b901cc34402da765e
|
||||
README.zh.md: 09570948b89089dda33d6705e4f17c7cd2f8481c
|
||||
README.md: 36d3fd7b260f95cffb67977e5a6f37852bf195aa
|
||||
README.zh.md: 9df8fe8bc3a39fceeccfc8b08a8e18cc5eeaf752
|
||||
@@ -31,7 +31,7 @@ Users reach the shell through the sidebar's bottom Settings control; feature plu
|
||||
|
||||
When the section navigation exceeds the panel's available height, the list scrolls independently of the settings content and keeps the Settings title fixed.
|
||||
|
||||
In Desktop, the account-row update control shows availability, progress, verification, readiness, and persistent retry feedback. The preload carries semantic phase, version, progress, and classified failures; the component resolves every visible and accessible string from the active `settings` locale, including after an in-application language change. Selecting an available update starts downloading; installation requires a separate shell-owned confirmation. A collapsed sidebar shows the same status as a dot on its top expand button. Connection feedback takes priority except during shell-reported installation, when the expected backend disconnect must not hide update status. Failure restores connection feedback. Both controls share one carrier subscription; browser code cannot choose packages or authorize installation. [Desktop updates](../../../apps/desktop/README.md) owns the release workflow.
|
||||
In Desktop, the account-row update control shows availability, progress, verification, readiness, and persistent retry feedback. It shares the connection indicator’s 28px height, 13px corners, 14px icon slot, 4px icon gap, and 12px medium text with an 18px line height; update-state border, fill, and text colors remain independently defined. Retry text and its dot use the same brand blue as other update labels; numeric download progress has no ellipsis. The preload carries semantic phase, version, progress, and classified failures; the component resolves every visible and accessible string from the active `settings` locale, including after an in-application language change. Selecting an available update starts downloading; installation requires a separate shell-owned confirmation. A collapsed sidebar shows the same status as a brand-blue dot on its top expand button, including failures. Connection feedback takes priority except during shell-reported installation, when the expected backend disconnect must not hide update status. Failure restores connection feedback. Both controls share one carrier subscription; browser code cannot choose packages or authorize installation. [Desktop updates](../../../apps/desktop/README.md) owns the release workflow.
|
||||
|
||||
### The General section
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ kind: "package-reference"
|
||||
|
||||
当分区导航超出面板可用高度时,列表独立于设置内容滚动,并保持「设置」标题固定。
|
||||
|
||||
在 Desktop 中,账户行更新控件显示可用版本、进度、验证、就绪和持久重试反馈。预加载仅传递语义化阶段、版本、进度和失败类别;组件从当前 `settings` locale 解析全部可见与无障碍文案,并在应用内语言变化后同步更新。选择可用更新即开始下载;安装需要独立的壳拥有的确认。侧栏收起时,其顶部展开按钮以圆点显示相同状态。连接反馈通常优先展示,但壳报告正在安装时,预期的后端断开不能遮盖更新状态;失败后恢复连接反馈。两个控件共用一次载体订阅;浏览器代码不能选择安装包或授权安装。[Desktop 更新](../../../apps/desktop/README.zh.md)负责发布流程。
|
||||
在 Desktop 中,账户行更新控件显示可用版本、进度、验证、就绪和持久重试反馈。它与连接指示器共用 28px 高度、13px 圆角、14px 图标占位、4px 图文间距,以及 12px 中等字重文字和 18px 行高;更新状态的边框、填充和文字颜色独立定义。重试文字及其圆点与其他更新文案使用相同的品牌蓝色;数字下载进度不带省略号。预加载仅传递语义化阶段、版本、进度和失败类别;组件从当前 `settings` locale 解析全部可见与无障碍文案,并在应用内语言变化后同步更新。选择可用更新即开始下载;安装需要独立的壳拥有的确认。侧栏收起时,其顶部展开按钮以品牌蓝色圆点显示相同状态,包括失败状态。连接反馈通常优先展示,但壳报告正在安装时,预期的后端断开不能遮盖更新状态;失败后恢复连接反馈。两个控件共用一次载体订阅;浏览器代码不能选择安装包或授权安装。[Desktop 更新](../../../apps/desktop/README.zh.md)负责发布流程。
|
||||
|
||||
### 「通用」分区
|
||||
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
/* The entry's seat is the Settings foot row, which bleeds 2px past the sidebar
|
||||
content box for the Settings hover surface. The New Session bar and panel
|
||||
rows instead keep a 2px inset inside that box, so this entry gives back both
|
||||
2px offsets and ends on their trailing edge rather than flush against the
|
||||
sidebar edge. */
|
||||
.indicator {
|
||||
display: inline-flex;
|
||||
display: inline-grid;
|
||||
grid-template-columns: 14px max-content;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
column-gap: 4px;
|
||||
flex: none;
|
||||
margin-inline-end: 4px;
|
||||
padding: 1px 8px;
|
||||
height: 28px;
|
||||
padding: 0 8px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 20%, transparent);
|
||||
border-radius: 6px;
|
||||
border-radius: 13px;
|
||||
color: var(--dsw-alias-brand-primary-new-colorprimary-new-color);
|
||||
background: color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 8%, transparent);
|
||||
font: inherit;
|
||||
font-family: inherit;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
font-weight: 500;
|
||||
line-height: 18px;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.indicator[data-error] {
|
||||
color: var(--dsw-alias-state-error-primary);
|
||||
.icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.badge {
|
||||
@@ -36,8 +38,7 @@
|
||||
background: var(--dsw-alias-brand-primary-new-colorprimary-new-color);
|
||||
}
|
||||
|
||||
.badge[data-error], .errorDot { background: var(--dsw-alias-state-error-primary); }
|
||||
.errorDot { width: 6px; height: 6px; border-radius: 50%; corner-shape: round; }
|
||||
.errorDot { background: currentColor; width: 6px; height: 6px; border-radius: 50%; corner-shape: round; }
|
||||
.spinner { animation: spin 1s linear infinite; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
|
||||
|
||||
@@ -46,6 +46,7 @@ function updateCopy(state: DesktopUpdatePresentation, t: SettingsTranslate): { l
|
||||
}
|
||||
|
||||
/**
|
||||
* Render update status with connection-indicator geometry and brand-blue labels, including retries.
|
||||
* @param props - Connection priority, sidebar width, and localized bridge-failure copy.
|
||||
* @returns Desktop-only status beside the account button, or nothing in browsers.
|
||||
*/
|
||||
@@ -64,10 +65,12 @@ export function DesktopUpdateIndicator({ wide, hidden, t, view, onOpen }: {
|
||||
const error = failed || state?.phase === 'error'
|
||||
const busy = opening || (state !== undefined && BUSY_PHASES.has(state.phase))
|
||||
return <Tooltip label={failed ? retryLabel : copy.detail} side="top">
|
||||
<button type="button" className={css.indicator} data-error={error || undefined}
|
||||
<button type="button" className={css.indicator}
|
||||
aria-label={label} aria-disabled={busy} onClick={() => { if (!busy) onOpen() }}>
|
||||
{error ? <span className={css.errorDot} aria-hidden="true" />
|
||||
: busy ? <IconLoadingOutlineRegular className={css.spinner} size={16} /> : <IconDownloadOutlineRegular size={14} />}
|
||||
<span className={css.icon} aria-hidden="true">
|
||||
{error ? <span className={css.errorDot} />
|
||||
: busy ? <IconLoadingOutlineRegular className={css.spinner} size={14} /> : <IconDownloadOutlineRegular size={14} />}
|
||||
</span>
|
||||
<span>{label}</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
@@ -78,7 +81,7 @@ type BadgeProps = PropsRuntime<'sidebar.toggle.badge'> & PropsLocale<'settings'>
|
||||
|
||||
/**
|
||||
* @param props - Framework-bound carrier and connection state.
|
||||
* @returns A non-interactive notification on the sidebar expand button.
|
||||
* @returns A non-interactive brand-blue notification on the sidebar expand button.
|
||||
*/
|
||||
export function DesktopUpdateBadge({ useDesktopUpdate, useConnectionState, t }: BadgeProps) {
|
||||
const { presentation: state, failed } = useDesktopUpdate(value => value)
|
||||
@@ -89,6 +92,6 @@ export function DesktopUpdateBadge({ useDesktopUpdate, useConnectionState, t }:
|
||||
const copy = state === undefined ? { label: retryLabel, detail: retryLabel } : updateCopy(state, t)
|
||||
const label = failed ? retryLabel : copy.label
|
||||
return <Tooltip label={failed ? label : copy.detail} side="right">
|
||||
<span role="img" aria-label={label} className={css.badge} data-error={failed || state?.phase === 'error' || undefined} />
|
||||
<span role="img" aria-label={label} className={css.badge} />
|
||||
</Tooltip>
|
||||
}
|
||||
@@ -5,7 +5,7 @@ export const zh = {
|
||||
'trigger': '设置',
|
||||
'desktop.update.available': '新版本',
|
||||
'desktop.update.checking': '正在检查更新…',
|
||||
'desktop.update.progress': '{percent}%…',
|
||||
'desktop.update.progress': '{percent}%',
|
||||
'desktop.update.verifying': '正在校验更新文件…',
|
||||
'desktop.update.installing': '正在准备重启…',
|
||||
'desktop.update.ready': '安装并重启',
|
||||
@@ -45,7 +45,7 @@ export const en = {
|
||||
'trigger': 'Settings',
|
||||
'desktop.update.available': 'Update',
|
||||
'desktop.update.checking': 'Checking for updates…',
|
||||
'desktop.update.progress': '{percent}%…',
|
||||
'desktop.update.progress': '{percent}%',
|
||||
'desktop.update.verifying': 'Verifying update files…',
|
||||
'desktop.update.installing': 'Preparing to restart…',
|
||||
'desktop.update.ready': 'Install and Restart',
|
||||
|
||||
@@ -44,7 +44,7 @@ const kit = {
|
||||
}
|
||||
|
||||
describe('Desktop collapsed update badge', () => {
|
||||
it('shows update status, marks failures, and yields to connection feedback', () => {
|
||||
it('shows update and retry status and yields to connection feedback', () => {
|
||||
let state: DesktopUpdateView = { failed: false, opening: false }
|
||||
let connection: 'connected' | 'connecting' | 'disconnected' = 'connected'
|
||||
const props = { ...kit, t,
|
||||
@@ -55,17 +55,17 @@ describe('Desktop collapsed update badge', () => {
|
||||
expect(screen.queryByRole('img')).toBeNull()
|
||||
state = { ...state, presentation: { phase: 'available', version: '1.0.1' } }
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
expect(screen.getByRole('img', { name: 'Update' }).getAttribute('data-error')).toBeNull()
|
||||
expect(screen.getByRole('img', { name: 'Update' })).toBeTruthy()
|
||||
expect(screen.queryByRole('button')).toBeNull()
|
||||
state = { ...state, failed: true }
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] }).getAttribute('data-error')).toBe('true')
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] })).toBeTruthy()
|
||||
state = { failed: true, opening: false }
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] }).getAttribute('data-error')).toBe('true')
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] })).toBeTruthy()
|
||||
state = { failed: false, opening: false, presentation: { phase: 'error', failure: 'install' } }
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] }).getAttribute('data-error')).toBe('true')
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] })).toBeTruthy()
|
||||
for (const value of ['connecting', 'disconnected'] as const) {
|
||||
connection = value
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
|
||||
@@ -71,11 +71,10 @@ it('keeps the newest event, hides for connection priority, and invokes only the
|
||||
expect(screen.queryByRole('button')).toBeNull()
|
||||
await f.emit({ phase: 'downloading', version: available.version, percent: 58 })
|
||||
f.view.rerender(<f.Indicator />)
|
||||
fireEvent.click(screen.getByRole('button', { name: '58%…' }))
|
||||
fireEvent.click(screen.getByRole('button', { name: '58%' }))
|
||||
expect(f.open).toHaveBeenCalledOnce()
|
||||
await f.emit({ phase: 'error', version: available.version, failure: 'download' })
|
||||
const retry = screen.getByRole('button', { name: '重试更新' })
|
||||
expect(retry.getAttribute('data-error')).toBe('true')
|
||||
fireEvent.focus(retry)
|
||||
expect((await screen.findByRole('tooltip')).textContent).toBe('下载更新失败,请重试。')
|
||||
f.view.rerender(<f.Indicator wide={false} />)
|
||||
@@ -90,7 +89,6 @@ it('keeps bridge failures actionable and ignores status completion after unmount
|
||||
f.open.mockRejectedValueOnce(new Error('IPC unavailable'))
|
||||
fireEvent.click(screen.getByRole('button', { name: '重试更新' }))
|
||||
await act(async () => {})
|
||||
expect(screen.getByRole('button').getAttribute('data-error')).toBe('true')
|
||||
f.view.unmount()
|
||||
const late = fixture()
|
||||
late.view.unmount()
|
||||
@@ -143,11 +141,11 @@ it('shows fallback progress and error details when the shell omits optional fiel
|
||||
const f = fixture()
|
||||
try {
|
||||
await f.emit({ phase: 'downloading' })
|
||||
const progress = screen.getByRole('button', { name: '0%…' })
|
||||
const progress = screen.getByRole('button', { name: '0%' })
|
||||
fireEvent.focus(progress)
|
||||
expect((await screen.findByRole('tooltip')).textContent).toBe('0%…')
|
||||
expect((await screen.findByRole('tooltip')).textContent).toBe('0%')
|
||||
await f.emit({ phase: 'downloading', version: '1.0.1' })
|
||||
fireEvent.focus(screen.getByRole('button', { name: '0%…' }))
|
||||
fireEvent.focus(screen.getByRole('button', { name: '0%' }))
|
||||
expect((await screen.findByRole('tooltip')).textContent).toContain('1.0.1')
|
||||
await f.emit({ phase: 'error' })
|
||||
fireEvent.focus(screen.getByRole('button', { name: '重试更新' }))
|
||||
|
||||