0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -05:00

Fix review issues.

This commit is contained in:
Andrey Antukh 2020-09-28 11:39:01 +02:00 committed by Alonso Torres
parent b3252ec2b2
commit a4d6524cb6
7 changed files with 17 additions and 17 deletions

View file

@ -108,10 +108,10 @@
;; --- Mutation: Toggle Project Pin
(s/def ::is-pinned ::us/boolean)
(s/def ::toggle-project-pin
(s/def ::update-project-pin
(s/keys :req-un [::profile-id ::id ::team-id ::is-pinned]))
(sm/defmutation ::toggle-project-pin
(sm/defmutation ::update-project-pin
[{:keys [id profile-id team-id is-pinned] :as params}]
(db/with-atomic [conn db/pool]
(db/update! conn :team-project-profile-rel
@ -121,6 +121,7 @@
:team-id team-id})
nil))
;; --- Mutation: Rename Project
(declare rename-project)

View file

@ -71,7 +71,7 @@
(def sql:projects
"select p.*,
tpp.is_pinned,
coalesce(tpp.is_pinned, false) as is_pinned,
(select count(*) from file as f
where f.project_id = p.id
and deleted_at is null) as count

View file

@ -28,6 +28,7 @@
(s/def ::project-id ::us/uuid)
(s/def ::created-at ::us/inst)
(s/def ::modified-at ::us/inst)
(s/def ::is-pinned ::us/boolean)
(s/def ::team
(s/keys :req-un [::id
@ -41,7 +42,8 @@
::team-id
::profile-id
::created-at
::modified-at]))
::modified-at
::is-pinned]))
(s/def ::file
(s/keys :req-un [::id
@ -204,6 +206,7 @@
(update [_ state]
(assoc-in state [:dashboard-local :project-for-edit] nil))))
(defn toggle-project-pin
[{:keys [id is-pinned team-id] :as params}]
(us/assert ::project params)
@ -214,8 +217,9 @@
ptk/WatchEvent
(watch [_ state stream]
(let [params (select-keys params [:id :is-pinned :team-id])]
(->> (rp/mutation :toggle-project-pin params)
(let [project (get-in state [:projects team-id id])
params (select-keys project [:id :is-pinned :team-id])]
(->> (rp/mutation :update-project-pin params)
(rx/ignore))))))
;; --- Rename Project

View file

@ -121,6 +121,5 @@
[:& header {:team team :project project}]
[:section.dashboard-grid-container
[:& grid {:id (:id project)
:files files
:hide-new? true}]]]))
:files files}]]]))

View file

@ -174,16 +174,11 @@
[:div.text (t locale "dashboard.grid.empty-files")]]))
(mf/defc grid
[{:keys [id opts files hide-new?] :as props}]
(let [locale (mf/deref i18n/locale)
click #(st/emit! (dd/create-file id))]
[{:keys [id opts files] :as props}]
(let [locale (mf/deref i18n/locale)]
[:section.dashboard-grid
(if (pos? (count files))
[:div.dashboard-grid-row
(when (not hide-new?)
[:div.grid-item.add-file {:on-click click}
[:span (t locale "dashboard.new-file")]])
[:div.grid-row
(for [item files]
[:& grid-item
{:id (:id item)

View file

@ -38,5 +38,5 @@
[:header.dashboard-header
[:h1.dashboard-title (tr "dashboard.header.libraries")]]
[:section.dashboard-grid-container
[:& grid {:files files :hide-new? true}]]]))
[:& grid {:files files}]]]))

View file

@ -332,6 +332,7 @@
(for [item pinned-projects]
[:& sidebar-project
{:item item
:key (:id item)
:id (:id item)
:selected? (= (:id item) (:id project))}])]
[:div.sidebar-empty-placeholder