Skip to content

Commit

Permalink
feat: introduced new downloads page
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ovflowd committed Dec 27, 2024
1 parent 68c3996 commit abe2da4
Show file tree
Hide file tree
Showing 177 changed files with 1,327 additions and 7,561 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import {
providePaginatedBlogPosts,
} from '@/next-data/providers/blogData';
import { defaultLocale } from '@/next.locales.mjs';
import type { BlogCategory } from '@/types';

type DynamicStaticPaths = { locale: string; category: string; page: string };
type DynamicStaticPaths = {
locale: string;
category: BlogCategory;
page: string;
};
type StaticParams = { params: Promise<DynamicStaticPaths> };

// This is the Route Handler for the `GET` method which handles the request
Expand Down
5 changes: 3 additions & 2 deletions apps/site/components/Common/AlertBox/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
text-white;

a {
@apply font-ibm-plex-mono
@apply font-bold
text-white
underline;
underline
hover:text-white;

&:hover {
@apply no-underline;
Expand Down
3 changes: 2 additions & 1 deletion apps/site/components/Common/BlogPostCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import FormattedTime from '@/components/Common/FormattedTime';
import Preview from '@/components/Common/Preview';
import Link from '@/components/Link';
import WithAvatarGroup from '@/components/withAvatarGroup';
import type { BlogCategory } from '@/types';
import { mapBlogCategoryToPreviewType } from '@/util/blogUtils';

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

type BlogPostCardProps = {
title: string;
category: string;
category: BlogCategory;
description?: string;
authors?: Array<string>;
date?: Date;
Expand Down
1 change: 1 addition & 0 deletions apps/site/components/Common/Button/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
relative
inline-flex
items-center
justify-center
gap-2
py-2.5
text-center
Expand Down
10 changes: 8 additions & 2 deletions apps/site/components/Common/Select/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,14 @@
}
}

.dropdown:has(.label) .text > span > span {
@apply pl-3;
.dropdown:has(.label) .text > span {
&:has(svg) > svg {
@apply ml-3;
}

&:not(&:has(svg)) > span {
@apply ml-3;
}
}

.inline {
Expand Down
13 changes: 5 additions & 8 deletions apps/site/components/Common/Select/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { Meta as MetaObj, StoryObj } from '@storybook/react';

import Select from '@/components/Common/Select';
import AIX from '@/components/Icons/Platform/AIX';
import Apple from '@/components/Icons/Platform/Apple';
import Linux from '@/components/Icons/Platform/Linux';
import Microsoft from '@/components/Icons/Platform/Microsoft';
import OSIcons from '@/components/Icons/OperatingSystem';

type Story = StoryObj<typeof Select>;
type Meta = MetaObj<typeof Select>;
Expand Down Expand Up @@ -79,22 +76,22 @@ export const InlineSelect: Story = {
{
value: 'linux',
label: 'Linux',
iconImage: <Linux width={16} height={16} />,
iconImage: <OSIcons.Linux width={16} height={16} />,
},
{
value: 'macos',
label: 'macOS',
iconImage: <Apple width={16} height={16} />,
iconImage: <OSIcons.Apple width={16} height={16} />,
},
{
value: 'windows',
label: 'Windows',
iconImage: <Microsoft width={16} height={16} />,
iconImage: <OSIcons.Microsoft width={16} height={16} />,
},
{
value: 'aix',
label: 'AIX',
iconImage: <AIX width={16} height={16} />,
iconImage: <OSIcons.AIX width={16} height={16} />,
},
],
},
Expand Down
52 changes: 32 additions & 20 deletions apps/site/components/Common/Select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,47 @@ import * as ScrollPrimitive from '@radix-ui/react-scroll-area';
import * as SelectPrimitive from '@radix-ui/react-select';
import classNames from 'classnames';
import { useEffect, useId, useMemo, useState } from 'react';
import type { FC } from 'react';
import type { ReactElement, ReactNode } from 'react';

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

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

type SelectValue = {
label: FormattedMessage;
value: string;
iconImage?: React.ReactNode;
export type SelectValue<T extends string> = {
label: FormattedMessage | string;
value: T;
iconImage?: ReactElement<SVGSVGElement>;
disabled?: boolean;
};

type SelectGroup = {
label?: FormattedMessage;
items: Array<SelectValue>;
export type SelectGroup<T extends string> = {
label?: FormattedMessage | string;
items: Array<SelectValue<T>>;
};

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

const isValuesArray = (values: Array<unknown>): values is Array<SelectValue> =>
const isValuesArray = <T extends string>(
values: Array<unknown>
): values is Array<SelectValue<T>> =>
Boolean(values[0] && typeof values[0] === 'object' && 'value' in values[0]);

type SelectProps = {
values: Array<SelectGroup | string | SelectValue>;
defaultValue?: string;
type SelectProps<T extends string> = {
values: Array<SelectGroup<T>> | Array<T> | Array<SelectValue<T>>;
defaultValue?: T;
placeholder?: string;
label?: string;
inline?: boolean;
onChange?: (value: string) => void;
onChange?: (value: T) => void;
className?: string;
ariaLabel?: string;
loading?: boolean;
disabled?: boolean;
};

const Select: FC<SelectProps> = ({
const Select = <T extends string>({
values = [],
defaultValue,
placeholder,
Expand All @@ -52,7 +55,8 @@ const Select: FC<SelectProps> = ({
className,
ariaLabel,
loading = false,
}) => {
disabled = false,
}: SelectProps<T>): ReactNode => {
const id = useId();
const [value, setValue] = useState(defaultValue);

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

return mappedValues as Array<SelectGroup>;
return mappedValues as Array<SelectGroup<T>>;
}, [values]);

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

// Both change the internal state and emit the change event
const handleChange = (value: string) => {
const handleChange = (value: T) => {
setValue(value);

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

<SelectPrimitive.Root value={value} onValueChange={handleChange}>
<SelectPrimitive.Root
value={currentItem !== undefined ? value : undefined}
onValueChange={handleChange}
disabled={disabled}
>
<SelectPrimitive.Trigger
className={styles.trigger}
aria-label={ariaLabel}
id={id}
>
<SelectPrimitive.Value placeholder={placeholder}>
{currentItem?.iconImage}
<span>{currentItem?.label}</span>
{currentItem !== undefined && (
<>
{currentItem.iconImage}
<span>{currentItem.label}</span>
</>
)}
</SelectPrimitive.Value>
<ChevronDownIcon className={styles.icon} />
</SelectPrimitive.Trigger>
Expand Down
11 changes: 10 additions & 1 deletion apps/site/components/Common/Skeleton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@ import { isValidElement } from 'react';

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

type SkeletonProps = { loading?: boolean };
type SkeletonProps = { hide?: boolean; loading?: boolean };

const Skeleton: FC<PropsWithChildren<SkeletonProps>> = ({
children,
hide = false,
loading = true,
}) => {
// This can be used to completely hide the children after the Skeleton has loaded
// If certain criterias do not match. This is useful for conditional rendering without
// changing the actual tree that the Skeleton is wrapping
if (!loading && hide) {
return null;
}

// If we finished loading, we can hide the Skeleton and render the children tree
if (!loading) {
return children;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/site/components/Containers/MetaBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Link from '@/components/Link';
import styles from './index.module.css';

type MetaBarProps = {
items: Record<string, React.ReactNode>;
items: Partial<Record<IntlMessageKeys, React.ReactNode>>;
headings?: {
items: Array<Heading>;
minDepth?: number;
Expand All @@ -33,7 +33,7 @@ const MetaBar: FC<MetaBarProps> = ({ items, headings }) => {
.filter(([, value]) => !!value)
.map(([key, value]) => (
<Fragment key={key}>
<dt>{t(key)}</dt>
<dt>{t(key as IntlMessageKeys)}</dt>
<dd>{value}</dd>
</Fragment>
))}
Expand Down
Loading

0 comments on commit abe2da4

Please sign in to comment.