From 676a2db1f5aa652f42fd3eb46cf45c212dbb10bc Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 30 Mar 2021 08:33:25 +0200 Subject: [PATCH] :bug: Fix team form autofocus prop. --- .../src/app/main/ui/dashboard/team_form.cljs | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/frontend/src/app/main/ui/dashboard/team_form.cljs b/frontend/src/app/main/ui/dashboard/team_form.cljs index d743f76dc..f27c93642 100644 --- a/frontend/src/app/main/ui/dashboard/team_form.cljs +++ b/frontend/src/app/main/ui/dashboard/team_form.cljs @@ -5,27 +5,22 @@ ;; This Source Code Form is "Incompatible With Secondary Licenses", as ;; 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 (:require [app.common.data :as d] [app.common.spec :as us] - [app.config :as cfg] - [app.main.data.auth :as da] [app.main.data.dashboard :as dd] [app.main.data.messages :as dm] [app.main.data.modal :as modal] - [app.main.repo :as rp] [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.keyboard :as kbd] + [app.util.i18n :as i18n :refer [tr]] [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] @@ -52,10 +47,8 @@ [form response] (let [id (get-in @form [:clean-data :id])] (if id - (st/emit! (dm/error "Error on updating team.")) - (st/emit! (dm/error "Error on creating team."))))) - -;; TODO: check global error handler + (rx/of (dm/error "Error on updating team.")) + (rx/of (dm/error "Error on creating team."))))) (defn- on-create-submit [form] @@ -76,8 +69,7 @@ {::mf/register modal/components ::mf/register-as :team-form} [{:keys [team] :as props}] - (let [locale (mf/deref i18n/locale) - form (fm/use-form :spec ::team-form + (let [form (fm/use-form :spec ::team-form :initial (or team {})) on-submit @@ -89,19 +81,20 @@ [:div.modal-overlay [:div.modal-container.team-form-modal - [:& fm/form {:form form - :on-submit on-submit} + [:& fm/form {:form form :on-submit on-submit} [:div.modal-header [:div.modal-header-title (if team [:h2 (tr "labels.rename-team")] [:h2 (tr "labels.create-team")])] + [:div.modal-close-button {:on-click (st/emitf (modal/hide))} i/close]] [:div.modal-content.generic-form [:& fm/input {:type "text" + :auto-focus true :form form :name :name :label "Enter new team name:"}]]