0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

Automatically show themes and sets on dev and PR previews

This commit is contained in:
Florian Schroedl 2024-08-22 11:21:53 +02:00
parent 37a3fbcec2
commit 157cc5a994

View file

@ -283,8 +283,22 @@
(when @open?
[:& sets-list {:selected-set-id selected-set-id}])]))
(defn dev-or-preview-url? [url]
(let [host (-> url js/URL. .-host)
pure-host (first (str/split host #":"))
domain (second (str/split pure-host #"\."))]
(or (= domain "penpot.tokens.studio")
(= pure-host "localhost"))))
(defn location-url-dev-or-preview-url!? []
(dev-or-preview-url? js/window.location.href))
(defn temp-use-themes-flag []
(let [show? (mf/use-state (get @storage ::show-token-themes-sets? false))]
(let [show? (mf/use-state (or
(location-url-dev-or-preview-url!?)
(get @storage ::show-token-themes-sets?)
false))]
(mf/use-effect
(fn []
(letfn [(toggle! []