From ca6701c8170a7e3b15b1b80b3d8e2046aa32fe4c Mon Sep 17 00:00:00 2001 From: Alex the Emperor Penguin Date: Thu, 3 Nov 2022 21:47:07 +0100 Subject: [PATCH] updated to nextjs 13 features and behaviour --- .gitignore | 1 + app/contact/page.js | 6 +++++ app/courses/page.js | 6 +++++ app/forum/page.js | 6 +++++ app/globals.css | 44 ++++++++++++++++++++++++++++++++++ app/layout.js | 39 ++++++++++++++++++++++++++++++ app/page.js | 39 ++++++++++++++++++++++++++++++ app/register/page.js | 6 +++++ app/user/page.js | 6 +++++ just-stuff/_app.js | 7 ++++++ just-stuff/api/hello.js | 5 ++++ {pages => just-stuff}/index.js | 0 next.config.js | 7 +++--- package.json | 2 +- 14 files changed, 170 insertions(+), 4 deletions(-) create mode 100644 app/contact/page.js create mode 100644 app/courses/page.js create mode 100644 app/forum/page.js create mode 100644 app/globals.css create mode 100644 app/layout.js create mode 100644 app/page.js create mode 100644 app/register/page.js create mode 100644 app/user/page.js create mode 100644 just-stuff/_app.js create mode 100644 just-stuff/api/hello.js rename {pages => just-stuff}/index.js (100%) diff --git a/.gitignore b/.gitignore index 0fde6f0..72a95f3 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ # misc .DS_Store *.pem +just-stuff # debug npm-debug.log* diff --git a/app/contact/page.js b/app/contact/page.js new file mode 100644 index 0000000..e652f8d --- /dev/null +++ b/app/contact/page.js @@ -0,0 +1,6 @@ +export default async function Page({ children }) { + return( +

+

+ ); +} \ No newline at end of file diff --git a/app/courses/page.js b/app/courses/page.js new file mode 100644 index 0000000..e652f8d --- /dev/null +++ b/app/courses/page.js @@ -0,0 +1,6 @@ +export default async function Page({ children }) { + return( +

+

+ ); +} \ No newline at end of file diff --git a/app/forum/page.js b/app/forum/page.js new file mode 100644 index 0000000..e652f8d --- /dev/null +++ b/app/forum/page.js @@ -0,0 +1,6 @@ +export default async function Page({ children }) { + return( +

+

+ ); +} \ No newline at end of file diff --git a/app/globals.css b/app/globals.css new file mode 100644 index 0000000..d5fe39c --- /dev/null +++ b/app/globals.css @@ -0,0 +1,44 @@ +html, +body { + padding: 0; + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, + Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; + height: 100%; +} + +a { + color: inherit; + text-decoration: none; +} +a:hover { + color: lightskyblue; +} + +* { + box-sizing: border-box; +} +main { + display: flex; + flex-direction: row; + gap: 10rem; + height: 100%; +} +nav { + background-color: #2d2d2d; + display: flex; + flex-direction: column; + justify-content: space-evenly; + padding-left: 3rem; + padding-right: 3rem; +} + +@media (prefers-color-scheme: dark) { + html { + color-scheme: dark; + } + body { + color: white; + background: black; + } +} diff --git a/app/layout.js b/app/layout.js new file mode 100644 index 0000000..e6d935e --- /dev/null +++ b/app/layout.js @@ -0,0 +1,39 @@ +/* eslint-disable @next/next/no-head-element */ + +import Link from "next/link"; +import './globals.css'; + +export default function RootLayout({ children }) { + return ( + + + +
+ +
+ {children} +
+
+ + + ); +} diff --git a/app/page.js b/app/page.js new file mode 100644 index 0000000..fe10ae9 --- /dev/null +++ b/app/page.js @@ -0,0 +1,39 @@ +import PocketBase from "pocketbase"; + +async function getItems() { + const client = new PocketBase('https://backend.saachen.lu'); + const adminAuthData = await client.admins.authViaEmail(process.env.USERNAME, process.env.PASSWORD); +//console.log(adminAuthData); + const resultList = await client.records.getList('forums', 1, 50, { + filter: 'created >= "2022-01-01 00:00:00"', + }); + console.log(resultList); + return resultList; +} + +export default async function Page({ children }) { + const resultList = await getItems(); + return ( +
+

hi

+
+ {resultList.items.map((item, i) => ( +
+ // Show all things which you want +
+ {i} +
+ {item.title} +
+ {i} +
+ {item.description} +
+ )) + } +
+
+ ); +} + +export default Page; diff --git a/app/register/page.js b/app/register/page.js new file mode 100644 index 0000000..e652f8d --- /dev/null +++ b/app/register/page.js @@ -0,0 +1,6 @@ +export default async function Page({ children }) { + return( +

+

+ ); +} \ No newline at end of file diff --git a/app/user/page.js b/app/user/page.js new file mode 100644 index 0000000..e652f8d --- /dev/null +++ b/app/user/page.js @@ -0,0 +1,6 @@ +export default async function Page({ children }) { + return( +

+

+ ); +} \ No newline at end of file diff --git a/just-stuff/_app.js b/just-stuff/_app.js new file mode 100644 index 0000000..1e1cec9 --- /dev/null +++ b/just-stuff/_app.js @@ -0,0 +1,7 @@ +import '../styles/globals.css' + +function MyApp({ Component, pageProps }) { + return +} + +export default MyApp diff --git a/just-stuff/api/hello.js b/just-stuff/api/hello.js new file mode 100644 index 0000000..df63de8 --- /dev/null +++ b/just-stuff/api/hello.js @@ -0,0 +1,5 @@ +// Next.js API route support: https://nextjs.org/docs/api-routes/introduction + +export default function handler(req, res) { + res.status(200).json({ name: 'John Doe' }) +} diff --git a/pages/index.js b/just-stuff/index.js similarity index 100% rename from pages/index.js rename to just-stuff/index.js diff --git a/next.config.js b/next.config.js index bdc2bac..7b8bb0c 100644 --- a/next.config.js +++ b/next.config.js @@ -1,13 +1,14 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - reactStrictMode: true, - webpack: (config) => { + reactStrictMode: true, + experimental:{appDir: true}, + /*webpack: (config) => { config.experiments = { topLevelAwait: true, layers: true, } return config - }, + },*/ } module.exports = nextConfig diff --git a/package.json b/package.json index f427909..2c3d8e6 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev --turbo", "build": "next build", "start": "next start", "lint": "next lint"