0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Merge pull request #297 from tokens-studio/feature-flag

 Add feature flag for design tokens
This commit is contained in:
Florian Schrödl 2024-10-09 13:21:38 +02:00 committed by GitHub
commit bbf5fce0c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 36 additions and 28 deletions

View file

@ -31,7 +31,7 @@ spec:
- name: PENPOT_PUBLIC_URI
value: {{ .Values.config.publicURI | quote }}
- name: PENPOT_FLAGS
value: "$PENPOT_FLAGS {{ .Values.config.flags }}"
value: "{{ .Values.config.flags }}"
- name: PENPOT_SECRET_KEY
value: {{ .Values.config.apiSecretKey | quote }}
- name: PENPOT_DATABASE_URI

View file

@ -278,7 +278,7 @@ config:
## @param config.apiSecretKey A random secret key needed for persistent user sessions. Generate with `openssl rand -hex 16` for example.
##
publicURI: "http://localhost:8080"
flags: "enable-registration enable-login disable-demo-users disable-demo-warning"
flags: "enable-registration enable-login disable-demo-users disable-demo-warning enable-feature-design-tokens"
apiSecretKey: "b46a12cb4bedc6b9df8cb3f18c708b65"
## @param config.postgresql.host The PostgreSQL host to connect to.

View file

@ -37,7 +37,7 @@ values:
secretKeys:
accessKeyIDKey: CONSOLE_ACCESS_KEY
secretAccessKey: CONSOLE_SECRET_KEY
flags: 'enable-smtp'
flags: 'enable-smtp enable-feature-design-tokens'
smtp:
enabled: true
host: mailslurper

View file

@ -19,7 +19,7 @@ values:
secret: db-penpot-secrets
superUser: db-penpot-superuser-secret
config:
flags: 'enable-smtp'
flags: 'enable-smtp enable-feature-design-tokens'
assets:
storageBackend: assets-s3
s3:
@ -72,4 +72,4 @@ values:
tls:
- secretName: tls-penpot
hosts:
- penpot.tokens.studio
- penpot.tokens.studio

View file

@ -28,7 +28,8 @@ export PENPOT_FLAGS="\
enable-webhooks \
enable-access-tokens \
enable-file-validation \
enable-file-schema-validation";
enable-file-schema-validation \
disable-feature-design-tokens";
# Default deletion delay for devenv
export PENPOT_DELETION_DELAY="24h"

View file

@ -20,7 +20,8 @@ export PENPOT_FLAGS="\
enable-file-snapshot \
enable-access-tokens \
enable-file-validation \
enable-file-schema-validation";
enable-file-schema-validation \
disable-feature-design-tokens";
export OPTIONS="
-A:jmx-remote -A:dev \

View file

@ -49,7 +49,8 @@
"components/v2"
"styles/v2"
"layout/grid"
"plugins/runtime"})
"plugins/runtime"
"design-tokens/v1"})
;; A set of features enabled by default
(def default-features
@ -81,7 +82,8 @@
"fdata/pointer-map"
"layout/grid"
"fdata/shape-data-type"
"plugins/runtime"}
"plugins/runtime"
"design-tokens/v1"}
(into frontend-only-features)))
(sm/register! ::features
@ -101,6 +103,7 @@
:feature-fdata-objects-map "fdata/objects-map"
:feature-fdata-pointer-map "fdata/pointer-map"
:feature-plugins "plugins/runtime"
:feature-design-tokens "design-tokens/v1"
nil))
(defn migrate-legacy-features
@ -308,5 +311,3 @@
:feature (first not-supported)
:hint (str/ffmt "paste features '%' not enabled on the application"
(str/join "," not-supported))))))

View file

@ -109,7 +109,7 @@
(watch [_ _ _]
(when *assert*
(->> (rx/from cfeat/no-migration-features)
(rx/filter #(not (contains? cfeat/backend-only-features %)))
(rx/filter #(not (or (contains? cfeat/backend-only-features %) (= "design-tokens/v1" %))))
(rx/observe-on :async)
(rx/map enable-feature))))

View file

@ -24,10 +24,11 @@
(def libraries (mf/create-context nil))
(def components-v2 (mf/create-context nil))
(def design-tokens (mf/create-context nil))
(def current-scroll (mf/create-context nil))
(def current-zoom (mf/create-context nil))
(def workspace-read-only? (mf/create-context nil))
(def is-component? (mf/create-context false))
(def sidebar (mf/create-context nil))
(def sidebar (mf/create-context nil))

View file

@ -176,6 +176,7 @@
file-ready? (mf/deref file-ready*)
components-v2? (features/use-feature "components/v2")
design-tokens? (features/use-feature "design-tokens/v1")
background-color (:background-color wglobal)]
@ -204,15 +205,16 @@
[:& (mf/provider ctx/current-team-id) {:value team-id}
[:& (mf/provider ctx/current-page-id) {:value page-id}
[:& (mf/provider ctx/components-v2) {:value components-v2?}
[:& (mf/provider ctx/workspace-read-only?) {:value read-only?}
[:section {:class (stl/css :workspace)
:style {:background-color background-color
:touch-action "none"}}
[:& context-menu]
[:& (mf/provider ctx/design-tokens) {:value design-tokens?}
[:& (mf/provider ctx/workspace-read-only?) {:value read-only?}
[:section {:class (stl/css :workspace)
:style {:background-color background-color
:touch-action "none"}}
[:& context-menu]
(if ^boolean file-ready?
[:& workspace-page {:page-id page-id
:file file
:wglobal wglobal
:layout layout}]
[:& workspace-loader])]]]]]]]))
(if ^boolean file-ready?
[:& workspace-page {:page-id page-id
:file file
:wglobal wglobal
:layout layout}]
[:& workspace-loader])]]]]]]]]))

View file

@ -12,7 +12,7 @@
[app.main.refs :as refs]
[app.main.store :as st]
[app.main.ui.components.tab-container :refer [tab-container tab-element]]
[app.main.ui.context :as muc]
[app.main.ui.context :as ctx]
[app.main.ui.hooks.resize :refer [use-resize-hook]]
[app.main.ui.workspace.comments :refer [comments-sidebar]]
[app.main.ui.workspace.left-header :refer [left-header]]
@ -40,6 +40,7 @@
mode-inspect? (= options-mode :inspect)
project (mf/deref refs/workspace-project)
design-tokens? (mf/use-ctx ctx/design-tokens)
section (cond (or mode-inspect? (contains? layout :layers)) :layers
(contains? layout :assets) :assets
@ -64,7 +65,7 @@
on-tab-change
(mf/use-fn #(st/emit! (dw/go-to-layout %)))]
[:& (mf/provider muc/sidebar) {:value :left}
[:& (mf/provider ctx/sidebar) {:value :left}
[:aside {:ref parent-ref
:id "left-sidebar-aside"
:data-testid "left-sidebar"
@ -122,7 +123,8 @@
:title (tr "workspace.toolbar.assets")}
[:& assets-toolbox {:size (- size 58)}]])
(when-not ^boolean mode-inspect?
(when (and (not ^boolean mode-inspect?)
design-tokens?)
[:& tab-element {:id :tokens
:title "Tokens"}
[:& tokens-sidebar-tab]])]])]]))
@ -170,7 +172,7 @@
:on-change-section handle-change-section
:on-expand handle-expand)]
[:& (mf/provider muc/sidebar) {:value :right}
[:& (mf/provider ctx/sidebar) {:value :right}
[:aside {:class (stl/css-case :right-settings-bar true
:not-expand (not can-be-expanded?)
:expanded (> size 276))