Skip to content

Commit 9e1e2af

Browse files
Merge branch 'main' into WSL-Guidance-on-Download-Page
Signed-off-by: Vishal <93390689+Vishal-K-988@users.noreply.github.com>
2 parents 103a672 + 663fad9 commit 9e1e2af

File tree

13 files changed

+176
-128
lines changed

13 files changed

+176
-128
lines changed

apps/site/components/MDX/Image/index.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import type { ImageProps } from 'next/image';
22
import Image from 'next/image';
33
import type { FC } from 'react';
44

5-
import { isSvgImage } from '#site/util/imageUtils';
6-
75
const MDXImage: FC<ImageProps> = ({ width, height, alt, src, ...props }) => {
8-
const isUnoptimizedImage = isSvgImage(src.toString());
9-
106
if (!width || !height) {
117
// Since `width` and `height` are not provided in the Markdown image format,
128
// we provide the height and width automatically.
@@ -15,7 +11,6 @@ const MDXImage: FC<ImageProps> = ({ width, height, alt, src, ...props }) => {
1511
<Image
1612
{...props}
1713
src={src}
18-
unoptimized={isUnoptimizedImage}
1914
alt={alt}
2015
width={0}
2116
height={0}
@@ -25,16 +20,7 @@ const MDXImage: FC<ImageProps> = ({ width, height, alt, src, ...props }) => {
2520
);
2621
}
2722

28-
return (
29-
<Image
30-
{...props}
31-
alt={alt}
32-
width={width}
33-
height={height}
34-
src={src}
35-
unoptimized={isUnoptimizedImage}
36-
/>
37-
);
23+
return <Image {...props} alt={alt} width={width} height={height} src={src} />;
3824
};
3925

4026
export default MDXImage;

apps/site/components/withAvatarGroup.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use client';
22

33
import AvatarGroup from '@node-core/ui-components/Common/AvatarGroup';
4-
import Image from 'next/image';
54
import type { ComponentProps, FC } from 'react';
65

76
import Link from '#site/components/Link';
@@ -27,7 +26,6 @@ const WithAvatarGroup: FC<WithAvatarGroupProps> = ({
2726
clickable: clickable,
2827
})}
2928
as={Link}
30-
img={Image}
3129
{...props}
3230
/>
3331
);

