From 5f61254a75294f82f4965a79a20834a403895373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20L=C3=B3pez?= Date: Wed, 19 Feb 2025 16:52:35 +0100 Subject: [PATCH] :bug: Fix library button condition and copy (#5889) * :bug: Fix library button condition and copy * :paperclip: Add changes from feedback * :paperclip: Add changes from feedback --- .../src/app/main/ui/workspace/sidebar.cljs | 2 +- .../app/main/ui/workspace/sidebar/assets.cljs | 14 +++++++----- .../app/main/ui/workspace/sidebar/assets.scss | 22 +------------------ frontend/translations/en.po | 7 +++--- frontend/translations/es.po | 7 +++--- 5 files changed, 16 insertions(+), 36 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar.cljs b/frontend/src/app/main/ui/workspace/sidebar.cljs index 788aea01b..21e639f25 100644 --- a/frontend/src/app/main/ui/workspace/sidebar.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar.cljs @@ -116,7 +116,7 @@ assets-tab - (mf/html [:& assets-toolbox {:size (- size 58)}]) + (mf/html [:& assets-toolbox {:size (- size 58) :file-id file}]) tokens-tab (when design-tokens? diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index 10973c9a5..7f240d734 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -8,6 +8,7 @@ (:require-macros [app.main.style :as stl]) (:require [app.common.data.macros :as dm] + [app.common.types.components-list :as ctkl] [app.main.data.modal :as modal] [app.main.data.workspace :as dw] [app.main.data.workspace.assets :as dwa] @@ -73,7 +74,7 @@ (mf/defc assets-toolbox {::mf/wrap [mf/memo] ::mf/wrap-props false} - [{:keys [size]}] + [{:keys [size file-id]}] (let [components-v2 (mf/use-ctx ctx/components-v2) read-only? (mf/use-ctx ctx/workspace-read-only?) filters* (mf/use-state @@ -89,7 +90,10 @@ section (:section filters) ordering (:ordering filters) reverse-sort? (= :desc ordering) - num-libs (count (mf/deref refs/libraries)) + libs (mf/deref refs/libraries) + num-libs (count libs) + file (get libs (:id file-id)) + components (mf/with-memo [file] (ctkl/components (:data file))) toggle-ordering (mf/use-fn @@ -159,7 +163,7 @@ [:article {:class (stl/css :assets-bar)} [:div {:class (stl/css :assets-header)} (when-not ^boolean read-only? - (if (= num-libs 1) + (if (and (= num-libs 1) (empty? components)) [:button {:class (stl/css :add-library-button) :on-click show-libraries-dialog :data-testid "libraries"} @@ -168,9 +172,7 @@ [:button {:class (stl/css :libraries-button) :on-click show-libraries-dialog :data-testid "libraries"} - [:span {:class (stl/css :libraries-icon)} - i/library] - (tr "workspace.assets.libraries")])) + (tr "workspace.assets.manage-library")])) [:div {:class (stl/css :search-wrapper)} diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.scss b/frontend/src/app/main/ui/workspace/sidebar/assets.scss index 21f7af9d5..9223b299c 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.scss @@ -26,42 +26,22 @@ margin-bottom: $s-4; border-radius: $s-8; - .libraries-icon { - @include flexCenter; - width: $s-24; - height: 100%; - - svg { - @include flexCenter; - @extend .button-icon; - stroke: var(--icon-foreground); - } - } - &:hover { background-color: var(--button-secondary-background-color-hover); color: var(--button-secondary-foreground-color-hover); border: $s-1 solid var(--button-secondary-border-color-hover); - - svg { - stroke: var(--button-secondary-foreground-color-hover); - } } &:focus { background-color: var(--button-secondary-background-color-focus); color: var(--button-secondary-foreground-color-focus); border: $s-1 solid var(--button-secondary-border-color-focus); - - svg { - stroke: var(--button-secondary-foreground-color-focus); - } } } .add-library-button { @extend .button-primary; - text-transform: uppercase; + @include uppercaseTitleTipography; gap: $s-2; height: $s-32; width: 100%; diff --git a/frontend/translations/en.po b/frontend/translations/en.po index aba49b67a..a6e1de98a 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -4206,6 +4206,9 @@ msgstr "Align top (%s)" msgid "workspace.assets.add-library" msgstr "Add library" +msgid "workspace.assets.manage-library" +msgstr "Manage library" + #: src/app/main/ui/workspace/sidebar/assets.cljs #, unused msgid "workspace.assets.assets" @@ -4275,10 +4278,6 @@ msgstr "Group" msgid "workspace.assets.group-name" msgstr "Group name" -#: src/app/main/ui/workspace/sidebar/assets.cljs:186 -msgid "workspace.assets.libraries" -msgstr "Libraries" - #: src/app/main/ui/workspace/sidebar/assets/components.cljs:501 msgid "workspace.assets.list-view" msgstr "List view" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 8ef63e217..6caf8f18c 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -4222,6 +4222,9 @@ msgstr "Alinear arriba (%s)" msgid "workspace.assets.add-library" msgstr "AƱadir biblioteca" +msgid "workspace.assets.manage-library" +msgstr "Gestionar biblioteca" + #: src/app/main/ui/workspace/sidebar/assets.cljs #, unused msgid "workspace.assets.assets" @@ -4293,10 +4296,6 @@ msgstr "Agrupar" msgid "workspace.assets.group-name" msgstr "Nombre del grupo" -#: src/app/main/ui/workspace/sidebar/assets.cljs:186 -msgid "workspace.assets.libraries" -msgstr "Bibliotecas" - #: src/app/main/ui/workspace/sidebar/assets/components.cljs:501 msgid "workspace.assets.list-view" msgstr "Ver como lista"