diff --git a/app/web/src/nova/ed/panel/main/main.tsx b/app/web/src/nova/ed/panel/main/main.tsx index 853aeb9a..e32a906f 100644 --- a/app/web/src/nova/ed/panel/main/main.tsx +++ b/app/web/src/nova/ed/panel/main/main.tsx @@ -35,6 +35,7 @@ export const EdMain = () => { local.cache = ( { > , - tick: 0, - site: { - id: "", - api_url: "", - api: null as any, - db: null as any, - code: { - mode: "old" as "old" | "vsc", - }, - }, - script: { - init_local_effect: undefined as undefined | Record, - }, - visit: undefined as - | undefined - | ((meta: IMeta, parts: ReturnType) => void), - on_status_changes: undefined as void | ((status: ViStatus) => void), + ts: 0, + status: "init" as ViStatus, + meta: {} as Record, + tick: 0, + mode: "desktop" as "mobile" | "desktop", + site: { + id: "", + api_url: "", + api: null as any, + db: null as any, + code: { + mode: "old" as "old" | "vsc", + }, + }, + script: { + init_local_effect: undefined as undefined | Record, + }, + visit: undefined as + | undefined + | ((meta: IMeta, parts: ReturnType) => void), + on_status_changes: undefined as void | ((status: ViStatus) => void), }; export type VG = typeof ViGlobal & { render: () => void }; diff --git a/app/web/src/nova/vi/render/script/arg.tsx b/app/web/src/nova/vi/render/script/arg.tsx index 7ef98abd..8b8c28e1 100644 --- a/app/web/src/nova/vi/render/script/arg.tsx +++ b/app/web/src/nova/vi/render/script/arg.tsx @@ -1,5 +1,8 @@ -export const viScriptArg = (vi: { site: { db: any; api: any } }) => ({ - isMobile: false, - isDesktop: true, - isEditor: true, +export const viScriptArg = (vi: { + mode: "mobile" | "desktop"; + site: { db: any; api: any }; +}) => ({ + isMobile: vi.mode === "mobile", + isDesktop: vi.mode === "desktop", + isEditor: location.pathname.startsWith("/ed/"), }); diff --git a/app/web/src/nova/vi/vi.tsx b/app/web/src/nova/vi/vi.tsx index d1b4b8f9..4ffd9c35 100644 --- a/app/web/src/nova/vi/vi.tsx +++ b/app/web/src/nova/vi/vi.tsx @@ -9,6 +9,7 @@ import { render_stat } from "./render/render"; export const Vi: FC<{ meta: Record; + mode: "mobile" | "desktop"; comp_load?: (comp_id: string) => Promise; entry: string[]; api_url: string; @@ -26,6 +27,7 @@ export const Vi: FC<{ api_url, site_id, api, + mode, db, visit, script, @@ -33,6 +35,7 @@ export const Vi: FC<{ on_status_changed, }) => { const vi = useGlobal(ViGlobal, "VI"); + vi.mode = mode; vi.on_status_changes = on_status_changed; if (rs === "disabled") {