mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 11:34:45 +00:00
feature #3243 - contact profile screen cleanup
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
cffa4c5759
commit
d1fbde8a40
@ -1,7 +1,6 @@
|
|||||||
(ns status-im.ui.screens.profile.styles
|
(ns status-im.ui.screens.profile.styles
|
||||||
(:require [status-im.ui.components.styles :as styles]
|
(:require [status-im.ui.components.styles :as styles]
|
||||||
[status-im.ui.components.colors :as colors]
|
[status-im.ui.components.colors :as colors])
|
||||||
[status-im.utils.platform :as platform])
|
|
||||||
(:require-macros [status-im.utils.styles :refer [defstyle]]))
|
(:require-macros [status-im.utils.styles :refer [defstyle]]))
|
||||||
|
|
||||||
(def profile
|
(def profile
|
||||||
@ -19,26 +18,6 @@
|
|||||||
(def profile-info-item-button
|
(def profile-info-item-button
|
||||||
{:padding 16})
|
{: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
|
(def profile-badge
|
||||||
{:flex-direction :column
|
{:flex-direction :column
|
||||||
:justify-content :center
|
:justify-content :center
|
||||||
@ -110,6 +89,12 @@
|
|||||||
:font-size 14
|
:font-size 14
|
||||||
:ios {:letter-spacing -0.2}})
|
: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
|
(defstyle profile-setting-text
|
||||||
{:ios {:font-size 17
|
{:ios {:font-size 17
|
||||||
:letter-spacing -0.2}
|
:letter-spacing -0.2}
|
||||||
@ -134,14 +119,6 @@
|
|||||||
:background-color colors/white
|
:background-color colors/white
|
||||||
:height 52})
|
: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
|
(defstyle settings-item-text
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:font-size 15
|
:font-size 15
|
||||||
@ -157,11 +134,6 @@
|
|||||||
(merge settings-item-text
|
(merge settings-item-text
|
||||||
{:color colors/red}))
|
{:color colors/red}))
|
||||||
|
|
||||||
(def edit-line-color
|
|
||||||
(if platform/ios?
|
|
||||||
(str styles/color-gray5 "80")
|
|
||||||
styles/color-gray5))
|
|
||||||
|
|
||||||
(defstyle profile-name-input
|
(defstyle profile-name-input
|
||||||
{:color styles/text1-color
|
{:color styles/text1-color
|
||||||
:ios {:font-size 17
|
:ios {:font-size 17
|
||||||
@ -174,45 +146,6 @@
|
|||||||
:height 30
|
:height 30
|
||||||
:padding-bottom 0}})
|
: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 network-info {:background-color :white})
|
||||||
|
|
||||||
(def share-contact-code
|
(def share-contact-code
|
||||||
|
@ -62,18 +62,14 @@
|
|||||||
(time/time-ago last-online-date)
|
(time/time-ago last-online-date)
|
||||||
(i18n/label :t/active-unknown))))
|
(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
|
[react/view styles/profile-badge
|
||||||
[chat-icon.screen/my-profile-icon {:account contact
|
[chat-icon.screen/my-profile-icon {:account contact
|
||||||
:edit? false}]
|
:edit? false}]
|
||||||
[react/view styles/profile-badge-name-container
|
[react/view styles/profile-badge-name-container
|
||||||
[react/text {:style styles/profile-name-text
|
[react/text {:style styles/profile-name-text
|
||||||
:number-of-lines 1}
|
:number-of-lines 1}
|
||||||
name]
|
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)]])]])
|
|
||||||
|
|
||||||
|
|
||||||
(defn profile-name-input [name]
|
(defn profile-name-input [name]
|
||||||
@ -98,7 +94,7 @@
|
|||||||
(i18n/label :t/camera-access-error))]))}])
|
(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/view styles/profile-badge-edit
|
||||||
[react/touchable-highlight {:on-press #(list-selection/show {:title (i18n/label :t/image-source-title)
|
[react/touchable-highlight {:on-press #(list-selection/show {:title (i18n/label :t/image-source-title)
|
||||||
:options profile-icon-options})}
|
:options profile-icon-options})}
|
||||||
@ -106,11 +102,7 @@
|
|||||||
[chat-icon.screen/my-profile-icon {:account account
|
[chat-icon.screen/my-profile-icon {:account account
|
||||||
:edit? true}]]]
|
:edit? true}]]]
|
||||||
[react/view styles/profile-badge-name-container
|
[react/view styles/profile-badge-name-container
|
||||||
[profile-name-input name]
|
[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)]])]])
|
|
||||||
|
|
||||||
(defn profile-actions [{:keys [pending? whisper-identity dapp?]} chat-id]
|
(defn profile-actions [{:keys [pending? whisper-identity dapp?]} chat-id]
|
||||||
[react/view action-button.styles/actions-list
|
[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]}]
|
(defn profile-info-item [{:keys [label value options text-mode empty-value? accessibility-label]}]
|
||||||
[react/view styles/profile-setting-item
|
[react/view styles/profile-setting-item
|
||||||
[react/view (styles/profile-info-text-container options)
|
[react/view (styles/profile-info-text-container options)
|
||||||
[react/text {:style styles/profile-settings-title}
|
[react/text {:style styles/profile-info-title}
|
||||||
label]
|
label]
|
||||||
[react/view styles/profile-setting-spacing]
|
[react/view styles/profile-setting-spacing]
|
||||||
[react/text {:style (if empty-value?
|
[react/text {:style (if empty-value?
|
||||||
@ -173,28 +165,28 @@
|
|||||||
:source source
|
:source source
|
||||||
:value value}]))
|
:value value}]))
|
||||||
|
|
||||||
(defn profile-options [contact k text]
|
(defn profile-options [text]
|
||||||
(into []
|
(into []
|
||||||
(concat [{:action (show-qr contact k text)
|
(when text
|
||||||
:label (i18n/label :t/show-qr)}]
|
(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
|
[profile-info-item
|
||||||
{:label (i18n/label :t/address)
|
{:label (i18n/label :t/address)
|
||||||
:action address
|
:action address
|
||||||
:options (profile-options contact :address address)
|
:options (profile-options address)
|
||||||
:text-mode :middle
|
: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
|
[profile-info-item
|
||||||
{:label (i18n/label :t/public-key)
|
{:label (i18n/label :t/public-key)
|
||||||
:action public-key
|
:action whisper-identity
|
||||||
:options (profile-options contact :public-key public-key)
|
:options (profile-options whisper-identity)
|
||||||
:text-mode :middle
|
:text-mode :middle
|
||||||
:accessibility-label :profile-public-key}])
|
:accessibility-label :profile-public-key
|
||||||
|
:value whisper-identity}])
|
||||||
|
|
||||||
(defn settings-item-separator []
|
(defn settings-item-separator []
|
||||||
[common/separator styles/settings-item-separator])
|
[common/separator styles/settings-item-separator])
|
||||||
@ -228,11 +220,11 @@
|
|||||||
(when active?
|
(when active?
|
||||||
[vector-icons/icon :icons/forward {:color colors/gray}])]])
|
[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
|
[react/view
|
||||||
[profile-info-address-item contact]
|
[profile-info-address-item address]
|
||||||
[settings-item-separator]
|
[settings-item-separator]
|
||||||
[profile-info-public-key-item whisper-identity contact]])
|
[profile-info-public-key-item whisper-identity]])
|
||||||
|
|
||||||
(defn navigate-to-accounts []
|
(defn navigate-to-accounts []
|
||||||
;; TODO(rasom): probably not the best place for this call
|
;; TODO(rasom): probably not the best place for this call
|
||||||
@ -268,19 +260,6 @@
|
|||||||
[settings-item :t/offline-messaging-settings ""
|
[settings-item :t/offline-messaging-settings ""
|
||||||
#(re-frame/dispatch [:navigate-to :offline-messaging-settings]) true])])
|
#(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 []
|
(defn network-info []
|
||||||
[react/view styles/network-info
|
[react/view styles/network-info
|
||||||
[common/network-info]
|
[common/network-info]
|
||||||
@ -316,8 +295,7 @@
|
|||||||
[logout]]]))
|
[logout]]]))
|
||||||
|
|
||||||
(defview profile []
|
(defview profile []
|
||||||
(letsubs [{:keys [status]
|
(letsubs [contact [:contact]
|
||||||
:as contact} [:contact]
|
|
||||||
chat-id [:get :current-chat-id]]
|
chat-id [:get :current-chat-id]]
|
||||||
[react/view styles/profile
|
[react/view styles/profile
|
||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
@ -325,9 +303,7 @@
|
|||||||
[network-info]
|
[network-info]
|
||||||
[react/scroll-view
|
[react/scroll-view
|
||||||
[react/view styles/profile-form
|
[react/view styles/profile-form
|
||||||
[profile-badge contact]
|
[profile-badge contact]]
|
||||||
(when (and (not (nil? status)) (not (string/blank? status)))
|
|
||||||
[profile-status status])]
|
|
||||||
[common/form-spacer]
|
[common/form-spacer]
|
||||||
[profile-actions contact chat-id]
|
[profile-actions contact chat-id]
|
||||||
[common/form-spacer]
|
[common/form-spacer]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user