From dbf3d0d7c1f9613524bf76ba3b2fb9382228cadc Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Wed, 27 Nov 2024 13:35:07 +0100 Subject: [PATCH] :sparkles: Add event "navigate-to-library-file" --- .../workspace/sidebar/assets/file_library.cljs | 16 +++++++++++++--- frontend/translations/en.po | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs index 052a7bbe5..88a548384 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs @@ -9,6 +9,7 @@ (:require [app.common.data :as d] [app.common.data.macros :as dm] + [app.main.data.events :as ev] [app.main.data.workspace :as dw] [app.main.data.workspace.libraries :as dwl] [app.main.data.workspace.undo :as dwu] @@ -29,6 +30,7 @@ [app.util.router :as rt] [cuerdas.core :as str] [okulary.core :as l] + [potok.v2.core :as ptk] [rumext.v2 :as mf])) (def lens:open-status @@ -50,7 +52,15 @@ (mf/use-fn (mf/deps file-id open?) (fn [] - (st/emit! (dw/set-assets-section-open file-id :library (not open?)))))] + (st/emit! (dw/set-assets-section-open file-id :library (not open?))))) + + on-click + (mf/use-fn + (fn [ev] + (dom/stop-propagation ev) + (st/emit! + (ptk/event ::ev/event {::ev/name "navigate-to-library-file"}))))] + [:div {:class (stl/css-case :library-title true :open open?)} [:& title-bar {:collapsable true @@ -65,11 +75,11 @@ (mf/html [:div {:class (stl/css :special-title)} file-name]))} (when-not local? - [:span {:title "Open library file"} + [:span {:title (tr "workspace.assets.open-library")} [:a {:class (stl/css :file-link) :href (str "#" url) :target "_blank" - :on-click dom/stop-propagation} + :on-click on-click} i/open-link]])]])) (mf/defc file-library-content diff --git a/frontend/translations/en.po b/frontend/translations/en.po index 62f00de6b..e001ffb0e 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -4070,7 +4070,7 @@ msgstr "local library" msgid "workspace.assets.not-found" msgstr "No assets found" -#, unused +#: src/app/main/ui/workspace/sidebar/assets/file_library.cljs:68 msgid "workspace.assets.open-library" msgstr "Open library file"