mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 17:56:38 +02:00
✨ Fix linter issues on frontend (part 3).
This commit is contained in:
parent
3e4e54870b
commit
30e77556db
42 changed files with 183 additions and 307 deletions
|
@ -15,7 +15,6 @@
|
|||
"app/util/perf.cljs"
|
||||
"app/util/import/.*"
|
||||
"app/worker/.*"
|
||||
"app/main/ui.*"
|
||||
"app/libs/.*"
|
||||
"app/main/data/workspace/path/selection.cljs"
|
||||
"app/main/data/workspace/transforms.cljs"
|
||||
|
|
|
@ -6,38 +6,27 @@
|
|||
|
||||
(ns app.main.ui.auth
|
||||
(:require
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.messages :as dm]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.auth.login :refer [login-page]]
|
||||
[app.main.ui.auth.recovery :refer [recovery-page]]
|
||||
[app.main.ui.auth.recovery-request :refer [recovery-request-page]]
|
||||
[app.main.ui.auth.register :refer [register-page register-success-page register-validate-page]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.forms :as fm]
|
||||
[app.util.i18n :as i18n :refer [t]]
|
||||
[app.util.router :as rt]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc auth
|
||||
[{:keys [route] :as props}]
|
||||
(let [section (get-in route [:data :name])
|
||||
locale (mf/deref i18n/locale)
|
||||
params (:query-params route)]
|
||||
|
||||
(mf/use-effect
|
||||
#(dom/set-html-title (t locale "title.default")))
|
||||
#(dom/set-html-title (tr "title.default")))
|
||||
|
||||
[:div.auth
|
||||
[:section.auth-sidebar
|
||||
[:a.logo {:href "#/"} i/logo]
|
||||
[:span.tagline (t locale "auth.sidebar-tagline")]]
|
||||
[:a.logo {:href "https://penpot.app"} i/logo]
|
||||
[:span.tagline (tr "auth.sidebar-tagline")]]
|
||||
|
||||
[:section.auth-content
|
||||
(case section
|
||||
|
@ -54,10 +43,10 @@
|
|||
[:& login-page {:params params}]
|
||||
|
||||
:auth-recovery-request
|
||||
[:& recovery-request-page {:locale locale}]
|
||||
[:& recovery-request-page]
|
||||
|
||||
:auth-recovery
|
||||
[:& recovery-page {:locale locale :params params}])
|
||||
[:& recovery-page {:params params}])
|
||||
|
||||
[:div.terms-login
|
||||
[:a {:href "https://penpot.app/terms.html" :target "_blank"} "Terms of service"]
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.main.ui.messages :as msgs]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :refer [tr t]]
|
||||
[app.util.object :as obj]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
|
@ -74,7 +73,7 @@
|
|||
on-submit
|
||||
(mf/use-callback
|
||||
(mf/deps form)
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(reset! error nil)
|
||||
(let [params (with-meta (:clean-data @form)
|
||||
{:on-error on-error})]
|
||||
|
|
|
@ -11,12 +11,9 @@
|
|||
[app.main.data.users :as du]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.forms :as fm]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [t tr]]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[cljs.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(s/def ::password-1 ::us/not-empty-string)
|
||||
|
@ -40,7 +37,7 @@
|
|||
(assoc :password-1 {:message "errors.password-too-short"}))))
|
||||
|
||||
(defn- on-error
|
||||
[form error]
|
||||
[_form _error]
|
||||
(st/emit! (dm/error (tr "auth.notifications.invalid-token-error"))))
|
||||
|
||||
(defn- on-success
|
||||
|
@ -49,7 +46,7 @@
|
|||
(rt/nav :auth-login)))
|
||||
|
||||
(defn- on-submit
|
||||
[form event]
|
||||
[form _event]
|
||||
(let [mdata {:on-error on-error
|
||||
:on-success on-success}
|
||||
params {:token (get-in @form [:clean-data :token])
|
||||
|
@ -57,7 +54,7 @@
|
|||
(st/emit! (du/recover-profile (with-meta params mdata)))))
|
||||
|
||||
(mf/defc recovery-form
|
||||
[{:keys [locale params] :as props}]
|
||||
[{:keys [params] :as props}]
|
||||
(let [form (fm/use-form :spec ::recovery-form
|
||||
:validators [password-equality]
|
||||
:initial params)]
|
||||
|
@ -66,28 +63,28 @@
|
|||
[:div.fields-row
|
||||
[:& fm/input {:type "password"
|
||||
:name :password-1
|
||||
:label (t locale "auth.new-password")}]]
|
||||
:label (tr "auth.new-password")}]]
|
||||
|
||||
[:div.fields-row
|
||||
[:& fm/input {:type "password"
|
||||
:name :password-2
|
||||
:label (t locale "auth.confirm-password")}]]
|
||||
:label (tr "auth.confirm-password")}]]
|
||||
|
||||
[:& fm/submit-button
|
||||
{:label (t locale "auth.recovery-submit")}]]))
|
||||
{:label (tr "auth.recovery-submit")}]]))
|
||||
|
||||
;; --- Recovery Request Page
|
||||
|
||||
(mf/defc recovery-page
|
||||
[{:keys [locale params] :as props}]
|
||||
[{:keys [params] :as props}]
|
||||
[:section.generic-form
|
||||
[:div.form-container
|
||||
[:h1 "Forgot your password?"]
|
||||
[:div.subtitle "Please enter your new password"]
|
||||
[:& recovery-form {:locale locale :params params}]
|
||||
[:& recovery-form {:params params}]
|
||||
|
||||
[:div.links
|
||||
[:div.link-entry
|
||||
[:a {:on-click #(st/emit! (rt/nav :auth-login))}
|
||||
(t locale "profile.recovery.go-to-login")]]]]])
|
||||
(tr "profile.recovery.go-to-login")]]]]])
|
||||
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
[app.main.store :as st]
|
||||
[app.main.ui.components.forms :as fm]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr t]]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(s/def ::email ::us/email)
|
||||
|
@ -30,7 +28,7 @@
|
|||
|
||||
on-success
|
||||
(mf/use-callback
|
||||
(fn [data]
|
||||
(fn [_ _]
|
||||
(reset! submitted false)
|
||||
(st/emit! (dm/info (tr "auth.notifications.recovery-token-sent"))
|
||||
(rt/nav :auth-login))))
|
||||
|
|
|
@ -8,21 +8,18 @@
|
|||
(:require
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cf]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.data.messages :as dm]
|
||||
[app.main.store :as st]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.auth.login :as login]
|
||||
[app.main.ui.components.forms :as fm]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.ui.messages :as msgs]
|
||||
[app.main.ui.auth.login :as login]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :refer [tr t]]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[app.util.timers :as tm]
|
||||
[beicon.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc demo-warning
|
||||
|
@ -84,7 +81,7 @@
|
|||
|
||||
on-submit
|
||||
(mf/use-callback
|
||||
(fn [form event]
|
||||
(fn [form _event]
|
||||
(reset! submitted? true)
|
||||
(let [params (:clean-data @form)]
|
||||
(->> (rp/mutation :prepare-register-profile params)
|
||||
|
|
|
@ -6,23 +6,16 @@
|
|||
|
||||
(ns app.main.ui.auth.verify-token
|
||||
(:require
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.messages :as dm]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.auth.login :refer [login-page]]
|
||||
[app.main.ui.auth.recovery :refer [recovery-page]]
|
||||
[app.main.ui.auth.recovery-request :refer [recovery-request-page]]
|
||||
[app.main.ui.auth.register :refer [register-page]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.forms :as fm]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(defmulti handle-token (fn [token] (:iss token)))
|
||||
|
@ -34,7 +27,7 @@
|
|||
(st/emit! (du/login-from-token data))))
|
||||
|
||||
(defmethod handle-token :change-email
|
||||
[data]
|
||||
[_data]
|
||||
(let [msg (tr "dashboard.notifications.email-changed-successfully")]
|
||||
(ts/schedule 100 #(st/emit! (dm/success msg)))
|
||||
(st/emit! (rt/nav :settings-profile)
|
||||
|
@ -57,7 +50,7 @@
|
|||
(st/emit! (rt/nav :auth-register {} {:invitation-token token})))))
|
||||
|
||||
(defmethod handle-token :default
|
||||
[tdata]
|
||||
[_tdata]
|
||||
(st/emit!
|
||||
(rt/nav :auth-login)
|
||||
(dm/warn (tr "errors.unexpected-token"))))
|
||||
|
|
|
@ -11,16 +11,13 @@
|
|||
[app.main.data.modal :as modal]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.streams :as ms]
|
||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||
[app.main.ui.context :as ctx]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [t tr]]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.object :as obj]
|
||||
[app.util.time :as dt]
|
||||
[cuerdas.core :as str]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
|
@ -105,7 +102,7 @@
|
|||
:on-focus on-focus
|
||||
:on-change on-change}]
|
||||
(when (or @show-buttons?
|
||||
(not (empty? @content)))
|
||||
(seq @content))
|
||||
[:div.buttons
|
||||
[:input.btn-primary {:type "button" :value "Post" :on-click on-submit}]
|
||||
[:input.btn-secondary {:type "button" :value "Cancel" :on-click on-cancel}]])]))
|
||||
|
@ -323,7 +320,7 @@
|
|||
|
||||
(mf/defc thread-bubble
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [thread zoom open? on-click] :as params}]
|
||||
[{:keys [thread zoom on-click] :as params}]
|
||||
(let [pos (:position thread)
|
||||
pos-x (* (:x pos) zoom)
|
||||
pos-y (* (:y pos) zoom)
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
(ns app.main.ui.components.color-bullet
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[app.util.color :as uc]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.color :as uc]))
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc color-bullet [{:keys [color on-click]}]
|
||||
(if (uc/multiple? color)
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
(mf/defc color-name [{:keys [color size on-click on-double-click]}]
|
||||
(let [color (if (string? color) {:color color :opacity 1} color)
|
||||
{:keys [name color opacity gradient]} color
|
||||
{:keys [name color gradient]} color
|
||||
color-str (or name color (gradient-type->string (:type gradient)))]
|
||||
(when (or (not size) (= size :big))
|
||||
[:span.color-text {:on-click #(when on-click (on-click %))
|
||||
|
|
|
@ -6,16 +6,11 @@
|
|||
|
||||
(ns app.main.ui.components.color-input
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.math :as math]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.util.color :as uc]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.object :as obj]
|
||||
[app.util.simple-math :as sm]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc color-input
|
||||
|
@ -80,7 +75,7 @@
|
|||
handle-blur
|
||||
(mf/use-callback
|
||||
(mf/deps parse-value apply-value update-input)
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(let [new-value (parse-value)]
|
||||
(if new-value
|
||||
(apply-value new-value)
|
||||
|
|
|
@ -6,13 +6,12 @@
|
|||
|
||||
(ns app.main.ui.components.context-menu
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[goog.object :as gobj]
|
||||
[app.main.ui.components.dropdown :refer [dropdown']]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.object :as obj]))
|
||||
[app.util.object :as obj]
|
||||
[goog.object :as gobj]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc context-menu
|
||||
{::mf/wrap-props false}
|
||||
|
@ -52,7 +51,7 @@
|
|||
(- node-height)
|
||||
0)]
|
||||
|
||||
(if (not= target-offset (:offset @local))
|
||||
(when (not= target-offset (:offset @local))
|
||||
(swap! local assoc :offset target-offset))))))
|
||||
|
||||
enter-submenu
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
(ns app.main.ui.components.copy-button
|
||||
(:require
|
||||
[beicon.core :as rx]
|
||||
[rumext.alpha :as mf]
|
||||
[app.util.webapi :as wapi]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.timers :as timers]
|
||||
[app.main.ui.icons :as i]))
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc copy-button [{:keys [data]}]
|
||||
(let [just-copied (mf/use-state false)]
|
||||
|
@ -24,9 +24,8 @@
|
|||
|
||||
[:button.copy-button
|
||||
{:on-click #(when-not @just-copied
|
||||
(do
|
||||
(reset! just-copied true)
|
||||
(wapi/write-to-clipboard data)))}
|
||||
(wapi/write-to-clipboard data))}
|
||||
(if @just-copied
|
||||
i/tick
|
||||
i/copy)]))
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.main.ui.components.dropdown
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.keyboard :as kbd]
|
||||
[goog.events :as events]
|
||||
[goog.object :as gobj])
|
||||
[goog.object :as gobj]
|
||||
[rumext.alpha :as mf])
|
||||
(:import goog.events.EventType))
|
||||
|
||||
(mf/defc dropdown'
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
(ns app.main.ui.components.editable-label
|
||||
(:require
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.data :refer [classnames]]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.timers :as timers]
|
||||
|
@ -32,7 +31,7 @@
|
|||
cancel-editing (fn []
|
||||
(stop-editing)
|
||||
(when on-cancel (on-cancel)))
|
||||
on-dbl-click (fn [e] (when (not disable-dbl-click?) (start-editing)))
|
||||
on-dbl-click (fn [_] (when (not disable-dbl-click?) (start-editing)))
|
||||
on-key-up (fn [e]
|
||||
(cond
|
||||
(kbd/esc? e)
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
(ns app.main.ui.components.editable-select
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.common.data :as d]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.timers :as timers]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.ui.components.dropdown :refer [dropdown]]))
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc editable-select [{:keys [value type options class on-change placeholder]}]
|
||||
(let [state (mf/use-state {:id (uuid/next)
|
||||
|
@ -24,7 +24,7 @@
|
|||
open-dropdown #(swap! state assoc :is-open? true)
|
||||
close-dropdown #(swap! state assoc :is-open? false)
|
||||
select-item (fn [value]
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(swap! state assoc :current-value value)
|
||||
(when on-change (on-change value))))
|
||||
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
|
||||
(ns app.main.ui.components.file-uploader
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.store :as st]
|
||||
[app.util.dom :as dom]))
|
||||
[app.util.dom :as dom]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc file-uploader
|
||||
{::mf/forward-ref true}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
(:require
|
||||
[app.util.dom :as dom]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(def fullscreen-context
|
||||
|
@ -21,7 +20,7 @@
|
|||
|
||||
change
|
||||
(mf/use-callback
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(let [val (dom/fullscreen?)]
|
||||
(reset! state val))))
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
handle-blur
|
||||
(mf/use-callback
|
||||
(mf/deps parse-value apply-value update-input)
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(let [new-value (parse-value)]
|
||||
(if new-value
|
||||
(apply-value new-value)
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
(ns app.main.ui.components.select
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.ui.components.dropdown :refer [dropdown]]))
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc select [{:keys [default-value options class on-change]}]
|
||||
(let [state (mf/use-state {:id (uuid/next)
|
||||
|
@ -17,7 +17,8 @@
|
|||
:current-value default-value})
|
||||
open-dropdown #(swap! state assoc :is-open? true)
|
||||
close-dropdown #(swap! state assoc :is-open? false)
|
||||
select-item (fn [value] (fn [event]
|
||||
select-item (fn [value]
|
||||
(fn [_]
|
||||
(swap! state assoc :current-value value)
|
||||
(when on-change (on-change value))))
|
||||
as-key-value (fn [item] (if (map? item) [(:value item) (:label item)] [item item]))
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require [rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc tab-element
|
||||
[{:keys [children id title]}]
|
||||
[{:keys [children]}]
|
||||
[:div.tab-element
|
||||
[:div.tab-element-content children]])
|
||||
|
||||
|
|
|
@ -57,10 +57,10 @@
|
|||
(let [on-keydown
|
||||
(fn [event]
|
||||
(when (k/enter? event)
|
||||
(do (dom/prevent-default event)
|
||||
(dom/prevent-default event)
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (modal/hide))
|
||||
(on-accept props))))
|
||||
(on-accept props)))
|
||||
key (events/listen js/document EventType.KEYDOWN on-keydown)]
|
||||
#(events/unlistenByKey key))))
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
(ns app.main.ui.cursors
|
||||
(:require
|
||||
[app.common.uri :as u]
|
||||
[clojure.java.io :as io]
|
||||
[cuerdas.core :as str]
|
||||
[app.common.uri :as u]))
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
(def cursor-folder "images/cursors")
|
||||
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
|
||||
(ns app.main.ui.cursors
|
||||
(:require-macros [app.main.ui.cursors :refer [cursor-ref cursor-fn]])
|
||||
(:require [rumext.alpha :as mf]
|
||||
(:require
|
||||
[app.util.timers :as ts]
|
||||
[cuerdas.core :as str]
|
||||
[app.util.timers :as ts]))
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
;; Static cursors
|
||||
(def comments (cursor-ref :comments 0 2 20))
|
||||
|
@ -40,7 +41,7 @@
|
|||
|
||||
(mf/defc debug-preview
|
||||
{::mf/wrap-props false}
|
||||
[props]
|
||||
[]
|
||||
(let [rotation (mf/use-state 0)]
|
||||
(mf/use-effect (fn [] (ts/interval 100 #(reset! rotation inc))))
|
||||
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
(ns app.main.ui.dashboard
|
||||
(:require
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cf]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.modal :as modal]
|
||||
|
@ -16,19 +14,13 @@
|
|||
[app.main.store :as st]
|
||||
[app.main.ui.context :as ctx]
|
||||
[app.main.ui.dashboard.files :refer [files-section]]
|
||||
[app.main.ui.dashboard.fonts :refer [fonts-page font-providers-page]]
|
||||
[app.main.ui.dashboard.libraries :refer [libraries-page]]
|
||||
[app.main.ui.dashboard.projects :refer [projects-section]]
|
||||
[app.main.ui.dashboard.fonts :refer [fonts-page font-providers-page]]
|
||||
[app.main.ui.dashboard.search :refer [search-page]]
|
||||
[app.main.ui.dashboard.sidebar :refer [sidebar]]
|
||||
[app.main.ui.dashboard.team :refer [team-settings-page team-members-page]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.i18n :as i18n :refer [t]]
|
||||
[app.util.router :as rt]
|
||||
[app.util.timers :as tm]
|
||||
[beicon.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(defn ^boolean uuid-str?
|
||||
|
@ -37,9 +29,8 @@
|
|||
(boolean (re-seq us/uuid-rx s))))
|
||||
|
||||
(defn- parse-params
|
||||
[route profile]
|
||||
(let [route-name (get-in route [:data :name])
|
||||
search-term (get-in route [:params :query :search-term])
|
||||
[route]
|
||||
(let [search-term (get-in route [:params :query :search-term])
|
||||
team-id (get-in route [:params :path :team-id])
|
||||
project-id (get-in route [:params :path :project-id])]
|
||||
(cond->
|
||||
|
@ -87,7 +78,7 @@
|
|||
[{:keys [route] :as props}]
|
||||
(let [profile (mf/deref refs/profile)
|
||||
section (get-in route [:data :name])
|
||||
params (parse-params route profile)
|
||||
params (parse-params route)
|
||||
|
||||
project-id (:project-id params)
|
||||
team-id (:team-id params)
|
||||
|
|
|
@ -6,29 +6,15 @@
|
|||
|
||||
(ns app.main.ui.dashboard.comments
|
||||
(:require
|
||||
[okulary.core :as l]
|
||||
[app.common.data :as d]
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cfg]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.comments :as dwcm]
|
||||
[app.main.data.comments :as dcm]
|
||||
[app.main.data.workspace.comments :as dwcm]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||
[app.main.ui.comments :as cmt]
|
||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [t tr]]
|
||||
[app.util.object :as obj]
|
||||
[app.util.router :as rt]
|
||||
[app.util.time :as dt]
|
||||
[app.util.timers :as tm]
|
||||
[beicon.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc comments-section
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
(ns app.main.ui.dashboard.files
|
||||
(:require
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.dashboard.grid :refer [grid]]
|
||||
|
@ -16,18 +15,12 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.router :as rt]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc header
|
||||
[{:keys [team project] :as props}]
|
||||
[{:keys [project] :as props}]
|
||||
(let [local (mf/use-state {:menu-open false
|
||||
:edition false})
|
||||
project-id (:id project)
|
||||
team-id (:id team)
|
||||
|
||||
on-menu-click
|
||||
(mf/use-callback
|
||||
(fn [event]
|
||||
|
|
|
@ -6,27 +6,22 @@
|
|||
|
||||
(ns app.main.ui.dashboard.fonts
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.media :as cm]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.fonts :as df]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.ui.components.file-uploader :refer [file-uploader]]
|
||||
[app.main.ui.components.context-menu :refer [context-menu]]
|
||||
[app.main.store :as st]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.context-menu :refer [context-menu]]
|
||||
[app.main.ui.components.file-uploader :refer [file-uploader]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.logging :as log]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.router :as rt]
|
||||
[app.util.webapi :as wa]
|
||||
[cuerdas.core :as str]
|
||||
[app.util.logging :as log]
|
||||
;; [app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[okulary.core :as l]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(log/set-level! :trace)
|
||||
|
@ -47,15 +42,15 @@
|
|||
(mf/defc header
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [section team] :as props}]
|
||||
(let [go-fonts
|
||||
(mf/use-callback
|
||||
(mf/deps team)
|
||||
(st/emitf (rt/nav :dashboard-fonts {:team-id (:id team)})))
|
||||
;; (let [go-fonts
|
||||
;; (mf/use-callback
|
||||
;; (mf/deps team)
|
||||
;; (st/emitf (rt/nav :dashboard-fonts {:team-id (:id team)})))
|
||||
|
||||
go-providers
|
||||
(mf/use-callback
|
||||
(mf/deps team)
|
||||
(st/emitf (rt/nav :dashboard-font-providers {:team-id (:id team)})))]
|
||||
;; go-providers
|
||||
;; (mf/use-callback
|
||||
;; (mf/deps team)
|
||||
;; (st/emitf (rt/nav :dashboard-font-providers {:team-id (:id team)})))]
|
||||
|
||||
(use-set-page-title team section)
|
||||
|
||||
|
@ -69,7 +64,7 @@
|
|||
[:li {:class (when (= section :providers) "active")}
|
||||
[:a {:on-click go-providers} (tr "labels.font-providers")]]]]
|
||||
|
||||
[:div]]))
|
||||
[:div]])
|
||||
|
||||
(mf/defc font-variant-display-name
|
||||
[{:keys [variant]}]
|
||||
|
@ -88,9 +83,6 @@
|
|||
on-click
|
||||
(mf/use-callback #(dom/click (mf/ref-val input-ref)))
|
||||
|
||||
font-key-fn
|
||||
(mf/use-callback (juxt :font-family :font-weight :font-style))
|
||||
|
||||
on-selected
|
||||
(mf/use-callback
|
||||
(mf/deps team installed-fonts)
|
||||
|
@ -190,7 +182,7 @@
|
|||
(reset! state (dom/get-target-val event)))
|
||||
|
||||
on-save
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(let [font-family @state]
|
||||
(when-not (str/blank? font-family)
|
||||
(st/emit! (df/update-font
|
||||
|
@ -204,7 +196,7 @@
|
|||
(on-save event)))
|
||||
|
||||
on-cancel
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(reset! edit? false)
|
||||
(reset! state (:font-family font)))
|
||||
|
||||
|
@ -221,8 +213,7 @@
|
|||
:title (tr "modals.delete-font.title")
|
||||
:message (tr "modals.delete-font.message")
|
||||
:accept-label (tr "labels.delete")
|
||||
:on-accept (fn [props]
|
||||
(delete-font-fn))})))
|
||||
:on-accept (fn [_props] (delete-font-fn))})))
|
||||
|
||||
on-delete-variant
|
||||
(fn [id]
|
||||
|
@ -231,7 +222,7 @@
|
|||
:title (tr "modals.delete-font-variant.title")
|
||||
:message (tr "modals.delete-font-variant.message")
|
||||
:accept-label (tr "labels.delete")
|
||||
:on-accept (fn [props]
|
||||
:on-accept (fn [_props]
|
||||
(delete-variant-fn id))})))]
|
||||
|
||||
[:div.font-item.table-row
|
||||
|
@ -276,7 +267,7 @@
|
|||
|
||||
|
||||
(mf/defc installed-fonts
|
||||
[{:keys [team fonts] :as props}]
|
||||
[{:keys [fonts] :as props}]
|
||||
(let [sterm (mf/use-state "")
|
||||
|
||||
matches?
|
||||
|
|
|
@ -7,11 +7,8 @@
|
|||
(ns app.main.ui.dashboard.grid
|
||||
(:require
|
||||
[app.common.math :as mth]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.messages :as dm]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.fonts :as fonts]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
|
@ -23,12 +20,10 @@
|
|||
[app.util.dom.dnd :as dnd]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.router :as rt]
|
||||
[app.util.time :as dt]
|
||||
[app.util.timers :as ts]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
;; --- Grid Item Thumbnail
|
||||
|
@ -59,7 +54,7 @@
|
|||
(str (tr "ds.updated-at" time))))
|
||||
|
||||
(defn create-counter-element
|
||||
[element file-count]
|
||||
[_element file-count]
|
||||
(let [counter-el (dom/create-element "div")]
|
||||
(dom/set-property! counter-el "class" "drag-counter")
|
||||
(dom/set-text! counter-el (str file-count))
|
||||
|
@ -215,7 +210,7 @@
|
|||
[:div.text (tr "dashboard.loading-files")]])
|
||||
|
||||
(mf/defc grid
|
||||
[{:keys [id opts files] :as props}]
|
||||
[{:keys [files] :as props}]
|
||||
[:section.dashboard-grid
|
||||
(cond
|
||||
(nil? files)
|
||||
|
@ -233,7 +228,7 @@
|
|||
[:& empty-placeholder])])
|
||||
|
||||
(mf/defc line-grid-row
|
||||
[{:keys [files team-id selected-files on-load-more dragging?] :as props}]
|
||||
[{:keys [files selected-files on-load-more dragging?] :as props}]
|
||||
(let [rowref (mf/use-ref)
|
||||
|
||||
width (mf/use-state nil)
|
||||
|
@ -288,7 +283,7 @@
|
|||
(tr "dashboard.show-all-files")]])]))
|
||||
|
||||
(mf/defc line-grid
|
||||
[{:keys [project-id team-id opts files on-load-more] :as props}]
|
||||
[{:keys [project-id team-id files on-load-more] :as props}]
|
||||
(let [dragging? (mf/use-state false)
|
||||
|
||||
selected-files (mf/deref refs/dashboard-selected-files)
|
||||
|
@ -326,7 +321,7 @@
|
|||
on-drop
|
||||
(mf/use-callback
|
||||
(mf/deps files selected-files)
|
||||
(fn [e]
|
||||
(fn [_]
|
||||
(reset! dragging? false)
|
||||
(when (not= selected-project project-id)
|
||||
(let [data {:ids (into #{} (keys selected-files))
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
(ns app.main.ui.dashboard.import
|
||||
(:require
|
||||
[app.main.ui.components.file-uploader :refer [file-uploader]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.worker :as uw]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.logging :as log]
|
||||
|
|
|
@ -7,14 +7,11 @@
|
|||
(ns app.main.ui.dashboard.libraries
|
||||
(:require
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.dashboard.grid :refer [grid]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.refs :as refs]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc libraries-page
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
[app.main.data.messages :as dm]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.context-menu :refer [context-menu]]
|
||||
[app.main.ui.context :as ctx]
|
||||
|
@ -19,7 +18,6 @@
|
|||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc project-menu
|
||||
|
@ -62,7 +60,7 @@
|
|||
(dd/move-project (with-meta data mdata)))))
|
||||
|
||||
delete-fn
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(st/emit! (dm/success (tr "dashboard.success-delete-project"))
|
||||
(dd/delete-project project)
|
||||
(dd/go-to-projects (:team-id project))))
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
(ns app.main.ui.dashboard.projects
|
||||
(:require
|
||||
[app.common.exceptions :as ex]
|
||||
[app.main.constants :as c]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
|
@ -16,8 +14,7 @@
|
|||
[app.main.ui.dashboard.project-menu :refer [project-menu]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [t tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[app.util.time :as dt]
|
||||
[okulary.core :as l]
|
||||
|
@ -38,7 +35,6 @@
|
|||
[{:keys [project first? files] :as props}]
|
||||
(let [locale (mf/deref i18n/locale)
|
||||
|
||||
project-id (:id project)
|
||||
team-id (:team-id project)
|
||||
file-count (or (:count project) 0)
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc search-page
|
||||
|
|
|
@ -9,13 +9,11 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cfg]
|
||||
[app.main.data.comments :as dcm]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.messages :as dm]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||
[app.main.ui.components.forms :as fm]
|
||||
|
@ -24,23 +22,17 @@
|
|||
[app.main.ui.dashboard.project-menu :refer [project-menu]]
|
||||
[app.main.ui.dashboard.team-form]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.avatars :as avatars]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.dom.dnd :as dnd]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.object :as obj]
|
||||
[app.util.router :as rt]
|
||||
[app.util.time :as dt]
|
||||
[beicon.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[goog.functions :as f]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc sidebar-project
|
||||
[{:keys [item team-id selected?] :as props}]
|
||||
[{:keys [item selected?] :as props}]
|
||||
(let [dstate (mf/deref refs/dashboard-local)
|
||||
selected-files (:selected-files dstate)
|
||||
selected-project (:selected-project dstate)
|
||||
|
@ -111,7 +103,7 @@
|
|||
on-drop
|
||||
(mf/use-callback
|
||||
(mf/deps item selected-files)
|
||||
(fn [e]
|
||||
(fn [_]
|
||||
(swap! local assoc :dragging? false)
|
||||
(when (not= selected-project (:id item))
|
||||
(let [data {:ids selected-files
|
||||
|
@ -157,7 +149,7 @@
|
|||
|
||||
on-search-blur
|
||||
(mf/use-callback
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(reset! focused? false)))
|
||||
|
||||
on-search-change
|
||||
|
@ -170,7 +162,7 @@
|
|||
on-clear-click
|
||||
(mf/use-callback
|
||||
(mf/deps team-id)
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(let [search-input (dom/get-element "search-input")]
|
||||
(dom/clean-value! search-input)
|
||||
(dom/focus! search-input)
|
||||
|
@ -189,7 +181,7 @@
|
|||
:on-change on-search-change
|
||||
:ref #(when % (set! (.-value %) search-term))}]
|
||||
|
||||
(if (or @focused? (not (empty? search-term)))
|
||||
(if (or @focused? (seq search-term))
|
||||
[:div.clear-search
|
||||
{:on-click on-clear-click}
|
||||
i/close]
|
||||
|
@ -199,9 +191,8 @@
|
|||
i/search])]))
|
||||
|
||||
(mf/defc teams-selector-dropdown
|
||||
[{:keys [team profile] :as props}]
|
||||
(let [show-dropdown? (mf/use-state false)
|
||||
teams (mf/deref refs/teams)
|
||||
[{:keys [profile] :as props}]
|
||||
(let [teams (mf/deref refs/teams)
|
||||
|
||||
on-create-clicked
|
||||
(mf/use-callback
|
||||
|
@ -246,7 +237,7 @@
|
|||
|
||||
on-cancel (st/emitf (modal/hide))
|
||||
on-accept
|
||||
(fn [event]
|
||||
(fn [_]
|
||||
(let [member-id (get-in @form [:clean-data :member-id])]
|
||||
(accept member-id)))]
|
||||
|
||||
|
@ -291,9 +282,6 @@
|
|||
members-map (mf/deref refs/dashboard-team-members)
|
||||
members (vals members-map)
|
||||
|
||||
on-create-clicked
|
||||
(st/emitf (modal/show :team-form {}))
|
||||
|
||||
on-rename-clicked
|
||||
(st/emitf (modal/show :team-form {:team team}))
|
||||
|
||||
|
@ -358,9 +346,7 @@
|
|||
|
||||
(mf/defc sidebar-team-switch
|
||||
[{:keys [team profile] :as props}]
|
||||
(let [show-dropdown? (mf/use-state false)
|
||||
|
||||
show-team-opts-ddwn? (mf/use-state false)
|
||||
(let [show-team-opts-ddwn? (mf/use-state false)
|
||||
show-teams-ddwn? (mf/use-state false)]
|
||||
|
||||
[:div.sidebar-team-switch
|
||||
|
|
|
@ -7,10 +7,8 @@
|
|||
(ns app.main.ui.dashboard.team
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cfg]
|
||||
[app.main.constants :as c]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.messages :as dm]
|
||||
[app.main.data.modal :as modal]
|
||||
|
@ -23,15 +21,12 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[app.util.time :as dt]
|
||||
[cljs.spec.alpha :as s]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc header
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [section team] :as props}]
|
||||
[{:keys [section] :as props}]
|
||||
(let [go-members (st/emitf (dd/go-to-team-members))
|
||||
go-settings (st/emitf (dd/go-to-team-settings))
|
||||
invite-member (st/emitf (modal/show {:type ::invite-member}))
|
||||
|
@ -43,7 +38,7 @@
|
|||
[:h1 (cond
|
||||
members-section? (tr "labels.members")
|
||||
settings-section? (tr "labels.settings")
|
||||
nil)]]
|
||||
:else nil)]]
|
||||
[:nav
|
||||
[:ul
|
||||
[:li {:class (when members-section? "active")}
|
||||
|
@ -96,7 +91,7 @@
|
|||
(dm/error (tr "errors.member-is-muted"))
|
||||
|
||||
(and (= :validation type)
|
||||
(= :email-has-permanent-bounces))
|
||||
(= :email-has-permanent-bounces code))
|
||||
(dm/error (tr "errors.email-has-permanent-bounces" email))
|
||||
|
||||
:else
|
||||
|
@ -136,7 +131,7 @@
|
|||
set-owner-fn (partial set-role :owner)
|
||||
set-admin (partial set-role :admin)
|
||||
set-editor (partial set-role :editor)
|
||||
set-viewer (partial set-role :viewer)
|
||||
;; set-viewer (partial set-role :viewer)
|
||||
|
||||
set-owner
|
||||
(st/emitf (modal/show
|
||||
|
@ -242,7 +237,7 @@
|
|||
:members-map members-map}]]]))
|
||||
|
||||
(mf/defc team-settings-page
|
||||
[{:keys [team profile] :as props}]
|
||||
[{:keys [team] :as props}]
|
||||
(let [finput (mf/use-ref)
|
||||
|
||||
members-map (mf/deref refs/dashboard-team-members)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
(ns app.main.ui.dashboard.team-form
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.spec :as us]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.messages :as dm]
|
||||
|
@ -14,13 +13,10 @@
|
|||
[app.main.store :as st]
|
||||
[app.main.ui.components.forms :as fm]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.object :as obj]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(s/def ::name ::us/not-empty-string)
|
||||
|
@ -28,20 +24,20 @@
|
|||
(s/keys :req-un [::name]))
|
||||
|
||||
(defn- on-create-success
|
||||
[form response]
|
||||
[_form response]
|
||||
(let [msg "Team created successfuly"]
|
||||
(st/emit! (dm/success msg)
|
||||
(modal/hide)
|
||||
(rt/nav :dashboard-projects {:team-id (:id response)}))))
|
||||
|
||||
(defn- on-update-success
|
||||
[form response]
|
||||
[_form _response]
|
||||
(let [msg "Team created successfuly"]
|
||||
(st/emit! (dm/success msg)
|
||||
(modal/hide))))
|
||||
|
||||
(defn- on-error
|
||||
[form response]
|
||||
[form _response]
|
||||
(let [id (get-in @form [:clean-data :id])]
|
||||
(if id
|
||||
(rx/of (dm/error "Error on updating team."))
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
(ns app.main.ui.handoff
|
||||
(:require
|
||||
[app.common.exceptions :as ex]
|
||||
[app.main.data.viewer :as dv]
|
||||
[app.main.data.viewer.shortcuts :as sc]
|
||||
[app.main.refs :as refs]
|
||||
|
@ -15,15 +14,12 @@
|
|||
[app.main.ui.handoff.render :refer [render-frame-svg]]
|
||||
[app.main.ui.handoff.right-sidebar :refer [right-sidebar]]
|
||||
[app.main.ui.hooks :as hooks]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.ui.viewer.header :refer [header]]
|
||||
[app.main.ui.viewer.thumbnails :refer [thumbnails-panel]]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [t tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[beicon.core :as rx]
|
||||
[goog.events :as events]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf])
|
||||
(:import goog.events.EventType))
|
||||
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
|
||||
(ns app.main.ui.handoff.attributes
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[app.util.i18n :as i18n]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.main.ui.handoff.exports :refer [exports]]
|
||||
[app.main.ui.handoff.attributes.layout :refer [layout-panel]]
|
||||
[app.main.ui.handoff.attributes.fill :refer [fill-panel]]
|
||||
[app.main.ui.handoff.attributes.stroke :refer [stroke-panel]]
|
||||
[app.main.ui.handoff.attributes.shadow :refer [shadow-panel]]
|
||||
[app.main.ui.handoff.attributes.blur :refer [blur-panel]]
|
||||
[app.main.ui.handoff.attributes.fill :refer [fill-panel]]
|
||||
[app.main.ui.handoff.attributes.image :refer [image-panel]]
|
||||
[app.main.ui.handoff.attributes.layout :refer [layout-panel]]
|
||||
[app.main.ui.handoff.attributes.shadow :refer [shadow-panel]]
|
||||
[app.main.ui.handoff.attributes.stroke :refer [stroke-panel]]
|
||||
[app.main.ui.handoff.attributes.svg :refer [svg-panel]]
|
||||
[app.main.ui.handoff.attributes.text :refer [text-panel]]
|
||||
[app.main.ui.handoff.attributes.svg :refer [svg-panel]]))
|
||||
[app.main.ui.handoff.exports :refer [exports]]
|
||||
[app.util.i18n :as i18n]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(def type->options
|
||||
{:multiple [:fill :stroke :image :text :shadow :blur]
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
|
||||
(ns app.main.ui.handoff.attributes.blur
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[cuerdas.core :as str]
|
||||
[app.util.i18n :refer [t]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.ui.components.copy-button :refer [copy-button]]
|
||||
[app.util.code-gen :as cg]
|
||||
[app.main.ui.components.copy-button :refer [copy-button]]))
|
||||
[app.util.i18n :refer [t]]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(defn has-blur? [shape]
|
||||
(:blur shape))
|
||||
|
|
|
@ -6,19 +6,16 @@
|
|||
|
||||
(ns app.main.ui.handoff.attributes.common
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[cuerdas.core :as str]
|
||||
[okulary.core :as l]
|
||||
[app.common.math :as mth]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.color-bullet :refer [color-bullet color-name]]
|
||||
[app.main.ui.components.copy-button :refer [copy-button]]
|
||||
[app.util.color :as uc]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :refer [t] :as i18n]
|
||||
[app.util.color :as uc]
|
||||
[app.util.code-gen :as cg]
|
||||
[app.util.webapi :as wapi]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.copy-button :refer [copy-button]]
|
||||
[app.main.ui.components.color-bullet :refer [color-bullet color-name]]))
|
||||
[cuerdas.core :as str]
|
||||
[okulary.core :as l]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
|
||||
(def file-colors-ref
|
||||
|
|
|
@ -6,13 +6,12 @@
|
|||
|
||||
(ns app.main.ui.handoff.attributes.fill
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[app.util.i18n :refer [t]]
|
||||
[app.util.color :as uc]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.code-gen :as cg]
|
||||
[app.main.ui.components.copy-button :refer [copy-button]]
|
||||
[app.main.ui.handoff.attributes.common :refer [color-row]]))
|
||||
[app.main.ui.handoff.attributes.common :refer [color-row]]
|
||||
[app.util.code-gen :as cg]
|
||||
[app.util.color :as uc]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(def fill-attributes [:fill-color :fill-color-gradient])
|
||||
|
||||
|
@ -36,7 +35,7 @@
|
|||
{:to-prop "background"
|
||||
:format #(uc/color->background (shape->color shape))}))
|
||||
|
||||
(mf/defc fill-block [{:keys [shape locale]}]
|
||||
(mf/defc fill-block [{:keys [shape]}]
|
||||
(let [color-format (mf/use-state :hex)
|
||||
color (shape->color shape)]
|
||||
|
||||
|
@ -46,16 +45,15 @@
|
|||
:copy-data (copy-data shape)}]))
|
||||
|
||||
(mf/defc fill-panel
|
||||
[{:keys [shapes locale]}]
|
||||
[{:keys [shapes]}]
|
||||
(let [shapes (->> shapes (filter has-color?))]
|
||||
(when (seq shapes)
|
||||
[:div.attributes-block
|
||||
[:div.attributes-block-title
|
||||
[:div.attributes-block-title-text (t locale "handoff.attributes.fill")]
|
||||
[:div.attributes-block-title-text (tr "handoff.attributes.fill")]
|
||||
(when (= (count shapes) 1)
|
||||
[:& copy-button {:data (copy-data (first shapes))}])]
|
||||
|
||||
(for [shape shapes]
|
||||
[:& fill-block {:key (str "fill-block-" (:id shape))
|
||||
:shape shape
|
||||
:locale locale}])])))
|
||||
:shape shape}])])))
|
||||
|
|
|
@ -6,19 +6,17 @@
|
|||
|
||||
(ns app.main.ui.handoff.attributes.image
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[cuerdas.core :as str]
|
||||
[app.config :as cfg]
|
||||
[app.util.i18n :refer [t]]
|
||||
[app.util.dom :as dom]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.ui.components.copy-button :refer [copy-button]]
|
||||
[app.util.code-gen :as cg]
|
||||
[app.main.ui.components.copy-button :refer [copy-button]]))
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(defn has-image? [shape]
|
||||
(and (= (:type shape) :image)))
|
||||
(= (:type shape) :image))
|
||||
|
||||
(mf/defc image-panel [{:keys [shapes locale]}]
|
||||
(mf/defc image-panel [{:keys [shapes]}]
|
||||
(let [shapes (->> shapes (filter has-image?))]
|
||||
(for [shape shapes]
|
||||
[:div.attributes-block {:key (str "image-" (:id shape))}
|
||||
|
@ -27,12 +25,12 @@
|
|||
[:img {:src (cfg/resolve-file-media (-> shape :metadata))}]]]
|
||||
|
||||
[:div.attributes-unit-row
|
||||
[:div.attributes-label (t locale "handoff.attributes.image.width")]
|
||||
[:div.attributes-label (tr "handoff.attributes.image.width")]
|
||||
[:div.attributes-value (-> shape :metadata :width) "px"]
|
||||
[:& copy-button {:data (cg/generate-css-props shape :width)}]]
|
||||
|
||||
[:div.attributes-unit-row
|
||||
[:div.attributes-label (t locale "handoff.attributes.image.height")]
|
||||
[:div.attributes-label (tr "handoff.attributes.image.height")]
|
||||
[:div.attributes-value (-> shape :metadata :height) "px"]
|
||||
[:& copy-button {:data (cg/generate-css-props shape :height)}]]
|
||||
|
||||
|
@ -44,4 +42,4 @@
|
|||
(str name "." extension)
|
||||
name)
|
||||
:href (cfg/resolve-file-media (-> shape :metadata))}
|
||||
(t locale "handoff.attributes.image.download")])])))
|
||||
(tr "handoff.attributes.image.download")])])))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue