fix(website): SSR not working due to download helper

This commit is contained in:
Elian Doran 2025-09-28 00:02:41 +03:00
parent 093f48f76a
commit 159fab41ce
No known key found for this signature in database
2 changed files with 7 additions and 5 deletions

View File

@ -8,19 +8,19 @@ interface DownloadButtonProps {
big?: boolean; big?: boolean;
} }
const { name, url } = getRecommendedDownload(); const recommendedDownload = getRecommendedDownload();
export default function DownloadButton({ big }: DownloadButtonProps) { export default function DownloadButton({ big }: DownloadButtonProps) {
return ( return (recommendedDownload &&
<Button <Button
className={`download-button desktop-only ${big ? "big" : ""}`} className={`download-button desktop-only ${big ? "big" : ""}`}
href={url} href={recommendedDownload.url}
iconSvg={downloadIcon} iconSvg={downloadIcon}
text={<> text={<>
Download now{" "} Download now{" "}
{big {big
? <span class="platform">v{packageJson.version} for {name}</span> ? <span class="platform">v{packageJson.version} for {recommendedDownload.name}</span>
: <span class="platform">for {name}</span> : <span class="platform">for {recommendedDownload.name}</span>
} }
</>} </>}
/> />

View File

@ -202,6 +202,8 @@ export function getPlatform(): Platform {
} }
export function getRecommendedDownload() { export function getRecommendedDownload() {
if (typeof window === "undefined") return null;
const architecture = getArchitecture(); const architecture = getArchitecture();
const platform = getPlatform(); const platform = getPlatform();