mirror of
https://github.com/penpot/penpot.git
synced 2025-02-02 12:28:54 -05:00
✨ Fix review issues.
This commit is contained in:
parent
b3252ec2b2
commit
a4d6524cb6
7 changed files with 17 additions and 17 deletions
|
@ -108,10 +108,10 @@
|
||||||
;; --- Mutation: Toggle Project Pin
|
;; --- Mutation: Toggle Project Pin
|
||||||
|
|
||||||
(s/def ::is-pinned ::us/boolean)
|
(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]))
|
(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}]
|
[{:keys [id profile-id team-id is-pinned] :as params}]
|
||||||
(db/with-atomic [conn db/pool]
|
(db/with-atomic [conn db/pool]
|
||||||
(db/update! conn :team-project-profile-rel
|
(db/update! conn :team-project-profile-rel
|
||||||
|
@ -121,6 +121,7 @@
|
||||||
:team-id team-id})
|
:team-id team-id})
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
|
|
||||||
;; --- Mutation: Rename Project
|
;; --- Mutation: Rename Project
|
||||||
|
|
||||||
(declare rename-project)
|
(declare rename-project)
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
(def sql:projects
|
(def sql:projects
|
||||||
"select p.*,
|
"select p.*,
|
||||||
tpp.is_pinned,
|
coalesce(tpp.is_pinned, false) as is_pinned,
|
||||||
(select count(*) from file as f
|
(select count(*) from file as f
|
||||||
where f.project_id = p.id
|
where f.project_id = p.id
|
||||||
and deleted_at is null) as count
|
and deleted_at is null) as count
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
(s/def ::project-id ::us/uuid)
|
(s/def ::project-id ::us/uuid)
|
||||||
(s/def ::created-at ::us/inst)
|
(s/def ::created-at ::us/inst)
|
||||||
(s/def ::modified-at ::us/inst)
|
(s/def ::modified-at ::us/inst)
|
||||||
|
(s/def ::is-pinned ::us/boolean)
|
||||||
|
|
||||||
(s/def ::team
|
(s/def ::team
|
||||||
(s/keys :req-un [::id
|
(s/keys :req-un [::id
|
||||||
|
@ -41,7 +42,8 @@
|
||||||
::team-id
|
::team-id
|
||||||
::profile-id
|
::profile-id
|
||||||
::created-at
|
::created-at
|
||||||
::modified-at]))
|
::modified-at
|
||||||
|
::is-pinned]))
|
||||||
|
|
||||||
(s/def ::file
|
(s/def ::file
|
||||||
(s/keys :req-un [::id
|
(s/keys :req-un [::id
|
||||||
|
@ -204,6 +206,7 @@
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(assoc-in state [:dashboard-local :project-for-edit] nil))))
|
(assoc-in state [:dashboard-local :project-for-edit] nil))))
|
||||||
|
|
||||||
|
|
||||||
(defn toggle-project-pin
|
(defn toggle-project-pin
|
||||||
[{:keys [id is-pinned team-id] :as params}]
|
[{:keys [id is-pinned team-id] :as params}]
|
||||||
(us/assert ::project params)
|
(us/assert ::project params)
|
||||||
|
@ -214,8 +217,9 @@
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [params (select-keys params [:id :is-pinned :team-id])]
|
(let [project (get-in state [:projects team-id id])
|
||||||
(->> (rp/mutation :toggle-project-pin params)
|
params (select-keys project [:id :is-pinned :team-id])]
|
||||||
|
(->> (rp/mutation :update-project-pin params)
|
||||||
(rx/ignore))))))
|
(rx/ignore))))))
|
||||||
|
|
||||||
;; --- Rename Project
|
;; --- Rename Project
|
||||||
|
|
|
@ -121,6 +121,5 @@
|
||||||
[:& header {:team team :project project}]
|
[:& header {:team team :project project}]
|
||||||
[:section.dashboard-grid-container
|
[:section.dashboard-grid-container
|
||||||
[:& grid {:id (:id project)
|
[:& grid {:id (:id project)
|
||||||
:files files
|
:files files}]]]))
|
||||||
:hide-new? true}]]]))
|
|
||||||
|
|
||||||
|
|
|
@ -174,16 +174,11 @@
|
||||||
[:div.text (t locale "dashboard.grid.empty-files")]]))
|
[:div.text (t locale "dashboard.grid.empty-files")]]))
|
||||||
|
|
||||||
(mf/defc grid
|
(mf/defc grid
|
||||||
[{:keys [id opts files hide-new?] :as props}]
|
[{:keys [id opts files] :as props}]
|
||||||
(let [locale (mf/deref i18n/locale)
|
(let [locale (mf/deref i18n/locale)]
|
||||||
click #(st/emit! (dd/create-file id))]
|
|
||||||
[:section.dashboard-grid
|
[:section.dashboard-grid
|
||||||
(if (pos? (count files))
|
(if (pos? (count files))
|
||||||
[:div.dashboard-grid-row
|
[:div.grid-row
|
||||||
(when (not hide-new?)
|
|
||||||
[:div.grid-item.add-file {:on-click click}
|
|
||||||
[:span (t locale "dashboard.new-file")]])
|
|
||||||
|
|
||||||
(for [item files]
|
(for [item files]
|
||||||
[:& grid-item
|
[:& grid-item
|
||||||
{:id (:id item)
|
{:id (:id item)
|
||||||
|
|
|
@ -38,5 +38,5 @@
|
||||||
[:header.dashboard-header
|
[:header.dashboard-header
|
||||||
[:h1.dashboard-title (tr "dashboard.header.libraries")]]
|
[:h1.dashboard-title (tr "dashboard.header.libraries")]]
|
||||||
[:section.dashboard-grid-container
|
[:section.dashboard-grid-container
|
||||||
[:& grid {:files files :hide-new? true}]]]))
|
[:& grid {:files files}]]]))
|
||||||
|
|
||||||
|
|
|
@ -332,6 +332,7 @@
|
||||||
(for [item pinned-projects]
|
(for [item pinned-projects]
|
||||||
[:& sidebar-project
|
[:& sidebar-project
|
||||||
{:item item
|
{:item item
|
||||||
|
:key (:id item)
|
||||||
:id (:id item)
|
:id (:id item)
|
||||||
:selected? (= (:id item) (:id project))}])]
|
:selected? (= (:id item) (:id project))}])]
|
||||||
[:div.sidebar-empty-placeholder
|
[:div.sidebar-empty-placeholder
|
||||||
|
|
Loading…
Add table
Reference in a new issue