Skip to content

Commit ff76711

Browse files
committed
chore: final code review
1 parent 021cd2f commit ff76711

File tree

8 files changed

+21
-19
lines changed

8 files changed

+21
-19
lines changed

apps/site/components/Blog/BlogHeader/index.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
'use client';
2-
31
import { RssIcon } from '@heroicons/react/24/solid';
4-
import { useTranslations } from 'next-intl';
2+
import { getTranslations } from 'next-intl/server';
53
import type { FC } from 'react';
64

75
import Link from '@/components/Link';
@@ -13,11 +11,11 @@ type BlogHeaderProps = {
1311
category: string;
1412
};
1513

16-
const BlogHeader: FC<BlogHeaderProps> = ({ category }) => {
17-
const t = useTranslations();
18-
const currentFile =
19-
siteConfig.rssFeeds.find(item => item.category === category)?.file ??
20-
'blog.xml';
14+
const BlogHeader: FC<BlogHeaderProps> = async ({ category }) => {
15+
const t = await getTranslations();
16+
17+
const feed = siteConfig.rssFeeds.find(item => item.category === category);
18+
const currentFile = feed ? feed.file : 'blog.xml';
2119

2220
return (
2321
<header className={styles.blogHeader}>

apps/site/components/Common/AvatarGroup/Avatar/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export type AvatarProps = {
1616
url?: string;
1717
};
1818

19+
// @TODO: We temporarily removed the Avatar Radix UI primitive, since it was causing flashing
20+
// during initial load and not being able to render nicely when images are already cached.
21+
// @see https://github.com/radix-ui/primitives/pull/3008
1922
const Avatar = forwardRef<
2023
HTMLSpanElement,
2124
HTMLAttributes<HTMLSpanElement> & AvatarProps

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import { useTranslations } from 'next-intl';
24
import type { ComponentProps, FC } from 'react';
35
import { useRef } from 'react';

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
.skeleton {
2-
@apply motion-safe:dark:animate-pulse-dark
2+
@apply dark:animate-pulse-dark
33
pointer-events-none
4+
animate-pulse
45
cursor-default
56
select-none
67
rounded-md
78
border-none
89
bg-clip-border
910
text-transparent
1011
shadow-none
11-
outline-none
12-
motion-safe:animate-pulse;
12+
outline-none;
1313
}
1414

1515
.skeleton[data-inline-skeleton] {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use client';
2-
31
import * as TabsPrimitive from '@radix-ui/react-tabs';
42
import type { ComponentProps, FC, ReactElement } from 'react';
53

apps/site/components/withDownloadCategories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { getLocale, getTranslations } from 'next-intl/server';
22
import type { FC, PropsWithChildren } from 'react';
33

4+
import { getClientContext } from '@/client-context';
45
import LinkTabs from '@/components/Common/LinkTabs';
56
import WithNodeRelease from '@/components/withNodeRelease';
6-
import { useClientContext } from '@/hooks/react-server';
77
import getDownloadSnippets from '@/next-data/downloadSnippets';
88
import getReleaseData from '@/next-data/releaseData';
99
import { defaultLocale } from '@/next.locales.mjs';
@@ -12,6 +12,7 @@ import type { NodeReleaseStatus } from '@/types';
1212
import { getDownloadCategory, mapCategoriesToTabs } from '@/util/downloadUtils';
1313

1414
// By default the translated languages do not contain all the download snippets
15+
// Hence we always merge any translated snippet with the fallbacks for missing snippets
1516
const fallbackSnippets = await getDownloadSnippets(defaultLocale.code);
1617

1718
const WithDownloadCategories: FC<PropsWithChildren> = async ({ children }) => {
@@ -20,8 +21,7 @@ const WithDownloadCategories: FC<PropsWithChildren> = async ({ children }) => {
2021
const releases = await getReleaseData();
2122
const snippets = await getDownloadSnippets(locale);
2223

23-
// eslint-disable-next-line react-hooks/rules-of-hooks
24-
const { pathname } = useClientContext();
24+
const { pathname } = getClientContext();
2525
const { page, category, subCategory } = getDownloadCategory(pathname);
2626

2727
const initialRelease: NodeReleaseStatus = pathname.includes('current')

apps/site/components/withProgressionSidebar.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
'use client';
2-
31
import type { RichTranslationValues } from 'next-intl';
42
import type { FC } from 'react';
53

64
import ProgressionSidebar from '@/components/Common/ProgressionSidebar';
7-
import { useSiteNavigation } from '@/hooks/server';
5+
import { useSiteNavigation } from '@/hooks';
86
import type { NavigationKeys } from '@/types';
97

108
type WithProgressionSidebarProps = {

apps/site/providers/__tests__/matterProvider.test.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const mockContext = {
88
headings: [],
99
readingTime: { text: '', minutes: 0, time: 0, words: 0 },
1010
filename: '',
11+
// @TODO: For some reason the initial value of the provider is flipping between
12+
// LOADING and OTHER, although the initial state is LOADING, render() might be doing more
13+
// than just initial rendering; This requires more investigation.
1114
os: expect.any(String),
1215
architecture: '',
1316
bitness: 64,

0 commit comments

Comments
 (0)