Fixed #216
This commit is contained in:
@@ -69,6 +69,8 @@ const FieldDescription = styled.div`
|
|||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
type Platform = "Windows" | "MacOS" | "Linux" | "Unsupported";
|
||||||
|
|
||||||
export default function DownloadPage() {
|
export default function DownloadPage() {
|
||||||
const [platform, setPlatform] = useState<string | null>(null);
|
const [platform, setPlatform] = useState<string | null>(null);
|
||||||
const [architecture, setArchitecture] = useState<string | null>(null);
|
const [architecture, setArchitecture] = useState<string | null>(null);
|
||||||
@@ -79,7 +81,7 @@ export default function DownloadPage() {
|
|||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [selectedPlatform, setSelectedPlatform] = useState("");
|
const [selectedPlatform, setSelectedPlatform] = useState<Platform | "">("");
|
||||||
const [selectedArchitecture, setSelectedArchitecture] = useState("specific");
|
const [selectedArchitecture, setSelectedArchitecture] = useState("specific");
|
||||||
const [selectedWindowsDownloadType, setSelectedWindowsDownloadType] =
|
const [selectedWindowsDownloadType, setSelectedWindowsDownloadType] =
|
||||||
useState("installer");
|
useState("installer");
|
||||||
@@ -94,14 +96,19 @@ export default function DownloadPage() {
|
|||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
userAgent = window.navigator.userAgent;
|
userAgent = window.navigator.userAgent;
|
||||||
}
|
}
|
||||||
if (userAgent.includes("Win")) {
|
switch (true) {
|
||||||
setSelectedPlatform("Windows");
|
case userAgent.includes("Win"):
|
||||||
}
|
setSelectedPlatform("Windows");
|
||||||
if (userAgent.includes("Mac")) {
|
break;
|
||||||
setSelectedPlatform("MacOS");
|
case userAgent.includes("Mac"):
|
||||||
}
|
setSelectedPlatform("MacOS");
|
||||||
if (userAgent.includes("Linux")) {
|
break;
|
||||||
setSelectedPlatform("Linux");
|
case userAgent.includes("Linux"):
|
||||||
|
setSelectedPlatform("Linux");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setSelectedPlatform("Unsupported");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
const throwConfetti = () => {
|
const throwConfetti = () => {
|
||||||
@@ -579,7 +586,7 @@ export default function DownloadPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => continueFlow()}
|
onClick={() => continueFlow()}
|
||||||
disabled={selectedPlatform === ""}
|
disabled={selectedPlatform === "Unsupported"}
|
||||||
>
|
>
|
||||||
{(flowIndex === 1 && platform === "MacOS") || flowIndex === 2
|
{(flowIndex === 1 && platform === "MacOS") || flowIndex === 2
|
||||||
? "Download 🥳"
|
? "Download 🥳"
|
||||||
@@ -587,7 +594,7 @@ export default function DownloadPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{selectedPlatform === "" && (
|
{selectedPlatform === "Unsupported" && (
|
||||||
<div className="mt-5 flex items-center">
|
<div className="mt-5 flex items-center">
|
||||||
<InfoCircledIcon className="mr-2 size-4" />
|
<InfoCircledIcon className="mr-2 size-4" />
|
||||||
<p className="text-muted-foreground">
|
<p className="text-muted-foreground">
|
||||||
|
|||||||
Reference in New Issue
Block a user