diff --git a/packages/ui/src/app/layout.tsx b/packages/ui/src/app/layout.tsx
index 2eab3cceb8..5023fa6669 100644
--- a/packages/ui/src/app/layout.tsx
+++ b/packages/ui/src/app/layout.tsx
@@ -1,6 +1,7 @@
import './globals.css';
import type { Metadata } from 'next';
+import { Shell } from '../components/shell';
import { EmailsProvider } from '../contexts/emails';
import { WorkspaceProvider } from '../contexts/workspace';
import { getEmailsDirectoryMetadata } from '../utils/get-emails-directory-metadata';
@@ -42,7 +43,7 @@ export default async function RootLayout({
- {children}
+ {children}
diff --git a/packages/ui/src/app/page.tsx b/packages/ui/src/app/page.tsx
index 93b604aea0..df21f4f973 100644
--- a/packages/ui/src/app/page.tsx
+++ b/packages/ui/src/app/page.tsx
@@ -3,7 +3,6 @@ import Image from 'next/image';
import Link from 'next/link';
import { Button, Heading, Text } from '../components';
import CodeSnippet from '../components/code-snippet';
-import { Shell } from '../components/shell';
import { emailsDirectoryAbsolutePath } from './env';
import logo from './logo.png';
@@ -11,34 +10,32 @@ export default function Home() {
const baseEmailsDirectoryName = path.basename(emailsDirectoryAbsolutePath);
return (
-
-
-
-
-
- Welcome to React Email
-
-
- To start developing your emails, you can create a
- .jsx or .tsx{' '}
- file under your {baseEmailsDirectoryName}{' '}
- folder.
-
-
-
+
+
+
+
+ Welcome to React Email
+
+
+ To start developing your emails, you can create a
+ .jsx or .tsx{' '}
+ file under your {baseEmailsDirectoryName}{' '}
+ folder.
+
+
-
+
);
}
diff --git a/packages/ui/src/app/preview/[...slug]/page.tsx b/packages/ui/src/app/preview/[...slug]/page.tsx
index 16e20260f8..d33306d19d 100644
--- a/packages/ui/src/app/preview/[...slug]/page.tsx
+++ b/packages/ui/src/app/preview/[...slug]/page.tsx
@@ -7,7 +7,6 @@ import {
} from '../../../actions/email-validation/check-compatibility';
import { getEmailPathFromSlug } from '../../../actions/get-email-path-from-slug';
import { renderEmailByPath } from '../../../actions/render-email-by-path';
-import { Shell } from '../../../components/shell';
import { Toolbar } from '../../../components/toolbar';
import type { LintingRow } from '../../../components/toolbar/linter';
import type { SpamCheckingResult } from '../../../components/toolbar/spam-assassin';
@@ -135,23 +134,21 @@ This is most likely not an issue with the preview server. Maybe there was a typo
emailPath={emailPath}
serverRenderingResult={serverEmailRenderingResult}
>
-
- {/* This suspense is so that this page doesn't throw warnings */}
- {/* on the build of the preview server de-opting into */}
- {/* client-side rendering on build */}
-
-
-
- 0}>
-
-
-
-
+ {/* This suspense is so that this page doesn't throw warnings */}
+ {/* on the build of the preview server de-opting into */}
+ {/* client-side rendering on build */}
+
+
+
+ 0}>
+
+
+
);
}
diff --git a/packages/ui/src/components/shell.tsx b/packages/ui/src/components/shell.tsx
index 237b187bf9..50b911a62c 100644
--- a/packages/ui/src/components/shell.tsx
+++ b/packages/ui/src/components/shell.tsx
@@ -7,7 +7,6 @@ import { Sidebar } from './sidebar';
interface ShellProps {
children: React.ReactNode;
- currentEmailOpenSlug?: string;
}
interface ShellContextValue {
@@ -19,7 +18,7 @@ export const ShellContext = React.createContext(
undefined,
);
-export const Shell = ({ children, currentEmailOpenSlug }: ShellProps) => {
+export const Shell = ({ children }: ShellProps) => {
const [sidebarToggled, setSidebarToggled] = React.useState(true);
return (
@@ -73,7 +72,6 @@ export const Shell = ({ children, currentEmailOpenSlug }: ShellProps) => {
'lg:w-0': !sidebarToggled,
},
)}
- currentEmailOpenSlug={currentEmailOpenSlug}
/>
{
+export const Sidebar = ({ className }: SidebarProps) => {
const { emailsDirectoryMetadata } = useEmails();
+ const params = useParams();
+ const currentEmailOpenSlug = Array.isArray(params.slug)
+ ? decodeURIComponent(params.slug.join('/'))
+ : undefined;
return (