From fb3cf431c13cc01b8fefc22627d09a44a540dd85 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Thu, 3 Sep 2026 12:07:09 +0200 Subject: [PATCH] :tada: Add changes notification (#11476) * :tada: Add changes notification * :recycle: Change fn names --- common/src/app/common/files/changes.cljc | 15 +++++++++++++++ .../src/app/main/data/workspace/libraries.cljs | 4 +++- frontend/translations/en.po | 4 ++++ frontend/translations/es.po | 4 ++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/files/changes.cljc b/common/src/app/common/files/changes.cljc index fa9a74f234..0c6700deb9 100644 --- a/common/src/app/common/files/changes.cljc +++ b/common/src/app/common/files/changes.cljc @@ -1269,3 +1269,18 @@ "Check if a commit contains changes that modify the tokens library." [changes] (some #(tokens-lib-change-types (:type %)) changes)) + +(def ^:private notifiable-token-change-types + "Set of change types that modify the structure of the tokens library sets + or themes (as opposed to `:set-token`, which only edits a token's value)." + #{:set-token-set + :set-token-theme + :rename-token-set-group + :move-token-set + :move-token-set-group}) + +(defn notifiable-token-change-occured? + "Check if a commit contains changes that modify the tokens library sets or + themes structure (renamed/added/removed sets, theme set-membership, etc.)." + [changes] + (some #(notifiable-token-change-types (:type %)) changes)) diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 1b2dc85dd4..da2b59b341 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -842,7 +842,9 @@ (rx/delay 5000) (rx/map fetch-library-thumbnails)) (when (ch/tokens-lib-changed? changes) - (rx/of (dwtp/propagate-workspace-tokens)))) + (rx/of (dwtp/propagate-workspace-tokens))) + (when (ch/notifiable-token-change-occured? changes) + (rx/of (ntf/info (tr "workspace.tokens.notifications.source-sets-or-themes-updated"))))) (rx/take-until stopper-s)))))) diff --git a/frontend/translations/en.po b/frontend/translations/en.po index 58410429db..e3395c8bf6 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -10159,6 +10159,10 @@ msgstr "This is the current Tokens source" msgid "workspace.tokens.open-connected-library" msgstr "Open connected library" +#: src/app/main/data/workspace/libraries.cljs:847 +msgid "workspace.tokens.notifications.source-sets-or-themes-updated" +msgstr "Tokens source sets or themes have been modified" + #: src/app/main/ui/workspace/tokens/management/forms/generic_form.cljs #, unused msgid "workspace.tokens.warning-name-change" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index d710e7fde7..894a561f93 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -9816,6 +9816,10 @@ msgstr "Esta es la actual fuente de Tokens" msgid "workspace.tokens.open-connected-library" msgstr "Abrir librería conectada" +#: src/app/main/data/workspace/libraries.cljs:847 +msgid "workspace.tokens.notifications.source-sets-or-themes-updated" +msgstr "Los sets o temas de la fuente de tokens se han modificado" + #: src/app/main/ui/workspace/tokens/management/forms/generic_form.cljs #, unused msgid "workspace.tokens.warning-name-change"