-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Download layout * refactor: utils methods moved into the file * refactor/docs: deprecated url path * refactor/docs: download utils * refactor: markdown formatting * fix: download URL paths * feat: exclude option for os dropdown * refactor: separated type import * refactor: styling updates * refactor: type definitions moved into the own file * test: unit tests for download utils * fix: icons added into the download/source buttons * fix: LinkWithArrow import path * docs/refactor: source button * refactor: review updates * chore: code-review and code improvements * feat: finished download page * chore: minor fixes * chore: code-review and bug fixes * chore: prevent page reload on tab change * chore: improve activelink matching * feat: proper download versions and prebuilt binaries * feat: added more support text for each respective version * chore: minor bitness fixes for macOS * refactor: cleanup of certain logic and added docker package manager * chore: fix shiki interop client-server * chore: fix unit test * chore: minor text correction * chore: nvm uses v prefix * chore: rename label to ARM64 to keep it easier to understand * refactor: reduce layout shift and improve select accessibility * chore: reduce layout shift, simplify codebox and cleanup text * Apply suggestions from code review Signed-off-by: Brian Muenzenmeyer <[email protected]> * added Docker platform logo, grouped by usage and alphabetized * chore: minor changes and fixes * chore: reduce build times by making build of these routes on-demand * fix: keep same bitness if compatible on OS change, verify OS supports bitness --------- Signed-off-by: Brian Muenzenmeyer <[email protected]> Co-authored-by: Claudio Wunder <[email protected]> Co-authored-by: Brian Muenzenmeyer <[email protected]>
- Loading branch information
1 parent
aef8eab
commit b624417
Showing
66 changed files
with
2,008 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
|
||
# lint and format staged files | ||
npx lint-staged | ||
|
||
# verify typescript staged files | ||
npx tsc --build . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
xs:hidden; | ||
} | ||
|
||
> div { | ||
> span { | ||
@apply hidden | ||
w-full | ||
xs:flex; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
xs:hidden; | ||
} | ||
|
||
> div { | ||
> span { | ||
@apply hidden | ||
w-full | ||
xs:flex; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
'use client'; | ||
|
||
import { useTranslations } from 'next-intl'; | ||
import type { FC } from 'react'; | ||
import { useEffect, useContext, useMemo } from 'react'; | ||
import semVer from 'semver'; | ||
|
||
import Select from '@/components/Common/Select'; | ||
import { useDetectOS } from '@/hooks/react-client'; | ||
import { ReleaseContext } from '@/providers/releaseProvider'; | ||
import { bitnessItems, formatDropdownItems } from '@/util/downloadUtils'; | ||
|
||
const parseNumericBitness = (bitness: string) => | ||
/^\d+$/.test(bitness) ? Number(bitness) : bitness; | ||
|
||
const BitnessDropdown: FC = () => { | ||
const { bitness: userBitness } = useDetectOS(); | ||
const { bitness, os, release, setBitness } = useContext(ReleaseContext); | ||
const t = useTranslations(); | ||
|
||
// we also reset the bitness when the OS changes, because different OSs have | ||
// different bitnesses available | ||
useEffect(() => setBitness(userBitness), [setBitness, userBitness]); | ||
|
||
// @TODO: We should have a proper utility that gives | ||
// disabled OSs, Platforms, based on specific criteria | ||
// this can be an optimisation for the future | ||
// to remove this logic from this component | ||
const disabledItems = useMemo(() => { | ||
const disabledItems = []; | ||
|
||
if (os === 'WIN' && semVer.satisfies(release.version, '< 19.9.0')) { | ||
disabledItems.push('arm64'); | ||
} | ||
|
||
if (os === 'LINUX' && semVer.satisfies(release.version, '< 4.0.0')) { | ||
disabledItems.push('arm64', 'armv7l'); | ||
} | ||
|
||
if (os === 'LINUX' && semVer.satisfies(release.version, '< 4.4.0')) { | ||
disabledItems.push('ppc64le'); | ||
} | ||
|
||
if (os === 'LINUX' && semVer.satisfies(release.version, '< 6.6.0')) { | ||
disabledItems.push('s390x'); | ||
} | ||
|
||
return disabledItems; | ||
}, [os, release.version]); | ||
|
||
// @TODO: We should have a proper utility that gives | ||
// disabled OSs, Platforms, based on specific criteria | ||
// this can be an optimisation for the future | ||
// to remove this logic from this component | ||
useEffect(() => { | ||
const mappedBittnessesValues = bitnessItems[os].map(({ value }) => value); | ||
|
||
const currentBittnessExcluded = | ||
// Different OSs support different Bitnessess, hence we should also check | ||
// if besides the current bitness not being supported for a given release version | ||
// we also should check if it is not supported by the OS | ||
disabledItems.includes(String(bitness)) || | ||
!mappedBittnessesValues.includes(String(bitness)); | ||
|
||
const nonExcludedBitness = mappedBittnessesValues.find( | ||
bittness => !disabledItems.includes(bittness) | ||
); | ||
|
||
if (currentBittnessExcluded && nonExcludedBitness) { | ||
setBitness(nonExcludedBitness); | ||
} | ||
// we shouldn't react when "actions" change | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [os, disabledItems]); | ||
|
||
return ( | ||
<Select | ||
label={t('layouts.download.dropdown.bitness')} | ||
values={formatDropdownItems({ | ||
items: bitnessItems[os], | ||
disabledItems, | ||
})} | ||
defaultValue={String(bitness)} | ||
onChange={bitness => setBitness(parseNumericBitness(bitness))} | ||
className="w-28" | ||
inline={true} | ||
/> | ||
); | ||
}; | ||
|
||
export default BitnessDropdown; |
Oops, something went wrong.