Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next15 #75

Merged
merged 4 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions apps/analytics-web/next.config.js

This file was deleted.

12 changes: 6 additions & 6 deletions apps/analytics-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"test": "vitest run",
Expand Down Expand Up @@ -34,10 +34,10 @@
"drizzle-orm": "^0.36.1",
"i18n-iso-countries": "^7.13.0",
"lucide-react": "^0.363.0",
"next": "^14.2.18",
"next": "15.0.3",
"papaparse": "^5.4.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
"tailwind-merge": "^2.0.0",
"zod": "^3.23.8"
},
Expand All @@ -48,8 +48,8 @@
"@testing-library/react": "^14.1.2",
"@types/node": "^20.5.2",
"@types/papaparse": "^5.3.15",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected].1",
"@vitejs/plugin-react": "^4.3.3",
"drizzle-kit": "^0.28.0",
"jsdom": "^25.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ type PageParams = {
docPath: string[];
};

export async function generateMetadata({ params }: { params: PageParams }) {
export async function generateMetadata(props: { params: Promise<PageParams> }) {
const params = await props.params;
const { locale, project, docPath } = params;
const document = await getDocumentForPath({
locale,
Expand All @@ -35,7 +36,8 @@ export function generateStaticParams({
return docPathSegmentsForRoute;
}

export default async function Page({ params }: { params: PageParams }) {
export default async function Page(props: { params: Promise<PageParams> }) {
const params = await props.params;
const { locale, project, docPath } = params;
// setting setRequestLocale to support next-intl for static rendering
setRequestLocale(locale);
Expand Down
5 changes: 3 additions & 2 deletions apps/documentation/app/[locale]/[project]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import type { Locale } from "~/app/types";
import Article from "~/components/article";
import { getDocumentForPath } from "~/lib/docs";

type PageProps = { params: { locale: Locale; project: string } };
type PageProps = { params: Promise<{ locale: Locale; project: string }> };

export default async function Page({ params }: PageProps) {
export default async function Page(props: PageProps) {
const params = await props.params;
const { locale, project } = params;

// setting setRequestLocale to support next-intl for static rendering
Expand Down
20 changes: 14 additions & 6 deletions apps/documentation/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ const quicksand = Quicksand({
display: "swap",
});

export function generateMetadata({
params: { locale },
}: {
params: { locale: Locale };
export async function generateMetadata(props: {
params: Promise<{ locale: Locale }>;
}) {
const params = await props.params;

const { locale } = params;

const metadata: Metadata = {
other: {
"docsearch:language": locale,
Expand All @@ -39,10 +41,16 @@ export function generateStaticParams() {

type MainLayoutProps = {
children: React.ReactNode;
params: { locale: Locale };
params: Promise<{ locale: Locale }>;
};

export default async function MainLayout({ children, params: { locale } }: MainLayoutProps) {
export default async function MainLayout(props: MainLayoutProps) {
const params = await props.params;

const { locale } = params;

const { children } = props;

// Validate that the incoming `locale` parameter is valid
const isValidLocale = locales.some((cur) => cur === locale);
if (!isValidLocale) notFound();
Expand Down
6 changes: 5 additions & 1 deletion apps/documentation/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { setRequestLocale } from "next-intl/server";
import type { Locale } from "~/app/types";
import { Hero } from "~/components/Hero";

const Page = ({ params: { locale } }: { params: { locale: Locale } }) => {
const Page = async (props: { params: Promise<{ locale: Locale }> }) => {
const params = await props.params;

const { locale } = params;

// setting setRequestLocale to support next-intl for static rendering
setRequestLocale(locale);

Expand Down
2 changes: 2 additions & 0 deletions apps/documentation/app/manifest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { MetadataRoute } from "next";

export const dynamic = "force-static";

export default function manifest(): MetadataRoute.Manifest {
return {
name: "Network Canvas Documentation",
Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const SidebarLink = ({
}: {
href: string;
label: string;
sidebarContainerRef: RefObject<HTMLDivElement>;
sidebarContainerRef: RefObject<HTMLDivElement | null>;
}) => {
const pathname = usePathname();
const isActive = pathname === href;
Expand Down Expand Up @@ -194,7 +194,7 @@ const SidebarLink = ({
const renderSidebarItem = (
item: TSidebarFolder | SidebarPage,
locale: Locale,
sidebarContainerRef: RefObject<HTMLDivElement>,
sidebarContainerRef: RefObject<HTMLDivElement | null>,
) => {
if (item.type === "folder") {
const sourceFile = processSourceFile(item.type, locale, item.sourceFile);
Expand Down
3 changes: 2 additions & 1 deletion apps/documentation/components/article.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"use client";

import { Heading } from "@codaco/ui";
import WorkInProgress from "~/components/customComponents/WorkInProgress";
import type { HeadingNode } from "~/lib/tableOfContents";
import { usePathname } from "~/navigation";
import FancyHeading from "./FancyHeading";
import TableOfContents from "./TableOfContents";

import type { JSX } from "react";

export default function Article({
content,
headings,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import NextBundleAnalyzer from "@next/bundle-analyzer";
import type { NextConfig } from "next";
import createNextIntl from "next-intl/plugin";

const withNextIntl = createNextIntl("./lib/i18n/request.ts");
const withBundleAnalyzer = NextBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});

/** @type {import('next').NextConfig} */
const nextConfig = {
const nextConfig: NextConfig = {
reactStrictMode: true,
output: "export",
images: {
Expand Down
16 changes: 8 additions & 8 deletions apps/documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"dev": "tsx ./lib/writeSidebarJson.ts && pnpm next dev",
"dev": "tsx ./lib/writeSidebarJson.ts && pnpm next dev --turbopack",
"build": "pnpm next build",
"postbuild": "pnpm next-sitemap",
"prebuild": "tsx ./lib/writeSidebarJson.ts",
Expand All @@ -16,8 +16,8 @@
"@docsearch/css": "^3.8.0",
"@docsearch/react": "^3.8.0",
"@mendable/search": "^0.0.206",
"@next/bundle-analyzer": "^15.0.3",
"@next/third-parties": "^14.2.18",
"@next/bundle-analyzer": "15.0.3",
"@next/third-parties": "15.0.3",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-navigation-menu": "^1.2.1",
"@radix-ui/react-popover": "^1.1.2",
Expand All @@ -29,11 +29,11 @@
"dotenv": "^16.4.5",
"framer-motion": "^11.11.15",
"lucide-react": "^0.456.0",
"next": "^14.2.18",
"next": "15.0.3",
"next-intl": "^3.25.1",
"next-themes": "^0.4.3",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106"
},
"devDependencies": {
"@codaco/tailwind-config": "workspace:*",
Expand All @@ -42,8 +42,8 @@
"@tailwindcss/typography": "^0.5.15",
"@types/hast": "^3.0.4",
"@types/node": "^20.17.6",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected].1",
"@types/unist": "^3.0.3",
"gray-matter": "^4.0.3",
"hast-util-heading-rank": "^3.0.0",
Expand Down
Loading
Loading