mirror of
https://github.com/penpot/penpot.git
synced 2025-02-09 16:48:16 -05:00
🐛 Fix many issues relted to comments on viewer.
This commit is contained in:
parent
013c866137
commit
061fdcd5bd
5 changed files with 33 additions and 27 deletions
|
@ -24,7 +24,7 @@
|
|||
|
||||
(def ^:private
|
||||
sql:project
|
||||
"select p.id, p.name
|
||||
"select p.id, p.name, p.team_id
|
||||
from project as p
|
||||
where p.id = ?
|
||||
and p.deleted_at is null")
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
.comments {
|
||||
max-height: 320px;
|
||||
min-height: 105px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,19 +9,21 @@
|
|||
|
||||
(ns app.main.data.viewer
|
||||
(:require
|
||||
[cljs.spec.alpha :as s]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]
|
||||
[app.common.data :as d]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.pages-helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.constants :as c]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.store :as st]
|
||||
[app.common.spec :as us]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.data :as d]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.main.data.comments :as dcm]
|
||||
[app.util.avatars :as avatars]
|
||||
[app.util.router :as rt]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.common.pages-helpers :as cph]))
|
||||
[beicon.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[potok.core :as ptk]))
|
||||
|
||||
;; --- General Specs
|
||||
|
||||
|
@ -149,7 +151,8 @@
|
|||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(let [objects (:objects page)
|
||||
frames (extract-frames objects)]
|
||||
frames (extract-frames objects)
|
||||
users (map #(avatars/assoc-avatar % :fullname) users)]
|
||||
(-> state
|
||||
(assoc :viewer-libraries (d/index-by :id libraries)
|
||||
:viewer-data {:project project
|
||||
|
@ -240,7 +243,9 @@
|
|||
pparams (:path-params route)
|
||||
index (:index qparams)]
|
||||
(when (pos? index)
|
||||
(rx/of (rt/nav screen pparams (assoc qparams :index (dec index)))))))))
|
||||
(rx/of
|
||||
(dcm/close-thread)
|
||||
(rt/nav screen pparams (assoc qparams :index (dec index)))))))))
|
||||
|
||||
(def select-next-frame
|
||||
(ptk/reify ::select-prev-frame
|
||||
|
@ -253,7 +258,9 @@
|
|||
index (:index qparams)
|
||||
total (count (get-in state [:viewer-data :frames]))]
|
||||
(when (< index (dec total))
|
||||
(rx/of (rt/nav screen pparams (assoc qparams :index (inc index)))))))))
|
||||
(rx/of
|
||||
(dcm/close-thread)
|
||||
(rt/nav screen pparams (assoc qparams :index (inc index)))))))))
|
||||
|
||||
(s/def ::interactions-mode #{:hide :show :show-on-click})
|
||||
|
||||
|
@ -387,12 +394,12 @@
|
|||
;; --- Shortcuts
|
||||
|
||||
(def shortcuts
|
||||
{"+" #(st/emit! increase-zoom)
|
||||
"-" #(st/emit! decrease-zoom)
|
||||
"ctrl+a" #(st/emit! (select-all))
|
||||
"shift+0" #(st/emit! zoom-to-50)
|
||||
"shift+1" #(st/emit! reset-zoom)
|
||||
"shift+2" #(st/emit! zoom-to-200)
|
||||
"left" #(st/emit! select-prev-frame)
|
||||
"right" #(st/emit! select-next-frame)})
|
||||
{"+" (st/emitf increase-zoom)
|
||||
"-" (st/emitf decrease-zoom)
|
||||
"ctrl+a" (st/emitf (select-all))
|
||||
"shift+0" (st/emitf zoom-to-50)
|
||||
"shift+1" (st/emitf reset-zoom)
|
||||
"shift+2" (st/emitf zoom-to-200)
|
||||
"left" (st/emitf select-prev-frame)
|
||||
"right" (st/emitf select-next-frame)})
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
(mf/defc comment-item
|
||||
[{:keys [comment thread users] :as props}]
|
||||
(let [owner (get users (:owner-id comment))
|
||||
profile (mf/use-state refs/profile)
|
||||
profile (mf/deref refs/profile)
|
||||
options (mf/use-state false)
|
||||
edition? (mf/use-state false)
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
|
||||
on-click
|
||||
(mf/use-callback
|
||||
(mf/deps cstate data)
|
||||
(mf/deps cstate data frame)
|
||||
(fn [event]
|
||||
(dom/stop-propagation event)
|
||||
(if (some? (:open cstate))
|
||||
|
@ -98,13 +98,11 @@
|
|||
|
||||
on-draft-submit
|
||||
(mf/use-callback
|
||||
(mf/deps frame)
|
||||
(fn [draft]
|
||||
(let [params (update draft :position gpt/transform modifier2)]
|
||||
;; (prn "on-draft-submit" params)
|
||||
|
||||
(st/emit! (dcm/create-thread params)
|
||||
(dcm/close-thread)))))
|
||||
]
|
||||
(dcm/close-thread)))))]
|
||||
|
||||
[:div.comments-section {:on-click on-click}
|
||||
[:div.viewer-comments-container
|
||||
|
|
Loading…
Add table
Reference in a new issue