diff --git a/src/components/UI/downloads/DownloadsTable.tsx b/src/components/UI/downloads/DownloadsTable.tsx index b8a45207c6..feb14bc9c4 100644 --- a/src/components/UI/downloads/DownloadsTable.tsx +++ b/src/components/UI/downloads/DownloadsTable.tsx @@ -1,5 +1,5 @@ import { Stack, Tabs, TabList, Tab, Text, TabPanel, TabPanels } from '@chakra-ui/react'; -import { FC } from 'react'; +import { FC, useMemo } from 'react'; import { DataTable } from '../../UI'; @@ -37,6 +37,16 @@ export const DownloadsTable: FC = ({ const LAST_2_LINUX_RELEASES = amountOfReleasesToShow + 12; + const getDefaultIndex = useMemo(() => { + const OS: string = typeof window !== 'undefined' ? window.navigator.platform : ''; + const userAgent = typeof window !== 'undefined' ? window.navigator.userAgent : ''; + if (/Mac/i.test(OS)) return 1; + if (/Win/i.test(OS)) return 2; + if (/iPhone/i.test(OS)) return 3; + if (/Android/i.test(userAgent)) return 4; + return 0; + }, []) + return ( = ({ : 'none' } > - setTotalReleases(totalReleases[idx])}> + setTotalReleases(totalReleases[idx])} defaultIndex={getDefaultIndex}> {DOWNLOADS_TABLE_TABS.map((tab, idx) => { return (