feature #3243 - contact profile screen cleanup

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Goran Jovic 2018-02-08 08:39:42 +01:00 committed by Andrey Shovkoplyas
parent cffa4c5759
commit d1fbde8a40
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
2 changed files with 29 additions and 120 deletions

View File

@ -1,7 +1,6 @@
(ns status-im.ui.screens.profile.styles
(:require [status-im.ui.components.styles :as styles]
[status-im.ui.components.colors :as colors]
[status-im.utils.platform :as platform])
[status-im.ui.components.colors :as colors])
(:require-macros [status-im.utils.styles :refer [defstyle]]))
(def profile
@ -19,26 +18,6 @@
(def profile-info-item-button
{:padding 16})
(def status-prompt
{:padding-left 16
:padding-right 16
:padding-top 6})
(defstyle status-prompt-text
{:color colors/gray
:ios {:font-size 14
:line-height 25
:letter-spacing -0.2}
:android {:line-height 18
:font-size 12}})
(def profile-status-container
{:background-color colors/gray
:margin-top 16
:border-radius 8
:padding 16
:max-height 114})
(def profile-badge
{:flex-direction :column
:justify-content :center
@ -110,6 +89,12 @@
:font-size 14
:ios {:letter-spacing -0.2}})
(defstyle profile-info-title
{:color colors/gray
:margin-left 16
:font-size 14
:ios {:letter-spacing -0.2}})
(defstyle profile-setting-text
{:ios {:font-size 17
:letter-spacing -0.2}
@ -134,14 +119,6 @@
:background-color colors/white
:height 52})
(defstyle offline-messaging-settings
{:padding-horizontal 16
:flex-direction :row
:align-items :center
:background-color colors/white
:android {:height 72}
:ios {:height 64}})
(defstyle settings-item-text
{:flex 1
:font-size 15
@ -157,11 +134,6 @@
(merge settings-item-text
{:color colors/red}))
(def edit-line-color
(if platform/ios?
(str styles/color-gray5 "80")
styles/color-gray5))
(defstyle profile-name-input
{:color styles/text1-color
:ios {:font-size 17
@ -174,45 +146,6 @@
:height 30
:padding-bottom 0}})
(defstyle profile-status-input
{:line-height 24 ;;TODO doesnt' work for multiline because a bug in the RN
:color colors/black
:padding-left 0
:ios {:font-size 17
:padding-bottom 0
:padding-top 0
:height 60
:letter-spacing -0.2}
:android {:font-size 16
:padding-top 5
:height 74
:text-align-vertical :top
:padding-bottom 0}})
(defstyle profile-status-text
{:color colors/black
:line-height 24
:ios {:font-size 17
:letter-spacing -0.2}
:android {:font-size 16}})
(defstyle edit-profile-status
{:background-color styles/color-light-gray
:border-radius 8
:height 90
:padding-horizontal 16
:padding-bottom 16
:margin-left 16
:margin-right 16
:ios {:padding-top 10
:margin-top 10}
:android {:padding-top 13
:margin-top 13}})
(def add-a-status
(merge profile-status-text
{:color colors/gray}))
(def network-info {:background-color :white})
(def share-contact-code

View File

@ -62,18 +62,14 @@
(time/time-ago last-online-date)
(i18n/label :t/active-unknown))))
(defn profile-badge [{:keys [name last-online] :as contact}]
(defn profile-badge [{:keys [name] :as contact}]
[react/view styles/profile-badge
[chat-icon.screen/my-profile-icon {:account contact
:edit? false}]
[react/view styles/profile-badge-name-container
[react/text {:style styles/profile-name-text
:number-of-lines 1}
name]
(when-not (nil? last-online)
[react/view styles/profile-activity-status-container
[react/text {:style styles/profile-activity-status-text}
(online-text last-online)]])]])
name]]])
(defn profile-name-input [name]
@ -98,7 +94,7 @@
(i18n/label :t/camera-access-error))]))}])
(defn profile-badge-edit [{:keys [name last-online] :as account}]
(defn profile-badge-edit [{:keys [name] :as account}]
[react/view styles/profile-badge-edit
[react/touchable-highlight {:on-press #(list-selection/show {:title (i18n/label :t/image-source-title)
:options profile-icon-options})}
@ -106,11 +102,7 @@
[chat-icon.screen/my-profile-icon {:account account
:edit? true}]]]
[react/view styles/profile-badge-name-container
[profile-name-input name]
(when-not (nil? last-online)
[react/view styles/profile-activity-status-container
[react/text {:style styles/profile-activity-status-text}
(online-text last-online)]])]])
[profile-name-input name]]])
(defn profile-actions [{:keys [pending? whisper-identity dapp?]} chat-id]
[react/view action-button.styles/actions-list
@ -136,7 +128,7 @@
(defn profile-info-item [{:keys [label value options text-mode empty-value? accessibility-label]}]
[react/view styles/profile-setting-item
[react/view (styles/profile-info-text-container options)
[react/text {:style styles/profile-settings-title}
[react/text {:style styles/profile-info-title}
label]
[react/view styles/profile-setting-spacing]
[react/text {:style (if empty-value?
@ -173,28 +165,28 @@
:source source
:value value}]))
(defn profile-options [contact k text]
(defn profile-options [text]
(into []
(concat [{:action (show-qr contact k text)
:label (i18n/label :t/show-qr)}]
(when text
(list-selection/share-options text)))))
(when text
(list-selection/share-options text))))
(defn profile-info-address-item [{:keys [address] :as contact}]
(defn profile-info-address-item [address]
[profile-info-item
{:label (i18n/label :t/address)
:action address
:options (profile-options contact :address address)
:options (profile-options address)
:text-mode :middle
:accessibility-label :profile-address}])
:accessibility-label :profile-address
:value address}])
(defn profile-info-public-key-item [public-key contact]
(defn profile-info-public-key-item [whisper-identity]
[profile-info-item
{:label (i18n/label :t/public-key)
:action public-key
:options (profile-options contact :public-key public-key)
:action whisper-identity
:options (profile-options whisper-identity)
:text-mode :middle
:accessibility-label :profile-public-key}])
:accessibility-label :profile-public-key
:value whisper-identity}])
(defn settings-item-separator []
[common/separator styles/settings-item-separator])
@ -228,11 +220,11 @@
(when active?
[vector-icons/icon :icons/forward {:color colors/gray}])]])
(defn profile-info [{:keys [whisper-identity] :as contact}]
(defn profile-info [{:keys [whisper-identity address]}]
[react/view
[profile-info-address-item contact]
[profile-info-address-item address]
[settings-item-separator]
[profile-info-public-key-item whisper-identity contact]])
[profile-info-public-key-item whisper-identity]])
(defn navigate-to-accounts []
;; TODO(rasom): probably not the best place for this call
@ -268,19 +260,6 @@
[settings-item :t/offline-messaging-settings ""
#(re-frame/dispatch [:navigate-to :offline-messaging-settings]) true])])
(defn profile-status [status & [edit?]]
[react/view styles/profile-status-container
(if (or (nil? status) (string/blank? status))
[react/touchable-highlight {:on-press #(re-frame/dispatch [:my-profile/edit-profile :edit-status])}
[react/view
[react/text {:style styles/add-a-status}
(i18n/label :t/add-a-status)]]]
[react/scroll-view
[react/touchable-highlight {:on-press (when edit? #(re-frame/dispatch [:my-profile/edit-profile :edit-status]))}
[react/view
[react/text {:style styles/profile-status-text}
(colorize-status-hashtags status)]]]])])
(defn network-info []
[react/view styles/network-info
[common/network-info]
@ -316,8 +295,7 @@
[logout]]]))
(defview profile []
(letsubs [{:keys [status]
:as contact} [:contact]
(letsubs [contact [:contact]
chat-id [:get :current-chat-id]]
[react/view styles/profile
[status-bar/status-bar]
@ -325,9 +303,7 @@
[network-info]
[react/scroll-view
[react/view styles/profile-form
[profile-badge contact]
(when (and (not (nil? status)) (not (string/blank? status)))
[profile-status status])]
[profile-badge contact]]
[common/form-spacer]
[profile-actions contact chat-id]
[common/form-spacer]