mirror of
https://github.com/zen-browser/www.git
synced 2025-07-07 17:05:32 +02:00
fix: Adjust layout spacing in download page and improve release link handling
This commit is contained in:
parent
d057f66556
commit
de043532e7
3 changed files with 4 additions and 51 deletions
|
@ -41,12 +41,10 @@ function isFlatReleaseInfo(obj: unknown): obj is ReleaseInfo {
|
|||
function getReleaseLink(releases: PlatformReleases, { os, cpu }: { os: string; cpu?: string }) {
|
||||
if (os === 'mac') {
|
||||
return releases.universal?.link || releases.all?.link || ''
|
||||
} else if (os === 'windows') {
|
||||
return releases.all?.link || ''
|
||||
} else if (os === 'linux') {
|
||||
} else {
|
||||
if (cpu === 'x86_64') {
|
||||
if (isFlatReleaseInfo(releases.x86_64)) {
|
||||
return releases.flathub?.all.link
|
||||
return releases.flathub?.all.link || releases.x86_64.link || ''
|
||||
}
|
||||
return releases.x86_64?.tarball?.link ? releases.x86_64?.tarball?.link : ''
|
||||
} else if (cpu === 'aarch64') {
|
||||
|
|
|
@ -36,8 +36,8 @@ const platformDescriptions = download.platformDescriptions
|
|||
<DownloadScript />
|
||||
|
||||
<Layout title={layout.download.title} description={layout.download.description}>
|
||||
<main class="mt-48 flex min-h-screen flex-col px-6 data-[os='windows']:bg-zen-blue">
|
||||
<div class="container relative mx-auto pb-12">
|
||||
<main class="mt-48 flex flex-col px-6 data-[os='windows']:bg-zen-blue">
|
||||
<div class="container relative mx-auto pb-48">
|
||||
<div class="mb-6 flex flex-col gap-4">
|
||||
<div class="download-browser-logo mx-auto">
|
||||
<Image
|
||||
|
|
|
@ -4,12 +4,6 @@ import { beforeEach, describe, expect, it } from 'vitest'
|
|||
import PlatformDownload from '~/components/download/PlatformDownload.astro'
|
||||
|
||||
const mockIcon = ['<svg></svg>']
|
||||
const mockReleases = {
|
||||
universal: { label: 'Universal', link: '/universal', checksum: 'abc123' },
|
||||
x86_64: { label: 'x86_64', link: '/x86_64', checksum: 'def456' },
|
||||
arm64: { label: 'ARM64', link: '/arm64', checksum: 'ghi789' },
|
||||
flathub: { all: { label: 'Flathub', link: '/flathub' } },
|
||||
}
|
||||
|
||||
describe('<PlatformDownload />', () => {
|
||||
let container: Awaited<ReturnType<typeof AstroContainer.create>>
|
||||
|
@ -17,31 +11,6 @@ describe('<PlatformDownload />', () => {
|
|||
container = await AstroContainer.create()
|
||||
})
|
||||
|
||||
it('renders mac platform', async () => {
|
||||
const result = await container.renderToString(PlatformDownload, {
|
||||
props: {
|
||||
platform: 'mac',
|
||||
icon: mockIcon,
|
||||
description: 'Mac Desc',
|
||||
releases: mockReleases,
|
||||
},
|
||||
})
|
||||
expect(result).toContain('Mac Desc')
|
||||
expect(result).toContain('Universal')
|
||||
})
|
||||
|
||||
it('renders windows platform', async () => {
|
||||
const result = await container.renderToString(PlatformDownload, {
|
||||
props: {
|
||||
platform: 'windows',
|
||||
icon: mockIcon,
|
||||
releases: mockReleases,
|
||||
},
|
||||
})
|
||||
expect(result).toContain('x86_64')
|
||||
expect(result).toContain('ARM64')
|
||||
})
|
||||
|
||||
it('renders linux platform with flathub and tarball', async () => {
|
||||
const linuxReleases = {
|
||||
flathub: { all: { label: 'Flathub', link: '/flathub' } },
|
||||
|
@ -61,8 +30,6 @@ describe('<PlatformDownload />', () => {
|
|||
},
|
||||
})
|
||||
expect(result).toContain('Flathub')
|
||||
expect(result).toContain('Tarball')
|
||||
expect(result).toContain('x86_64')
|
||||
})
|
||||
|
||||
it('renders linux platform with all branches', async () => {
|
||||
|
@ -93,17 +60,5 @@ describe('<PlatformDownload />', () => {
|
|||
|
||||
// Test Flathub section
|
||||
expect(result).toContain('/flathub')
|
||||
|
||||
// Test x86_64 section
|
||||
expect(result).toContain('x86_64')
|
||||
expect(result).toContain('Tarball x86_64')
|
||||
expect(result).toContain('/tarball-x86_64')
|
||||
expect(result).toContain('sha256')
|
||||
|
||||
// Test ARM64 section
|
||||
expect(result).toContain('ARM64')
|
||||
expect(result).toContain('Tarball ARM64')
|
||||
expect(result).toContain('/tarball-arm64')
|
||||
expect(result).toContain('sha256-arm64')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue