diff --git a/desktop/src/scripts/gallery/gallery.js b/desktop/src/scripts/gallery/gallery.js index 4469637..06c46ff 100644 --- a/desktop/src/scripts/gallery/gallery.js +++ b/desktop/src/scripts/gallery/gallery.js @@ -1,5 +1,5 @@ const providerSelector = document.getElementById('provider-selector'); -const searchInput = document.getElementById('main-search-input'); +const searchInput = document.getElementById('search-input'); const resultsContainer = document.getElementById('gallery-results'); let currentPage = 1; diff --git a/desktop/src/views/views.routes.ts b/desktop/src/views/views.routes.ts index 96d78ae..04b3b9a 100644 --- a/desktop/src/views/views.routes.ts +++ b/desktop/src/views/views.routes.ts @@ -2,91 +2,145 @@ import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify'; import * as fs from 'fs'; import * as path from 'path'; +let cachedNavbar: string | null = null; + +function getNavbarHTML(activePage: string, showSearch: boolean = true): string { + if (!cachedNavbar) { + const navbarPath = path.join(__dirname, '..', '..', 'views', 'components', 'navbar.html'); + cachedNavbar = fs.readFileSync(navbarPath, 'utf-8'); + } + + let navbar = cachedNavbar; + + const pages = ['anime', 'books', 'gallery', 'schedule', 'my-list', 'marketplace']; + pages.forEach(page => { + const regex = new RegExp(`( - - - - - - - - - -
diff --git a/desktop/views/books/books.html b/desktop/views/books/books.html index 6496492..c18f419 100644 --- a/desktop/views/books/books.html +++ b/desktop/views/books/books.html @@ -25,66 +25,6 @@
- - -
diff --git a/desktop/views/components/navbar.html b/desktop/views/components/navbar.html index f9d0b2d..8369bce 100644 --- a/desktop/views/components/navbar.html +++ b/desktop/views/components/navbar.html @@ -6,25 +6,24 @@ WaifuBoard -
- -
diff --git a/desktop/views/gallery/image.html b/desktop/views/gallery/image.html index 9789c90..e18d27c 100644 --- a/desktop/views/gallery/image.html +++ b/desktop/views/gallery/image.html @@ -26,65 +26,6 @@
- Back to Gallery diff --git a/desktop/views/list.html b/desktop/views/list.html index 2871037..c5e58fc 100644 --- a/desktop/views/list.html +++ b/desktop/views/list.html @@ -25,68 +25,6 @@ - -

My List

diff --git a/desktop/views/marketplace.html b/desktop/views/marketplace.html index 066fb42..0d71bc9 100644 --- a/desktop/views/marketplace.html +++ b/desktop/views/marketplace.html @@ -24,68 +24,6 @@
- -
diff --git a/desktop/views/schedule.html b/desktop/views/schedule.html index 3582fe7..6a755f5 100644 --- a/desktop/views/schedule.html +++ b/desktop/views/schedule.html @@ -29,68 +29,6 @@
- -
diff --git a/docker/src/scripts/gallery/gallery.js b/docker/src/scripts/gallery/gallery.js index 4469637..06c46ff 100644 --- a/docker/src/scripts/gallery/gallery.js +++ b/docker/src/scripts/gallery/gallery.js @@ -1,5 +1,5 @@ const providerSelector = document.getElementById('provider-selector'); -const searchInput = document.getElementById('main-search-input'); +const searchInput = document.getElementById('search-input'); const resultsContainer = document.getElementById('gallery-results'); let currentPage = 1; diff --git a/docker/src/views/views.routes.ts b/docker/src/views/views.routes.ts index 96d78ae..04b3b9a 100644 --- a/docker/src/views/views.routes.ts +++ b/docker/src/views/views.routes.ts @@ -2,91 +2,145 @@ import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify'; import * as fs from 'fs'; import * as path from 'path'; +let cachedNavbar: string | null = null; + +function getNavbarHTML(activePage: string, showSearch: boolean = true): string { + if (!cachedNavbar) { + const navbarPath = path.join(__dirname, '..', '..', 'views', 'components', 'navbar.html'); + cachedNavbar = fs.readFileSync(navbarPath, 'utf-8'); + } + + let navbar = cachedNavbar; + + const pages = ['anime', 'books', 'gallery', 'schedule', 'my-list', 'marketplace']; + pages.forEach(page => { + const regex = new RegExp(`( - - -
-
-