🐛 Show the themes permission message only to non-editors (#12203)

The theme selector showed "You need to be an editor to use themes"
whenever tokens could not be edited. That is also the case for editors
when the tokens source is a library, and they can still switch themes.
Base the message on file edit permission instead.

Closes #12177

AI-assisted-by: claude-opus-5-5
This commit is contained in:
andrés gonzález 2026-10-09 14:14:51 +02:00 committed by GitHub
parent f9515a69ca
commit 9931d82379
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,6 +23,9 @@
(let [ordered-themes
(mf/deref refs/workspace-token-themes-no-hidden)
can-edit-file?
(mf/use-ctx ctx/can-edit?)
can-edit-tokens?
(mf/use-ctx ctx/can-edit-tokens?)
@ -50,6 +53,6 @@
:class (stl/css :edit-theme-button)
:on-click open-modal}
(tr "labels.edit")]]
[:div {:title (when-not can-edit-tokens?
[:div {:title (when-not can-edit-file?
(tr "workspace.tokens.no-permission-themes"))}
[:> theme-selector* {:tokens-source tokens-source}]]))]))