chore(publish): replace source tree with static export at repo root
Publish the prerendered static export (index.html, 404.html, cinema/,
c/, about/, for-cinemas/, for-film-lovers/, assets/, images/, og/,
sitemap.xml, robots.txt) as the site root and remove the React Router
+ Nitro source tree from this branch. Source remains available in
history at 0548772.
Note: public/sw.js here reports VERSION v2.0.5 while the removed source
tree (v2.1.0) was newer, and .gitignore was not carried over.
This commit is contained in:
1 parent
05487728a7
commit
e6c4ebff48
394 files changed
+3977
-37891
No files matched your search
@@ -1,73 +0,0 @@
|
||||
import {
|
||||
appBasePath,
|
||||
appPathFromLocalRoute,
|
||||
} from "@agent-native/core/client/api-path";
|
||||
import { useAgentRouteState } from "@agent-native/core/client/navigation";
|
||||
|
||||
import { TAB_ID } from "@/lib/tab-id";
|
||||
|
||||
export interface NavigationState {
|
||||
view?: string;
|
||||
path?: string;
|
||||
publicPath?: string;
|
||||
}
|
||||
|
||||
export function useNavigationState() {
|
||||
useAgentRouteState<NavigationState>({
|
||||
browserTabId: TAB_ID,
|
||||
requestSource: TAB_ID,
|
||||
getNavigationState: ({ pathname }) => ({
|
||||
view: viewForPath(pathname),
|
||||
path: pathname,
|
||||
publicPath: appPathFromLocalRoute(pathname),
|
||||
}),
|
||||
getCommandPath: commandPathForNavigation,
|
||||
});
|
||||
}
|
||||
|
||||
export function commandPathForNavigation(command: NavigationState): string {
|
||||
const fallbackPath = pathForView(command?.view);
|
||||
const path = typeof command?.path === "string" ? command.path : "";
|
||||
if (!path) return fallbackPath;
|
||||
|
||||
const basePath = appBasePath();
|
||||
if (!basePath) return path;
|
||||
|
||||
const suffixIndex = path.search(/[?#]/);
|
||||
const pathname = suffixIndex === -1 ? path : path.slice(0, suffixIndex);
|
||||
const suffix = suffixIndex === -1 ? "" : path.slice(suffixIndex);
|
||||
const publicPath =
|
||||
typeof command?.publicPath === "string" ? command.publicPath : "";
|
||||
const publicPathSuffixIndex = publicPath.search(/[?#]/);
|
||||
const declaredPublicPath =
|
||||
publicPathSuffixIndex === -1
|
||||
? publicPath
|
||||
: publicPath.slice(0, publicPathSuffixIndex);
|
||||
const publicViewPath = appPathFromLocalRoute(pathForView(command?.view));
|
||||
if (
|
||||
matchesPathPrefix(pathname, basePath) &&
|
||||
(matchesPathPrefix(pathname, publicViewPath) ||
|
||||
(declaredPublicPath && declaredPublicPath === pathname))
|
||||
) {
|
||||
return `${pathname.slice(basePath.length) || "/"}${suffix}`;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
function matchesPathPrefix(pathname: string, prefix: string): boolean {
|
||||
return pathname === prefix || pathname.startsWith(`${prefix}/`);
|
||||
}
|
||||
|
||||
function viewForPath(pathname: string): string {
|
||||
if (pathname === "/") return "home";
|
||||
return "home";
|
||||
}
|
||||
|
||||
function pathForView(view?: string): string {
|
||||
switch (view) {
|
||||
case "home":
|
||||
return "/";
|
||||
default:
|
||||
return "/";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user