From c87f2fee5a95b523c5f462374180a520f5188b71 Mon Sep 17 00:00:00 2001 From: Adil Hanney Date: Sat, 14 Dec 2024 15:24:22 +0000 Subject: [PATCH] Fix: Migrate back to pages router :/ --- next-env.d.ts | 2 +- {src/app => public}/favicon.ico | Bin public/next.svg | 1 - public/vercel.svg | 1 - src/app/layout.tsx | 32 ----------- src/app/privacy_policy/page.tsx | 30 ---------- src/pages/_app.tsx | 6 ++ src/pages/_document.tsx | 13 +++++ src/{app/page.tsx => pages/index.tsx} | 36 ++++++++++-- src/pages/privacy_policy/index.tsx | 53 ++++++++++++++++++ .../styles/Home.module.css} | 0 src/{app => pages/styles}/globals.css | 0 12 files changed, 103 insertions(+), 71 deletions(-) rename {src/app => public}/favicon.ico (100%) delete mode 100644 public/next.svg delete mode 100644 public/vercel.svg delete mode 100644 src/app/layout.tsx delete mode 100644 src/app/privacy_policy/page.tsx create mode 100644 src/pages/_app.tsx create mode 100644 src/pages/_document.tsx rename src/{app/page.tsx => pages/index.tsx} (87%) create mode 100644 src/pages/privacy_policy/index.tsx rename src/{app/page.module.css => pages/styles/Home.module.css} (100%) rename src/{app => pages/styles}/globals.css (100%) diff --git a/next-env.d.ts b/next-env.d.ts index 1b3be08..52e831b 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. +// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. diff --git a/src/app/favicon.ico b/public/favicon.ico similarity index 100% rename from src/app/favicon.ico rename to public/favicon.ico diff --git a/public/next.svg b/public/next.svg deleted file mode 100644 index 5174b28..0000000 --- a/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/vercel.svg b/public/vercel.svg deleted file mode 100644 index d2f8422..0000000 --- a/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx deleted file mode 100644 index 64a10f1..0000000 --- a/src/app/layout.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import './globals.css' -import type { Metadata } from 'next' -import { Neucha } from 'next/font/google' - -const neucha = Neucha({ - weight: "400", - preload: true, - fallback: [ - "Neucha", "Dekko", - // fallbacks from https://github.com/system-fonts/modern-font-stacks#handwritten - 'Segoe Print', 'Bradley Hand', 'Chilanka', 'TSCu_Comic', - 'casual', 'cursive', - ], - subsets: ["latin"], -}) - -export const metadata: Metadata = { - title: 'Saber', - description: 'The notes app built for handwriting', -} - -export default function RootLayout({ - children, -}: { - children: React.ReactNode -}) { - return ( - - {children} - - ) -} diff --git a/src/app/privacy_policy/page.tsx b/src/app/privacy_policy/page.tsx deleted file mode 100644 index 9872afb..0000000 --- a/src/app/privacy_policy/page.tsx +++ /dev/null @@ -1,30 +0,0 @@ -'use client'; - -import ReactMarkdown from 'react-markdown' - -async function getPrivacyPolicyMarkdown(): Promise { - const res = await fetch('https://raw.githubusercontent.com/saber-notes/saber/main/privacy_policy.md'); - const text = await res.text(); - return text; -} - -export default async function() { - const markdown = await getPrivacyPolicyMarkdown(); - return ; -} - -function PrivacyPolicy({ markdown }: { markdown: string }) { - return ( -
- - -
-

- See this page on{' '} - - GitHub - -

-
- ); -} diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx new file mode 100644 index 0000000..f54c950 --- /dev/null +++ b/src/pages/_app.tsx @@ -0,0 +1,6 @@ +import "./styles/globals.css"; +import type { AppProps } from "next/app"; + +export default function App({ Component, pageProps }: AppProps) { + return ; +} diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx new file mode 100644 index 0000000..b2fff8b --- /dev/null +++ b/src/pages/_document.tsx @@ -0,0 +1,13 @@ +import { Html, Head, Main, NextScript } from "next/document"; + +export default function Document() { + return ( + + + +
+ + + + ); +} diff --git a/src/app/page.tsx b/src/pages/index.tsx similarity index 87% rename from src/app/page.tsx rename to src/pages/index.tsx index 25c58c6..b792369 100644 --- a/src/app/page.tsx +++ b/src/pages/index.tsx @@ -1,10 +1,25 @@ 'use client'; import Image from 'next/image' -import styles from './page.module.css' +import styles from "./styles/Home.module.css"; import { useEffect } from 'react'; import { annotate, annotationGroup } from 'rough-notation'; import assert from 'assert'; +import { Neucha } from 'next/font/google' +import Head from "next/head"; +import Link from 'next/link'; + +const neucha = Neucha({ + weight: "400", + preload: true, + fallback: [ + "Neucha", "Dekko", + // fallbacks from https://github.com/system-fonts/modern-font-stacks#handwritten + 'Segoe Print', 'Bradley Hand', 'Chilanka', 'TSCu_Comic', + 'casual', 'cursive', + ], + subsets: ["latin"], +}) /** * This function gets the latest version of Saber from GitHub, @@ -20,12 +35,13 @@ async function getVersionName(): Promise { return versionWithoutV; } -export default async function () { +export async function getStaticProps() { const versionName = await getVersionName(); - return ; + + return { props: { versionName } }; } -function Home({ versionName }: { versionName: string }) { +export default function Home({ versionName }: { versionName: string }) { useEffect(() => { const highlightColor = "var(--highlight-color)"; @@ -77,7 +93,14 @@ function Home({ versionName }: { versionName: string }) { }, []); return ( -
+ <> + + Saber + + + + +

Saber @@ -165,7 +188,7 @@ function Home({ versionName }: { versionName: string }) {

You can also read the{' '} - privacy policy. + privacy policy.

@@ -233,5 +256,6 @@ function Home({ versionName }: { versionName: string }) {

+ ) } diff --git a/src/pages/privacy_policy/index.tsx b/src/pages/privacy_policy/index.tsx new file mode 100644 index 0000000..747ac3f --- /dev/null +++ b/src/pages/privacy_policy/index.tsx @@ -0,0 +1,53 @@ +'use client'; + +import { Neucha } from 'next/font/google'; +import Head from 'next/head'; +import ReactMarkdown from 'react-markdown' + +const neucha = Neucha({ + weight: "400", + preload: true, + fallback: [ + "Neucha", "Dekko", + // fallbacks from https://github.com/system-fonts/modern-font-stacks#handwritten + 'Segoe Print', 'Bradley Hand', 'Chilanka', 'TSCu_Comic', + 'casual', 'cursive', + ], + subsets: ["latin"], +}) + +async function getPrivacyPolicyMarkdown(): Promise { + const res = await fetch('https://raw.githubusercontent.com/saber-notes/saber/main/privacy_policy.md'); + const text = await res.text(); + return text; +} + +export async function getStaticProps() { + const markdown = await getPrivacyPolicyMarkdown(); + + return { props: { markdown } }; +} + +export default function PrivacyPolicy({ markdown }: { markdown: string }) { + return ( + <> + + Saber: Privacy Policy + + + + +
+ {markdown} + +
+

+ See this page on{' '} + + GitHub + +

+
+ + ); +} diff --git a/src/app/page.module.css b/src/pages/styles/Home.module.css similarity index 100% rename from src/app/page.module.css rename to src/pages/styles/Home.module.css diff --git a/src/app/globals.css b/src/pages/styles/globals.css similarity index 100% rename from src/app/globals.css rename to src/pages/styles/globals.css