From 5cfb385134ac78bb4f20b991105b937d1bc9524a Mon Sep 17 00:00:00 2001 From: obeys Date: Wed, 11 Dec 2024 23:02:00 +0000 Subject: [PATCH 1/8] feat: upgrade template structure --- build/esbuild-build.ts | 9 ++++--- src/components/component1.ts | 3 +++ src/components/component2.ts | 3 +++ src/controllers/404.ts | 13 ++++++++++ src/controllers/home.ts | 13 ++++++++++ src/controllers/page1.ts | 14 +++++++++++ src/controllers/page2.ts | 14 +++++++++++ src/main.ts | 23 ++++++++++++++++++ src/on-load.ts | 16 +++++++++++++ src/router.ts | 41 ++++++++++++++++++++++++++++++++ src/types.ts | 4 ++++ static/404.html | 30 +++++++++++++++++++++++ static/home.html | 3 +++ static/index.html | 12 ++++++++-- static/main.ts | 11 --------- static/page1.html | 3 +++ static/page2.html | 3 +++ static/style.css | 46 ++++++++++++++++++++++++++++++++++++ tests/main.test.ts | 2 +- 19 files changed, 244 insertions(+), 19 deletions(-) create mode 100644 src/components/component1.ts create mode 100644 src/components/component2.ts create mode 100644 src/controllers/404.ts create mode 100644 src/controllers/home.ts create mode 100644 src/controllers/page1.ts create mode 100644 src/controllers/page2.ts create mode 100644 src/main.ts create mode 100644 src/on-load.ts create mode 100644 src/router.ts create mode 100644 src/types.ts create mode 100644 static/404.html create mode 100644 static/home.html delete mode 100644 static/main.ts create mode 100644 static/page1.html create mode 100644 static/page2.html diff --git a/build/esbuild-build.ts b/build/esbuild-build.ts index 00fc141..5009594 100644 --- a/build/esbuild-build.ts +++ b/build/esbuild-build.ts @@ -1,15 +1,14 @@ import esbuild, { BuildOptions } from "esbuild"; -const ENTRY_POINTS = { - typescript: ["static/main.ts"], - // css: ["static/style.css"], -}; +const typescriptEntries = ["src/main.ts"]; +const cssEntries = ["static/style.css"]; +const entries = [...typescriptEntries, ...cssEntries]; const DATA_URL_LOADERS = [".png", ".woff", ".woff2", ".eot", ".ttf", ".svg"]; export const esbuildOptions: BuildOptions = { sourcemap: true, - entryPoints: [...ENTRY_POINTS.typescript /* ...ENTRY_POINTS.css */], + entryPoints: entries, bundle: true, minify: false, loader: Object.fromEntries(DATA_URL_LOADERS.map((ext) => [ext, "dataurl"])), diff --git a/src/components/component1.ts b/src/components/component1.ts new file mode 100644 index 0000000..821e398 --- /dev/null +++ b/src/components/component1.ts @@ -0,0 +1,3 @@ +export function createPage1Content(): string { + return `
This is the content of page 1
`; +} diff --git a/src/components/component2.ts b/src/components/component2.ts new file mode 100644 index 0000000..87778b9 --- /dev/null +++ b/src/components/component2.ts @@ -0,0 +1,3 @@ +export function createPage2Content(): string { + return `
This is the content of page 2
`; +} diff --git a/src/controllers/404.ts b/src/controllers/404.ts new file mode 100644 index 0000000..7200383 --- /dev/null +++ b/src/controllers/404.ts @@ -0,0 +1,13 @@ +export async function load404Page() { + const contentArea = document.getElementById("content-area"); + + if (contentArea) { + try { + const response = await fetch("./404.html"); + const html = await response.text(); + contentArea.innerHTML = html; + } catch (error) { + console.error("Failed to load 404 page:", error); + } + } +} diff --git a/src/controllers/home.ts b/src/controllers/home.ts new file mode 100644 index 0000000..e6a3048 --- /dev/null +++ b/src/controllers/home.ts @@ -0,0 +1,13 @@ +export async function loadHomePage() { + const contentArea = document.getElementById("content-area"); + + if (contentArea) { + try { + const response = await fetch("./home.html"); + const html = await response.text(); + contentArea.innerHTML = html; + } catch (error) { + console.error("Failed to load home page:", error); + } + } +} diff --git a/src/controllers/page1.ts b/src/controllers/page1.ts new file mode 100644 index 0000000..f99103e --- /dev/null +++ b/src/controllers/page1.ts @@ -0,0 +1,14 @@ +import { createPage1Content } from "../components/component1"; + +export async function loadPage1() { + const contentArea = document.getElementById("content-area"); + + if (contentArea) { + try { + const content = createPage1Content(); + contentArea.innerHTML = content; + } catch (error) { + console.error("Failed to load page 1:", error); + } + } +} diff --git a/src/controllers/page2.ts b/src/controllers/page2.ts new file mode 100644 index 0000000..df364c4 --- /dev/null +++ b/src/controllers/page2.ts @@ -0,0 +1,14 @@ +import { createPage2Content } from "../components/component2"; + +export async function loadPage2() { + const contentArea = document.getElementById("content-area"); + + if (contentArea) { + try { + const content = createPage2Content(); // Use a reusable component + contentArea.innerHTML = content; + } catch (error) { + console.error("Failed to load page 2:", error); + } + } +} diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..42349eb --- /dev/null +++ b/src/main.ts @@ -0,0 +1,23 @@ +import { handleRouting, setupRouter } from "./router"; +import { initializeState } from "./on-load"; + +setupRouter(); + +export async function mainModule() { + try { + await initializeState(); + console.log("State initialized"); + + await handleRouting(); + } catch (error) { + console.error("Error in main: ", error); + } +} + +mainModule() + .then(() => { + console.log("mainModule loaded"); + }) + .catch((error) => { + console.error(error); + }); diff --git a/src/on-load.ts b/src/on-load.ts new file mode 100644 index 0000000..9a1b2dd --- /dev/null +++ b/src/on-load.ts @@ -0,0 +1,16 @@ +import { GlobalState } from "./types"; + +export const globalState: GlobalState = { + isLoading: false, + data: {}, +}; + +export async function initializeState() { + globalState.isLoading = true; + try { + // Initial data loading goes here + globalState.data = {}; + } finally { + globalState.isLoading = false; + } +} diff --git a/src/router.ts b/src/router.ts new file mode 100644 index 0000000..2fc726e --- /dev/null +++ b/src/router.ts @@ -0,0 +1,41 @@ +import { loadPage1 } from "./controllers/page1"; +import { loadPage2 } from "./controllers/page2"; +import { load404Page } from "./controllers/404"; +import { loadHomePage } from "./controllers/home"; + +// URL Path based routing +export async function handleRouting() { + const contentArea = document.getElementById("content-area"); + + if (!contentArea) return; + + const route = window.location.hash; + + switch (route) { + case "": + case "#/home": + case "#/index": + await loadHomePage(); + break; + case "#/page1": + await loadPage1(); + break; + case "#/page2": + await loadPage2(); + break; + default: + // Redirect to 404 page if no route matches + await load404Page(); + break; + } +} + +export function setupRouter() { + if (typeof window !== "undefined") { + window.addEventListener("hashchange", () => { + handleRouting().catch(console.error); + }); + + handleRouting().catch(console.error); + } +} diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..952e745 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,4 @@ +export interface GlobalState { + isLoading: boolean; + data: Record; +} diff --git a/static/404.html b/static/404.html new file mode 100644 index 0000000..4f8766b --- /dev/null +++ b/static/404.html @@ -0,0 +1,30 @@ +
+
+

Oops!

+

We can't seem to find the page you're looking for

+

+ Here are some helpful links instead: +

+ +
+
404
+
diff --git a/static/home.html b/static/home.html new file mode 100644 index 0000000..e0ecad9 --- /dev/null +++ b/static/home.html @@ -0,0 +1,3 @@ +
+

Ubiquity TypeScript Template Home

+
diff --git a/static/index.html b/static/index.html index dbae5f4..10fa4a9 100644 --- a/static/index.html +++ b/static/index.html @@ -7,7 +7,15 @@ -

Ubiquity TypeScript Template

- + + +
+ +
+ diff --git a/static/main.ts b/static/main.ts deleted file mode 100644 index 780e240..0000000 --- a/static/main.ts +++ /dev/null @@ -1,11 +0,0 @@ -export async function mainModule() { - console.log(`Hello from mainModule`); -} - -mainModule() - .then(() => { - console.log("mainModule loaded"); - }) - .catch((error) => { - console.error(error); - }); diff --git a/static/page1.html b/static/page1.html new file mode 100644 index 0000000..5556514 --- /dev/null +++ b/static/page1.html @@ -0,0 +1,3 @@ +
+

Ubiquity TypeScript Template Page 1

+
diff --git a/static/page2.html b/static/page2.html new file mode 100644 index 0000000..08ba90a --- /dev/null +++ b/static/page2.html @@ -0,0 +1,3 @@ +
+

Ubiquity TypeScript Template Page 2

+
diff --git a/static/style.css b/static/style.css index 3bbb3f0..2f9473e 100644 --- a/static/style.css +++ b/static/style.css @@ -14,3 +14,49 @@ body { url(./fonts/ubiquity-nova-standard.woff) format("woff"), url(./fonts/ubiquity-nova-standard.ttf) format("truetype"); } + +#nav-selector { + display: flex; + gap: 20px; + justify-content: center; +} + +#nav-selector a { + color: #fff; + text-decoration: none; + font-size: 1rem; +} + +/* Page 404 styles */ +#Page404 { + display: flex; + height: 100%; + justify-content: space-between; + align-items: center; + padding: 2rem; +} +#Page404 a { + text-decoration: underline; +} +#Page404 ul { + padding: 0; + margin: 0; +} +#Page404 li { + width: 100%; +} +#Page404 > div:nth-child(1) { + display: flex; + flex-direction: column; + justify-content: center; + padding: 16px; +} +#Page404 > div:nth-child(1) > p:nth-child(1) { + font-size: 2rem; +} +#Page404 > div:nth-child(2) { + align-items: center; + display: flex; + font-size: 4rem; + padding: 16px; +} diff --git a/tests/main.test.ts b/tests/main.test.ts index d891c3c..ea0a9e4 100644 --- a/tests/main.test.ts +++ b/tests/main.test.ts @@ -1,4 +1,4 @@ -import { mainModule } from "../static/main"; +import { mainModule } from "../src/main"; import { db } from "./__mocks__/db"; import { server } from "./__mocks__/node"; import usersGet from "./__mocks__/users-get.json"; From 40471ffdda6b25183d3a6de767f83f090201ec2a Mon Sep 17 00:00:00 2001 From: obeys Date: Wed, 11 Dec 2024 23:25:52 +0000 Subject: [PATCH 2/8] fix: fix empty string --- src/router.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/router.ts b/src/router.ts index 2fc726e..84ba80e 100644 --- a/src/router.ts +++ b/src/router.ts @@ -9,10 +9,10 @@ export async function handleRouting() { if (!contentArea) return; - const route = window.location.hash; + // Normalize route to handle default case + const route = window.location.hash || "#/home"; switch (route) { - case "": case "#/home": case "#/index": await loadHomePage(); From acd244cc1ca85d8e275485e8b484107cfb644985 Mon Sep 17 00:00:00 2001 From: obeys Date: Mon, 16 Dec 2024 19:35:31 +0000 Subject: [PATCH 3/8] fix: prefetch html at build time --- build/esbuild-build.ts | 2 +- src/controllers/404.ts | 7 ++++--- src/controllers/home.ts | 7 ++++--- src/shared/html.d.ts | 4 ++++ src/types.ts | 4 ---- static/home.html | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 src/shared/html.d.ts delete mode 100644 src/types.ts diff --git a/build/esbuild-build.ts b/build/esbuild-build.ts index 5009594..a1c9b07 100644 --- a/build/esbuild-build.ts +++ b/build/esbuild-build.ts @@ -4,7 +4,7 @@ const typescriptEntries = ["src/main.ts"]; const cssEntries = ["static/style.css"]; const entries = [...typescriptEntries, ...cssEntries]; -const DATA_URL_LOADERS = [".png", ".woff", ".woff2", ".eot", ".ttf", ".svg"]; +const DATA_URL_LOADERS = [".png", ".woff", ".woff2", ".eot", ".ttf", ".svg", ".html"]; export const esbuildOptions: BuildOptions = { sourcemap: true, diff --git a/src/controllers/404.ts b/src/controllers/404.ts index 7200383..9a92305 100644 --- a/src/controllers/404.ts +++ b/src/controllers/404.ts @@ -1,11 +1,12 @@ +import _html from "../../static/404.html"; + export async function load404Page() { const contentArea = document.getElementById("content-area"); if (contentArea) { try { - const response = await fetch("./404.html"); - const html = await response.text(); - contentArea.innerHTML = html; + const errContent = decodeURIComponent(_html).replace(/^data:text\/html;charset=utf-8,/, ""); + contentArea.innerHTML = errContent; } catch (error) { console.error("Failed to load 404 page:", error); } diff --git a/src/controllers/home.ts b/src/controllers/home.ts index e6a3048..941ccb9 100644 --- a/src/controllers/home.ts +++ b/src/controllers/home.ts @@ -1,11 +1,12 @@ +import _html from "../../static/home.html"; + export async function loadHomePage() { const contentArea = document.getElementById("content-area"); if (contentArea) { try { - const response = await fetch("./home.html"); - const html = await response.text(); - contentArea.innerHTML = html; + const homeContent = decodeURIComponent(_html).replace(/^data:text\/html;charset=utf-8,/, ""); + contentArea.innerHTML = homeContent; } catch (error) { console.error("Failed to load home page:", error); } diff --git a/src/shared/html.d.ts b/src/shared/html.d.ts new file mode 100644 index 0000000..3a031d8 --- /dev/null +++ b/src/shared/html.d.ts @@ -0,0 +1,4 @@ +declare module "*.html" { + const content: string; + export default content; +} diff --git a/src/types.ts b/src/types.ts deleted file mode 100644 index 952e745..0000000 --- a/src/types.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface GlobalState { - isLoading: boolean; - data: Record; -} diff --git a/static/home.html b/static/home.html index e0ecad9..21c7c24 100644 --- a/static/home.html +++ b/static/home.html @@ -1,3 +1,3 @@ -
+

Ubiquity TypeScript Template Home

From b0503e2709ea005080da822d076a0c79337c6d78 Mon Sep 17 00:00:00 2001 From: obeys Date: Mon, 16 Dec 2024 19:47:23 +0000 Subject: [PATCH 4/8] fix: add types file back --- src/on-load.ts | 2 +- src/shared/types.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 src/shared/types.ts diff --git a/src/on-load.ts b/src/on-load.ts index 9a1b2dd..85f55db 100644 --- a/src/on-load.ts +++ b/src/on-load.ts @@ -1,4 +1,4 @@ -import { GlobalState } from "./types"; +import { GlobalState } from "./shared/types"; export const globalState: GlobalState = { isLoading: false, diff --git a/src/shared/types.ts b/src/shared/types.ts new file mode 100644 index 0000000..952e745 --- /dev/null +++ b/src/shared/types.ts @@ -0,0 +1,4 @@ +export interface GlobalState { + isLoading: boolean; + data: Record; +} From 1b9746562a5b4352551a24dc5ae8d27795a76db9 Mon Sep 17 00:00:00 2001 From: obeys Date: Mon, 16 Dec 2024 20:38:35 +0000 Subject: [PATCH 5/8] fix: convert 404 and home to components --- build/esbuild-build.ts | 2 +- src/components/404.ts | 34 ++++++++++++++++++++++++++++++++++ src/components/home.ts | 7 +++++++ src/controllers/404.ts | 7 +++---- src/controllers/home.ts | 6 +++--- src/shared/html.d.ts | 4 ---- static/404.html | 30 ------------------------------ static/home.html | 3 --- 8 files changed, 48 insertions(+), 45 deletions(-) create mode 100644 src/components/404.ts create mode 100644 src/components/home.ts delete mode 100644 src/shared/html.d.ts delete mode 100644 static/404.html delete mode 100644 static/home.html diff --git a/build/esbuild-build.ts b/build/esbuild-build.ts index a1c9b07..5009594 100644 --- a/build/esbuild-build.ts +++ b/build/esbuild-build.ts @@ -4,7 +4,7 @@ const typescriptEntries = ["src/main.ts"]; const cssEntries = ["static/style.css"]; const entries = [...typescriptEntries, ...cssEntries]; -const DATA_URL_LOADERS = [".png", ".woff", ".woff2", ".eot", ".ttf", ".svg", ".html"]; +const DATA_URL_LOADERS = [".png", ".woff", ".woff2", ".eot", ".ttf", ".svg"]; export const esbuildOptions: BuildOptions = { sourcemap: true, diff --git a/src/components/404.ts b/src/components/404.ts new file mode 100644 index 0000000..0108b6a --- /dev/null +++ b/src/components/404.ts @@ -0,0 +1,34 @@ +export function create404Page(): string { + return ` +
+
+

Oops!

+

We can't seem to find the page you're looking for

+

+ Here are some helpful links instead: +

+ +
+
404
+
+`; +} diff --git a/src/components/home.ts b/src/components/home.ts new file mode 100644 index 0000000..4dacd91 --- /dev/null +++ b/src/components/home.ts @@ -0,0 +1,7 @@ +export function createHomePage(): string { + return ` +
+

Ubiquity TypeScript Template Home

+
+ `; +} diff --git a/src/controllers/404.ts b/src/controllers/404.ts index 9a92305..24a1af5 100644 --- a/src/controllers/404.ts +++ b/src/controllers/404.ts @@ -1,12 +1,11 @@ -import _html from "../../static/404.html"; - +import { create404Page } from "../components/404"; export async function load404Page() { const contentArea = document.getElementById("content-area"); if (contentArea) { try { - const errContent = decodeURIComponent(_html).replace(/^data:text\/html;charset=utf-8,/, ""); - contentArea.innerHTML = errContent; + const content = create404Page(); + contentArea.innerHTML = content; } catch (error) { console.error("Failed to load 404 page:", error); } diff --git a/src/controllers/home.ts b/src/controllers/home.ts index 941ccb9..2b47b4d 100644 --- a/src/controllers/home.ts +++ b/src/controllers/home.ts @@ -1,12 +1,12 @@ -import _html from "../../static/home.html"; +import { createHomePage } from "../components/home"; export async function loadHomePage() { const contentArea = document.getElementById("content-area"); if (contentArea) { try { - const homeContent = decodeURIComponent(_html).replace(/^data:text\/html;charset=utf-8,/, ""); - contentArea.innerHTML = homeContent; + const content = createHomePage(); + contentArea.innerHTML = content; } catch (error) { console.error("Failed to load home page:", error); } diff --git a/src/shared/html.d.ts b/src/shared/html.d.ts deleted file mode 100644 index 3a031d8..0000000 --- a/src/shared/html.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.html" { - const content: string; - export default content; -} diff --git a/static/404.html b/static/404.html deleted file mode 100644 index 4f8766b..0000000 --- a/static/404.html +++ /dev/null @@ -1,30 +0,0 @@ -
-
-

Oops!

-

We can't seem to find the page you're looking for

-

- Here are some helpful links instead: -

- -
-
404
-
diff --git a/static/home.html b/static/home.html deleted file mode 100644 index 21c7c24..0000000 --- a/static/home.html +++ /dev/null @@ -1,3 +0,0 @@ -
-

Ubiquity TypeScript Template Home

-
From 29ba726507cd8ae47c4ff790241298c72b6b804f Mon Sep 17 00:00:00 2001 From: obeys Date: Tue, 17 Dec 2024 23:51:04 +0000 Subject: [PATCH 6/8] fix: prettier error page --- src/components/404.ts | 53 ++++++++++------------ static/style.css | 101 +++++++++++++++++++++++++++++++++--------- 2 files changed, 102 insertions(+), 52 deletions(-) diff --git a/src/components/404.ts b/src/components/404.ts index 0108b6a..0d91604 100644 --- a/src/components/404.ts +++ b/src/components/404.ts @@ -1,34 +1,27 @@ export function create404Page(): string { return ` -
-
-

Oops!

-

We can't seem to find the page you're looking for

-

- Here are some helpful links instead: -

- -
-
404
-
+
+
+

Sorry!

+

We can't seem to find the page you're looking for

+ + +
+ +
+ 404 +
+
`; } diff --git a/static/style.css b/static/style.css index 2f9473e..9948817 100644 --- a/static/style.css +++ b/static/style.css @@ -27,36 +27,93 @@ body { font-size: 1rem; } -/* Page 404 styles */ -#Page404 { +/* ERROR PAGE STYLES */ + +.err-container { + min-height: 100vh; display: flex; - height: 100%; justify-content: space-between; align-items: center; + font-family: "Inter", sans-serif; + width: 100%; + max-width: 1200px; padding: 2rem; + gap: 2rem; + margin: 0 auto; } -#Page404 a { - text-decoration: underline; + +.err-content { + flex: 1; } -#Page404 ul { - padding: 0; - margin: 0; + +.err-content h1 { + font-size: 2.5rem; + margin-bottom: 1rem; + font-weight: 600; } -#Page404 li { - width: 100%; + +.err-subtitle { + font-size: 1.2rem; + margin-bottom: 2rem; + opacity: 0.9; } -#Page404 > div:nth-child(1) { - display: flex; - flex-direction: column; - justify-content: center; - padding: 16px; + +.err-links h2 { + font-size: 1rem; + margin-bottom: 1.5rem; + font-weight: 500; } -#Page404 > div:nth-child(1) > p:nth-child(1) { - font-size: 2rem; + +.err-links-grid { + display: grid; + gap: 1rem; } -#Page404 > div:nth-child(2) { - align-items: center; - display: flex; - font-size: 4rem; - padding: 16px; + +.err-nav-link { + color: #fff; + text-decoration: none; + font-size: 0.9rem; + opacity: 0.7; + transition: opacity 0.2s ease; +} + +.err-nav-link:hover { + opacity: 1; +} + +.err-code { + font-size: 8rem; + font-weight: 600; + opacity: 0.8; + line-height: 1; +} + +/* Responsive design */ +@media (max-width: 768px) { + .err-container { + flex-direction: column; + text-align: center; + } + + .err-code { + font-size: 6rem; + } + + .err-links-grid { + justify-content: center; + } +} + +@media (max-width: 480px) { + .err-code { + font-size: 4rem; + } + + .err-content h1 { + font-size: 2rem; + } + + .err-subtitle { + font-size: 1rem; + } } From 15cb6b8d7967e9586c35c0d51e97c7804e28bd7c Mon Sep 17 00:00:00 2001 From: obeys Date: Wed, 18 Dec 2024 01:07:39 +0000 Subject: [PATCH 7/8] fix: redirect to a shared 404 page --- src/components/404.ts | 27 --------------------------- src/controllers/404.ts | 6 ++---- src/router.ts | 4 ++-- 3 files changed, 4 insertions(+), 33 deletions(-) delete mode 100644 src/components/404.ts diff --git a/src/components/404.ts b/src/components/404.ts deleted file mode 100644 index 0d91604..0000000 --- a/src/components/404.ts +++ /dev/null @@ -1,27 +0,0 @@ -export function create404Page(): string { - return ` -
-
-

Sorry!

-

We can't seem to find the page you're looking for

- - -
- -
- 404 -
-
-`; -} diff --git a/src/controllers/404.ts b/src/controllers/404.ts index 24a1af5..72f85aa 100644 --- a/src/controllers/404.ts +++ b/src/controllers/404.ts @@ -1,11 +1,9 @@ -import { create404Page } from "../components/404"; -export async function load404Page() { +export async function redirectTo404() { const contentArea = document.getElementById("content-area"); if (contentArea) { try { - const content = create404Page(); - contentArea.innerHTML = content; + window.location.href = "https://dao.ubq.fi/404"; } catch (error) { console.error("Failed to load 404 page:", error); } diff --git a/src/router.ts b/src/router.ts index 84ba80e..3dcba4a 100644 --- a/src/router.ts +++ b/src/router.ts @@ -1,6 +1,6 @@ import { loadPage1 } from "./controllers/page1"; import { loadPage2 } from "./controllers/page2"; -import { load404Page } from "./controllers/404"; +import { redirectTo404 } from "./controllers/404"; import { loadHomePage } from "./controllers/home"; // URL Path based routing @@ -25,7 +25,7 @@ export async function handleRouting() { break; default: // Redirect to 404 page if no route matches - await load404Page(); + await redirectTo404(); break; } } From 448cf4c251cb4d7c7a40da7c8bd942b94a314012 Mon Sep 17 00:00:00 2001 From: obeys Date: Wed, 18 Dec 2024 01:09:33 +0000 Subject: [PATCH 8/8] chore: remove 404 styles --- static/style.css | 91 ------------------------------------------------ 1 file changed, 91 deletions(-) diff --git a/static/style.css b/static/style.css index 9948817..228cef9 100644 --- a/static/style.css +++ b/static/style.css @@ -26,94 +26,3 @@ body { text-decoration: none; font-size: 1rem; } - -/* ERROR PAGE STYLES */ - -.err-container { - min-height: 100vh; - display: flex; - justify-content: space-between; - align-items: center; - font-family: "Inter", sans-serif; - width: 100%; - max-width: 1200px; - padding: 2rem; - gap: 2rem; - margin: 0 auto; -} - -.err-content { - flex: 1; -} - -.err-content h1 { - font-size: 2.5rem; - margin-bottom: 1rem; - font-weight: 600; -} - -.err-subtitle { - font-size: 1.2rem; - margin-bottom: 2rem; - opacity: 0.9; -} - -.err-links h2 { - font-size: 1rem; - margin-bottom: 1.5rem; - font-weight: 500; -} - -.err-links-grid { - display: grid; - gap: 1rem; -} - -.err-nav-link { - color: #fff; - text-decoration: none; - font-size: 0.9rem; - opacity: 0.7; - transition: opacity 0.2s ease; -} - -.err-nav-link:hover { - opacity: 1; -} - -.err-code { - font-size: 8rem; - font-weight: 600; - opacity: 0.8; - line-height: 1; -} - -/* Responsive design */ -@media (max-width: 768px) { - .err-container { - flex-direction: column; - text-align: center; - } - - .err-code { - font-size: 6rem; - } - - .err-links-grid { - justify-content: center; - } -} - -@media (max-width: 480px) { - .err-code { - font-size: 4rem; - } - - .err-content h1 { - font-size: 2rem; - } - - .err-subtitle { - font-size: 1rem; - } -}