mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	fix(website): SSR not working due to download helper
This commit is contained in:
		| @@ -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> | ||||||
|                 } |                 } | ||||||
|            </>} |            </>} | ||||||
|         /> |         /> | ||||||
|   | |||||||
| @@ -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(); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user