diff --git a/app/srv/api/export-mobile.ts b/app/srv/api/export-mobile.ts
new file mode 100644
index 00000000..f69cc194
--- /dev/null
+++ b/app/srv/api/export-mobile.ts
@@ -0,0 +1,51 @@
+import { ExportMobileConfig } from "../../web/src/render/editor/panel/toolbar/center/mobile/config";
+import { exmobile } from "../util/export-mobile";
+
+export const _ = {
+ url: "/export-mobile/:site_id/:action",
+ async api(
+ site_id: string,
+ action:
+ | "config"
+ | "set-config"
+ | "build-android"
+ | "remove-android"
+ | "build-ios"
+ | "remove-ios",
+ config?: ExportMobileConfig
+ ) {
+ if (action === "config") {
+ return await exmobile.config.read(site_id);
+ } else if (action === "set-config") {
+ if (config) {
+ return await exmobile.config.write(site_id, config);
+ }
+ } else if (action === "build-android") {
+ let result = await exmobile.config.modify(site_id, (conf) => ({
+ ...conf,
+ android: true,
+ }));
+ return result;
+ } else if (action === "remove-android") {
+ let result = await exmobile.config.modify(site_id, (conf) => ({
+ ...conf,
+ android: false,
+ }));
+ return result;
+ } else if (action === "build-ios") {
+ let result = await exmobile.config.modify(site_id, (conf) => ({
+ ...conf,
+ ios: true,
+ }));
+ return result;
+ } else if (action === "remove-ios") {
+ let result = await exmobile.config.modify(site_id, (conf) => ({
+ ...conf,
+ ios: false,
+ }));
+ return result;
+ }
+
+ return "This is export-mobile.ts";
+ },
+};
diff --git a/app/srv/util/build-npm.ts b/app/srv/util/build-npm.ts
index e9805716..91edbd98 100644
--- a/app/srv/util/build-npm.ts
+++ b/app/srv/util/build-npm.ts
@@ -6,7 +6,6 @@ import { build } from "esbuild";
import { $ } from "execa";
import { dirAsync, writeAsync } from "fs-jetpack";
import { stat } from "fs/promises";
-import { apiContext } from "service-srv";
import { g } from "utils/global";
import { validate } from "uuid";
import { glb } from "../global";
diff --git a/app/srv/util/export-mobile.ts b/app/srv/util/export-mobile.ts
new file mode 100644
index 00000000..2d529a56
--- /dev/null
+++ b/app/srv/util/export-mobile.ts
@@ -0,0 +1,34 @@
+import { dir } from "dir";
+import { g } from "utils/global";
+import { writeAsync, dirAsync } from "fs-jetpack";
+import { ExportMobileConfig } from "../../web/src/render/editor/panel/toolbar/center/mobile/config";
+
+const mpath = (site_id: string, path?: string) =>
+ dir.path(`${g.datadir}/mobile/${site_id}/${path || ""}`);
+
+export const exmobile = {
+ config: {
+ async modify(
+ site_id: string,
+ fn: (config: ExportMobileConfig) => ExportMobileConfig
+ ) {
+ const conf = await this.read(site_id);
+ let result = fn(conf);
+ this.write(site_id, result);
+ return result;
+ },
+ write: async (site_id: string, config: ExportMobileConfig) => {
+ const path = mpath(site_id, "config.json");
+ await dirAsync(mpath(site_id));
+ await writeAsync(path, config);
+ },
+ read: async (site_id: string) => {
+ const path = mpath(site_id, "config.json");
+ if (await Bun.file(path).exists()) {
+ return await Bun.file(path).json();
+ }
+
+ return null;
+ },
+ },
+};
diff --git a/app/web/src/render/editor/panel/toolbar/center/ToolbarCenter.tsx b/app/web/src/render/editor/panel/toolbar/center/ToolbarCenter.tsx
index b7f73f50..53339aed 100644
--- a/app/web/src/render/editor/panel/toolbar/center/ToolbarCenter.tsx
+++ b/app/web/src/render/editor/panel/toolbar/center/ToolbarCenter.tsx
@@ -12,6 +12,7 @@ import { AddElement } from "./AddElement";
import { Export } from "./Export";
import { NPMImport } from "./NPMImport";
import { APIConfig } from "./api/APIConfig";
+import { ExportMobile } from "./mobile/export-mobile";
export const ToolbarCenter = () => {
const p = useGlobal(EditorGlobal, "EDITOR");
@@ -192,17 +193,28 @@ export const ToolbarCenter = () => {
>
),
},
- // {
- // content: (
- // <>
- //
- // >
- // ),
- // },
]}
/>
+
}
+ popoverClassName={cx(
+ "bg-white shadow-2xl shadow-slate-400 outline-none border border-slate-300"
+ )}
+ >
+
+
+ ),
+ },
+ ]}
+ />
+
+ {/* {
),
},
]}
- />
+ /> */}
);
};
+const MobileIcon = () => (
+
+);
+
const JSIcon = () => (