diff --git a/pages/download.tsx b/pages/download.tsx index 4b4f4ae..69253c8 100644 --- a/pages/download.tsx +++ b/pages/download.tsx @@ -23,7 +23,9 @@ type releaseObject = { }; const Download = (props: Props) => { - const [latestReleases, setLatestReleases] = useState>([]); + const [latestReleases, setLatestReleases] = useState>( + [] + ); const [currentTab, setCurrentTab] = useState(); const [primaryDownloadUrl, setPrimaryDownloadUrl] = useState(); const [isGettingRelease, setIsGettingRelease] = useState(false); @@ -38,7 +40,10 @@ const Download = (props: Props) => { const cache = JSON.parse(localStorage.getItem("cachedRelease") ?? "{}"); // If we have a cached release and it hasn't expired, use it. - if (cache.cacheExpires && parseInt(cache.cacheExpires) > new Date().getTime()) { + if ( + cache.cacheExpires && + parseInt(cache.cacheExpires) > new Date().getTime() + ) { return cache.release; } @@ -101,22 +106,27 @@ const Download = (props: Props) => { return castAsset; }) .filter( - (asset: releaseObject) => !asset.name.includes("yml") && !asset.name.includes("blockmap") + (asset: releaseObject) => + !asset.name.includes("yml") && !asset.name.includes("blockmap") ); - const userOS = navigator.userAgent.match(/Mac|Win|Linux/g)?.[0].toLowerCase() || "win"; + const userOS = + navigator.userAgent.match(/Mac|Win|Linux/g)?.[0].toLowerCase() || "win"; switch (true) { case userOS.includes("linux"): setCurrentTab("linux"); setPrimaryDownloadUrl( - filteredResponse.find((asset: releaseObject) => asset.name.includes("AppImage")) + filteredResponse.find((asset: releaseObject) => + asset.name.includes("AppImage") + ) ); break; case userOS.includes("mac"): setCurrentTab("mac"); setPrimaryDownloadUrl( filteredResponse.find( - (asset: releaseObject) => asset.name.includes("dmg") && asset.name.includes("x64") + (asset: releaseObject) => + asset.name.includes("dmg") && asset.name.includes("x64") ) ); break; @@ -144,7 +154,7 @@ const Download = (props: Props) => { links = ( { { title: "RPM", link: { - ...latestReleases.find((asset: releaseObject) => asset.name.includes("rpm")), + ...latestReleases.find((asset: releaseObject) => + asset.name.includes("rpm") + ), }, }, { title: "AppImage", link: { - ...latestReleases.find((asset: releaseObject) => asset.name.includes("AppImage")), + ...latestReleases.find((asset: releaseObject) => + asset.name.includes("AppImage") + ), }, }, { title: "FreeBSD", link: { - ...latestReleases.find((asset: releaseObject) => asset.name.includes("freebsd")), + ...latestReleases.find((asset: releaseObject) => + asset.name.includes("freebsd") + ), }, }, { title: "Tar", link: { - ...latestReleases.find((asset: releaseObject) => asset.name.includes("tar")), + ...latestReleases.find((asset: releaseObject) => + asset.name.includes("tar") + ), }, }, ]} @@ -190,7 +208,8 @@ const Download = (props: Props) => { multipleLinks: latestReleases .filter( (asset: releaseObject) => - asset.name.includes("exe") && !asset.name.includes("Portable") + asset.name.includes("exe") && + !asset.name.includes("Portable") ) .reverse(), }, @@ -199,7 +218,8 @@ const Download = (props: Props) => { multipleLinks: latestReleases .filter( (asset: releaseObject) => - asset.name.includes("exe") && asset.name.includes("Portable") + asset.name.includes("exe") && + asset.name.includes("Portable") ) .reverse(), }, @@ -233,26 +253,27 @@ const Download = (props: Props) => { } return ( - + {fallback && (

Download

- Something went wrong when getting the links to the latest Ferdium release. Try again - later or follow the link below to download the latest nightly release of Ferdium from - our GitHub Releases.{" "} + Something went wrong when getting the links to the latest Ferdium + release. Try again later or follow the link below to download the + latest nightly release of Ferdium from our GitHub Releases.{" "}

- Once there click "Assets" and choose the version for your platform (check - the - FAQ if you are unsure which one to get)! We currently have - releases for macOS, Windows, Linux (AppImage and DEB) and FreeBSD. + Once there click "Assets" and choose the version for + your platform (check the + FAQ if you are unsure which one to + get)! We currently have releases for macOS, Windows, Linux + (AppImage and DEB) and FreeBSD.

- - @@ -263,12 +284,14 @@ const Download = (props: Props) => { <>

Download

-

Find the installer for your OS below to install Ferdium!

+

+ Find the installer for your OS below to install Ferdium! +

{!primaryDownloadUrl || isGettingRelease ? ( ) : ( - @@ -295,41 +318,44 @@ const Download = (props: Props) => {

Using your OS's package manager

- Alternatively, you can use the package manager of your OS to install Ferdium. Use one of - the CLI commands below depending on your OS to install the latest binary release of - Ferdium. Some package managers (like AUR) also allow you to build the source release - yourself. + Alternatively, you can use the package manager of your OS to install + Ferdium. Use one of the CLI commands below depending on your OS to + install the latest binary release of Ferdium. Some package managers + (like AUR) also allow you to build the source release yourself.

+ - { // TODO: Update Flatpak with beta version when available } - { + { // TODO: Update scoop installer to include stable version when bucket will be ready - } + }