mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
✨ Small improvements over plugin manager
This commit is contained in:
parent
6f8ce1fc5a
commit
2cc3f65323
6 changed files with 43 additions and 6 deletions
|
@ -86,6 +86,8 @@
|
|||
plugin-url* (mf/use-state "")
|
||||
plugin-url @plugin-url*
|
||||
|
||||
fetching-manifest? (mf/use-state false)
|
||||
|
||||
input-status* (mf/use-state nil) ;; :error-url :error-manifest :success
|
||||
input-status @input-status*
|
||||
|
||||
|
@ -106,6 +108,7 @@
|
|||
(mf/use-callback
|
||||
(mf/deps plugins-state plugin-url)
|
||||
(fn []
|
||||
(reset! fetching-manifest? true)
|
||||
(->> (http/send! {:method :get
|
||||
:uri plugin-url
|
||||
:omit-default-headers true
|
||||
|
@ -113,6 +116,7 @@
|
|||
(rx/map :body)
|
||||
(rx/subs!
|
||||
(fn [body]
|
||||
(reset! fetching-manifest? false)
|
||||
(let [plugin (plugins/parser-manifest plugin-url body)]
|
||||
(st/emit! (ptk/event ::ev/event {::ev/name "install-plugin" :name (:name plugin) :url plugin-url}))
|
||||
(modal/show!
|
||||
|
@ -125,6 +129,7 @@
|
|||
(reset! input-status* :success)
|
||||
(reset! plugin-url* "")))
|
||||
(fn [_]
|
||||
(reset! fetching-manifest? false)
|
||||
(reset! input-status* :error-url))))))
|
||||
|
||||
handle-open-plugin
|
||||
|
@ -161,12 +166,18 @@
|
|||
:class (stl/css-case :input-error error?)}]
|
||||
|
||||
[:button {:class (stl/css :primary-button)
|
||||
:disabled @fetching-manifest?
|
||||
:on-click handle-install-click} (tr "workspace.plugins.install")]]
|
||||
|
||||
(when error?
|
||||
[:div {:class (stl/css-case :info true :error error?)}
|
||||
(tr "workspace.plugins.error.url")])
|
||||
|
||||
[:> i18n/tr-html*
|
||||
{:class (stl/css :discover)
|
||||
:on-click #(st/emit! (ptk/event ::ev/event {::ev/name "open-plugins-list"}))
|
||||
:content (tr "workspace.plugins.discover" cf/plugins-list-uri)}]
|
||||
|
||||
[:hr]
|
||||
|
||||
(if (empty? plugins-state)
|
||||
|
|
|
@ -213,7 +213,7 @@ div.input-error {
|
|||
gap: $s-4;
|
||||
|
||||
svg {
|
||||
margin-top: calc(-1 * var($s-2));
|
||||
margin-top: calc(-1 * $s-2);
|
||||
width: $s-12;
|
||||
height: $s-12;
|
||||
stroke: $da-primary;
|
||||
|
@ -262,3 +262,13 @@ div.input-error {
|
|||
display: flex;
|
||||
gap: $s-12;
|
||||
}
|
||||
|
||||
.discover {
|
||||
@include bodySmallTypography;
|
||||
color: $df-secondary;
|
||||
margin-top: $s-24;
|
||||
|
||||
a {
|
||||
color: $da-primary;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,12 @@
|
|||
|
||||
(defn install-plugin!
|
||||
[plugin]
|
||||
(let [plugins (vec (conj (seq @pluginsdb) plugin))]
|
||||
(let [plugins (as-> @pluginsdb $
|
||||
(remove (fn [{:keys [name host]}]
|
||||
(and (= name (:name plugin))
|
||||
(= host (:host plugin)))) $)
|
||||
(conj $ plugin)
|
||||
(vec $))]
|
||||
(reset! pluginsdb plugins)
|
||||
(save-to-store plugins)))
|
||||
|
||||
|
|
|
@ -174,10 +174,11 @@
|
|||
|
||||
(mf/defc tr-html*
|
||||
{::mf/props :obj}
|
||||
[{:keys [content class tag-name]}]
|
||||
[{:keys [content class tag-name on-click]}]
|
||||
(let [tag-name (d/nilv tag-name "p")]
|
||||
[:> tag-name {:dangerouslySetInnerHTML #js {:__html content}
|
||||
:className class}]))
|
||||
:className class
|
||||
:on-click on-click}]))
|
||||
|
||||
;; DEPRECATED
|
||||
(defn use-locale
|
||||
|
|
|
@ -5282,7 +5282,7 @@ msgid "workspace.plugins.menu.title"
|
|||
msgstr "Plugins"
|
||||
|
||||
msgid "workspace.toolbar.plugins"
|
||||
msgstr "Plugins"
|
||||
msgstr "Plugins (%s)"
|
||||
|
||||
msgid "workspace.plugins.menu.plugins-manager"
|
||||
msgstr "Plugins manager"
|
||||
|
@ -5310,3 +5310,8 @@ msgstr "Read your libraries and assets."
|
|||
|
||||
msgid "workspace.plugins.permissions.library-write"
|
||||
msgstr "Read and modify your libraries and assets."
|
||||
|
||||
#, markdown
|
||||
msgid "workspace.plugins.discover"
|
||||
msgstr ""
|
||||
"Discover [more plugins](%s)"
|
||||
|
|
|
@ -5362,7 +5362,7 @@ msgid "workspace.plugins.title"
|
|||
msgstr "Extensiones"
|
||||
|
||||
msgid "workspace.toolbar.plugins"
|
||||
msgstr "Extensiones"
|
||||
msgstr "Extensiones (%s)"
|
||||
|
||||
msgid "workspace.plugins.search-placeholder"
|
||||
msgstr "Intruduzca URL de la extensión"
|
||||
|
@ -5414,3 +5414,8 @@ msgstr "Leer la información de sus bibliotecas y recursos."
|
|||
|
||||
msgid "workspace.plugins.permissions.library-write"
|
||||
msgstr "Leer y modificar la información de sus bibliotecas y recursos."
|
||||
|
||||
#, markdown
|
||||
msgid "workspace.plugins.discover"
|
||||
msgstr ""
|
||||
"Descubre [más extensiones](%s)"
|
||||
|
|
Loading…
Add table
Reference in a new issue