From f54bacf947f0d65162012c183e905f41dd52bb72 Mon Sep 17 00:00:00 2001 From: delishad21 Date: Tue, 8 Oct 2024 15:34:03 +0800 Subject: [PATCH] add multiple root layouts --- .../peerprep/app/{ => (default)}/error.tsx | 0 .../app/{ => (default)}/home/layout.tsx | 0 .../app/{ => (default)}/home/page.tsx | 0 frontend/peerprep/app/(default)/layout.tsx | 66 +++++++++++++++++++ .../app/{ => (default)}/providers.tsx | 0 .../questions-management/add/layout.tsx | 0 .../questions-management/add/page.tsx | 0 .../questions-management/columns.tsx | 0 .../questions-management/edit/[id]/layout.tsx | 0 .../questions-management/edit/[id]/page.tsx | 0 .../questions-management/layout.tsx | 0 .../mockdata/sample_getAllQuestions.json | 0 .../mockdata/sample_getSingleQuestion.json | 0 .../questions-management/page.tsx | 0 .../app/{ => (default)}/settings/layout.tsx | 0 .../app/{ => (default)}/settings/page.tsx | 0 frontend/peerprep/app/layout.tsx | 57 +--------------- frontend/peerprep/app/page.tsx | 7 -- .../peerprep/components/addquestionform.tsx | 2 +- .../peerprep/components/editquestionform.tsx | 2 +- .../peerprep/components/questionstable.tsx | 2 +- 21 files changed, 71 insertions(+), 65 deletions(-) rename frontend/peerprep/app/{ => (default)}/error.tsx (100%) rename frontend/peerprep/app/{ => (default)}/home/layout.tsx (100%) rename frontend/peerprep/app/{ => (default)}/home/page.tsx (100%) create mode 100644 frontend/peerprep/app/(default)/layout.tsx rename frontend/peerprep/app/{ => (default)}/providers.tsx (100%) rename frontend/peerprep/app/{ => (default)}/questions-management/add/layout.tsx (100%) rename frontend/peerprep/app/{ => (default)}/questions-management/add/page.tsx (100%) rename frontend/peerprep/app/{ => (default)}/questions-management/columns.tsx (100%) rename frontend/peerprep/app/{ => (default)}/questions-management/edit/[id]/layout.tsx (100%) rename frontend/peerprep/app/{ => (default)}/questions-management/edit/[id]/page.tsx (100%) rename frontend/peerprep/app/{ => (default)}/questions-management/layout.tsx (100%) rename frontend/peerprep/app/{ => (default)}/questions-management/mockdata/sample_getAllQuestions.json (100%) rename frontend/peerprep/app/{ => (default)}/questions-management/mockdata/sample_getSingleQuestion.json (100%) rename frontend/peerprep/app/{ => (default)}/questions-management/page.tsx (100%) rename frontend/peerprep/app/{ => (default)}/settings/layout.tsx (100%) rename frontend/peerprep/app/{ => (default)}/settings/page.tsx (100%) diff --git a/frontend/peerprep/app/error.tsx b/frontend/peerprep/app/(default)/error.tsx similarity index 100% rename from frontend/peerprep/app/error.tsx rename to frontend/peerprep/app/(default)/error.tsx diff --git a/frontend/peerprep/app/home/layout.tsx b/frontend/peerprep/app/(default)/home/layout.tsx similarity index 100% rename from frontend/peerprep/app/home/layout.tsx rename to frontend/peerprep/app/(default)/home/layout.tsx diff --git a/frontend/peerprep/app/home/page.tsx b/frontend/peerprep/app/(default)/home/page.tsx similarity index 100% rename from frontend/peerprep/app/home/page.tsx rename to frontend/peerprep/app/(default)/home/page.tsx diff --git a/frontend/peerprep/app/(default)/layout.tsx b/frontend/peerprep/app/(default)/layout.tsx new file mode 100644 index 0000000000..5f8e46b4a4 --- /dev/null +++ b/frontend/peerprep/app/(default)/layout.tsx @@ -0,0 +1,66 @@ +import "@/styles/globals.css"; +import { Metadata, Viewport } from "next"; +import clsx from "clsx"; +import { PublicEnvScript } from "next-runtime-env"; + +import { Providers } from "./providers"; + +import { siteConfig } from "@/config/site"; +import { fontSans } from "@/config/fonts"; +import { Navbar } from "@/components/navbar"; +import { Sidebar } from "@/components/sidebar"; + +export const metadata: Metadata = { + title: { + default: siteConfig.name, + template: `%s - ${siteConfig.name}`, + }, + description: siteConfig.description, + icons: { + icon: "/favicon.ico", + }, +}; + +export const viewport: Viewport = { + themeColor: [ + { media: "(prefers-color-scheme: light)", color: "white" }, + { media: "(prefers-color-scheme: dark)", color: "black" }, + ], +}; + +export default function RootLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + + + + + + + +
+ +
+ +
+ {children} +
+
+
+
+
+ + + ); +} diff --git a/frontend/peerprep/app/providers.tsx b/frontend/peerprep/app/(default)/providers.tsx similarity index 100% rename from frontend/peerprep/app/providers.tsx rename to frontend/peerprep/app/(default)/providers.tsx diff --git a/frontend/peerprep/app/questions-management/add/layout.tsx b/frontend/peerprep/app/(default)/questions-management/add/layout.tsx similarity index 100% rename from frontend/peerprep/app/questions-management/add/layout.tsx rename to frontend/peerprep/app/(default)/questions-management/add/layout.tsx diff --git a/frontend/peerprep/app/questions-management/add/page.tsx b/frontend/peerprep/app/(default)/questions-management/add/page.tsx similarity index 100% rename from frontend/peerprep/app/questions-management/add/page.tsx rename to frontend/peerprep/app/(default)/questions-management/add/page.tsx diff --git a/frontend/peerprep/app/questions-management/columns.tsx b/frontend/peerprep/app/(default)/questions-management/columns.tsx similarity index 100% rename from frontend/peerprep/app/questions-management/columns.tsx rename to frontend/peerprep/app/(default)/questions-management/columns.tsx diff --git a/frontend/peerprep/app/questions-management/edit/[id]/layout.tsx b/frontend/peerprep/app/(default)/questions-management/edit/[id]/layout.tsx similarity index 100% rename from frontend/peerprep/app/questions-management/edit/[id]/layout.tsx rename to frontend/peerprep/app/(default)/questions-management/edit/[id]/layout.tsx diff --git a/frontend/peerprep/app/questions-management/edit/[id]/page.tsx b/frontend/peerprep/app/(default)/questions-management/edit/[id]/page.tsx similarity index 100% rename from frontend/peerprep/app/questions-management/edit/[id]/page.tsx rename to frontend/peerprep/app/(default)/questions-management/edit/[id]/page.tsx diff --git a/frontend/peerprep/app/questions-management/layout.tsx b/frontend/peerprep/app/(default)/questions-management/layout.tsx similarity index 100% rename from frontend/peerprep/app/questions-management/layout.tsx rename to frontend/peerprep/app/(default)/questions-management/layout.tsx diff --git a/frontend/peerprep/app/questions-management/mockdata/sample_getAllQuestions.json b/frontend/peerprep/app/(default)/questions-management/mockdata/sample_getAllQuestions.json similarity index 100% rename from frontend/peerprep/app/questions-management/mockdata/sample_getAllQuestions.json rename to frontend/peerprep/app/(default)/questions-management/mockdata/sample_getAllQuestions.json diff --git a/frontend/peerprep/app/questions-management/mockdata/sample_getSingleQuestion.json b/frontend/peerprep/app/(default)/questions-management/mockdata/sample_getSingleQuestion.json similarity index 100% rename from frontend/peerprep/app/questions-management/mockdata/sample_getSingleQuestion.json rename to frontend/peerprep/app/(default)/questions-management/mockdata/sample_getSingleQuestion.json diff --git a/frontend/peerprep/app/questions-management/page.tsx b/frontend/peerprep/app/(default)/questions-management/page.tsx similarity index 100% rename from frontend/peerprep/app/questions-management/page.tsx rename to frontend/peerprep/app/(default)/questions-management/page.tsx diff --git a/frontend/peerprep/app/settings/layout.tsx b/frontend/peerprep/app/(default)/settings/layout.tsx similarity index 100% rename from frontend/peerprep/app/settings/layout.tsx rename to frontend/peerprep/app/(default)/settings/layout.tsx diff --git a/frontend/peerprep/app/settings/page.tsx b/frontend/peerprep/app/(default)/settings/page.tsx similarity index 100% rename from frontend/peerprep/app/settings/page.tsx rename to frontend/peerprep/app/(default)/settings/page.tsx diff --git a/frontend/peerprep/app/layout.tsx b/frontend/peerprep/app/layout.tsx index 5f8e46b4a4..9bf6d3c56f 100644 --- a/frontend/peerprep/app/layout.tsx +++ b/frontend/peerprep/app/layout.tsx @@ -1,33 +1,3 @@ -import "@/styles/globals.css"; -import { Metadata, Viewport } from "next"; -import clsx from "clsx"; -import { PublicEnvScript } from "next-runtime-env"; - -import { Providers } from "./providers"; - -import { siteConfig } from "@/config/site"; -import { fontSans } from "@/config/fonts"; -import { Navbar } from "@/components/navbar"; -import { Sidebar } from "@/components/sidebar"; - -export const metadata: Metadata = { - title: { - default: siteConfig.name, - template: `%s - ${siteConfig.name}`, - }, - description: siteConfig.description, - icons: { - icon: "/favicon.ico", - }, -}; - -export const viewport: Viewport = { - themeColor: [ - { media: "(prefers-color-scheme: light)", color: "white" }, - { media: "(prefers-color-scheme: dark)", color: "black" }, - ], -}; - export default function RootLayout({ children, }: { @@ -35,31 +5,8 @@ export default function RootLayout({ }) { return ( - - - - - - -
- -
- -
- {children} -
-
-
-
-
+ +
{children}
); diff --git a/frontend/peerprep/app/page.tsx b/frontend/peerprep/app/page.tsx index bae2db1ba4..0aacb55687 100644 --- a/frontend/peerprep/app/page.tsx +++ b/frontend/peerprep/app/page.tsx @@ -1,13 +1,6 @@ "use client"; export default function Home() { - const friends = [ - { name: "s_name", status: "online" }, - { name: "thisisalongusername", status: "online" }, - { name: "Friend3", status: "hidden" }, - { name: "Friend4", status: "offline" }, - ]; - return (

diff --git a/frontend/peerprep/components/addquestionform.tsx b/frontend/peerprep/components/addquestionform.tsx index b924d26a1e..b304a558db 100644 --- a/frontend/peerprep/components/addquestionform.tsx +++ b/frontend/peerprep/components/addquestionform.tsx @@ -21,7 +21,7 @@ import { WysiMarkEditor } from "./wysimarkeditor"; import BoxIcon from "./boxicons"; import { capitalize, languages } from "@/utils/utils"; -import { complexityColorMap } from "@/app/questions-management/columns"; +import { complexityColorMap } from "@/app/(default)/questions-management/columns"; interface AddQuestionFormProps { initialTitle?: string; diff --git a/frontend/peerprep/components/editquestionform.tsx b/frontend/peerprep/components/editquestionform.tsx index 8e8be1dd57..3429eebdaf 100644 --- a/frontend/peerprep/components/editquestionform.tsx +++ b/frontend/peerprep/components/editquestionform.tsx @@ -26,7 +26,7 @@ import { capitalize, languages } from "@/utils/utils"; import { complexityColorMap, Question, -} from "@/app/questions-management/columns"; +} from "@/app/(default)/questions-management/columns"; interface EditQuestionFormProps { initialTitle?: string; diff --git a/frontend/peerprep/components/questionstable.tsx b/frontend/peerprep/components/questionstable.tsx index 6f5f266d7c..e056e21251 100644 --- a/frontend/peerprep/components/questionstable.tsx +++ b/frontend/peerprep/components/questionstable.tsx @@ -32,7 +32,7 @@ import { Question, RenderCell, complexityOptions, -} from "@/app/questions-management/columns"; +} from "@/app/(default)/questions-management/columns"; const fetcher = (url: string) => fetch(url).then((res) => res.json());