mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 02:26:12 +02:00
Merge remote-tracking branch 'origin/staging'
This commit is contained in:
commit
853b78613d
19 changed files with 99 additions and 80 deletions
|
@ -93,7 +93,7 @@
|
|||
[]
|
||||
(if (cf/check-platform? :macos)
|
||||
mac-delete
|
||||
"Supr"))
|
||||
"Del"))
|
||||
|
||||
(defn esc
|
||||
[]
|
||||
|
|
|
@ -292,7 +292,7 @@
|
|||
(mf/use-callback
|
||||
(fn [event]
|
||||
(let [val (dom/get-target-val event)]
|
||||
(reset! sterm val))))]
|
||||
(reset! sterm (str/lower val)))))]
|
||||
|
||||
[:div.dashboard-installed-fonts
|
||||
[:h3 (tr "labels.installed-fonts")]
|
||||
|
|
|
@ -304,7 +304,8 @@
|
|||
success-files (->> @state :files (filter #(and (= (:status %) :import-finish) (empty? (:errors %)))) count)
|
||||
pending-analysis? (> (->> @state :files (filter #(= (:status %) :analyzing)) count) 0)
|
||||
pending-import? (> (->> @state :files (filter #(= (:status %) :importing)) count) 0)
|
||||
files (->> (:files @state) (filterv (comp not :deleted?)))]
|
||||
files (->> (:files @state) (filterv (comp not :deleted?)))
|
||||
valid-files? (> (->> files (filterv (fn [x] (not= (:status x) :analyze-error))) count) 0)]
|
||||
|
||||
(mf/use-effect
|
||||
(fn []
|
||||
|
@ -359,7 +360,7 @@
|
|||
{:class "primary"
|
||||
:type "button"
|
||||
:value (tr "labels.continue")
|
||||
:disabled pending-analysis?
|
||||
:disabled (or pending-analysis? (not valid-files?))
|
||||
:on-click handle-continue}])
|
||||
|
||||
(when (= :importing (:status @state))
|
||||
|
@ -367,5 +368,5 @@
|
|||
{:class "primary"
|
||||
:type "button"
|
||||
:value (tr "labels.accept")
|
||||
:disabled pending-import?
|
||||
:disabled (or pending-import? (not valid-files?))
|
||||
:on-click handle-accept}])]]]]))
|
||||
|
|
|
@ -300,13 +300,13 @@
|
|||
[key default]
|
||||
(let [id (use-id)
|
||||
state (mf/use-state (get @storage key default))
|
||||
stream (mf/with-memo []
|
||||
stream (mf/with-memo [id]
|
||||
(->> mbc/stream
|
||||
(rx/filter #(= (:type %) key))
|
||||
(rx/filter #(not= (:id %) id))
|
||||
(rx/filter #(= (:type %) key))
|
||||
(rx/map deref)))]
|
||||
|
||||
(mf/with-effect [@state key]
|
||||
(mf/with-effect [@state key id]
|
||||
(mbc/emit! id key @state)
|
||||
(swap! storage assoc key @state))
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
(remove #(= "transform" (.-attributeName ^js %))))]
|
||||
(when (d/not-empty? mutations)
|
||||
(on-change (mf/ref-val node-ref))))))
|
||||
|
||||
|
||||
set-node
|
||||
(mf/use-callback
|
||||
(mf/deps on-mutation)
|
||||
|
|
|
@ -96,14 +96,6 @@
|
|||
{:href "https://twitter.com/PenpotSupport" :target "_blank"}
|
||||
(tr "feedback.twitter-go-to")]
|
||||
|
||||
[:hr]
|
||||
|
||||
[:h2 "Gitter"]
|
||||
[:p (tr "feedback.chat-subtitle")]
|
||||
[:a.btn-secondary.btn-large
|
||||
{:href "https://gitter.im/penpot/community" :target "_blank"}
|
||||
(tr "feedback.chat-start")]
|
||||
|
||||
]))
|
||||
|
||||
(mf/defc feedback-page
|
||||
|
|
|
@ -37,17 +37,17 @@
|
|||
(mf/defc palette
|
||||
[{:keys [current-colors recent-colors file-colors shared-libs selected on-select]}]
|
||||
(let [;; We had to do this due to a bug that leave some bugged colors
|
||||
current-colors (filter #(or (:gradient %) (:color %)) current-colors)
|
||||
state (mf/use-state {:show-menu false})
|
||||
current-colors (h/use-equal-memo (filter #(or (:gradient %) (:color %)) current-colors))
|
||||
state (mf/use-state {:show-menu false})
|
||||
|
||||
width (:width @state 0)
|
||||
visible (/ width 66)
|
||||
width (:width @state 0)
|
||||
visible (/ width 66)
|
||||
|
||||
offset (:offset @state 0)
|
||||
max-offset (- (count current-colors)
|
||||
visible)
|
||||
offset (:offset @state 0)
|
||||
max-offset (- (count current-colors)
|
||||
visible)
|
||||
|
||||
container (mf/use-ref nil)
|
||||
container (mf/use-ref nil)
|
||||
|
||||
{:keys [on-pointer-down on-lost-pointer-capture on-mouse-move parent-ref size]}
|
||||
(use-resize-hook :palette 72 54 80 :y true :bottom)
|
||||
|
@ -139,7 +139,7 @@
|
|||
(tr "workspace.libraries.colors.file-library")
|
||||
(str/ffmt " (%)" (count file-colors)))]
|
||||
[:div.color-sample
|
||||
(for [[i color] (map-indexed vector (take 7 (vals file-colors))) ]
|
||||
(for [[i color] (map-indexed vector (take 7 (vals file-colors)))]
|
||||
[:& cb/color-bullet {:key (dm/str "color-" i)
|
||||
:color color}])]]
|
||||
|
||||
|
@ -150,7 +150,7 @@
|
|||
[:div.library-name (str (tr "workspace.libraries.colors.recent-colors")
|
||||
(str/format " (%s)" (count recent-colors)))]
|
||||
[:div.color-sample
|
||||
(for [[idx color] (map-indexed vector (take 7 (reverse recent-colors))) ]
|
||||
(for [[idx color] (map-indexed vector (take 7 (reverse recent-colors)))]
|
||||
[:& cb/color-bullet {:key (str "color-" idx)
|
||||
:color color}])]]]]
|
||||
|
||||
|
@ -185,13 +185,11 @@
|
|||
on-select (mf/use-fn #(reset! selected %))]
|
||||
|
||||
(mf/with-effect [@selected]
|
||||
(fn []
|
||||
(reset! colors
|
||||
(into []
|
||||
(cond
|
||||
(= @selected :recent) (reverse recent-colors)
|
||||
(= @selected :file) (->> (vals file-colors) (sort-by :name))
|
||||
:else (->> (library->colors shared-libs @selected) (sort-by :name)))))))
|
||||
(let [colors' (cond
|
||||
(= @selected :recent) (reverse recent-colors)
|
||||
(= @selected :file) (->> (vals file-colors) (sort-by :name))
|
||||
:else (->> (library->colors shared-libs @selected) (sort-by :name)))]
|
||||
(reset! colors (into [] colors'))))
|
||||
|
||||
(mf/with-effect [recent-colors @selected]
|
||||
(when (= @selected :recent)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
(ns app.main.ui.workspace.colorpicker.libraries
|
||||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.main.data.workspace.colors :as dc]
|
||||
[app.main.data.workspace.colors :as mdc]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.color-bullet :refer [color-bullet]]
|
||||
|
@ -19,13 +19,13 @@
|
|||
|
||||
(mf/defc libraries
|
||||
[{:keys [on-select-color on-add-library-color disable-gradient disable-opacity]}]
|
||||
(let [selected (h/use-shared-state dc/colorpicker-selected-broadcast-key :recent)
|
||||
(let [selected (h/use-shared-state mdc/colorpicker-selected-broadcast-key :recent)
|
||||
current-colors (mf/use-state [])
|
||||
|
||||
shared-libs (mf/deref refs/workspace-libraries)
|
||||
file-colors (mf/deref refs/workspace-file-colors)
|
||||
recent-colors (mf/deref refs/workspace-recent-colors)
|
||||
recent-colors (filter #(or (:gradient %) (:color %)) recent-colors)
|
||||
recent-colors (h/use-equal-memo (filter #(or (:gradient %) (:color %)) recent-colors))
|
||||
|
||||
on-library-change
|
||||
(mf/use-fn
|
||||
|
@ -81,7 +81,7 @@
|
|||
i/plus])
|
||||
|
||||
[:div.color-bullet.button {:style {:background-color "var(--color-white)"}
|
||||
:on-click #(st/emit! (dc/show-palette @selected))}
|
||||
:on-click #(st/emit! (mdc/show-palette @selected))}
|
||||
i/palette]
|
||||
|
||||
(for [[idx color] (map-indexed vector @current-colors)]
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
(l/derived refs/workspace-local)))
|
||||
|
||||
(mf/defc layer-item
|
||||
[{:keys [index item selected objects] :as props}]
|
||||
[{:keys [index item selected objects sortable?] :as props}]
|
||||
(let [id (:id item)
|
||||
selected? (contains? selected id)
|
||||
container? (or (cph/frame-shape? item)
|
||||
|
@ -170,16 +170,17 @@
|
|||
(when-not expanded?
|
||||
(st/emit! (dwc/toggle-collapse (:id item)))))
|
||||
|
||||
[dprops dref] (hooks/use-sortable
|
||||
:data-type "penpot/layer"
|
||||
:on-drop on-drop
|
||||
:on-drag on-drag
|
||||
:on-hold on-hold
|
||||
:disabled @disable-drag
|
||||
:detect-center? container?
|
||||
:data {:id (:id item)
|
||||
:index index
|
||||
:name (:name item)})
|
||||
[dprops dref] (when sortable?
|
||||
(hooks/use-sortable
|
||||
:data-type "penpot/layer"
|
||||
:on-drop on-drop
|
||||
:on-drag on-drag
|
||||
:on-hold on-hold
|
||||
:disabled @disable-drag
|
||||
:detect-center? container?
|
||||
:data {:id (:id item)
|
||||
:index index
|
||||
:name (:name item)}))
|
||||
|
||||
ref (mf/use-ref)]
|
||||
|
||||
|
@ -276,13 +277,15 @@
|
|||
:selected selected
|
||||
:index index
|
||||
:objects objects
|
||||
:key id}]
|
||||
:key id
|
||||
:sortable? true}]
|
||||
[:& layer-item
|
||||
{:item obj
|
||||
:selected selected
|
||||
:index index
|
||||
:objects objects
|
||||
:key id}])))]]))
|
||||
:key id
|
||||
:sortable? true}])))]]))
|
||||
|
||||
(mf/defc filters-tree
|
||||
{::mf/wrap [#(mf/memo % =)
|
||||
|
@ -299,7 +302,8 @@
|
|||
:selected selected
|
||||
:index index
|
||||
:objects objects
|
||||
:key id}]))]))
|
||||
:key id
|
||||
:sortable? false}]))]))
|
||||
|
||||
|
||||
(defn calc-reparented-objects
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
[app.common.uuid :as uuid]
|
||||
[app.main.repo :as rp]
|
||||
[app.util.http :as http]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.import.parser :as cip]
|
||||
[app.util.json :as json]
|
||||
[app.util.webapi :as wapi]
|
||||
|
@ -526,7 +527,8 @@
|
|||
sg (areduce u8 i ret "" (str ret (if (zero? i) "" " ") (.toString (aget u8 i) 8)))]
|
||||
(case sg
|
||||
"120 113 3 4" "application/zip"
|
||||
"application/octet-stream")))
|
||||
"1 13 32 206" "application/octet-stream"
|
||||
"other")))
|
||||
|
||||
(defmethod impl/handler :analyze-import
|
||||
[{:keys [files]}]
|
||||
|
@ -560,8 +562,15 @@
|
|||
:file-id file-id
|
||||
:files {file-id {:name (:name file)}}
|
||||
:status :ready}
|
||||
:type "application/octet-stream"})))))
|
||||
(rx/catch #(rx/of {:uri (:uri file) :error (.-message %)}))))))))
|
||||
:type "application/octet-stream"}))))
|
||||
(->> st
|
||||
(rx/filter (fn [data] (= "other" (:type data))))
|
||||
(rx/map (fn [_]
|
||||
{:uri (:uri file)
|
||||
:error (tr "dashboard.import.analyze-error")}))))
|
||||
(rx/catch (fn [data]
|
||||
(let [error (or (.-message data) (tr "dashboard.import.analyze-error"))]
|
||||
(rx/of {:uri (:uri file) :error error}))))))))))
|
||||
|
||||
(defmethod impl/handler :import-files
|
||||
[{:keys [project-id files]}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue