🚧 Basic user profile style refactor.

This commit is contained in:
Andrey Antukh 2020-03-24 23:25:16 +01:00
parent 0c4c50270c
commit 62d90caf51
13 changed files with 112 additions and 122 deletions

View file

@ -5,8 +5,7 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.dashboard
(:require
@ -94,5 +93,4 @@
:dashboard-project
(mf/element project-page #js {:team-id team-id
:project-id project-id}))]]])
)
:project-id project-id}))]]]))

View file

@ -5,8 +5,7 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2020 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.dashboard.project
(:require

View file

@ -5,8 +5,7 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2015-2020 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2015-2020 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.dashboard.recent-files
(:require

View file

@ -11,21 +11,28 @@
[potok.core :as ptk]
[rumext.alpha :as mf]
[uxbox.builtins.icons :as i]
[uxbox.main.refs :as refs]
[uxbox.main.ui.dashboard.profile :refer [profile-section]]
[uxbox.main.ui.messages :refer [messages-widget]]
[uxbox.main.ui.settings.header :refer [header]]
[uxbox.main.ui.settings.password :refer [password-page]]
[uxbox.main.ui.settings.profile :refer [profile-page]]))
(mf/defc settings
{:wrap [mf/wrap-memo]}
[{:keys [route] :as props}]
(let [section (get-in route [:data :name])]
[:main.dashboard-main
(let [section (get-in route [:data :name])
profile (mf/deref refs/profile)]
[:main.settings-main
[:& messages-widget]
[:& header {:section section}]
(case section
:settings-profile (mf/element profile-page)
:settings-password (mf/element password-page))]))
[:section.settings-layout
[:div.main-logo i/logo-icon]
[:div.left-bar]
[:div.settings-content
[:& header {:section section}]
(case section
:settings-profile (mf/element profile-page)
:settings-password (mf/element password-page))]]]))

View file

@ -2,8 +2,7 @@
;; 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) 2015-2017 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.settings.header
(:require
@ -15,25 +14,18 @@
[uxbox.util.i18n :as i18n :refer [tr t]]
[uxbox.util.router :as rt]))
(mf/defc header-link
[{:keys [section content] :as props}]
(let [on-click #(st/emit! (rt/nav section))]
[:a {:on-click on-click} content]))
(mf/defc header
[{:keys [section] :as props}]
(let [profile? (= section :settings-profile)
password? (= section :settings-password)]
[:header#main-bar.main-bar
[:div.main-logo
[:& header-link {:section :dashboard-projects
:content i/logo}]]
[:ul.main-nav
[:li {:class (when profile? "current")}
[:& header-link {:section :settings-profile
:content (tr "settings.profile")}]]
[:li {:class (when password? "current")}
[:& header-link {:section :settings-password
:content (tr "settings.password")}]]]
#_[:& user]]))
password? (= section :settings-password)
locale (i18n/use-locale)]
[:header.main-bar
[:nav.library-header-navigation
[:a.library-header-navigation-item
{:class (when profile? "current")
:on-click #(st/emit! (rt/nav :settings-profile))}
(t locale "settings.profile")]
[:a.library-header-navigation-item
{:class (when password? "current")
:on-click #(st/emit! (rt/nav :settings-password))}
(t locale "settings.password")]]]))

View file

@ -105,6 +105,5 @@
(mf/defc password-page
[props]
[:section.dashboard-content.user-settings
[:section.user-settings-content
[:& password-form]]])
[:section.user-settings-page
[:& password-form]])

View file

@ -130,8 +130,7 @@
(mf/defc profile-page
[]
[:section.dashboard-content.user-settings
[:section.user-settings-content
[:span.user-settings-label (tr "settings.profile.your-avatar")]
[:& profile-photo-form]
[:& profile-form]]])
[:section.user-settings-page
[:span.user-settings-label (tr "settings.profile.your-avatar")]
[:& profile-photo-form]
[:& profile-form]])