Skip to content

Commit b458b22

Browse files
Disable download button on unsupported OS (#9)
* Don't show zip build if doesn't exist * Disable download button on unsupported OS * Hide zip build if unsuppported os
1 parent 220f6c5 commit b458b22

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/pages/download.page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import banner from '../assets/banner.png';
33
import '../index.scss';
44
import { Box, Button, HStack, Icon, Image, Link, Spacer, Text, VStack } from '@chakra-ui/react';
55
import { IGithubRelease, IReleaseAsset } from '../types/githubTypes';
6-
import { OS } from '../utils';
6+
import { OS, isSupportedOS } from '../utils';
77
import { BsWindows, BsApple, BsFillQuestionDiamondFill } from 'react-icons/bs/index.js';
88
import { FaLinux } from 'react-icons/fa/index.js';
99
import { MdDownload } from 'react-icons/md/index.js';
@@ -91,13 +91,14 @@ function Page(pageProps: {
9191
colorScheme="green"
9292
borderRadius="2xl"
9393
onClick={() => {
94-
if (currentBuild != null) {
94+
if (currentBuild != null && isSupportedOS) {
9595
window.location.href = currentBuild?.browser_download_url;
9696
}
9797
}}
9898
height="auto"
9999
px={8}
100100
py={7}
101+
disabled={!isSupportedOS}
101102
>
102103
<VStack>
103104
<HStack>
@@ -118,11 +119,11 @@ function Page(pageProps: {
118119
</HStack>
119120
<HStack>
120121
<Icon as={icon}></Icon>
121-
<Text fontSize={18}>{OS.name}</Text>
122+
<Text fontSize={18}>{isSupportedOS ? OS.name : 'Unsupported OS'}</Text>
122123
</HStack>
123124
</VStack>
124125
</Button>
125-
{zipBuild != null && (
126+
{zipBuild != null && isSupportedOS && (
126127
<Text color="white">
127128
Or download the{' '}
128129
<Link

0 commit comments

Comments
 (0)