From f0aaa29d6674e85e400a6242e28bff12c78368c8 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Fri, 16 Aug 2024 06:24:03 +0200 Subject: [PATCH] Add type functions --- .../main/ui/workspace/tokens/token_set.cljs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/frontend/src/app/main/ui/workspace/tokens/token_set.cljs b/frontend/src/app/main/ui/workspace/tokens/token_set.cljs index c76784c49..db3f3c626 100644 --- a/frontend/src/app/main/ui/workspace/tokens/token_set.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/token_set.cljs @@ -1,5 +1,27 @@ (ns app.main.ui.workspace.tokens.token-set) +;; Themes ---------------------------------------------------------------------- + +(defn get-theme-group [theme] + (:group theme)) + +(defn get-workspace-themes [state] + (get-in state [:workspace-data :token-themes] [])) + +(defn get-workspace-themes-index [state] + (get-in state [:workspace-data :token-themes-index] {})) + +(defn get-workspace-ordered-themes [state] + (let [themes (get-workspace-themes state) + themes-index (get-workspace-themes-index state)] + (->> (map #(get themes-index (:id %)) themes) + (group-by :group)))) + +(defn theme-selected? [theme] + (= :enabled (:selected theme))) + + ;; Sets ------------------------------------------------------------------------ + (defn get-workspace-tokens [state] (get-in state [:workspace-data :tokens]))