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