mirror of
https://github.com/penpot/penpot.git
synced 2025-07-23 11:57:24 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
e6664013ba
23 changed files with 391 additions and 83 deletions
|
@ -37,7 +37,7 @@
|
|||
(log/setup! {:app :info})
|
||||
|
||||
(when (= :browser cf/target)
|
||||
(log/info :message "Welcome to penpot"
|
||||
(log/info :message "Hey!,Welcome to penpot"
|
||||
:version (:full cf/version)
|
||||
:asserts *assert*
|
||||
:build-date cf/build-date
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
(ns app.main.data.common
|
||||
"A general purpose events."
|
||||
(:require
|
||||
[app.config :as cf]
|
||||
[app.main.data.messages :as msg]
|
||||
[app.main.repo :as rp]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
|
||||
|
@ -43,3 +46,33 @@
|
|||
(watch [_ _ _]
|
||||
(->> (rp/cmd! :delete-share-link {:id id})
|
||||
(rx/ignore)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; NOTIFICATIONS
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn force-reload!
|
||||
[]
|
||||
(.reload js/location))
|
||||
|
||||
(defn handle-notification
|
||||
[{:keys [message code level] :as params}]
|
||||
(ptk/reify ::show-notification
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(case code
|
||||
:upgrade-version
|
||||
(when (or (not= (:version params) (:full cf/version))
|
||||
(true? (:force params)))
|
||||
(rx/of (msg/dialog
|
||||
:content (tr "notifications.by-code.upgrade-version")
|
||||
:controls :inline-actions
|
||||
:type level
|
||||
:actions [{:label "Refresh" :callback force-reload!}]
|
||||
:tag :notification)))
|
||||
|
||||
(rx/of (msg/dialog
|
||||
:content message
|
||||
:controls :close
|
||||
:type level
|
||||
:tag :notification))))))
|
||||
|
|
|
@ -13,10 +13,12 @@
|
|||
[app.common.uri :as u]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cf]
|
||||
[app.main.data.common :refer [handle-notification]]
|
||||
[app.main.data.events :as ev]
|
||||
[app.main.data.fonts :as df]
|
||||
[app.main.data.media :as di]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.data.websocket :as dws]
|
||||
[app.main.features :as features]
|
||||
[app.main.repo :as rp]
|
||||
[app.util.dom :as dom]
|
||||
|
@ -61,7 +63,23 @@
|
|||
(ptk/watch (fetch-projects) state stream)
|
||||
(ptk/watch (fetch-team-members) state stream)
|
||||
(ptk/watch (du/fetch-teams) state stream)
|
||||
(ptk/watch (du/fetch-users {:team-id id}) state stream)))))
|
||||
(ptk/watch (du/fetch-users {:team-id id}) state stream)
|
||||
|
||||
(let [stoper (rx/filter (ptk/type? ::finalize) stream)
|
||||
profile-id (:profile-id state)]
|
||||
(->> stream
|
||||
(rx/filter (ptk/type? ::dws/message))
|
||||
(rx/map deref)
|
||||
(rx/filter (fn [{:keys [subs-id type] :as msg}]
|
||||
(and (or (= subs-id uuid/zero)
|
||||
(= subs-id profile-id))
|
||||
(= :notification type))))
|
||||
(rx/map handle-notification)
|
||||
(rx/take-until stoper)))))))
|
||||
|
||||
(defn finalize
|
||||
[params]
|
||||
(ptk/data-event ::finalize params))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Data Fetching (context aware: current team)
|
||||
|
|
|
@ -120,6 +120,17 @@
|
|||
:position :fixed
|
||||
:timeout timeout})))
|
||||
|
||||
(defn dialog
|
||||
[& {:keys [content controls actions position tag type]
|
||||
:or {controls :none position :floating type :info}}]
|
||||
(show (d/without-nils
|
||||
{:content content
|
||||
:type type
|
||||
:position position
|
||||
:controls controls
|
||||
:actions actions
|
||||
:tag tag})))
|
||||
|
||||
(defn info-dialog
|
||||
([content controls actions]
|
||||
(info-dialog content controls actions nil))
|
||||
|
|
|
@ -518,6 +518,29 @@
|
|||
(->> (rp/cmd! :get-access-tokens)
|
||||
(rx/map access-tokens-fetched)))))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(defn heyhey-fetched
|
||||
[value]
|
||||
(ptk/reify ::heyhey-fetched
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(assoc state :hey-value value))))
|
||||
|
||||
|
||||
|
||||
(defn fetch-heyhey
|
||||
[]
|
||||
(ptk/reify ::fetch-heyhey
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(->> (rp/cmd! :hey)
|
||||
(rx/map heyhey-fetched)))))
|
||||
|
||||
|
||||
|
||||
;; --- EVENT: create-access-token
|
||||
|
||||
(defn access-token-created
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
[app.common.data.macros :as dm]
|
||||
[app.common.pages.changes :as cpc]
|
||||
[app.common.schema :as sm]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.common :refer [handle-notification]]
|
||||
[app.main.data.websocket :as dws]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.libraries :as dwl]
|
||||
|
@ -57,8 +59,9 @@
|
|||
(rx/filter (ptk/type? ::dws/message))
|
||||
(rx/map deref)
|
||||
(rx/filter (fn [{:keys [subs-id] :as msg}]
|
||||
(or (= subs-id team-id)
|
||||
(or (= subs-id uuid/zero)
|
||||
(= subs-id profile-id)
|
||||
(= subs-id team-id)
|
||||
(= subs-id file-id))))
|
||||
(rx/map process-message))
|
||||
|
||||
|
@ -96,6 +99,7 @@
|
|||
:pointer-update (handle-pointer-update msg)
|
||||
:file-change (handle-file-change msg)
|
||||
:library-change (handle-library-change msg)
|
||||
:notification (handle-notification msg)
|
||||
nil))
|
||||
|
||||
(defn- handle-pointer-send
|
||||
|
|
|
@ -154,18 +154,18 @@
|
|||
(hooks/use-shortcuts ::dashboard sc/shortcuts)
|
||||
|
||||
(mf/with-effect [team-id]
|
||||
(st/emit! (dd/initialize {:id team-id})))
|
||||
(st/emit! (dd/initialize {:id team-id}))
|
||||
(fn []
|
||||
(dd/finalize {:id team-id})))
|
||||
|
||||
(mf/use-effect
|
||||
(fn []
|
||||
(let [events [(events/listen goog/global "keydown"
|
||||
(fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dd/open-selected-file)))))]]
|
||||
(fn []
|
||||
(doseq [key events]
|
||||
(events/unlistenByKey key))))))
|
||||
(mf/with-effect []
|
||||
(let [key (events/listen goog/global "keydown"
|
||||
(fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dd/open-selected-file)))))]
|
||||
(fn []
|
||||
(events/unlistenByKey key))))
|
||||
|
||||
[:& (mf/provider ctx/current-team-id) {:value team-id}
|
||||
[:& (mf/provider ctx/current-project-id) {:value project-id}
|
||||
|
|
|
@ -260,16 +260,21 @@
|
|||
[:& access-token-actions
|
||||
{:on-delete on-delete}]]]))
|
||||
|
||||
(def hey-ref
|
||||
(l/derived :hey-value st/state))
|
||||
|
||||
(mf/defc access-tokens-page
|
||||
[]
|
||||
(mf/with-effect []
|
||||
(dom/set-html-title (tr "title.settings.access-tokens"))
|
||||
(st/emit! (du/fetch-access-tokens)))
|
||||
(st/emit! (du/fetch-access-tokens))
|
||||
(st/emit! (du/fetch-heyhey)))
|
||||
|
||||
(let [tokens (mf/deref tokens-ref)]
|
||||
[:div.dashboard-access-tokens
|
||||
(let [tokens (mf/deref tokens-ref)
|
||||
hey (mf/deref hey-ref)]
|
||||
[:div.dashboard-access-tokens {:style {:background "pink"}}
|
||||
[:div
|
||||
[:& access-tokens-hero]
|
||||
[:div {:on-click #(st/emit! (du/fetch-heyhey))} hey]
|
||||
(if (empty? tokens)
|
||||
[:div.access-tokens-empty
|
||||
[:div (tr "dashboard.access-tokens.empty.no-access-tokens")]
|
||||
|
|
|
@ -38,11 +38,10 @@
|
|||
|
||||
(defn- find-relative-to-base-frame
|
||||
[shape objects overlays-ids base-frame]
|
||||
(if (or (empty? overlays-ids) (nil? shape) (cph/root? shape))
|
||||
base-frame
|
||||
(if (contains? overlays-ids (:id shape))
|
||||
shape
|
||||
(find-relative-to-base-frame (cph/get-parent objects (:id shape)) objects overlays-ids base-frame))))
|
||||
(cond
|
||||
(cph/frame-shape? shape) shape
|
||||
(or (empty? overlays-ids) (nil? shape) (cph/root? shape)) base-frame
|
||||
:else (find-relative-to-base-frame (cph/get-parent objects (:id shape)) objects overlays-ids base-frame)))
|
||||
|
||||
(defn- activate-interaction
|
||||
[interaction shape base-frame frame-offset objects overlays]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue