Skip to content

Commit abe2da4

Browse files
committed
feat: introduced new downloads page
chore: removed all translated (old) downloads page (forcing re-translation) fix: fix build and extension extraction chore: just update todo text Apply suggestions from code review Co-authored-by: Geoffrey Booth <[email protected]> Signed-off-by: Claudio W <[email protected]> fix: fixed unit tests chore: unnecessary memoization of reqs chore: some minor code review changes feat: code review and iteration on logic chore: improvements for docker chore: more improvements for texts and sizes chore: minor design updates chore: numerous improvements and fixes chore: some typo fixes feat: bug fixes, improved types, handle unknown scenarios and fallback chore: always use corepack to enable pnpm chore: util will always return string, but `parseNumericBitness` ensures number is set chore: improved types chore: random changed file chore: some code reviews and bug fixes chore: not an external link
1 parent 68c3996 commit abe2da4

File tree

177 files changed

+1327
-7561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+1327
-7561
lines changed

apps/site/app/[locale]/next-data/blog-data/[category]/[page]/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ import {
33
providePaginatedBlogPosts,
44
} from '@/next-data/providers/blogData';
55
import { defaultLocale } from '@/next.locales.mjs';
6+
import type { BlogCategory } from '@/types';
67

7-
type DynamicStaticPaths = { locale: string; category: string; page: string };
8+
type DynamicStaticPaths = {
9+
locale: string;
10+
category: BlogCategory;
11+
page: string;
12+
};
813
type StaticParams = { params: Promise<DynamicStaticPaths> };
914

1015
// This is the Route Handler for the `GET` method which handles the request

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/Common/BlogPostCard/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import FormattedTime from '@/components/Common/FormattedTime';
55
import Preview from '@/components/Common/Preview';
66
import Link from '@/components/Link';
77
import WithAvatarGroup from '@/components/withAvatarGroup';
8+
import type { BlogCategory } from '@/types';
89
import { mapBlogCategoryToPreviewType } from '@/util/blogUtils';
910

1011
import styles from './index.module.css';
1112

1213
type BlogPostCardProps = {
1314
title: string;
14-
category: string;
15+
category: BlogCategory;
1516
description?: string;
1617
authors?: Array<string>;
1718
date?: Date;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
relative
44
inline-flex
55
items-center
6+
justify-center
67
gap-2
78
py-2.5
89
text-center

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,14 @@
108108
}
109109
}
110110