apps/site/next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const nextConfig = {
8888
'@radix-ui/react-tabs',
8989
'@radix-ui/react-toast',
9090
'@radix-ui/react-tooltip',
91+
'@radix-ui/react-avatar',
9192
'@orama/highlight',
9293
'@orama/react-components',
9394
'@heroicons/react',

apps/site/types/userOS.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import type { OperatingSystemLabel } from '../util/downloadUtils/constants.json';
23
import type downloadConstants from '../util/downloadUtils/constants.json';
34

@@ -13,3 +14,4 @@ export type UserBitness = (typeof downloadConstants.UserBitness)[number];
1314
// Derive the union type of UserArchitecture from the JSON array values.
1415
export type UserArchitecture =
1516
(typeof downloadConstants.UserArchitecture)[number];
17+

apps/site/util/__tests__/imageUtils.test.mjs

Lines changed: 0 additions & 56 deletions
This file was deleted.

apps/site/util/downloadUtils/constants.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
23
"OperatingSystemLabel": {
34
"WIN": "Windows",
45
"MAC": "macOS",
@@ -54,15 +55,18 @@
5455
"label": "NVM",
5556
"value": "NVM",
5657
"compatibility": { "os": ["MAC", "LINUX", "OTHER"] },
58+
5759
"recommended": true,
5860
"url": "https://github.com/nvm-sh/nvm",
5961
"info": "layouts.download.codeBox.platformInfo.nvm"
6062
},
6163
{
64+
6265
"key": "FNM",
6366
"label": "FNM",
6467
"value": "FNM",
6568
"compatibility": { "os": ["MAC", "LINUX", "WIN"] },
69+
6670
"recommended": true,
6771
"url": "https://github.com/Schniz/fnm",
6872
"info": "layouts.download.codeBox.platformInfo.fnm"
@@ -71,6 +75,7 @@
7175
"key": "BREW",
7276
"label": "BREW",
7377
"value": "BREW",
78+
7479
"compatibility": {
7580
"os": ["MAC", "LINUX"],
7681
"releases": ["Current", "LTS"]
@@ -83,14 +88,17 @@
8388
"label": "DEVBOX",
8489
"value": "DEVBOX",
8590
"compatibility": { "os": ["MAC", "LINUX"] },
91+
8692
"url": "https://jetify.com/devbox/",
8793
"info": "layouts.download.codeBox.platformInfo.devbox"
8894
},
8995
{
96+
9097
"key": "CHOCO",
9198
"label": "CHOCO",
9299
"value": "CHOCO",
93100
"compatibility": { "os": ["WIN"] },
101+
94102
"url": "https://chocolatey.org/",
95103
"info": "layouts.download.codeBox.platformInfo.choco"
96104
},
@@ -99,27 +107,33 @@
99107
"label": "DOCKER",
100108
"value": "DOCKER",
101109
"compatibility": { "os": ["WIN", "MAC", "LINUX"] },
110+
102111
"recommended": true,
103112
"url": "https://docs.docker.com/get-started/get-docker/",
104113
"info": "layouts.download.codeBox.platformInfo.docker"
105114
},
106115
{
116+
107117
"key": "N",
108118
"label": "N",
109119
"value": "N",
110120
"compatibility": { "os": ["MAC", "LINUX"] },
121+
111122
"url": "https://github.com/tj/n",
112123
"info": "layouts.download.codeBox.platformInfo.n"
113124
},
114125
{
126+
115127
"key": "VOLTA",
116128
"label": "VOLTA",
117129
"value": "VOLTA",
118130
"compatibility": { "os": ["WIN", "MAC", "LINUX"] },
131+
119132
"url": "https://docs.volta.sh/guide/getting-started",
120133
"info": "layouts.download.codeBox.platformInfo.volta"
121134
}
122135
],
136+
123137
"Platforms": {
124138
"WIN": [
125139
{
@@ -224,4 +238,5 @@
224238
],
225239
"UserBitness": ["64", "32"],
226240
"UserArchitecture": ["arm", "x86"]
241+
227242
}

apps/site/util/downloadUtils/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type { SelectValue } from '@node-core/ui-components/Common/Select';
22
import * as InstallMethodIcons from '@node-core/ui-components/Icons/InstallationMethod';
33
import * as OSIcons from '@node-core/ui-components/Icons/OperatingSystem';
44
import * as PackageManagerIcons from '@node-core/ui-components/Icons/PackageManager';
5+
6+
57
import satisfies from 'semver/functions/satisfies';
68

79
import type { NodeReleaseStatus } from '#site/types';
@@ -56,6 +58,7 @@ type DownloadDropdownItem<T extends string> = {
5658
// when the current item is disabeld/excluded/not valid
5759
// And this is useful when a parent release value (i.e. OS) is changed
5860
// and requires the current dropdown (i.e. Platform) to be updated
61+
5962
export const nextItem = <T extends string>(
6063
current: T,
6164
items: Array<DownloadDropdownItem<T>>
@@ -77,6 +80,7 @@ export const nextItem = <T extends string>(
7780

7881
// This function is used to parse the compatibility of the dropdown items
7982
// In a nice and static way that allows a lot of abstraction and flexibility
83+
8084
export const parseCompat = <
8185
K extends string,
8286
T extends DownloadDropdownItem<K>,
@@ -193,3 +197,4 @@ export const PLATFORMS: Record<
193197
UserOS | 'LOADING',
194198
Array<DownloadDropdownItem<UserPlatform>>
195199
> = Platforms;
200+

apps/site/util/imageUtils.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/ui-components/Common/AvatarGroup/Avatar/index.tsx

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import * as RadixAvatar from '@radix-ui/react-avatar';
12
import classNames from 'classnames';
2-
import type { HTMLAttributes, ElementType } from 'react';
3+
import type { HTMLAttributes } from 'react';
34
import { forwardRef } from 'react';
45

56
import type { LinkLike } from '#ui/types';
@@ -14,12 +15,8 @@ export type AvatarProps = {
1415
size?: 'small' | 'medium';
1516
url?: string;
1617
as?: LinkLike | 'div';
17-
img?: ElementType | 'img';
1818
};
1919

20-
// @TODO: We temporarily removed the Avatar Radix UI primitive, since it was causing flashing
21-
// during initial load and not being able to render nicely when images are already cached.
22-
// @see https://github.com/radix-ui/primitives/pull/3008
2320
const Avatar = forwardRef<
2421
HTMLSpanElement,
2522
HTMLAttributes<HTMLSpanElement> & AvatarProps
@@ -33,14 +30,13 @@ const Avatar = forwardRef<
3330
url,
3431
size = 'small',
3532
as: Component = 'a',
36-
img: Image = 'img',
3733
...props
3834
},
3935
ref
4036
) => {
4137
if (!url) Component = 'div';
4238
return (
43-
<span
39+
<RadixAvatar.Root
4440
{...props}
4541
ref={ref}
4642
className={classNames(styles.avatar, styles[size], props.className)}
@@ -50,25 +46,20 @@ const Avatar = forwardRef<
5046
target={url ? '_blank' : undefined}
5147
className={styles.wrapper}
5248
>
53-
{image && (
54-
<Image
55-
width={40}
56-
height={40}
57-
loading="lazy"
58-
decoding="async"
59-
src={image}
60-
alt={name || nickname}
61-
className={styles.item}
62-
/>
63-
)}
64-
65-
{!image && (
66-
<span className={classNames(styles.item, styles[size])}>
67-
{fallback}
68-
</span>
69-
)}
49+
<RadixAvatar.Image
50+
loading="lazy"
51+
decoding="async"
52+
src={image}
53+
alt={name || nickname}
54+
className={styles.item}
55+
/>
56+
<RadixAvatar.Fallback
57+
className={classNames(styles.item, styles[size])}
58+
>
59+
{fallback}
60+
</RadixAvatar.Fallback>
7061
</Component>
71-
</span>
62+
</RadixAvatar.Root>
7263
);
7364
}
7465
);

packages/ui-components/Common/AvatarGroup/Overlay/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const AvatarOverlay: FC<AvatarOverlayProps> = ({
1616
fallback,
1717
url,
1818
as: Component = 'a',
19-
img,
2019
}) => (
2120
<Component className={styles.overlay} href={url} target="_blank">
2221
<Avatar
@@ -25,7 +24,6 @@ const AvatarOverlay: FC<AvatarOverlayProps> = ({
2524
nickname={nickname}
2625
fallback={fallback}
2726
size="medium"
28-
img={img}
2927
/>
3028

3129
<div className={styles.user}>

0 commit comments

Comments
 (0)