diff --git a/app/home/(user)/(dashboard)/cart/loading.tsx b/app/home/(user)/(dashboard)/cart/loading.tsx
new file mode 100644
index 0000000..f093295
--- /dev/null
+++ b/app/home/(user)/(dashboard)/cart/loading.tsx
@@ -0,0 +1,5 @@
+import SkeletonCartPage from '~/medusa/modules/skeletons/templates/skeleton-cart-page';
+
+export default function Loading() {
+ return ;
+}
diff --git a/app/home/(user)/(dashboard)/cart/not-found.tsx b/app/home/(user)/(dashboard)/cart/not-found.tsx
new file mode 100644
index 0000000..a2f02bd
--- /dev/null
+++ b/app/home/(user)/(dashboard)/cart/not-found.tsx
@@ -0,0 +1,21 @@
+import { Metadata } from 'next';
+
+import InteractiveLink from '~/medusa/modules/common/components/interactive-link';
+
+export const metadata: Metadata = {
+ title: '404',
+ description: 'Something went wrong',
+};
+
+export default function NotFound() {
+ return (
+
diff --git a/app/join/page.tsx b/app/join/page.tsx
index 1c1b061..a8ae240 100644
--- a/app/join/page.tsx
+++ b/app/join/page.tsx
@@ -68,13 +68,11 @@ async function JoinTeamAccountPage(props: JoinTeamAccountPageProps) {
const invitation = await api.getInvitation(adminClient, token);
// the invitation is not found or expired
- if (!invitation) {
return (
);
- }
// we need to verify the user isn't already in the account
// we do so by checking if the user can read the account
diff --git a/app/store/[countryCode]/(main)/layout.tsx b/app/store/[countryCode]/(main)/layout.tsx
index 31d1512..61aca29 100644
--- a/app/store/[countryCode]/(main)/layout.tsx
+++ b/app/store/[countryCode]/(main)/layout.tsx
@@ -1,46 +1,117 @@
-import { Metadata } from 'next';
+import { use } from 'react';
-import { StoreCartShippingOption } from '@medusajs/types';
+import { cookies } from 'next/headers';
-import { listCartOptions, retrieveCart } from '~/medusa/lib/data/cart';
-import { retrieveCustomer } from '~/medusa/lib/data/customer';
-import { getBaseURL } from '~/medusa/lib/util/env';
-import CartMismatchBanner from '~/medusa/modules/layout/components/cart-mismatch-banner';
-import Footer from '~/medusa/modules/layout/templates/footer';
-import Nav from '~/medusa/modules/layout/templates/nav';
-import FreeShippingPriceNudge from '~/medusa/modules/shipping/components/free-shipping-price-nudge';
+import { z } from 'zod';
-export const metadata: Metadata = {
- metadataBase: new URL(getBaseURL()),
-};
+import { UserWorkspaceContextProvider } from '@kit/accounts/components';
+import { Page, PageMobileNavigation, PageNavigation } from '@kit/ui/page';
+import { SidebarProvider } from '@kit/ui/shadcn-sidebar';
-export default async function PageLayout(props: { children: React.ReactNode }) {
- const customer = await retrieveCustomer();
- const cart = await retrieveCart();
- let shippingOptions: StoreCartShippingOption[] = [];
+import { AppLogo } from '~/components/app-logo';
+import { personalAccountNavigationConfig } from '~/config/personal-account-navigation.config';
+import { withI18n } from '~/lib/i18n/with-i18n';
+import { loadUserWorkspace } from '@/app/home/(user)/_lib/server/load-user-workspace';
+import { HomeSidebar } from '@/app/home/(user)/_components/home-sidebar';
+import { HomeMenuNavigation } from '@/app/home/(user)/_components/home-menu-navigation';
+import { HomeMobileNavigation } from '@/app/home/(user)/_components/home-mobile-navigation';
- if (cart) {
- const { shipping_options } = await listCartOptions();
+function UserHomeLayout({ children }: React.PropsWithChildren) {
+ const state = use(getLayoutState());
- shippingOptions = shipping_options;
+ if (state.style === 'sidebar') {
+ return
{children};
}
+ return
{children};
+}
+
+export default withI18n(UserHomeLayout);
+
+function SidebarLayout({ children }: React.PropsWithChildren) {
+ const workspace = use(loadUserWorkspace());
+ const state = use(getLayoutState());
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ {children}
+
+
+
+ );
+}
+
+function HeaderLayout({ children }: React.PropsWithChildren) {
+ const workspace = use(loadUserWorkspace());
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {children}
+
+
+
+
+ );
+}
+
+function MobileNavigation({
+ workspace,
+}: {
+ workspace: Awaited
>;
+}) {
return (
<>
-
- {customer && cart && (
-
- )}
+
- {cart && (
-
- )}
- {props.children}
-
+
>
);
}
+
+async function getLayoutState() {
+ const cookieStore = await cookies();
+
+ const LayoutStyleSchema = z.enum(['sidebar', 'header', 'custom']);
+
+ const layoutStyleCookie = cookieStore.get('layout-style');
+ const sidebarOpenCookie = cookieStore.get('sidebar:state');
+
+ const sidebarOpen = sidebarOpenCookie
+ ? sidebarOpenCookie.value === 'false'
+ : !personalAccountNavigationConfig.sidebarCollapsed;
+
+ const parsedStyle = LayoutStyleSchema.safeParse(layoutStyleCookie?.value);
+
+ const style = parsedStyle.success
+ ? parsedStyle.data
+ : personalAccountNavigationConfig.style;
+
+ return {
+ open: sidebarOpen,
+ style,
+ };
+}
diff --git a/app/store/[countryCode]/(main)/layout2.tsx b/app/store/[countryCode]/(main)/layout2.tsx
new file mode 100644
index 0000000..31d1512
--- /dev/null
+++ b/app/store/[countryCode]/(main)/layout2.tsx
@@ -0,0 +1,46 @@
+import { Metadata } from 'next';
+
+import { StoreCartShippingOption } from '@medusajs/types';
+
+import { listCartOptions, retrieveCart } from '~/medusa/lib/data/cart';
+import { retrieveCustomer } from '~/medusa/lib/data/customer';
+import { getBaseURL } from '~/medusa/lib/util/env';
+import CartMismatchBanner from '~/medusa/modules/layout/components/cart-mismatch-banner';
+import Footer from '~/medusa/modules/layout/templates/footer';
+import Nav from '~/medusa/modules/layout/templates/nav';
+import FreeShippingPriceNudge from '~/medusa/modules/shipping/components/free-shipping-price-nudge';
+
+export const metadata: Metadata = {
+ metadataBase: new URL(getBaseURL()),
+};
+
+export default async function PageLayout(props: { children: React.ReactNode }) {
+ const customer = await retrieveCustomer();
+ const cart = await retrieveCart();
+ let shippingOptions: StoreCartShippingOption[] = [];
+
+ if (cart) {
+ const { shipping_options } = await listCartOptions();
+
+ shippingOptions = shipping_options;
+ }
+
+ return (
+ <>
+
+ {customer && cart && (
+
+ )}
+
+ {cart && (
+
+ )}
+ {props.children}
+
+ >
+ );
+}