diff --git a/app/web/src/nova/ed/logic/ed-global.ts b/app/web/src/nova/ed/logic/ed-global.ts index d784ff5b..9761f18e 100644 --- a/app/web/src/nova/ed/logic/ed-global.ts +++ b/app/web/src/nova/ed/logic/ed-global.ts @@ -225,6 +225,7 @@ export const EDGlobal = { name: "site", log: "", loading: false, + startup_running: false, error: false, show_log: false, list: {} as Record, diff --git a/app/web/src/nova/ed/logic/ed-sync.tsx b/app/web/src/nova/ed/logic/ed-sync.tsx index 2644c17b..f7b0c1f8 100644 --- a/app/web/src/nova/ed/logic/ed-sync.tsx +++ b/app/web/src/nova/ed/logic/ed-sync.tsx @@ -23,48 +23,81 @@ export const edInitSync = (p: PG) => { localStorage.getItem("prasi-session") || "null" ) as { data: { user: { id: string; username: string } } }; if (!session && location.pathname.startsWith("/ed/")) { - navigate("/login"); + location.href = "/login"; return ; } p.user.id = session.data.user.id; p.user.username = session.data.user.username; - if (!params.page_id && location.pathname.startsWith("/vi/")) { - p.preview.show_loading = false; - if (page.list.length === 0) { - db.page - .findMany({ - where: { - id_site: params.site_id, - is_deleted: false, - is_default_layout: false, - }, - select: { - id: true, - url: true, - }, - }) - .then((list) => { - page.list = list; - edInitSync(p); - }); + if (!params.page_id) { + if (location.pathname.startsWith("/vi/")) { + p.preview.show_loading = false; + if (page.list.length === 0) { + db.page + .findMany({ + where: { + id_site: params.site_id, + is_deleted: false, + is_default_layout: false, + }, + select: { + id: true, + url: true, + }, + }) + .then((list) => { + page.list = list; + edInitSync(p); + }); - return; - } else { - if (!page.route) { - page.route = createRouter(); - for (const e of page.list) { - page.route.insert(e.url, e); + return; + } else { + if (!page.route) { + page.route = createRouter(); + for (const e of page.list) { + page.route.insert(e.url, e); + } + } + + const arrpath = location.pathname.split("/"); + const pathname = "/" + arrpath.slice(3).join("/"); + + const res = page.route.lookup(pathname); + if (res) { + params.page_id = res.id; } } - - const arrpath = location.pathname.split("/"); - const pathname = "/" + arrpath.slice(3).join("/"); - - const res = page.route.lookup(pathname); - if (res) { - params.page_id = res.id; + } else if (location.pathname.startsWith("/ed")) { + if (!params.site_id) { + db.page + .findFirst({ + where: { + is_deleted: false, + is_default_layout: false, + site: { + id_user: p.user.id, + }, + }, + select: { id: true, id_site: true }, + }) + .then((e) => { + if (e) location.href = `/ed/${e.id_site}/${e.id}`; + }); + } else { + db.page + .findFirst({ + where: { + is_deleted: false, + is_default_layout: false, + id_site: params.site_id, + }, + select: { id: true, id_site: true }, + }) + .then((e) => { + if (e) location.href = `/ed/${e.id_site}/${e.id}`; + }); } + return false; } } @@ -102,7 +135,7 @@ export const edInitSync = (p: PG) => { select: { id: true }, }) .then((e) => { - if (e) navigate(`/ed/${params.site_id}/${e.id}`); + if (e) location.href = `/ed/${params.site_id}/${e.id}`; }); return false; } @@ -149,7 +182,7 @@ export const edInitSync = (p: PG) => { p.site.id = e.site_id; p.page.cur.id = e.page_id; if (location.pathname.startsWith("/ed/")) { - navigate(`/ed/${e.site_id}/${e.page_id}`); + location.href = `/ed/${e.site_id}/${e.page_id}`; } } else { p.site.id = e.site_id; diff --git a/app/web/src/nova/ed/panel/popup/code/code.tsx b/app/web/src/nova/ed/panel/popup/code/code.tsx index 8c15c88b..86cbda94 100644 --- a/app/web/src/nova/ed/panel/popup/code/code.tsx +++ b/app/web/src/nova/ed/panel/popup/code/code.tsx @@ -8,10 +8,14 @@ import { Tooltip } from "../../../../../utils/ui/tooltip"; import { EDGlobal } from "../../../logic/ed-global"; import { iconChevronDown, + iconDownload, iconLoading, iconLog, iconNewTab, + iconScrollOff, + iconScrollOn, iconTrash, + iconUpload, } from "./icons"; import { CodeNameItem, CodeNameList, codeName } from "./name-list"; @@ -141,7 +145,7 @@ const CodeBody = () => { > - { __html: p.ui.popup.code.loading ? iconLog : iconLoading, }} > + */} + +
{ + p.ui.popup.code.startup_running = + !p.ui.popup.code.startup_running; + p.render(); + }} + >
+ + + +
+
+ + +
+
+ `; export const iconNewTab = ``; + +export const iconScrollOn = ``; + +export const iconScrollOff = ``; + +export const iconUpload = ``; + +export const iconDownload = `` \ No newline at end of file