mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -05:00
🐛 Fix team form autofocus prop.
This commit is contained in:
parent
62ed2221e9
commit
676a2db1f5
1 changed files with 8 additions and 15 deletions
|
@ -5,27 +5,22 @@
|
||||||
;; This Source Code Form is "Incompatible With Secondary Licenses", as
|
;; This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
;; defined by the Mozilla Public License, v. 2.0.
|
;; defined by the Mozilla Public License, v. 2.0.
|
||||||
;;
|
;;
|
||||||
;; Copyright (c) 2020 UXBOX Labs SL
|
;; Copyright (c) UXBOX Labs SL
|
||||||
|
|
||||||
(ns app.main.ui.dashboard.team-form
|
(ns app.main.ui.dashboard.team-form
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.config :as cfg]
|
|
||||||
[app.main.data.auth :as da]
|
|
||||||
[app.main.data.dashboard :as dd]
|
[app.main.data.dashboard :as dd]
|
||||||
[app.main.data.messages :as dm]
|
[app.main.data.messages :as dm]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
[app.main.repo :as rp]
|
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.forms :as fm]
|
[app.main.ui.components.forms :as fm]
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
[app.util.dom :as dom]
|
[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.object :as obj]
|
||||||
[app.util.router :as rt]
|
[app.util.router :as rt]
|
||||||
[app.util.time :as dt]
|
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
[cljs.spec.alpha :as s]
|
[cljs.spec.alpha :as s]
|
||||||
[cuerdas.core :as str]
|
[cuerdas.core :as str]
|
||||||
|
@ -52,10 +47,8 @@
|
||||||
[form response]
|
[form response]
|
||||||
(let [id (get-in @form [:clean-data :id])]
|
(let [id (get-in @form [:clean-data :id])]
|
||||||
(if id
|
(if id
|
||||||
(st/emit! (dm/error "Error on updating team."))
|
(rx/of (dm/error "Error on updating team."))
|
||||||
(st/emit! (dm/error "Error on creating team.")))))
|
(rx/of (dm/error "Error on creating team.")))))
|
||||||
|
|
||||||
;; TODO: check global error handler
|
|
||||||
|
|
||||||
(defn- on-create-submit
|
(defn- on-create-submit
|
||||||
[form]
|
[form]
|
||||||
|
@ -76,8 +69,7 @@
|
||||||
{::mf/register modal/components
|
{::mf/register modal/components
|
||||||
::mf/register-as :team-form}
|
::mf/register-as :team-form}
|
||||||
[{:keys [team] :as props}]
|
[{:keys [team] :as props}]
|
||||||
(let [locale (mf/deref i18n/locale)
|
(let [form (fm/use-form :spec ::team-form
|
||||||
form (fm/use-form :spec ::team-form
|
|
||||||
:initial (or team {}))
|
:initial (or team {}))
|
||||||
|
|
||||||
on-submit
|
on-submit
|
||||||
|
@ -89,19 +81,20 @@
|
||||||
|
|
||||||
[:div.modal-overlay
|
[:div.modal-overlay
|
||||||
[:div.modal-container.team-form-modal
|
[:div.modal-container.team-form-modal
|
||||||
[:& fm/form {:form form
|
[:& fm/form {:form form :on-submit on-submit}
|
||||||
:on-submit on-submit}
|
|
||||||
|
|
||||||
[:div.modal-header
|
[:div.modal-header
|
||||||
[:div.modal-header-title
|
[:div.modal-header-title
|
||||||
(if team
|
(if team
|
||||||
[:h2 (tr "labels.rename-team")]
|
[:h2 (tr "labels.rename-team")]
|
||||||
[:h2 (tr "labels.create-team")])]
|
[:h2 (tr "labels.create-team")])]
|
||||||
|
|
||||||
[:div.modal-close-button
|
[:div.modal-close-button
|
||||||
{:on-click (st/emitf (modal/hide))} i/close]]
|
{:on-click (st/emitf (modal/hide))} i/close]]
|
||||||
|
|
||||||
[:div.modal-content.generic-form
|
[:div.modal-content.generic-form
|
||||||
[:& fm/input {:type "text"
|
[:& fm/input {:type "text"
|
||||||
|
:auto-focus true
|
||||||
:form form
|
:form form
|
||||||
:name :name
|
:name :name
|
||||||
:label "Enter new team name:"}]]
|
:label "Enter new team name:"}]]
|
||||||
|
|
Loading…
Reference in a new issue