Skip to content

Commit

Permalink
[docs] Fix correct use of Page Router and App Router
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Dec 26, 2024
1 parent 0206699 commit 77a8b87
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ First components in @toolpad/core: [DashboardLayout](https://github.com/mui/tool

- Lock file maintenance (#3622) @renovate[bot]
- Lock file maintenance Examples (#3624) @renovate[bot]
- Add Next.js app router Toolpad Core playground (#3587) @apedroferreira
- Add Next.js App Router Toolpad Core playground (#3587) @apedroferreira
- Isolate api-docs-builder deps @Janpot
- isolate react-docgen @Janpot
- Update renovate.json @Janpot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function useDynamicBreadcrumbs(id: string): Breadcrumb[] {
}
```

For example, under the Next.js app router you would be able to obtain breadcrumbs for a dynamic route as follows:
For example, under the Next.js App Router you would be able to obtain breadcrumbs for a dynamic route as follows:

```tsx
// ./src/app/example/[id]/page.tsx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The `SignInPage` component can be set up to use [Passkeys](https://passkeys.dev)
The [Toolpad Core Passkey example app](https://github.com/mui/mui-toolpad/tree/master/examples/core/auth-nextjs-passkey/) comes with a working app using `next-auth/webauthn`, Prisma and PostgreSQL.
:::

{{"component": "modules/components/DocsImage.tsx", "src": "/static/toolpad/docs/core/auth-next-passkey.png", "srcDark": "/static/toolpad/docs/core/auth-next-passkey-dark.png", "alt": "Auth.js Passkeys & Next.js with Toolpad Core sign-in page", "caption": "Auth.js Passkeys & Next.js app router with Toolpad Core Sign-in page", "zoom": true, "aspectRatio": "1.428" }}
{{"component": "modules/components/DocsImage.tsx", "src": "/static/toolpad/docs/core/auth-next-passkey.png", "srcDark": "/static/toolpad/docs/core/auth-next-passkey-dark.png", "alt": "Auth.js Passkeys & Next.js with Toolpad Core sign-in page", "caption": "Auth.js Passkeys & Next.js App Router with Toolpad Core Sign-in page", "zoom": true, "aspectRatio": "1.428" }}

## Credentials

Expand Down Expand Up @@ -110,7 +110,7 @@ This renders an alert with the `error` string as the message.

The component is composable with any authentication library you might want to use. The following is a `SignInPage` with [Auth.js](https://authjs.dev/) using GitHub, Next.js App Router and server actions.

{{"component": "modules/components/DocsImage.tsx", "src": "/static/toolpad/docs/core/auth-next.png", "srcDark": "/static/toolpad/docs/core/auth-next-dark.png", "alt": "Auth.js & Next.js with Toolpad Core sign-in page", "caption": "Auth.js & Next.js app router with Toolpad Core Sign-in page", "zoom": true, "indent": 1, "aspectRatio": "1.428" }}
{{"component": "modules/components/DocsImage.tsx", "src": "/static/toolpad/docs/core/auth-next.png", "srcDark": "/static/toolpad/docs/core/auth-next-dark.png", "alt": "Auth.js & Next.js with Toolpad Core sign-in page", "caption": "Auth.js & Next.js App Router with Toolpad Core Sign-in page", "zoom": true, "indent": 1, "aspectRatio": "1.428" }}

#### Setting up

Expand Down
2 changes: 1 addition & 1 deletion docs/data/toolpad/core/integrations/nextjs-approuter.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ See the [Material UI Next.js integration docs](https://mui.com/material-ui/inte
:::

:::warning
If your app is statically rendered, you must wrap the `AppProvider` in a `Suspense` component when using the app router. See [https://github.com/mui/toolpad/issues/4524](https://github.com/mui/toolpad/issues/4524) for more information.
If your app is statically rendered, you must wrap the `AppProvider` in a `Suspense` component when using the App Router. See [https://github.com/mui/toolpad/issues/4524](https://github.com/mui/toolpad/issues/4524) for more information.
:::

## Create a dashboard layout
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/Examples/core-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function examples() {
{
title: 'Functional dashboard',
description:
'This example shows you how to get started building a dashboard with Toolpad Core, Next.js app router, Auth.js and Material UI components in a customized theme.',
'This example shows you how to get started building a dashboard with Toolpad Core, Next.js App Router, Auth.js and Material UI components in a customized theme.',
src: '/static/toolpad/docs/core/functional-dashboard.png',
href: 'https://mui.com/toolpad/core/templates/nextjs-dashboard',
srcDark: '/static/toolpad/docs/core/functional-dashboard-dark.png',
Expand Down
6 changes: 3 additions & 3 deletions packages/create-toolpad-app/src/generateProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import prisma from './templates/auth/prisma';
import env from './templates/auth/env';
import schemaPrisma from './templates/auth/schemaPrisma';

// Auth files for app router
// Auth files for App Router
import signInPage from './templates/auth/nextjs-app/signInPage';
import signInAction from './templates/auth/nextjs-app/actions';

// Auth files for pages router
// Auth files for Pages Router
import signInPagePagesRouter from './templates/auth/nextjs-pages/signIn';

import { GenerateProjectOptions } from './types';
Expand Down Expand Up @@ -72,7 +72,7 @@ export default function generateProject(
['auth.ts', { content: auth(options) }],
['.env.local', { content: envLocal(options) }],
['middleware.ts', { content: middleware }],
// next-auth v5 does not provide an API route, so this file must be in the app router
// next-auth v5 does not provide an API route, so this file must be in the App Router
// even if the rest of the app is using pages router
// https://authjs.dev/getting-started/installation#configure
['app/api/auth/[...nextAuth]/route.ts', { content: routeHandler }],
Expand Down

0 comments on commit 77a8b87

Please sign in to comment.