diff --git a/apps/chat/src/pages/_app.tsx b/apps/chat/src/pages/_app.tsx
index c32ef7a80..2f97f8ef1 100644
--- a/apps/chat/src/pages/_app.tsx
+++ b/apps/chat/src/pages/_app.tsx
@@ -1,10 +1,14 @@
import { SessionProvider, SessionProviderProps } from 'next-auth/react';
+import { ReactElement, ReactNode } from 'react';
import { Provider } from 'react-redux';
+import { NextPage } from 'next';
import { appWithTranslation } from 'next-i18next';
import type { AppProps } from 'next/app';
import { Inconsolata, Inter } from 'next/font/google';
+import { SettingsState } from '@/src/store/settings/settings.reducers';
+
import Layout from '../components/Layout';
import { Toasts } from '../components/Toasts/Toasts';
@@ -13,6 +17,14 @@ import { HomeProps } from '.';
import { createStore } from '@/src/store';
import '@/src/styles/globals.css';
+export type NextPageWithLayout
= NextPage
& {
+ getLayout?: (page: ReactElement, settings: SettingsState) => ReactNode;
+};
+
+export function getLayout(page: ReactElement, settings: SettingsState) {
+ return {page};
+}
+
export const inter = Inter({
subsets: ['latin'],
weight: 'variable',
@@ -24,22 +36,26 @@ export const inconsolata = Inconsolata({
variable: '--font-inconsolata',
});
-function App({
- Component,
- ...rest
-}: AppProps) {
+type AppPropsWithLayout = AppProps & {
+ Component: NextPageWithLayout;
+};
+
+function App({ Component, ...rest }: AppPropsWithLayout) {
const store = createStore({
settings: rest.pageProps.initialState?.settings,
});
+ const getPage = Component.getLayout ?? ((page) => page);
+
return (
-
-
-
+ {getPage(
+ ,
+ rest.pageProps.initialState?.settings,
+ )}
diff --git a/apps/chat/src/pages/index.tsx b/apps/chat/src/pages/index.tsx
index e88565c3a..c25f51694 100644
--- a/apps/chat/src/pages/index.tsx
+++ b/apps/chat/src/pages/index.tsx
@@ -13,6 +13,8 @@ import {
selectShowSelectToMigrateWindow,
} from '@/src/store/ui/ui.reducers';
+import { getLayout } from '@/src/pages/_app';
+
import ShareModal from '../components/Chat/ShareModal';
import { ImportExportLoader } from '../components/Chatbar/ImportExportLoader';
import { AnnouncementsBanner } from '../components/Common/AnnouncementBanner';
@@ -34,7 +36,7 @@ export interface HomeProps {
};
}
-export default function Home() {
+function Home() {
useCustomizations();
const isProfileOpen = useAppSelector(UISelectors.selectIsProfileOpen);
@@ -120,4 +122,8 @@ export default function Home() {
);
}
+Home.getLayout = getLayout;
+
+export default Home;
+
export const getServerSideProps = getCommonPageProps;
diff --git a/apps/chat/src/pages/marketplace/index.tsx b/apps/chat/src/pages/marketplace/index.tsx
index 68ff419f4..bdf7eb1a3 100644
--- a/apps/chat/src/pages/marketplace/index.tsx
+++ b/apps/chat/src/pages/marketplace/index.tsx
@@ -9,6 +9,8 @@ import { MarketplaceActions } from '@/src/store/marketplace/marketplace.reducers
import { SettingsSelectors } from '@/src/store/settings/settings.reducers';
import { UISelectors } from '@/src/store/ui/ui.reducers';
+import { getLayout } from '@/src/pages/_app';
+
import Loader from '@/src/components/Common/Loader';
import { UserMobile } from '@/src/components/Header/User/UserMobile';
import { Marketplace as MarketplaceView } from '@/src/components/Marketplace/Marketplace';
@@ -17,7 +19,7 @@ import { MarketplaceHeader } from '@/src/components/Marketplace/MarketplaceHeade
import { Feature } from '@epam/ai-dial-shared';
-export default function Marketplace() {
+function Marketplace() {
const dispatch = useAppDispatch();
const isProfileOpen = useAppSelector(UISelectors.selectIsProfileOpen);
@@ -53,4 +55,8 @@ export default function Marketplace() {
);
}
+Marketplace.getLayout = getLayout;
+
+export default Marketplace;
+
export const getServerSideProps = getCommonPageProps;