Просмотр исходного кода

enhance(ui): refactor the plugins modal with the shui dialog

charlie 1 год назад
Родитель
Сommit
72faafa832

+ 3 - 3
src/main/frontend/components/plugins.cljs

@@ -12,6 +12,7 @@
             [frontend.search :as search]
             [frontend.util :as util]
             [frontend.mixins :as mixins]
+            [logseq.shui.ui :as shui]
             [electron.ipc :as ipc]
             [promesa.core :as p]
             [frontend.components.svg :as svg]
@@ -1400,9 +1401,8 @@
 
 (defn open-plugins-modal!
   []
-  (state/set-modal!
-    (fn [_close!]
-      (plugins-page))
+  (shui/dialog-open!
+    (plugins-page)
     {:label "plugins-dashboard"}))
 
 (defn open-waiting-updates-modal!

+ 4 - 5
src/main/frontend/components/plugins.css

@@ -979,11 +979,10 @@ html[data-theme='dark'] {
   }
 }
 
-.ui__modal[label=plugins-dashboard] {
-  .panel-content {
-    overflow-y: auto;
-    max-height: calc(100vh - 50px);
-  }
+.ui__dialog-content[label=plugins-dashboard] {
+  @apply w-auto overflow-y-auto max-w-[90vw] 2xl:max-w-[1300px];
+
+  max-height: calc(100vh - 50px);
 }
 
 body[data-page=plugins] {

+ 1 - 3
src/main/frontend/components/settings.cljs

@@ -619,9 +619,7 @@
                  (and protocol host port (str protocol "://" host ":" port)))]
               (ui/icon "edit")]
              :class "text-sm"
-             :on-click #(state/set-sub-modal!
-                         (fn [_] (plugins/user-proxy-settings-panel agent-opts))
-                         {:id :https-proxy-panel :center? true})))
+             :on-click #(state/pub-event! [:go/proxy-settings agent-opts])))
 
 (defn plugin-system-switcher-row []
   (row-with-button-action

+ 1 - 1
src/main/frontend/components/settings.css

@@ -287,7 +287,7 @@
   }
 
   &-network-proxy-panel {
-    margin: -15px;
+    margin: -15px 0;
 
     label {
       display: flex;

+ 3 - 2
src/main/frontend/handler/events.cljs

@@ -26,6 +26,7 @@
             [frontend.components.db-based.page :as db-page]
             [frontend.config :as config]
             [frontend.context.i18n :refer [t]]
+            [logseq.shui.ui :as shui]
             [frontend.db :as db]
             [frontend.db.conn :as conn]
             [frontend.db.model :as db-model]
@@ -454,8 +455,8 @@
     (state/close-sub-modal! "ls-focused-settings-modal")))
 
 (defmethod handle :go/proxy-settings [[_ agent-opts]]
-  (state/set-sub-modal!
-    (fn [_] (plugin/user-proxy-settings-panel agent-opts))
+  (shui/dialog-open!
+    (plugin/user-proxy-settings-panel agent-opts)
     {:id :https-proxy-panel :center? true}))