diff --git a/src/components/downloadModal.tsx b/src/components/downloadModal.tsx index 76e66296..9d3b2c92 100644 --- a/src/components/downloadModal.tsx +++ b/src/components/downloadModal.tsx @@ -1,5 +1,5 @@ import { Link, graphql, useStaticQuery } from "gatsby" -import React, { useState } from "react" +import React, { useEffect, useState } from "react" import { APP_VERSION } from "../constants" import DownloadModalSelecter from "./downloadModalSelecter" @@ -133,6 +133,17 @@ export const DownloadModal: React.FC<{ ? selectedPackage : packageAvailables[selectedOs][selectedOrDefaultMode]![0] + useEffect(() => { + const userAgent = window.navigator.userAgent + if (userAgent.includes("Windows")) { + setSelectedOs("Windows") + } else if (userAgent.includes("Mac")) { + setSelectedOs("Mac") + } else if (userAgent.includes("Linux")) { + setSelectedOs("Linux") + } + }, []) + const selectOs = (os: OsType) => { setSelectedOs(os) // 変更先のOSで選択できないモードの場合、最初のモードを選択する