From 739e6b4c3c7edaa4e58148ee5d6b14b814e5a35c 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/forum/page.js | 28 ++----------- app/globals.css | 6 --- app/layout.js | 13 +----- app/page.js | 43 +++++++++++++++++--- next.config.js | 7 ++-- package.json | 2 +- pages/_app.js | 7 ---- pages/api/hello.js | 5 --- pages/index.js | 98 ---------------------------------------------- 10 files changed, 49 insertions(+), 161 deletions(-) delete mode 100644 pages/_app.js delete mode 100644 pages/api/hello.js delete mode 100644 pages/index.js 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/forum/page.js b/app/forum/page.js index a862359..e652f8d 100644 --- a/app/forum/page.js +++ b/app/forum/page.js @@ -1,26 +1,6 @@ -import getItems from "./getItems"; - 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} -
- )) - } -
-
+ return( +

+

); -} +} \ No newline at end of file diff --git a/app/globals.css b/app/globals.css index 0685f97..d5fe39c 100644 --- a/app/globals.css +++ b/app/globals.css @@ -33,12 +33,6 @@ nav { padding-right: 3rem; } -.social { - display: flex; - flex-direction: row; - justify-content: space-between; -} - @media (prefers-color-scheme: dark) { html { color-scheme: dark; diff --git a/app/layout.js b/app/layout.js index 925e455..e6d935e 100644 --- a/app/layout.js +++ b/app/layout.js @@ -6,10 +6,7 @@ import './globals.css'; export default function RootLayout({ children }) { return ( - - - +
{children} diff --git a/app/page.js b/app/page.js index e652f8d..fe10ae9 100644 --- a/app/page.js +++ b/app/page.js @@ -1,6 +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 }) { - return( -

-

- ); -} \ No newline at end of file + 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/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" diff --git a/pages/_app.js b/pages/_app.js deleted file mode 100644 index 1e1cec9..0000000 --- a/pages/_app.js +++ /dev/null @@ -1,7 +0,0 @@ -import '../styles/globals.css' - -function MyApp({ Component, pageProps }) { - return -} - -export default MyApp diff --git a/pages/api/hello.js b/pages/api/hello.js deleted file mode 100644 index df63de8..0000000 --- a/pages/api/hello.js +++ /dev/null @@ -1,5 +0,0 @@ -// 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/pages/index.js deleted file mode 100644 index 43a65a1..0000000 --- a/pages/index.js +++ /dev/null @@ -1,98 +0,0 @@ -import Head from 'next/head' -import Image from 'next/image' -import PocketBase from 'pocketbase' -import styles from '../styles/Home.module.css' - -console.log("username:" + process.env.USERNAME); - -const client = new PocketBase('https://backend.saachen.lu'); -const adminAuthData = await client.admins.authViaEmail(process.env.USERNAME, process.env.PASSWORD).catch((error) =>{console.log("It be a feature")}); -//console.log(adminAuthData); -const resultList = await client.records.getList('forums', 1, 50, { - filter: 'created >= "2022-01-01 00:00:00"', -}); -//console.log(resultList); - -export default function Home() { - return ( -
- - hihi - - - - {/*{console.log(adminAuthData)}*/} -
- {resultList.items.map((item, i) => ( -
- // Show all things which you want -
- {i} -
- {item.title} -
- {i} -
- {item.description} -
- )) - } -
-
-

- Welcome to kakapoopoo.js! -
-

-

- Get started by editing{' '} - pages/index.js -

- - -
- - -
- ) -}