feat: improve card catalog and add outfit effect filters
Publish GitHub Pages output / publish (push) Successful in 38s
Publish GitHub Pages output / publish (push) Successful in 38s
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import AiPage from '../src/routes/tools/ai/+page.svelte';
|
||||
import HomePage from '../src/routes/+page.svelte';
|
||||
import CardsPage from '../src/routes/cards/+page.svelte';
|
||||
import OutfitsPage from '../src/routes/cards/outfits/+page.svelte';
|
||||
import AnalysisPage from '../src/routes/analysis/+page.svelte';
|
||||
import RatingPage from '../src/routes/rating/+page.svelte';
|
||||
import CombinationPage from '../src/routes/combination/+page.svelte';
|
||||
@@ -25,6 +26,7 @@
|
||||
const routes = new Map([
|
||||
['/', HomePage],
|
||||
['/cards', CardsPage],
|
||||
['/cards/outfits', OutfitsPage],
|
||||
['/analysis', AnalysisPage],
|
||||
['/rating', RatingPage],
|
||||
['/combination', CombinationPage],
|
||||
@@ -43,24 +45,27 @@
|
||||
['/updates', UpdatesPage]
|
||||
]);
|
||||
|
||||
function pathFromHash() {
|
||||
const path = window.location.hash.replace(/^#/, '') || '/';
|
||||
if (path === '/tools/compare') return '/compare';
|
||||
return routes.has(path) ? path : '/';
|
||||
function routeFromHash() {
|
||||
const route = window.location.hash.replace(/^#/, '') || '/';
|
||||
const url = new URL(route, window.location.href);
|
||||
const pathname = url.pathname === '/tools/compare' ? '/compare' : url.pathname;
|
||||
return routes.has(pathname) ? pathname + url.search + url.hash : '/';
|
||||
}
|
||||
|
||||
let currentPath = pathFromHash();
|
||||
let currentRoute = routeFromHash();
|
||||
let currentPath = new URL(currentRoute, window.location.href).pathname;
|
||||
let CurrentPage = routes.get(currentPath) ?? HomePage;
|
||||
let eventNow = Date.now();
|
||||
let menuOpen = false;
|
||||
$: if (currentPath) menuOpen = false;
|
||||
$: showEventTab = Boolean(activeEventAt(events, eventNow));
|
||||
setOfflinePage(currentPath);
|
||||
setOfflinePage(currentRoute);
|
||||
|
||||
function syncRoute() {
|
||||
currentPath = pathFromHash();
|
||||
currentRoute = routeFromHash();
|
||||
currentPath = new URL(currentRoute, window.location.href).pathname;
|
||||
CurrentPage = routes.get(currentPath) ?? HomePage;
|
||||
setOfflinePage(currentPath);
|
||||
setOfflinePage(currentRoute);
|
||||
window.scrollTo({ top: 0 });
|
||||
}
|
||||
|
||||
@@ -126,7 +131,9 @@
|
||||
</header>
|
||||
|
||||
<AssistantConnection />
|
||||
<svelte:component this={CurrentPage} />
|
||||
{#key currentRoute}
|
||||
<svelte:component this={CurrentPage} />
|
||||
{/key}
|
||||
|
||||
<AnalyticsConsent pagePath={currentPath} />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user