Fix admin SQL count parsing for local SpacetimeDB

This commit is contained in:
2026-05-01 00:36:42 +08:00
parent 89e7bdbed6
commit 28b77a5ff5
29 changed files with 3064 additions and 581 deletions

View File

@@ -0,0 +1,29 @@
export type AdminRouteId = 'overview' | 'debug' | 'redeem';
export interface AdminRouteDefinition {
id: AdminRouteId;
label: string;
hash: string;
}
export const adminRoutes: AdminRouteDefinition[] = [
{id: 'overview', label: '总览', hash: '#overview'},
{id: 'debug', label: 'API 调试', hash: '#debug'},
{id: 'redeem', label: '兑换码', hash: '#redeem'},
];
export function resolveAdminRoute(hash: string): AdminRouteId {
const normalizedHash = hash.trim().toLowerCase();
return (
adminRoutes.find((route) => route.hash === normalizedHash)?.id ??
'overview'
);
}
export function routeHash(routeId: AdminRouteId) {
return (
adminRoutes.find((route) => route.id === routeId)?.hash ??
adminRoutes[0]?.hash ??
'#overview'
);
}