mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
✨ Add has-files prop to create-file event
This commit is contained in:
parent
15a896e050
commit
a2ce5efe69
3 changed files with 3 additions and 2 deletions
|
@ -953,6 +953,7 @@
|
||||||
(defn create-file
|
(defn create-file
|
||||||
[{:keys [project-id name] :as params}]
|
[{:keys [project-id name] :as params}]
|
||||||
(dm/assert! (uuid? project-id))
|
(dm/assert! (uuid? project-id))
|
||||||
|
|
||||||
(ptk/reify ::create-file
|
(ptk/reify ::create-file
|
||||||
ev/Event
|
ev/Event
|
||||||
(-data [_] {:project-id project-id})
|
(-data [_] {:project-id project-id})
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
(let [mdata {:on-success on-file-created}
|
(let [mdata {:on-success on-file-created}
|
||||||
params {:project-id (:id project)}]
|
params {:project-id (:id project)}]
|
||||||
(st/emit! (-> (dd/create-file (with-meta params mdata))
|
(st/emit! (-> (dd/create-file (with-meta params mdata))
|
||||||
(with-meta {::ev/origin origin}))))))]
|
(with-meta {::ev/origin origin :has-files (> file-count 0)}))))))]
|
||||||
|
|
||||||
(mf/with-effect [project]
|
(mf/with-effect [project]
|
||||||
(when project
|
(when project
|
||||||
|
|
|
@ -179,7 +179,7 @@
|
||||||
(let [mdata {:on-success on-file-created}
|
(let [mdata {:on-success on-file-created}
|
||||||
params {:project-id project-id}]
|
params {:project-id project-id}]
|
||||||
(st/emit! (-> (dd/create-file (with-meta params mdata))
|
(st/emit! (-> (dd/create-file (with-meta params mdata))
|
||||||
(with-meta {::ev/origin origin}))))))
|
(with-meta {::ev/origin origin :has-files (> file-count 0)}))))))
|
||||||
|
|
||||||
on-create-click
|
on-create-click
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue