0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 15:39:50 -05:00

Changes name to typography collection

This commit is contained in:
alonso.torres 2020-10-02 11:06:52 +02:00 committed by Hirunatan
parent f45845cf85
commit 2c23b0e7f4
7 changed files with 20 additions and 20 deletions

View file

@ -877,15 +877,15 @@
(defmethod process-change :add-typography
[data {:keys [typography]}]
(update data :typography assoc (:id typography) typography))
(update data :typographies assoc (:id typography) typography))
(defmethod process-change :mod-typography
[data {:keys [typography]}]
(d/update-in-when data [:typography (:id typography)] merge typography))
(d/update-in-when data [:typographies (:id typography)] merge typography))
(defmethod process-change :del-typography
[data {:keys [id]}]
(update data :typography dissoc id))
(update data :typographies dissoc id))
;; -- Operations

View file

@ -453,7 +453,7 @@
(let [[rchanges1 uchanges1] (dwlh/generate-sync-file-components state file-id)
[rchanges2 uchanges2] (dwlh/generate-sync-library-components state file-id)
[rchanges3 uchanges3] (dwlh/generate-sync-file :colors file-id state)
[rchanges4 uchanges4] (dwlh/generate-sync-file :typography file-id state)
[rchanges4 uchanges4] (dwlh/generate-sync-file :typographies file-id state)
rchanges (d/concat rchanges1 rchanges2 rchanges3 rchanges4)
uchanges (d/concat uchanges1 uchanges2 uchanges3 uchanges4)]
(rx/concat
@ -543,7 +543,7 @@
(ptk/reify ::update-typography
ptk/WatchEvent
(watch [_ state stream]
(let [prev (get-in state [:workspace-data :typography (:id typography)])
(let [prev (get-in state [:workspace-data :typographies (:id typography)])
rchg {:type :mod-typography
:typography typography}
uchg {:type :mod-typography
@ -557,7 +557,7 @@
(ptk/reify ::delete-typography
ptk/WatchEvent
(watch [_ state stream]
(let [prev (get-in state [:workspace-data :typography id])
(let [prev (get-in state [:workspace-data :typographies id])
rchg {:type :del-typography
:id id}
uchg {:type :add-typography

View file

@ -35,7 +35,7 @@
and call synchronize"
[asset-type library-id state]
(s/assert #{:colors :components :typography} asset-type)
(s/assert #{:colors :components :typographies} asset-type)
(s/assert (s/nilable ::us/uuid) library-id)
(let [library-items
@ -73,7 +73,7 @@
(= library-id (get shape attr-ref-file))))
cp/color-sync-attrs))
:typography
:typographies
(fn [shape]
(and (= (:type shape) :text)
(->> shape
@ -146,7 +146,7 @@
(conj roperations roperation)
(conj uoperations uoperation)))))))))
(defmethod generate-sync-shape :typography
(defmethod generate-sync-shape :typographies
[_ library-id library-items page shape]
(let [update-node (fn [node]
(if-let [typography (get library-items (:typography-ref-id node))]

View file

@ -100,7 +100,7 @@
(def workspace-file-typography
(l/derived (fn [state]
(when-let [file (:workspace-file state)]
(get-in file [:data :typography])))
(get-in file [:data :typographies])))
st/state))
(def workspace-project

View file

@ -28,7 +28,7 @@
(let [components-count (count (get-in library [:data :components] []))
graphics-count (count (get-in library [:data :media] []))
colors-count (count (get-in library [:data :colors] []))
typography-count (count (get-in library [:data :typography] []))]
typography-count (count (get-in library [:data :typographies] []))]
;; Include a   so this block has always some content
(str
(str/join " · "

View file

@ -465,8 +465,8 @@
(l/derived (fn [state]
(let [wfile (:workspace-file state)]
(if (= (:id wfile) id)
(vals (get-in wfile [:data :typography]))
(vals (get-in state [:workspace-libraries id :data :typography])))))
(vals (get-in wfile [:data :typographies]))
(vals (get-in state [:workspace-libraries id :data :typographies])))))
st/state =))
(defn apply-filters
@ -487,7 +487,7 @@
toggles (mf/use-state #{:components
:graphics
:colors
:typography})
:typographies})
url (rt/resolve router :workspace
{:project-id (:project-id file)
@ -537,7 +537,7 @@
(or (> (count colors) 0)
(str/empty? (:term filters))))
show-typography? (and (or (= (:box filters) :all)
(= (:box filters) :typography))
(= (:box filters) :typographies))
(or (> (count colors) 0)
(str/empty? (:term filters))))]
[:div.tool-window-content
@ -570,9 +570,9 @@
:local? local?
:locale locale
:typographies typographies
:open? (contains? @toggles :typography)
:on-open #(swap! toggles conj :typography)
:on-close #(swap! toggles disj :typography)}])
:open? (contains? @toggles :typographies)
:on-open #(swap! toggles conj :typographies)
:on-close #(swap! toggles disj :typographies)}])
(when (and (not show-components?) (not show-graphics?) (not show-colors?))
[:div.asset-group
@ -636,7 +636,7 @@
[:option {:value ":components"} (t locale "workspace.assets.components")]
[:option {:value ":graphics"} (t locale "workspace.assets.graphics")]
[:option {:value ":colors"} (t locale "workspace.assets.colors")]
[:option {:value ":typography"} (t locale "workspace.assets.typography")]]]]
[:option {:value ":typographies"} (t locale "workspace.assets.typography")]]]]
[:div.libraries-wrapper
[:& file-library

View file

@ -207,7 +207,7 @@
(not= (:typography-ref-id values) :multiple)
(:typography-ref-file values))
(-> shared-libs
(get-in [(:typography-ref-file values) :data :typography (:typography-ref-id values)])
(get-in [(:typography-ref-file values) :data :typographies (:typography-ref-id values)])
(assoc :file-id (:typography-ref-file values)))
(and (:typography-ref-id values)