Files
site/lib/route.js
zeekay 24fb4859f4 Load the sign-in pages whole
hanzo.ai's /login and /signup are the app's pages, so the site's
in-place navigation fetched their data from the app's build and fell
back to a page load with an error. Only this site's own pages move in
place now (lib/route has); everything else here loads whole.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
2026-11-09 06:08:14 -08:00

15 lines
706 B
JavaScript

// Links to pages this site has stay inside it; sign-in is hanzo.ai's own page; anything else is the app's (chat, pay,
// the rooms) on hanzo.app.
import ROUTES from './routes.json';
import { APP, SIGNIN } from './app';
const HAS = new Set(ROUTES);
const SIGN = /^\/(?:login|signup|forget|join)(?:\/|$)/;
const base = (p) => p.split(/[?#]/)[0].replace(/\/$/, '') || '/';
/** Whether this site renders `path`; anything else here (the sign-in pages, which the edge serves from the app) is a full page load. */
export const has = (path) => HAS.has(base(path));
export const href = (p) => {
if (!p || !p.startsWith('/')) return p;
if (has(p)) return p;
return (SIGN.test(base(p)) ? SIGNIN : APP) + p;
};