e9c3dc1120
保留 SpacetimeDB 历史表、迁移白名单与旧业务源码 切换前端 active 入口并解除旧创作页面和路由编译链 移除旧后端路由、worker 与纯业务 crate 依赖 收敛 SpacetimeDB 模块为历史数据壳 同步 Nginx、Pingora、验证门禁与架构文档
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
/* eslint-disable react-refresh/only-export-components */
|
|
|
|
import './index.css';
|
|
|
|
import { StrictMode, Suspense } from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
|
|
import { FloatingFeedbackEntry } from './components/common/FloatingFeedbackEntry';
|
|
import { stabilizeMobileViewportKeyboardFocus } from './mobileViewportKeyboardFocus';
|
|
import { lockMobileViewportZoom } from './mobileViewportZoomLock';
|
|
import { resolveAppRoute } from './routing/activeAppRoutes';
|
|
import {
|
|
getHostRuntime,
|
|
refreshNativeAppHostRuntime,
|
|
} from './services/host-bridge/hostBridge';
|
|
|
|
type AppRoot = ReturnType<typeof createRoot>;
|
|
|
|
declare global {
|
|
interface Window {
|
|
__tavernRealmsRoot__?: AppRoot;
|
|
}
|
|
}
|
|
|
|
const route = resolveAppRoute(window.location.pathname);
|
|
const rootElement = document.getElementById('root');
|
|
|
|
if (!rootElement) {
|
|
throw new Error('Missing #root container');
|
|
}
|
|
|
|
function markWechatMiniProgramRuntime() {
|
|
if (getHostRuntime().kind === 'wechat_mini_program') {
|
|
document.documentElement.dataset.wechatMiniProgramRuntime = 'true';
|
|
}
|
|
}
|
|
|
|
const root = (window.__tavernRealmsRoot__ ??= createRoot(rootElement));
|
|
const RouteComponent = route.Component;
|
|
const routeElement = <RouteComponent />;
|
|
|
|
lockMobileViewportZoom();
|
|
stabilizeMobileViewportKeyboardFocus();
|
|
markWechatMiniProgramRuntime();
|
|
void refreshNativeAppHostRuntime();
|
|
|
|
root.render(
|
|
<StrictMode>
|
|
<Suspense fallback={null}>{routeElement}</Suspense>
|
|
<FloatingFeedbackEntry />
|
|
</StrictMode>,
|
|
);
|