[#4931] always show only saved :name and :photo-path in my-profile

This commit is contained in:
Roman Volosovskyi 2018-07-06 17:17:15 +03:00
parent 229c64f002
commit 8964ec26a4
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
5 changed files with 22 additions and 6 deletions

View File

@ -50,9 +50,10 @@
[profile-name-input name on-change-text-event
(when group-chat {:accessibility-label :chat-name-input})]]])
(defn profile-header [contact editing? allow-icon-change? options on-change-text-event]
(defn profile-header
[{:keys [contact edited-contact editing? allow-icon-change? options on-change-text-event]}]
(if editing?
[profile-header-edit contact options on-change-text-event allow-icon-change?]
[profile-header-edit (or edited-contact contact) options on-change-text-event allow-icon-change?]
[profile-header-display contact]))
;; settings items elements

View File

@ -65,7 +65,10 @@
[profile-contact-toolbar]
[react/scroll-view
[react/view profile.components.styles/profile-form
[profile.components/profile-header contact false false nil nil]]
[profile.components/profile-header
{:contact contact
:editing? false
:allow-icon-change? false}]]
[list/action-list (actions contact)
{:container-style styles/action-container
:action-style styles/action

View File

@ -70,7 +70,9 @@
(handlers/register-handler-fx
:my-profile/start-editing-profile
(fn [{:keys [db]} []]
{:db (assoc db :my-profile/editing? true)}))
(let [profile (select-keys (:account/account db) [:name :photo-path])]
{:db (assoc db :my-profile/editing? true
:my-profile/profile profile)})))
(handlers/register-handler-fx
:my-profile/save-profile

View File

@ -101,7 +101,11 @@
[group-chat-profile-toolbar])
[react/scroll-view
[react/view profile.components.styles/profile-form
[profile.components/profile-header shown-chat editing? false nil :set-group-chat-name]
[profile.components/profile-header
{:contact shown-chat
:editing? editing?
:allow-icon-change? false
:on-change-text-event :set-group-chat-name}]
[list/action-list (actions admin? (:chat-id current-chat))
{:container-style styles/action-container
:action-style styles/action

View File

@ -207,7 +207,13 @@
[react/scroll-view {:ref #(reset! scroll %)
:keyboard-should-persist-taps :handled}
[react/view profile.components.styles/profile-form
[profile.components/profile-header shown-account editing? true profile-icon-options :my-profile/update-name]]
[profile.components/profile-header
{:contact current-account
:edited-contact changed-account
:editing? editing?
:allow-icon-change? true
:options profile-icon-options
:on-change-text-event :my-profile/update-name}]]
[react/view action-button.styles/actions-list
[share-contact-code current-account public-key]]
[react/view styles/my-profile-info-container