diff --git a/CHANGES.md b/CHANGES.md index c026d6dff..af8d8f019 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -28,6 +28,7 @@ ### :sparkles: New features +- Open feedback in a new window [Taiga #2901](https://tree.taiga.io/project/penpot/us/2901) - Improve usage of file menu [Taiga #2853](https://tree.taiga.io/project/penpot/us/2853) - Rotation to snap to 15ยบ intervals with shift [Taiga #2437](https://tree.taiga.io/project/penpot/issue/2437) - Support border radius and stroke properties for images [Taiga #497](https://tree.taiga.io/project/penpot/us/497) diff --git a/backend/src/app/tasks/telemetry.clj b/backend/src/app/tasks/telemetry.clj index 812e36f97..7b208cb00 100644 --- a/backend/src/app/tasks/telemetry.clj +++ b/backend/src/app/tasks/telemetry.clj @@ -38,14 +38,17 @@ (defmethod ig/init-key ::handler [_ {:keys [pool sprops version] :as cfg}] - (fn [_] + (fn [{:keys [send?] :or {send? true}}] ;; Sleep randomly between 0 to 10s - (thread-sleep (rand-int 10000)) + (when send? + (thread-sleep (rand-int 10000))) - (let [instance-id (:instance-id sprops)] - (-> (get-stats pool version) - (assoc :instance-id instance-id) - (send! cfg))))) + (let [instance-id (:instance-id sprops) + stats (-> (get-stats pool version) + (assoc :instance-id instance-id))] + (when send? + (send! stats cfg)) + stats))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; IMPL @@ -137,12 +140,28 @@ (->> [sql:team-averages] (db/exec-one! conn))) +(defn- retrieve-enabled-auth-providers + [conn] + (let [sql (str "select auth_backend as backend, count(*) as total " + " from profile group by 1") + rows (db/exec! conn [sql])] + (->> rows + (map (fn [{:keys [backend total]}] + (let [backend (or backend "penpot")] + [(keyword (str "auth-backend-" backend)) + total]))) + (into {})))) + (defn- retrieve-jvm-stats [] (let [^Runtime runtime (Runtime/getRuntime)] {:jvm-heap-current (.totalMemory runtime) :jvm-heap-max (.maxMemory runtime) - :jvm-cpus (.availableProcessors runtime)})) + :jvm-cpus (.availableProcessors runtime) + :os-arch (System/getProperty "os.arch") + :os-name (System/getProperty "os.name") + :os-version (System/getProperty "os.version") + :user-tz (System/getProperty "user.timezone")})) (defn get-stats [conn version] @@ -161,6 +180,7 @@ :total-touched-files (retrieve-num-touched-files conn)} (d/merge (retrieve-team-averages conn) - (retrieve-jvm-stats)) + (retrieve-jvm-stats) + (retrieve-enabled-auth-providers conn)) (d/without-nils)))) diff --git a/frontend/resources/styles/main/partials/workspace.scss b/frontend/resources/styles/main/partials/workspace.scss index 1ff81f3c4..7cead65b3 100644 --- a/frontend/resources/styles/main/partials/workspace.scss +++ b/frontend/resources/styles/main/partials/workspace.scss @@ -19,7 +19,7 @@ $height-palette-max: 80px; width: 100vw; height: 100vh; user-select: none; - + background-color: $color-canvas; display: grid; grid-template-areas: "header header header header" diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 29dac3cce..eca5db0f8 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -727,9 +727,13 @@ ptk/WatchEvent (watch [_ state _] (let [selected (wsh/lookup-selected state) - hover-guides (get-in state [:workspace-guides :hover])] + hover-guides (get-in state [:workspace-guides :hover]) + options-mode (get-in state [:workspace-local :options-mode])] (cond - (d/not-empty? selected) + (and (= options-mode :prototype) (d/not-empty? selected)) + (rx/of (dwi/remove-interactions selected)) + + (and (= options-mode :design) (d/not-empty? selected)) (rx/of (dwc/delete-shapes selected) (dws/deselect-all)) diff --git a/frontend/src/app/main/data/workspace/interactions.cljs b/frontend/src/app/main/data/workspace/interactions.cljs index cf71f907b..93331bd30 100644 --- a/frontend/src/app/main/data/workspace/interactions.cljs +++ b/frontend/src/app/main/data/workspace/interactions.cljs @@ -171,6 +171,15 @@ (update shape :interactions csi/remove-interaction index))))))) +(defn remove-interactions + [ids] + (ptk/reify ::remove-interactions + ptk/WatchEvent + (watch [_ _ _] + (rx/of (dch/update-shapes ids + (fn [shape] + (assoc shape :interactions []))))))) + (defn update-interaction [shape index update-fn] (ptk/reify ::update-interaction diff --git a/frontend/src/app/main/ui/workspace.cljs b/frontend/src/app/main/ui/workspace.cljs index 2dc271ece..d9d3e07b6 100644 --- a/frontend/src/app/main/ui/workspace.cljs +++ b/frontend/src/app/main/ui/workspace.cljs @@ -53,7 +53,7 @@ (mf/use-callback (mf/deps vport) (fn [resize-type size] - (when vport + (when (and vport (not= size vport)) (st/emit! (dw/update-viewport-size resize-type size))))) node-ref (use-resize-observer on-resize)] diff --git a/frontend/src/app/main/ui/workspace/header.cljs b/frontend/src/app/main/ui/workspace/header.cljs index 3d5169fb2..91dbaae85 100644 --- a/frontend/src/app/main/ui/workspace/header.cljs +++ b/frontend/src/app/main/ui/workspace/header.cljs @@ -252,8 +252,7 @@ [:span (tr "workspace.header.menu.option.preferences")] [:span i/arrow-slide]] (when (contains? @cf/flags :user-feedback) [:* - [:li.feedback {:on-click (st/emitf (rt/nav :settings-feedback)) - :on-pointer-enter (st/emitf (rt/nav :settings-feedback))} + [:li.feedback {:on-click (st/emitf (rt/nav-new-window* {:rname :settings-feedback}))} [:span (tr "labels.give-feedback")]]])]] [:& dropdown {:show (= @show-sub-menu? :file) diff --git a/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs b/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs index 56ed2bf76..942c75ea5 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs @@ -209,6 +209,7 @@ {:keys [on-pointer-down on-lost-pointer-capture on-mouse-move parent-ref size]} (use-resize-hook :sitemap 200 38 400 :y false nil) + size (if @show-pages? size 38) toggle-pages (mf/use-callback #(reset! show-pages? not))] @@ -217,12 +218,13 @@ [:div.tool-window-bar [:span (tr "workspace.sidebar.sitemap")] [:div.add-page {:on-click create} i/close] - [:div.collapse-pages {:on-click toggle-pages} i/arrow-slide]] + [:div.collapse-pages {:on-click toggle-pages + :style {:transform (when (not @show-pages?) "rotate(-90deg)")}} i/arrow-slide]] + + [:div.tool-window-content + [:& pages-list {:file file :key (:id file)}]] (when @show-pages? - [:div.tool-window-content - [:& pages-list {:file file :key (:id file)}]]) - - [:div.resize-area {:on-pointer-down on-pointer-down - :on-lost-pointer-capture on-lost-pointer-capture - :on-mouse-move on-mouse-move}]])) + [:div.resize-area {:on-pointer-down on-pointer-down + :on-lost-pointer-capture on-lost-pointer-capture + :on-mouse-move on-mouse-move}])])) diff --git a/frontend/src/app/main/ui/workspace/viewport/guides.cljs b/frontend/src/app/main/ui/workspace/viewport/guides.cljs index 6aebf468a..7bfde052a 100644 --- a/frontend/src/app/main/ui/workspace/viewport/guides.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/guides.cljs @@ -196,13 +196,13 @@ (if (= axis :x) {:rect-x (- pos (/ guide-pill-width 2)) - :rect-y (+ (:y vbox) rules-pos (- (/ guide-pill-width 2)) (/ 2 zoom)) + :rect-y (+ (:y vbox) rules-pos (- (/ guide-pill-width 2)) (/ 3 zoom)) :rect-width guide-pill-width :rect-height guide-pill-height :text-x pos :text-y (+ (:y vbox) rules-pos (- (/ 3 zoom)))} - {:rect-x (+ (:x vbox) rules-pos (- (/ guide-pill-height 2)) (- (/ 5 zoom))) + {:rect-x (+ (:x vbox) rules-pos (- (/ guide-pill-height 2)) (- (/ 4 zoom))) :rect-y (- pos (/ guide-pill-width 2)) :rect-width guide-pill-height :rect-height guide-pill-width @@ -363,8 +363,8 @@ :text-anchor "middle" :dominant-baseline "middle" :transform (when (= axis :y) (str "rotate(-90 " text-x "," text-y ")")) - :style {:font-size (/ 13 zoom) - :font-family "sourcesanspro" + :style {:font-size (/ rules/font-size zoom) + :font-family rules/font-family :fill colors/black}} (str (mth/round pos))]]))]))) diff --git a/frontend/src/app/main/ui/workspace/viewport/rules.cljs b/frontend/src/app/main/ui/workspace/viewport/rules.cljs index eac032403..57a27c106 100644 --- a/frontend/src/app/main/ui/workspace/viewport/rules.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/rules.cljs @@ -25,8 +25,8 @@ (def over-number-size 50) (def over-number-opacity 0.7) -(def font-size 13) -(def font-family "sourcesanspro") +(def font-size 12) +(def font-family "worksans") ;; ---------------- ;; RULES