mirror of
https://github.com/penpot/penpot.git
synced 2025-05-17 14:36:10 +02:00
✨ Kick out of a team - Visibility of System Status
This commit is contained in:
parent
226ab7233b
commit
823792339f
11 changed files with 88 additions and 42 deletions
|
@ -17,6 +17,7 @@
|
|||
[app.main.repo :as rp]
|
||||
[app.main.store :as st]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
|
@ -216,4 +217,23 @@
|
|||
(assoc permissions :can-edit true :is-admin true :is-owner true)
|
||||
|
||||
:else
|
||||
permissions)))))))
|
||||
permissions)))))))
|
||||
|
||||
|
||||
|
||||
(defn removed-from-team
|
||||
[{:keys [team-id team-name]}]
|
||||
(dm/assert! (uuid? team-id))
|
||||
(ptk/reify ::removed-from-team
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [msg (tr "dashboard.removed-from-team" team-name)]
|
||||
|
||||
(rx/concat
|
||||
(rx/of (rt/nav :dashboard-projects {:team-id (get-in state [:profile :default-team-id])}))
|
||||
(->> (rx/of (ntf/info msg))
|
||||
;; Delay so the navigation can finish
|
||||
(rx/delay 250)))))))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1215,4 +1215,5 @@
|
|||
(case type
|
||||
:notification (dc/handle-notification msg)
|
||||
:team-permissions-change (dc/change-team-permissions (assoc msg :workspace? false))
|
||||
:removed-from-team (dc/removed-from-team msg)
|
||||
nil))
|
|
@ -2106,24 +2106,7 @@
|
|||
(pcb/mod-page {:background (:color color)}))]
|
||||
(rx/of (dch/commit-changes changes)))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Read only
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn set-workspace-read-only
|
||||
[read-only?]
|
||||
(ptk/reify ::set-workspace-read-only
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(assoc-in state [:workspace-global :read-only?] read-only?))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(if read-only?
|
||||
(rx/of :interrupt
|
||||
(remove-layout-flag :colorpalette)
|
||||
(remove-layout-flag :textpalette))
|
||||
(rx/empty)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Measurements
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
(ns app.main.data.workspace.common
|
||||
(:require
|
||||
[app.common.logging :as log]
|
||||
[app.main.data.workspace.layout :as dwl]
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; Change this to :info :debug or :trace to debug this module
|
||||
|
@ -56,3 +58,22 @@
|
|||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(update-in state [:workspace-local :hide-toolbar] not))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Read only
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn set-workspace-read-only
|
||||
[read-only?]
|
||||
(ptk/reify ::set-workspace-read-only
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(assoc-in state [:workspace-global :read-only?] read-only?))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(if read-only?
|
||||
(rx/of :interrupt
|
||||
(dwl/remove-layout-flag :colorpalette)
|
||||
(dwl/remove-layout-flag :textpalette))
|
||||
(rx/empty)))))
|
||||
|
|
|
@ -12,10 +12,12 @@
|
|||
[app.common.schema :as sm]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.changes :as dch]
|
||||
[app.main.data.common :refer [handle-notification change-team-permissions]]
|
||||
[app.main.data.common :as dc]
|
||||
[app.main.data.websocket :as dws]
|
||||
[app.main.data.workspace.common :as dwc]
|
||||
[app.main.data.workspace.edition :as dwe]
|
||||
[app.main.data.workspace.layout :as dwly]
|
||||
|
||||
[app.main.data.workspace.libraries :as dwl]
|
||||
[app.util.globals :refer [global]]
|
||||
[app.util.mouse :as mse]
|
||||
|
@ -103,16 +105,15 @@
|
|||
(let [viewer? (= :viewer role)]
|
||||
|
||||
(rx/concat
|
||||
(->> (rx/of :interrupt
|
||||
(dwe/clear-edition-mode))
|
||||
(rx/of :interrupt
|
||||
(dwe/clear-edition-mode)
|
||||
(dwc/set-workspace-read-only false))
|
||||
(->> (rx/of (dc/change-team-permissions msg))
|
||||
;; Delay so anything that launched :interrupt can finish
|
||||
(rx/delay 500))
|
||||
|
||||
(rx/delay 100))
|
||||
(if viewer?
|
||||
(rx/of (dwly/set-options-mode :design))
|
||||
(rx/empty))
|
||||
|
||||
(rx/of (change-team-permissions msg)))))))
|
||||
(rx/of (dwly/set-options-mode :inspect))
|
||||
(rx/of (dwly/set-options-mode :design))))))))
|
||||
|
||||
|
||||
(defn- process-message
|
||||
|
@ -125,8 +126,9 @@
|
|||
:pointer-update (handle-pointer-update msg)
|
||||
:file-change (handle-file-change msg)
|
||||
:library-change (handle-library-change msg)
|
||||
:notification (handle-notification msg)
|
||||
:notification (dc/handle-notification msg)
|
||||
:team-permissions-change (handle-change-team-permissions (assoc msg :workspace? true))
|
||||
:removed-from-team (dc/removed-from-team msg)
|
||||
nil))
|
||||
|
||||
(defn- handle-pointer-send
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.main.data.workspace :as udw]
|
||||
[app.main.data.workspace.common :as dwc]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.context :as ctx]
|
||||
|
@ -147,8 +148,8 @@
|
|||
(let [options-mode (keyword options-mode)]
|
||||
(st/emit! (udw/set-options-mode options-mode))
|
||||
(if (= options-mode :inspect)
|
||||
(st/emit! :interrupt (udw/set-workspace-read-only true))
|
||||
(st/emit! :interrupt (udw/set-workspace-read-only false)))))
|
||||
(st/emit! :interrupt (dwc/set-workspace-read-only true))
|
||||
(st/emit! :interrupt (dwc/set-workspace-read-only false)))))
|
||||
|
||||
design-content
|
||||
(mf/html [:& design-menu {:selected selected
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
[app.common.files.helpers :as cfh]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.common :as dwc]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.context :as ctx]
|
||||
|
@ -26,7 +27,7 @@
|
|||
(fn []
|
||||
(st/emit! :interrupt
|
||||
(dw/set-options-mode :design)
|
||||
(dw/set-workspace-read-only false))))]
|
||||
(dwc/set-workspace-read-only false))))]
|
||||
[:div {:class (stl/css :viewport-actions)}
|
||||
[:div {:class (stl/css :viewport-actions-container)}
|
||||
[:div {:class (stl/css :viewport-actions-title)}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
[app.main.data.preview :as dp]
|
||||
[app.main.data.viewer.shortcuts]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.common :as dwcm]
|
||||
[app.main.data.workspace.path.shortcuts]
|
||||
[app.main.data.workspace.selection :as dws]
|
||||
[app.main.data.workspace.shortcuts]
|
||||
|
@ -370,7 +371,7 @@
|
|||
|
||||
(defn ^:export set-workspace-read-only
|
||||
[read-only?]
|
||||
(st/emit! (dw/set-workspace-read-only read-only?)))
|
||||
(st/emit! (dwcm/set-workspace-read-only read-only?)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; REPAIR & VALIDATION
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue