From 1b89ebee28e553b2203bc5fca8f57c673a9548e6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 2 Sep 2022 10:30:03 +0800 Subject: [PATCH] :lipstick: bazaar --- app/src/config/bazaar.ts | 67 ++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/app/src/config/bazaar.ts b/app/src/config/bazaar.ts index d1dd37773..56d50c336 100644 --- a/app/src/config/bazaar.ts +++ b/app/src/config/bazaar.ts @@ -31,31 +31,14 @@ export const bazaar = { const loadingHTML = `
`; return `
-
${window.siyuan.languages.downloaded}
-
${window.siyuan.languages.theme}
+
${window.siyuan.languages.theme}
${window.siyuan.languages.template}
${window.siyuan.languages.icon}
${window.siyuan.languages.widget}
+
${window.siyuan.languages.downloaded}
-
-
-
-
-
- -
- -
- -
- -
-
- ${loadingHTML} -
-
-
+
@@ -135,6 +118,23 @@ export const bazaar = { ${loadingHTML}
+
+
+
+
+
+ +
+ +
+ +
+ +
+
+ ${loadingHTML} +
+
`; @@ -166,11 +166,18 @@ export const bazaar = { ${item.downloads}
- +
+ + + +
+ + +
- -
- + + +
`; }, @@ -317,7 +324,10 @@ export const bazaar = { readmeElement.style.right = "0"; }, bindEvent() { - this._genMyHTML("themes"); + fetchPost("/api/bazaar/getBazaarTheme", {}, response => { + bazaar.onBazaar(response, "themes", false); + bazaar.data.themes = response.data.packages; + }); bazaar.element.addEventListener("click", (event) => { let target = event.target as HTMLElement; while (target && !target.isEqualNode(bazaar.element)) { @@ -542,11 +552,8 @@ export const bazaar = { bazaar.onBazaar(response, "widgets", false); bazaar.data.widgets = response.data.packages; }); - } else if (type === "theme") { - fetchPost("/api/bazaar/getBazaarTheme", {}, response => { - bazaar.onBazaar(response, "themes", false); - bazaar.data.themes = response.data.packages; - }); + } else if (type === "downloaded") { + this._genMyHTML("themes"); } item.setAttribute("data-init", "true"); }