From 5131b790604317169820444224456501271eb233 Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Thu, 23 May 2024 16:22:31 +0200 Subject: [PATCH 1/9] Prefer wait over deploy for build --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ce86277dc..5c31bd6b5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -71,7 +71,7 @@ jobs: with: ENV: "prod" APP: "penpot" - DEPLOY: "true" + WAIT: "true" smoke: runs-on: ubuntu-latest needs: From d1fc43d8d6e3af528c07547dd9213195c8fe3628 Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Mon, 27 May 2024 10:38:35 +0200 Subject: [PATCH 2/9] Try force deploy branch PR --- .github/workflows/pr.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index fdbaa0c15..c4e5fcd98 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -65,5 +65,6 @@ jobs: - name: 🍍 Deploy with Gimlet uses: gimlet-io/gimlet-artifact-shipper-action@v0.8.3 env: - GIMLET_SERVER: ${{ secrets.GIMLET_SERVER }} - GIMLET_TOKEN: ${{ secrets.GIMLET_TOKEN }} \ No newline at end of file + GIMLET_SERVER: ${{ secrets.GIMLET_SERVER }} + GIMLET_TOKEN: ${{ secrets.GIMLET_TOKEN }} + DEPLOY: 'true' \ No newline at end of file From eeb87e49a2e65340e92b990250eef359df7f8123 Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Tue, 28 May 2024 09:58:15 +0200 Subject: [PATCH 3/9] Cleanup github token usage --- .github/workflows/pr.yaml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index c4e5fcd98..dc23e0bda 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -30,7 +30,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GHCR_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Docker meta id: meta diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5c31bd6b5..085174b85 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,7 +31,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GHCR_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Docker meta id: meta From e02777b855ea0ce89483fb506f9a2d469973c9a4 Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Tue, 28 May 2024 10:23:20 +0200 Subject: [PATCH 4/9] Be explicit in tagging for prs --- .gimlet/penpot-pr.yaml | 2 +- .github/workflows/pr.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gimlet/penpot-pr.yaml b/.gimlet/penpot-pr.yaml index e53344369..f8cdaaf58 100644 --- a/.gimlet/penpot-pr.yaml +++ b/.gimlet/penpot-pr.yaml @@ -14,7 +14,7 @@ values: image: pullPolicy: IfNotPresent repository: ghcr.io/tokens-studio/tokens-studio-for-penpot - tag: 'frontend-{{ .SHA }}' + tag: 'frontend-pr-{{ .SHA }}' ingress: hosts: - host: "{{ .BRANCH | sanitizeDNSName }}.penpot.staging.tokens.studio" diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index dc23e0bda..3def786f3 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -12,7 +12,7 @@ jobs: matrix: include: - dockerfile: Dockerfile.frontend - type: frontend + type: pr-frontend permissions: contents: read packages: write From c1096e15da28332c0c9d694ec4afdd32d0a93d8e Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Mon, 3 Jun 2024 13:39:16 +0200 Subject: [PATCH 5/9] Cleanup --- frontend/src/app/main/ui/workspace/tokens/context_menu.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs b/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs index 034bf5eda..389a93dcd 100644 --- a/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs @@ -103,7 +103,7 @@ all-actions)) (mf/defc token-pill-context-menu - [{:keys [token-id token-type-props token-type selected-shapes] :as context-data}] + [context-data] (let [menu-entries (generate-menu-entries context-data)] (for [[index entry] (d/enumerate menu-entries)] [:& menu-entry {:title (:title entry) :on-click (:action entry) :key index}]))) @@ -142,4 +142,4 @@ [:& token-pill-context-menu {:token-id (:token-id mdata) :token-type-props (:token-type-props mdata) :token-type (:token-type mdata) - :selected-shapes selected-shapes}]])]])) \ No newline at end of file + :selected-shapes selected-shapes}]])]])) From 65942ef63b3ee3694823eb7b8ca0c24a7be3dbd1 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Mon, 3 Jun 2024 13:39:26 +0200 Subject: [PATCH 6/9] Use set of attributes for action generation --- .../ui/workspace/tokens/context_menu.cljs | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs b/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs index 389a93dcd..d011f9c8b 100644 --- a/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs @@ -19,6 +19,7 @@ [app.main.ui.workspace.context-menu :refer [menu-entry prevent-default]] [app.main.ui.workspace.tokens.core :as wtc] [app.util.dom :as dom] + [clojure.set :as set] [okulary.core :as l] [rumext.v2 :as mf])) @@ -34,12 +35,12 @@ {:reg-objects? true :attrs [:rx :ry :r1 :r2 :r3 :r4]}))) -(defn apply-border-radius-token [{:keys [token-id token-type-props selected-shapes]} attribute] +(defn apply-border-radius-token [{:keys [token-id token-type-props selected-shapes]} attributes] (let [token (dt/get-token-data-from-token-id token-id) - updated-token-type-props (if (#{:r1 :r2 :r3 :r4} attribute) + updated-token-type-props (if (set/superset? #{:r1 :r2 :r3 :r4} attributes) (assoc token-type-props :on-update-shape update-shape-radius-single-corner - :attributes #{attribute}) + :attributes attributes) token-type-props)] (wtc/on-apply-token {:token token :token-type-props updated-token-type-props @@ -65,24 +66,29 @@ (defn additional-actions [{:keys [token-type] :as context-data}] - (case token-type - :border-radius (let [action #(apply-border-radius-token context-data %)] - [{:title "All" :action #(action :all)} - {:title "Top Left" :action #(action :r1)} - {:title "Top Right" :action #(action :r2)} - {:title "Bottom Right" :action #(action :r3)} - {:title "Bottom Left" :action #(action :r4)}]) - :spacing (let [action #(apply-spacing-token context-data %)] - [{:title "All" :action #(action #{:p1 :p2 :p3 :p4})} - {:title "Column Gap" :action #(action #{:column-gap})} - {:title "Vertical padding" :action #(action #{:p1 :p3})} - {:title "Horizontal padding" :action #(action #{:p2 :p4})} - {:title "Row Gap" :action #(action #{:row-gap})} - {:title "Top" :action #(action #{:p1})} - {:title "Right" :action #(action #{:p2})} - {:title "Bottom" :action #(action #{:p3})} - {:title "Left" :action #(action #{:p4})}]) - [])) + (let [attributes->actions (fn [update-fn coll] + (for [{:keys [attributes] :as item} coll] + (assoc item :action #(update-fn context-data attributes))))] + (case token-type + :border-radius (attributes->actions + apply-border-radius-token + [{:title "All" :attributes #{:all}} + {:title "Top Left" :attributes #{:r1}} + {:title "Top Right" :attributes #{:r2}} + {:title "Bottom Right" :attributes #{:r3}} + {:title "Bottom Left" :attributes #{:r4}}]) + :spacing (attributes->actions + apply-spacing-token + [{:title "All" :attributes #{:p1 :p2 :p3 :p4}} + {:title "Column Gap" :attributes #{:column-gap}} + {:title "Vertical padding" :attributes #{:p1 :p3}} + {:title "Horizontal padding" :attributes #{:p2 :p4}} + {:title "Row Gap" :attributes #{:row-gap}} + {:title "Top" :attributes #{:p1}} + {:title "Right" :attributes #{:p2}} + {:title "Bottom" :attributes #{:p3}} + {:title "Left" :attributes #{:p4}}]) + []))) (defn generate-menu-entries [{:keys [token-id token-type-props token-type selected-shapes] :as context-data}] (let [{:keys [modal]} token-type-props From 580076355b327e878c5c19e03863a24d1caf01da Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Mon, 3 Jun 2024 15:21:08 +0200 Subject: [PATCH 7/9] Show checkmark for applied tokens --- .../ui/workspace/tokens/context_menu.cljs | 20 +++++++++++++------ .../ui/workspace/tokens/context_menu.scss | 15 ++++++++++++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs b/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs index d011f9c8b..c61f5f0d5 100644 --- a/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/context_menu.cljs @@ -64,15 +64,17 @@ :token-type-props updated-token-type-props :selected-shapes selected-shapes}))) - -(defn additional-actions [{:keys [token-type] :as context-data}] +(defn additional-actions [{:keys [token-id token-type selected-shapes] :as context-data}] (let [attributes->actions (fn [update-fn coll] (for [{:keys [attributes] :as item} coll] - (assoc item :action #(update-fn context-data attributes))))] + (let [selected? (wtc/tokens-applied? {:id token-id} selected-shapes attributes)] + (assoc item + :action #(update-fn context-data attributes) + :selected? selected?))))] (case token-type :border-radius (attributes->actions apply-border-radius-token - [{:title "All" :attributes #{:all}} + [{:title "All" :attributes #{:r1 :r2 :r3 :r4}} {:title "Top Left" :attributes #{:r1}} {:title "Top Right" :attributes #{:r2}} {:title "Bottom Right" :attributes #{:r3}} @@ -111,8 +113,14 @@ (mf/defc token-pill-context-menu [context-data] (let [menu-entries (generate-menu-entries context-data)] - (for [[index entry] (d/enumerate menu-entries)] - [:& menu-entry {:title (:title entry) :on-click (:action entry) :key index}]))) + (for [[index {:keys [title action selected?]}] (d/enumerate menu-entries)] + [:& menu-entry {:key index + :title title + :on-click action + ;; TODO: Allow selected items wihtout an icon for the context menu + :icon (mf/html [:div {:class (stl/css-case :empty-icon true + :hidden-icon (not selected?))}]) + :selected? selected?}]))) (mf/defc token-context-menu [] diff --git a/frontend/src/app/main/ui/workspace/tokens/context_menu.scss b/frontend/src/app/main/ui/workspace/tokens/context_menu.scss index 49fe69662..25505f4e9 100644 --- a/frontend/src/app/main/ui/workspace/tokens/context_menu.scss +++ b/frontend/src/app/main/ui/workspace/tokens/context_menu.scss @@ -24,8 +24,19 @@ background-color: var(--menu-background-color); max-height: 100vh; overflow-y: auto; + + // TODO: Fixes missing styles from parent context menu + li { + @include bodySmallTypography; + color: var(--menu-foreground-color); + } } -.token-context-submenu { - position: absolute; +// TODO: Allow selected items wihtout an icon for the context menu +.empty-icon { + width: 0; + height: 0; +} +.hidden-icon { + width: 11px; } From 3b3fbc2ccd9c62d57e316b12e6258150df9e1278 Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:06:00 +0200 Subject: [PATCH 8/9] fix deploys --- .gimlet/penpot-prod.yaml | 1 - .github/workflows/pr.yaml | 2 +- .github/workflows/publish.yml | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gimlet/penpot-prod.yaml b/.gimlet/penpot-prod.yaml index f3f84e2ae..bf6ca80cb 100644 --- a/.gimlet/penpot-prod.yaml +++ b/.gimlet/penpot-prod.yaml @@ -116,7 +116,6 @@ manifests: | enabled: true annotations: cert-manager.io/cluster-issuer: letsencrypt-prod - networking.gke.io/v1beta1.FrontendConfig: default-frontend-config hosts: - host: penpot.tokens.studio tls: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 3def786f3..b1a56d72d 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -30,7 +30,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.PAT_TOKEN }} - name: Docker meta id: meta diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 085174b85..b278fef22 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,7 +31,8 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.PAT_TOKEN }} + - name: Docker meta id: meta From 057934c883bd7b452a816e44d76bdebf558fd06a Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:11:58 +0200 Subject: [PATCH 9/9] Cleanup PR --- .github/workflows/pr.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index b1a56d72d..23f9290ec 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -13,6 +13,7 @@ jobs: include: - dockerfile: Dockerfile.frontend type: pr-frontend + name: frontend permissions: contents: read packages: write @@ -42,9 +43,9 @@ jobs: ghcr.io/tokens-studio/tokens-studio-for-penpot - name: prebuild run: | - echo "Building ${{ matrix.type }} image" - ./manage.sh build-${{matrix.type}}-bundle - mv ./bundles/${{matrix.type}} ./docker/images/bundle-${{matrix.type}}/ + echo "Building ${{ matrix.name }} image" + ./manage.sh build-${{matrix.name}}-bundle + mv ./bundles/${{matrix.name}} ./docker/images/bundle-${{matrix.name}}/ - name: Publish Docker images uses: docker/build-push-action@v5