Skip to content

Commit 88740ea

Browse files
author
Vitaliy Vlasov
committed
Add remove-chat button next to chat title
Update chat header design Aligh header heights Add 'Clear history'; some reformatting Add confirmations Formatting Member photo fix; increase font size for 9+ unviewed messages indicator Fix chat view autoloading upon tab switching; Merge with desktop Fix add-to-contacts
1 parent a7f9390 commit 88740ea

File tree

11 files changed

+130
-99
lines changed

11 files changed

+130
-99
lines changed

components/src/status_im/ui/components/react.cljs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
(dissoc :font)
7777
(assoc style-key (merge style font)))))
7878

79-
8079
(defn transform-to-uppercase [{:keys [uppercase? force-uppercase?] :as opts} ts]
8180
(if (or force-uppercase? (and uppercase? platform/android?))
8281
(vec (map string/upper-case ts))
@@ -95,13 +94,13 @@
9594
:or {font :default}} text]
9695
(let [font (get-in platform/platform-specific [:fonts (keyword font)])]
9796
[text-input-class (merge
98-
{:underline-color-android :transparent
99-
:placeholder-text-color styles/text2-color
100-
:placeholder (i18n/label :t/type-a-message)
101-
:value text}
102-
(-> opts
103-
(dissoc :font)
104-
(assoc :style (merge style font))))]))
97+
{:underline-color-android :transparent
98+
:placeholder-text-color styles/text2-color
99+
:placeholder (i18n/label :t/type-a-message)
100+
:value text}
101+
(-> opts
102+
(dissoc :font)
103+
(assoc :style (merge style font))))]))
105104

106105
(defn i18n-text
107106
[{:keys [style key]}]
@@ -122,9 +121,9 @@
122121
content])
123122

124123
(defn touchable-without-feedback [props content]
125-
[touchable-without-feedback-class
126-
props
127-
content])
124+
[touchable-without-feedback-class
125+
props
126+
content])
128127

129128
(defn get-dimensions [name]
130129
(js->clj (.get dimensions name) :keywordize-keys true))
@@ -245,20 +244,20 @@
245244
(:qr-viewer
246245
:recipient-qr-code) "#2f3031"
247246
(:accounts :login
248-
:wallet-transactions-filter) styles/color-white
247+
:wallet-transactions-filter) styles/color-white
249248
:transparent)})
250249
children (cond-> children
251-
(#{:wallet
252-
:recent-recipients
253-
:wallet-send-assets
254-
:wallet-request-assets} current-view)
255-
(conj [view {:background-color styles/color-white
256-
:position :absolute
257-
:bottom 0
258-
:right 0
259-
:left 0
260-
:height 100
261-
:z-index -1000}]))]
250+
(#{:wallet
251+
:recent-recipients
252+
:wallet-send-assets
253+
:wallet-request-assets} current-view)
254+
(conj [view {:background-color styles/color-white
255+
:position :absolute
256+
:bottom 0
257+
:right 0
258+
:left 0
259+
:height 100
260+
:z-index -1000}]))]
262261
(apply vector safe-area-view props children))))
263262

