From 2ef5e33b0ec84336eb3e8346d472e847962922f9 Mon Sep 17 00:00:00 2001
From: Nathaniel Tampus
Date: Wed, 15 Feb 2023 14:09:33 +0800
Subject: [PATCH] use next.js 13 appdir, add initial navbar drawer
---
client/next.config.js | 5 ++-
client/src/{styles => app}/globals.css | 0
client/src/app/head.tsx | 9 ++++
client/src/app/layout.tsx | 58 ++++++++++++++++++++++++++
client/src/app/page.tsx | 3 ++
client/src/pages/_app.tsx | 6 ---
client/src/pages/_document.tsx | 13 ------
client/src/pages/api/hello.ts | 10 -----
client/src/pages/index.tsx | 5 ---
client/tsconfig.json | 9 +++-
10 files changed, 81 insertions(+), 37 deletions(-)
rename client/src/{styles => app}/globals.css (100%)
create mode 100644 client/src/app/head.tsx
create mode 100644 client/src/app/layout.tsx
create mode 100644 client/src/app/page.tsx
delete mode 100644 client/src/pages/_app.tsx
delete mode 100644 client/src/pages/_document.tsx
delete mode 100644 client/src/pages/api/hello.ts
delete mode 100644 client/src/pages/index.tsx
diff --git a/client/next.config.js b/client/next.config.js
index eda88d1..72ccbee 100644
--- a/client/next.config.js
+++ b/client/next.config.js
@@ -1,6 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
- reactStrictMode: true
+ reactStrictMode: true,
+ experimental: {
+ appDir: true
+ }
};
module.exports = nextConfig;
diff --git a/client/src/styles/globals.css b/client/src/app/globals.css
similarity index 100%
rename from client/src/styles/globals.css
rename to client/src/app/globals.css
diff --git a/client/src/app/head.tsx b/client/src/app/head.tsx
new file mode 100644
index 0000000..3f83925
--- /dev/null
+++ b/client/src/app/head.tsx
@@ -0,0 +1,9 @@
+export default function Head() {
+ return (
+ <>
+ Chessu
+
+
+ >
+ );
+}
diff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsx
new file mode 100644
index 0000000..f4fa6ab
--- /dev/null
+++ b/client/src/app/layout.tsx
@@ -0,0 +1,58 @@
+import "./globals.css";
+
+export default function RootLayout({ children }: { children: React.ReactNode }) {
+ return (
+
+
+
+
+
+
+
+ );
+}
diff --git a/client/src/app/page.tsx b/client/src/app/page.tsx
new file mode 100644
index 0000000..16e9484
--- /dev/null
+++ b/client/src/app/page.tsx
@@ -0,0 +1,3 @@
+export default function Home() {
+ return Homepage
;
+}
diff --git a/client/src/pages/_app.tsx b/client/src/pages/_app.tsx
deleted file mode 100644
index a7a790f..0000000
--- a/client/src/pages/_app.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import "@/styles/globals.css";
-import type { AppProps } from "next/app";
-
-export default function App({ Component, pageProps }: AppProps) {
- return ;
-}
diff --git a/client/src/pages/_document.tsx b/client/src/pages/_document.tsx
deleted file mode 100644
index b2fff8b..0000000
--- a/client/src/pages/_document.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Html, Head, Main, NextScript } from "next/document";
-
-export default function Document() {
- return (
-
-
-
-
-
-
- );
-}
diff --git a/client/src/pages/api/hello.ts b/client/src/pages/api/hello.ts
deleted file mode 100644
index c50d809..0000000
--- a/client/src/pages/api/hello.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
-import type { NextApiRequest, NextApiResponse } from "next";
-
-type Data = {
- name: string;
-};
-
-export default function handler(req: NextApiRequest, res: NextApiResponse) {
- res.status(200).json({ name: "John Doe" });
-}
diff --git a/client/src/pages/index.tsx b/client/src/pages/index.tsx
deleted file mode 100644
index 83d39dc..0000000
--- a/client/src/pages/index.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-const index = () => {
- return index
;
-};
-
-export default index;
diff --git a/client/tsconfig.json b/client/tsconfig.json
index ee95d38..eb2ca4d 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -17,8 +17,13 @@
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
- }
+ },
+ "plugins": [
+ {
+ "name": "next"
+ }
+ ]
},
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}