Increase number on 'unread' messages indicator to +99

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
William Mruzek 2019-10-29 20:49:10 -05:00 committed by yenda
parent 2e8e1a35ad
commit ed0c16b33b
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
5 changed files with 23 additions and 7 deletions

View File

@ -1,6 +1,7 @@
(ns status-im.ui.components.badge (ns status-im.ui.components.badge
(:require [status-im.ui.components.react :as react] (:require [status-im.ui.components.react :as react]
[status-im.ui.components.colors :as colors])) [status-im.ui.components.colors :as colors]
[status-im.i18n :as i18n]))
(defn badge [label & [small?]] (defn badge [label & [small?]]
[react/view (merge [react/view (merge
@ -10,4 +11,11 @@
{:background-color colors/blue {:background-color colors/blue
:justify-content :center :justify-content :center
:align-items :center}) :align-items :center})
[react/text {:style {:typography :caption :color colors/white}} label]]) [react/text {:style {:typography :caption :color colors/white}} label]])
(defn message-counter [value & [small?]]
[badge
(if (> value 99)
(i18n/label :t/counter-99-plus)
value)
small?])

View File

@ -7,6 +7,7 @@
[status-im.utils.platform :as platform] [status-im.utils.platform :as platform]
[status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.components.icons.vector-icons :as vector-icons]
[status-im.ui.components.common.common :as components.common] [status-im.ui.components.common.common :as components.common]
[status-im.ui.components.badge :as badge]
[status-im.i18n :as i18n] [status-im.i18n :as i18n]
[re-frame.core :as re-frame])) [re-frame.core :as re-frame]))
@ -67,8 +68,10 @@
{:style tabs.styles/icon-container} {:style tabs.styles/icon-container}
[vector-icons/icon icon (tabs.styles/icon active?)] [vector-icons/icon icon (tabs.styles/icon active?)]
(when (pos? (if count @count 0)) (when (pos? (if count @count 0))
[react/view tabs.styles/counter [react/view {:style (if (= nav-stack :chat-stack)
[components.common/counter @count]])] tabs.styles/message-counter
tabs.styles/counter)}
[badge/message-counter @count true]])]
(when-not platform/desktop? (when-not platform/desktop?
[react/view {:style tabs.styles/tab-title-container} [react/view {:style tabs.styles/tab-title-container}
[react/text {:style (tabs.styles/new-tab-title active?)} [react/text {:style (tabs.styles/new-tab-title active?)}

View File

@ -46,6 +46,11 @@
:top 0 :top 0
:position :absolute}) :position :absolute})
(def message-counter
{:right -10
:top 0
:position :absolute})
(def touchable-container (def touchable-container
{:flex 1 {:flex 1
:height tabs-height}) :height tabs-height})

View File

@ -8,6 +8,7 @@
[status-im.ui.components.chat-icon.screen :as chat-icon.screen] [status-im.ui.components.chat-icon.screen :as chat-icon.screen]
[status-im.ui.components.common.common :as components.common] [status-im.ui.components.common.common :as components.common]
[status-im.ui.components.list-item.views :as list-item] [status-im.ui.components.list-item.views :as list-item]
[status-im.ui.components.badge :as badge]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im.ui.screens.home.styles :as styles] [status-im.ui.screens.home.styles :as styles]
[status-im.utils.contenthash :as contenthash] [status-im.utils.contenthash :as contenthash]
@ -64,9 +65,7 @@
(defview unviewed-indicator [chat-id] (defview unviewed-indicator [chat-id]
(letsubs [unviewed-messages-count [:chats/unviewed-messages-count chat-id]] (letsubs [unviewed-messages-count [:chats/unviewed-messages-count chat-id]]
(when (pos? unviewed-messages-count) (when (pos? unviewed-messages-count)
[components.common/counter {:size 22 [badge/message-counter unviewed-messages-count])))
:accessibility-label :unread-messages-count-text}
unviewed-messages-count])))
(defn home-list-item [[_ home-item]] (defn home-list-item [[_ home-item]]
(let [{:keys (let [{:keys

View File

@ -172,6 +172,7 @@
"copy-transaction-hash": "Copy transaction ID", "copy-transaction-hash": "Copy transaction ID",
"cost-fee": "Cost/Fee", "cost-fee": "Cost/Fee",
"counter-9-plus": "9+", "counter-9-plus": "9+",
"counter-99-plus": "99+",
"create": "Create", "create": "Create",
"create-a-pin": "Create a 6-digit passcode", "create-a-pin": "Create a 6-digit passcode",
"create-group-chat": "Create group chat", "create-group-chat": "Create group chat",