🐛 Fix activeSets in themes API

This commit is contained in:
Andrés Moya 2026-02-18 11:17:05 +01:00 committed by Andrés Moya
parent e2377e8fa8
commit 72a855d4ac
4 changed files with 20 additions and 2 deletions

View File

@ -354,7 +354,17 @@
(st/emit! (dwtl/toggle-token-theme-active id))) (st/emit! (dwtl/toggle-token-theme-active id)))
:activeSets :activeSets
{:this true :get (fn [_])} {:this true
:get (fn [_]
(let [tokens-lib (u/locate-tokens-lib file-id)
theme (u/locate-token-theme file-id id)]
(->> theme
:sets
(map #(->> %
(ctob/get-set-by-name tokens-lib)
(ctob/get-id)
(token-set-proxy plugin-id file-id)))
(apply array))))}
:addSet :addSet
{:enumerable false {:enumerable false

View File

@ -18,7 +18,12 @@
<ul data-handler="themes-list"> <ul data-handler="themes-list">
@for (theme of themes; track theme.id) { @for (theme of themes; track theme.id) {
<li class="body-m panel-item theme-item"> <li class="body-m panel-item theme-item">
<span>{{ theme.group }} / {{ theme.name }}</span> <span title="{{ theme.activeSets }}">
@if (theme.group) {
{{ theme.group }} /
}
{{ theme.name }}
</span>
<button <button
type="button" type="button"
data-appearance="secondary" data-appearance="secondary"

View File

@ -10,6 +10,7 @@ type TokenTheme = {
group: string; group: string;
description: string; description: string;
active: boolean; active: boolean;
activeSets: string;
}; };
type TokenSet = { type TokenSet = {

View File

@ -61,11 +61,13 @@ function loadLibrary() {
const themes = tokensCatalog.themes; const themes = tokensCatalog.themes;
const themesData = themes.map((theme) => { const themesData = themes.map((theme) => {
const activeSets = theme.activeSets.map((set) => set.name).join(', ');
return { return {
id: theme.id, id: theme.id,
group: theme.group, group: theme.group,
name: theme.name, name: theme.name,
active: theme.active, active: theme.active,
activeSets: activeSets,
}; };
}); });