Skip to content

Commit 09b0bb6

Browse files
committed
chore: some code reviews and bug fixes
1 parent 75fa9c6 commit 09b0bb6

File tree

12 files changed

+216
-188
lines changed

12 files changed

+216
-188
lines changed

apps/site/components/Common/AlertBox/index.module.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
text-white;
1111

1212
a {
13-
@apply font-ibm-plex-mono
13+
@apply font-bold
1414
text-white
15-
underline;
15+
underline
16+
hover:text-white;
1617

1718
&:hover {
1819
@apply no-underline;

apps/site/components/Downloads/Release/PackageManagerDropdown.tsx

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,49 @@
11
'use client';
22

33
import { useTranslations } from 'next-intl';
4-
import { useContext } from 'react';
4+
import { useContext, useEffect, useMemo } from 'react';
55
import type { FC } from 'react';
66

77
import Select from '@/components/Common/Select';
88
import { ReleaseContext } from '@/providers/releaseProvider';
99
import type { PackageManager } from '@/types/release';
10-
import { PACKAGE_MANAGERS } from '@/util/downloadUtils';
10+
import { nextItem, PACKAGE_MANAGERS, parseCompat } from '@/util/downloadUtils';
1111

1212
const PackageManagerDropdown: FC = () => {
1313
const release = useContext(ReleaseContext);
1414
const t = useTranslations();
1515

16+
// Prevents the Package Manager from being set during OS loading state
17+
const setManager = (manager: PackageManager | '') => {
18+
if (release.os !== 'LOADING') {
19+
release.setPackageManager(manager);
20+
}
21+
};
22+
23+
// We parse the compatibility of the dropdown items
24+
const parsedPackageManagers = useMemo(
25+
() => parseCompat(PACKAGE_MANAGERS, release),
26+
// We only want to react on the change of the Version
27+
// eslint-disable-next-line react-hooks/exhaustive-deps
28+
[release.version]
29+
);
30+
31+
// We set the Package Manager to the next available Package Manager when the current
32+
// one is not valid anymore due to Version changes
33+
useEffect(
34+
() => setManager(nextItem(release.packageManager, parsedPackageManagers)),
35+
// We only want to react on the change of the Version
36+
// eslint-disable-next-line react-hooks/exhaustive-deps
37+
[release.version]
38+
);
39+
1640
return (
1741
<Select<PackageManager | ''>
18-
values={PACKAGE_MANAGERS}
42+
values={parsedPackageManagers}
1943
defaultValue={release.packageManager}
2044
loading={release.os === 'LOADING' || release.platform === ''}
2145
ariaLabel={t('layouts.download.dropdown.packageManager')}
22-
onChange={manager => release.setPackageManager(manager)}
46+
onChange={manager => manager && setManager(manager)}
2347
className="min-w-28"
2448
inline={true}
2549
/>

apps/site/components/Downloads/Release/PlatformDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const PlatformDropdown: FC = () => {
7878
defaultValue={release.platform}
7979
loading={release.os === 'LOADING' || release.platform === ''}
8080
ariaLabel={t('layouts.download.dropdown.platform')}
81-
onChange={platform => setPlaform(platform)}
81+
onChange={platform => platform && setPlaform(platform)}
8282
className="min-w-28"
8383
inline={true}
8484
/>

apps/site/components/Downloads/Release/ReleaseCodeBox.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useContext, useMemo } from 'react';
77
import AlertBox from '@/components/Common/AlertBox';
88
import Skeleton from '@/components/Common/Skeleton';
99
import JSXCodeBox from '@/components/JSX/CodeBox';
10+
import Link from '@/components/Link';
1011
import { createSval } from '@/next.jsx.compiler.mjs';
1112
import { ReleaseContext, ReleasesContext } from '@/providers/releaseProvider';
1213
import type { ReleaseContextType } from '@/types/release';
@@ -81,7 +82,9 @@ const ReleaseCodeBox: FC = () => {
8182
<div className="mb-6 mt-4 flex flex-col gap-2">
8283
{release.status === 'End-of-life' && (
8384
<AlertBox title="Warning" level="warning" size="small">
84-
{t('layouts.download.codeBox.unsupportedVersionWarning')}
85+
{t.rich('layouts.download.codeBox.unsupportedVersionWarning', {
86+
link: text => <Link href="/about/previous-releases/">{text}</Link>,
87+
})}
8588
</AlertBox>
8689
)}
8790

apps/site/components/JSX/CodeBox/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import classNames from 'classnames';
2-
import dedent from 'dedent';
32
import { toJsxRuntime } from 'hast-util-to-jsx-runtime';
43
import type { FC, PropsWithChildren } from 'react';
54

@@ -19,7 +18,7 @@ const CodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
1918
showCopyButton,
2019
className,
2120
}) => {
22-
const highlighted = highlightToHast(dedent(String(children)), language);
21+
const highlighted = highlightToHast(String(children), language);
2322

2423
return toJsxRuntime(highlighted, {
2524
...reactRuntime,

apps/site/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"github-slugger": "~2.0.0",
5353
"glob": "~11.0.0",
5454
"gray-matter": "~4.0.3",
55-
"next": "15.1.2",
56-
"next-intl": "~3.25.3",
55+
"next": "15.1.3",
56+
"next-intl": "~3.26.3",
5757
"next-themes": "~0.4.3",
5858
"postcss": "~8.4.49",
5959
"postcss-calc": "~10.0.2",
@@ -77,7 +77,7 @@
7777
},
7878
"devDependencies": {
7979
"@eslint/compat": "~1.2.3",
80-
"@next/eslint-plugin-next": "15.1.2",
80+
"@next/eslint-plugin-next": "15.1.3",
8181
"@storybook/addon-controls": "^8.4.6",
8282
"@storybook/addon-interactions": "^8.4.6",
8383
"@storybook/addon-styling-webpack": "^1.0.1",
@@ -92,7 +92,7 @@
9292
"@types/react": "^18.3.12",
9393
"@types/react-dom": "^18.3.1",
9494
"@types/semver": "~7.5.8",
95-
"eslint-config-next": "15.1.2",
95+
"eslint-config-next": "15.1.3",
9696
"eslint-import-resolver-typescript": "~3.6.3",
9797
"eslint-plugin-mdx": "~3.1.5",
9898
"eslint-plugin-react": "~7.37.2",

apps/site/snippets/en/download/brew.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Download and install Homebrew
2-
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
2+
curl -o- https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
33

44
# Download and install Node.js:
55
brew install node@${props.release.major}

apps/site/snippets/en/download/fnm.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Download and install fnm:
22
${props.os === 'WIN' ?
33
'winget install Schniz.fnm' :
4-
'curl -fsSL https://fnm.vercel.app/install | bash'
4+
'curl -o- https://fnm.vercel.app/install | bash'
55
}
66

77
# Download and install Node.js:

apps/site/snippets/en/download/nvm.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Download and install nvm:
2-
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/HEAD/install.sh | bash
2+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
33

44
# Download and install Node.js:
55
nvm install ${props.release.major}

apps/site/util/downloadUtils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,13 @@ export const PACKAGE_MANAGERS: Array<
212212
{
213213
label: PackageManagerLabel.YARN,
214214
value: 'YARN',
215-
compatibility: {},
215+
compatibility: { semver: ['>= v14.19.0', '>= v16.9.0'] },
216216
iconImage: <PackageManagerIcons.YARN width={16} height={16} />,
217217
},
218218
{
219219
label: PackageManagerLabel.PNPM,
220220
value: 'PNPM',
221-
compatibility: {},
221+
compatibility: { semver: ['>= v14.19.0', '>= v16.9.0'] },
222222
iconImage: <PackageManagerIcons.PNPM width={16} height={16} />,
223223
},
224224
];

0 commit comments

Comments
 (0)