264263
(defmethod create-main-screen-view :default [_]

components/src/status_im/ui/components/svg.clj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
`(fn [~color]
2828
~(into []
2929
(clojure.walk/postwalk-replace
30-
{:viewbox :viewBox} ;; See https://github.com/jhy/jsoup/issues/272
31-
(clojure.walk/prewalk
32-
(fn [node]
33-
(if (svg-tags node)
34-
(symbol (name node))
35-
(if (vector? node)
36-
(let [[k v] node]
37-
(if (and (= :fill k) v)
38-
[k color]
39-
node))
40-
node)))
41-
svg-hiccup))))))
30+
{:viewbox :viewBox} ;; See https://github.com/jhy/jsoup/issues/272
31+
(clojure.walk/prewalk
32+
(fn [node]
33+
(if (svg-tags node)
34+
(symbol (name node))
35+
(if (vector? node)
36+
(let [[k v] node]
37+
(if (and (= :fill k) v)
38+
[k color]
39+
node))
40+
node)))
41+
svg-hiccup))))))

env/dev/env/config.cljs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
(ns env.config)
22

3-
43
(def figwheel-urls {:android "ws://192.168.10.203:3449/figwheel-ws",
54
:ios "ws://localhost:3449/figwheel-ws",
65
:desktop "ws://localhost:3449/figwheel-ws"})

env/dev/env/utils.cljs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
Returns host or an empty string upon failure"
77
[url]
88
(->
9-
url
10-
(string/split #"/")
11-
(get 2 "")
12-
(string/split #":")
13-
(get 0 "")))
9+
url
10+
(string/split #"/")
11+
(get 2 "")
12+
(string/split #":")
13+
(get 0 "")))
1414

1515
(defn re-frisk-url
1616
"Expects the input url to be in the form ws://host:port/figwheel-ws"

src/status_im/translations/en.cljs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@
244244
:group-info "Group info"
245245
:delete-chat-confirmation "Are you sure you want to delete this chat?"
246246
:delete-group-chat-confirmation "Are you sure you want to delete this group chat?"
247+
:delete-chat-action "Delete"
247248
:new-group-chat "New group chat"
248249
:new-public-group-chat "Join public chat"
249250
:selected-for-you "Selected for you"

src/status_im/ui/components/desktop/events.cljs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
(handlers/register-handler-fx
66
:show-desktop-tab
77
(fn [{:keys [db] :as cofx} [_ tab-name]]
8-
{:db (assoc-in db [:desktop/desktop :tab-view-id] tab-name)}))
8+
{:db (assoc-in db [:desktop/desktop :tab-view-id] tab-name)
9+
:dispatch [:navigate-to (if (= tab-name :home) :chat :home)]}))

src/status_im/ui/components/desktop/tabs.cljs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939
(defn tab [index content view-id active?]
4040
[react/touchable-highlight {:style (merge tabs.styles/tab-container {:flex 1})
4141
:disabled active?
42-
:on-press #(do
43-
(re-frame/dispatch [:navigate-to :home])
44-
(re-frame/dispatch [:show-desktop-tab view-id]))}
42+
:on-press #(re-frame/dispatch [:show-desktop-tab view-id])}
4543
[react/view
4644
[content active?]]])
4745

src/status_im/ui/screens/desktop/main/chat/styles.cljs

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,41 +74,43 @@
7474
:height 40
7575
:margin-right 8})
7676

77-
(def photo-style-toolbar
78-
{:border-radius 32
79-
:width 32
80-
:height 32
81-
:margin-right 8})
77+
(def chat-icon
78+
{:width 34
79+
:border-radius 34
80+
:height 34
81+
:margin-right 12})
8282

8383
(defn topic-image [color]
84-
(merge photo-style-toolbar
84+
(merge chat-icon
8585
{:background-color color
8686
:align-items :center
8787
:justify-content :center}))
8888

8989
(def topic-text
90-
{:font-size 18
90+
{:font-size 18.7
9191
:color colors/white})
9292

9393
(def toolbar-chat-view
94-
{:margin-left 11
95-
:justify-content :center})
96-
97-
(def toolbar-chat-name
98-
{:font-size 16
99-
:color :black
100-
:font-weight "300"})
101-
102-
(def add-contact
103-
{:background-color :white
104-
:border-radius 6
105-
:margin-top 3
106-
:padding-top 1})
94+
{:align-items :center
95+
:padding-vertical 17
96+
:padding-horizontal 24
97+
:height 68
98+
:flex-direction :row
99+
:justify-content :space-between})
107100

108101
(def add-contact-text
109-
{:font-size 14
102+
{:font-size 12
110103
:color colors/blue})
111104

105+
(def public-chat-text
106+
{:font-size 12
107+
:color colors/gray})
108+
109+
(defn profile-actions-text [color]
110+
{:font-size 12
111+
:color color
112+
:margin-bottom 4})
113+
112114
(def message-text
113115
{:font-size 14})
114116

@@ -169,3 +171,13 @@
169171
{:color colors/gray
170172
:margin-top 10
171173
:margin-bottom 5})
174+
175+
(defn chat-title-and-type [pending?]
176+
{:flex 1
177+
:justify-content (if pending? :flex-start :center)})
178+
179+
(def chat-title
180+
{:margin-bottom 4
181+
:font-size 14
182+
:color colors/black
183+
:font-weight "600"})

src/status_im/ui/screens/desktop/main/chat/views.cljs

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
(ns status-im.ui.screens.desktop.main.chat.views
23
(:require-macros [status-im.utils.views :as views])
34
(:require [re-frame.core :as re-frame]
@@ -10,6 +11,7 @@
1011
[status-im.constants :as constants]
1112
[status-im.utils.identicon :as identicon]
1213
[status-im.utils.datetime :as time]
14+
[status-im.utils.utils :as utils]
1315
[status-im.ui.components.react :as react]
1416
[status-im.ui.components.colors :as colors]
1517
[status-im.chat.views.message.datemark :as message.datemark]
@@ -18,35 +20,50 @@
1820
[status-im.ui.screens.desktop.main.chat.styles :as styles]
1921
[status-im.i18n :as i18n]))
2022

21-
(views/defview toolbar-chat-view []
22-
(views/letsubs [{:keys [chat-id public-key public? group-chat color]} [:get-current-chat]
23-
{:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]
24-
current-chat-name [:get-current-chat-name]]
23+
(views/defview toolbar-chat-view [{:keys [chat-id color public-key public? group-chat]
24+
:as current-chat}]
25+
(views/letsubs [photo-path [:get-chat-photo chat-id]
26+
chat-name [:get-current-chat-name]
27+
{:keys [pending? whisper-identity]} [:get-current-chat-contact]]
2528
[react/view {:style styles/toolbar-chat-view}
26-
[react/view {:style {:flex-direction :row
27-
:align-items :center}}
28-
29-
[react/view {:style styles/img-container}
30-
(if public?
31-
[react/view {:style (styles/topic-image color)}
32-
[react/text {:style styles/topic-text}
33-
(string/capitalize (first current-chat-name))]]
34-
[react/image {:style styles/photo-style-toolbar
35-
:source {:uri photo-path}}])]
36-
37-
[react/view
38-
[react/text {:style styles/toolbar-chat-name} current-chat-name]
39-
(when pending?
40-
[react/touchable-highlight
41-
{:on-press #(re-frame/dispatch [:add-contact whisper-identity])}
42-
[react/view {:style styles/add-contact}
43-
[react/text {:style styles/add-contact-text}
44-
(i18n/label :t/add-to-contacts)]]])]
29+
[react/view {:style {:flex-direction :row
30+
:flex 1}}
31+
(if public?
32+
[react/view {:style (styles/topic-image color)}
33+
[react/text {:style styles/topic-text}
34+
(string/capitalize (second chat-name))]]
35+
[react/image {:style styles/chat-icon
36+
:source {:uri photo-path}}])
37+
[react/view {:style (styles/chat-title-and-type pending?)}
38+
[react/text {:style styles/chat-title}
39+
chat-name]
40+
(cond pending?
41+
[react/text {:style styles/add-contact-text
42+
:on-press #(re-frame/dispatch [:add-contact whisper-identity])}
43+
(i18n/label :t/add-to-contacts)]
44+
public?
45+
[react/text {:style styles/public-chat-text}
46+
(i18n/label :t/public-chat)])]]
47+
[react/view
4548
(when (and (not group-chat) (not public?))
46-
[react/text {:style {:position :absolute
47-
:right 20}
49+
[react/text {:style (styles/profile-actions-text colors/black)
4850
:on-press #(re-frame/dispatch [:navigate-to :chat-profile])}
49-
(i18n/label :t/view-profile)])]]))
51+
(i18n/label :t/view-profile)])
52+
53+
[react/text {:style (styles/profile-actions-text colors/red)
54+
:on-press (fn []
55+
(utils/show-confirmation (i18n/label :clear-history-confirmation)
56+
""
57+
(i18n/label :clear-history-action)
58+
#(re-frame/dispatch [:clear-history])))}
59+
(i18n/label :t/clear-history)]
60+
[react/text {:style (styles/profile-actions-text colors/red)
61+
:on-press (fn []
62+
(utils/show-confirmation (i18n/label :delete-chat-confirmation)
63+
""
64+
(i18n/label :delete-chat-action)
65+
#(re-frame/dispatch [:remove-chat-and-navigate-home chat-id])))}
66+
(i18n/label :t/delete-chat)]]]))
5067

5168
(views/defview message-author-name [{:keys [outgoing from] :as message}]
5269
(views/letsubs [current-account [:get-current-account]
@@ -56,9 +73,11 @@
5673
[react/text {:style styles/author} name]])))
5774

5875
(views/defview member-photo [from]
59-
[react/view
60-
[react/image {:source {:uri (identicon/identicon from)}
61-
:style styles/photo-style}]])
76+
(letsubs [photo-path [:get-photo-path from]]
77+
[react/image {:source {:uri (if (string/blank? photo-path)
78+
(identicon/identicon from)
79+
photo-path)}
80+
:style styles/photo-style}]))
6281

6382
(views/defview my-photo [from]
6483
(views/letsubs [account [:get-current-account]]
@@ -188,7 +207,7 @@
188207
(views/defview chat-view []
189208
(views/letsubs [current-chat [:get-current-chat]]
190209
[react/view {:style styles/chat-view}
191-
[toolbar-chat-view]
210+
[toolbar-chat-view current-chat]
192211
[messages-view current-chat]
193212
[chat-text-input]]))
194213

src/status_im/ui/screens/desktop/main/tabs/home/styles.cljs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
(def chat-list-header
1717
{:flex-direction :row
1818
:align-items :center
19+
:height 68
1920
:padding 11})
2021

2122
(def img-container
@@ -41,14 +42,15 @@
4142

4243
(defn unread-messages-text [large?]
4344
{:color colors/white
44-
:font-size (if large? 10 12)})
45+
:font-size (if large? 11 12)})
4546

4647
(def chat-list-separator
4748
{:height 1
4849
:background-color colors/gray-light})
4950

5051
(def chat-name-box
5152
{:flex-direction :row
53+
:flex 1
5254
:align-items :center})
5355

5456
(def chat-name-last-msg-box

0 commit comments

Comments
 (0)