111-
.dropdown:has(.label) .text > span > span {
112-
@apply pl-3;
111+
.dropdown:has(.label) .text > span {
112+
&:has(svg) > svg {
113+
@apply ml-3;
114+
}
115+
116+
&:not(&:has(svg)) > span {
117+
@apply ml-3;
118+
}
113119
}
114120

115121
.inline {

apps/site/components/Common/Select/index.stories.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
22

33
import Select from '@/components/Common/Select';
4-
import AIX from '@/components/Icons/Platform/AIX';
5-
import Apple from '@/components/Icons/Platform/Apple';
6-
import Linux from '@/components/Icons/Platform/Linux';
7-
import Microsoft from '@/components/Icons/Platform/Microsoft';
4+
import OSIcons from '@/components/Icons/OperatingSystem';
85

96
type Story = StoryObj<typeof Select>;
107
type Meta = MetaObj<typeof Select>;
@@ -79,22 +76,22 @@ export const InlineSelect: Story = {
7976
{
8077
value: 'linux',
8178
label: 'Linux',
82-
iconImage: <Linux width={16} height={16} />,
79+
iconImage: <OSIcons.Linux width={16} height={16} />,
8380
},
8481
{
8582
value: 'macos',
8683
label: 'macOS',
87-
iconImage: <Apple width={16} height={16} />,
84+
iconImage: <OSIcons.Apple width={16} height={16} />,
8885
},
8986
{
9087
value: 'windows',
9188
label: 'Windows',
92-
iconImage: <Microsoft width={16} height={16} />,
89+
iconImage: <OSIcons.Microsoft width={16} height={16} />,
9390
},
9491
{
9592
value: 'aix',
9693
label: 'AIX',
97-
iconImage: <AIX width={16} height={16} />,
94+
iconImage: <OSIcons.AIX width={16} height={16} />,
9895
},
9996
],
10097
},

apps/site/components/Common/Select/index.tsx

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,47 @@ import * as ScrollPrimitive from '@radix-ui/react-scroll-area';
55
import * as SelectPrimitive from '@radix-ui/react-select';
66
import classNames from 'classnames';
77
import { useEffect, useId, useMemo, useState } from 'react';
8-
import type { FC } from 'react';
8+
import type { ReactElement, ReactNode } from 'react';
99

1010
import Skeleton from '@/components/Common/Skeleton';
1111
import type { FormattedMessage } from '@/types';
1212

1313
import styles from './index.module.css';
1414

15-
type SelectValue = {
16-
label: FormattedMessage;
17-
value: string;
18-
iconImage?: React.ReactNode;
15+
export type SelectValue<T extends string> = {
16+
label: FormattedMessage | string;
17+
value: T;
18+
iconImage?: ReactElement<SVGSVGElement>;
1919
disabled?: boolean;
2020
};
2121

22-
type SelectGroup = {
23-
label?: FormattedMessage;
24-
items: Array<SelectValue>;
22+
export type SelectGroup<T extends string> = {
23+
label?: FormattedMessage | string;
24+
items: Array<SelectValue<T>>;
2525
};
2626

2727
const isStringArray = (values: Array<unknown>): values is Array<string> =>
2828
Boolean(values[0] && typeof values[0] === 'string');
2929

30-
const isValuesArray = (values: Array<unknown>): values is Array<SelectValue> =>
30+
const isValuesArray = <T extends string>(
31+
values: Array<unknown>
32+
): values is Array<SelectValue<T>> =>
3133
Boolean(values[0] && typeof values[0] === 'object' && 'value' in values[0]);
3234

33-
type SelectProps = {
34-
values: Array<SelectGroup | string | SelectValue>;
35-
defaultValue?: string;
35+
type SelectProps<T extends string> = {
36+
values: Array<SelectGroup<T>> | Array<T> | Array<SelectValue<T>>;
37+
defaultValue?: T;
3638
placeholder?: string;
3739
label?: string;
3840
inline?: boolean;
39-
onChange?: (value: string) => void;
41+
onChange?: (value: T) => void;
4042
className?: string;
4143
ariaLabel?: string;
4244
loading?: boolean;
45+
disabled?: boolean;
4346
};
4447

45-
const Select: FC<SelectProps> = ({
48+
const Select = <T extends string>({
4649
values = [],
4750
defaultValue,
4851
placeholder,
@@ -52,7 +55,8 @@ const Select: FC<SelectProps> = ({
5255
className,
5356
ariaLabel,
5457
loading = false,
55-
}) => {
58+
disabled = false,
59+
}: SelectProps<T>): ReactNode => {
5660
const id = useId();
5761
const [value, setValue] = useState(defaultValue);
5862

@@ -69,7 +73,7 @@ const Select: FC<SelectProps> = ({
6973
return [{ items: mappedValues }];
7074
}
7175

72-
return mappedValues as Array<SelectGroup>;
76+
return mappedValues as Array<SelectGroup<T>>;
7377
}, [values]);
7478

7579
// We render the actual item slotted to fix/prevent the issue
@@ -83,7 +87,7 @@ const Select: FC<SelectProps> = ({
8387
);
8488

8589
// Both change the internal state and emit the change event
86-
const handleChange = (value: string) => {
90+
const handleChange = (value: T) => {
8791
setValue(value);
8892

8993
if (typeof onChange === 'function') {
@@ -106,15 +110,23 @@ const Select: FC<SelectProps> = ({
106110
</label>
107111
)}
108112

109-
<SelectPrimitive.Root value={value} onValueChange={handleChange}>
113+
<SelectPrimitive.Root
114+
value={currentItem !== undefined ? value : undefined}
115+
onValueChange={handleChange}
116+
disabled={disabled}
117+
>
110118
<SelectPrimitive.Trigger
111119
className={styles.trigger}
112120
aria-label={ariaLabel}
113121
id={id}
114122
>
115123
<SelectPrimitive.Value placeholder={placeholder}>
116-
{currentItem?.iconImage}
117-
<span>{currentItem?.label}</span>
124+
{currentItem !== undefined && (
125+
<>
126+
{currentItem.iconImage}
127+
<span>{currentItem.label}</span>
128+
</>
129+
)}
118130
</SelectPrimitive.Value>
119131
<ChevronDownIcon className={styles.icon} />
120132
</SelectPrimitive.Trigger>

apps/site/components/Common/Skeleton/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@ import { isValidElement } from 'react';
33

44
import styles from './index.module.css';
55

6-
type SkeletonProps = { loading?: boolean };
6+
type SkeletonProps = { hide?: boolean; loading?: boolean };
77

88
const Skeleton: FC<PropsWithChildren<SkeletonProps>> = ({
99
children,
10+
hide = false,
1011
loading = true,
1112
}) => {
13+
// This can be used to completely hide the children after the Skeleton has loaded
14+
// If certain criterias do not match. This is useful for conditional rendering without
15+
// changing the actual tree that the Skeleton is wrapping
16+
if (!loading && hide) {
17+
return null;
18+
}
19+
20+
// If we finished loading, we can hide the Skeleton and render the children tree
1221
if (!loading) {
1322
return children;
1423
}

apps/site/components/Containers/MetaBar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Link from '@/components/Link';
88
import styles from './index.module.css';
99

1010
type MetaBarProps = {
11-
items: Record<string, React.ReactNode>;
11+
items: Partial<Record<IntlMessageKeys, React.ReactNode>>;
1212
headings?: {
1313
items: Array<Heading>;
1414
minDepth?: number;
@@ -33,7 +33,7 @@ const MetaBar: FC<MetaBarProps> = ({ items, headings }) => {
3333
.filter(([, value]) => !!value)
3434
.map(([key, value]) => (
3535
<Fragment key={key}>
36-
<dt>{t(key)}</dt>
36+
<dt>{t(key as IntlMessageKeys)}</dt>
3737
<dd>{value}</dd>
3838
</Fragment>
3939
))}

0 commit comments

Comments
 (0)