parent
615cc4d73a
commit
585baa9d71
|
@ -13,6 +13,7 @@
|
||||||
chat-icon-view-menu-item]]
|
chat-icon-view-menu-item]]
|
||||||
[status-im.chat.styles.screen :as st]
|
[status-im.chat.styles.screen :as st]
|
||||||
[status-im.utils.listview :refer [to-datasource]]
|
[status-im.utils.listview :refer [to-datasource]]
|
||||||
|
[status-im.utils.utils :refer [truncate-str]]
|
||||||
[status-im.components.invertible-scroll-view :refer [invertible-scroll-view]]
|
[status-im.components.invertible-scroll-view :refer [invertible-scroll-view]]
|
||||||
[status-im.components.toolbar :refer [toolbar]]
|
[status-im.components.toolbar :refer [toolbar]]
|
||||||
[status-im.chat.views.message :refer [chat-message]]
|
[status-im.chat.views.message :refer [chat-message]]
|
||||||
|
@ -99,11 +100,7 @@
|
||||||
[chat-icon-view-menu-item chat-id group-chat name color true])
|
[chat-icon-view-menu-item chat-id group-chat name color true])
|
||||||
|
|
||||||
(defn members-text [members]
|
(defn members-text [members]
|
||||||
(let [max 35
|
(truncate-str (str (s/join ", " (map #(:name %) members)) " and you") 35))
|
||||||
text (str (s/join ", " (map #(:name %) members)) " and you")]
|
|
||||||
(if (< max (count text))
|
|
||||||
(str (subs text 0 (- max 3)) "...")
|
|
||||||
text)))
|
|
||||||
|
|
||||||
(defn actions-list-view []
|
(defn actions-list-view []
|
||||||
(let [{:keys [group-chat chat-id]}
|
(let [{:keys [group-chat chat-id]}
|
||||||
|
@ -182,7 +179,7 @@
|
||||||
(fn []
|
(fn []
|
||||||
[view (st/chat-name-view @show-actions)
|
[view (st/chat-name-view @show-actions)
|
||||||
[text {:style st/chat-name-text}
|
[text {:style st/chat-name-text}
|
||||||
(or @name "Chat name")]
|
(truncate-str (or @name "Chat name") 30)]
|
||||||
(if @group-chat
|
(if @group-chat
|
||||||
[view {:flexDirection :row}
|
[view {:flexDirection :row}
|
||||||
[icon :group st/group-icon]
|
[icon :group st/group-icon]
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
(:require [status-im.components.react :refer [view image icon text]]
|
(:require [status-im.components.react :refer [view image icon text]]
|
||||||
[status-im.components.chat-icon.screen :refer [chat-icon-view-chat-list]]
|
[status-im.components.chat-icon.screen :refer [chat-icon-view-chat-list]]
|
||||||
[status-im.chats-list.styles :as st]
|
[status-im.chats-list.styles :as st]
|
||||||
|
[status-im.utils.utils :refer [truncate-str]]
|
||||||
[status-im.utils.datetime :as time]))
|
[status-im.utils.datetime :as time]))
|
||||||
|
|
||||||
(defn chat-list-item-inner-view
|
(defn chat-list-item-inner-view
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
[chat-icon-view-chat-list chat-id group-chat name color online]]
|
[chat-icon-view-chat-list chat-id group-chat name color online]]
|
||||||
[view st/item-container
|
[view st/item-container
|
||||||
[view st/name-view
|
[view st/name-view
|
||||||
[text {:style st/name-text} name]
|
[text {:style st/name-text} (truncate-str name 20)]
|
||||||
(when group-chat
|
(when group-chat
|
||||||
[icon :group st/group-icon])
|
[icon :group st/group-icon])
|
||||||
(when group-chat
|
(when group-chat
|
||||||
|
|
|
@ -47,3 +47,8 @@
|
||||||
(.catch (or on-error
|
(.catch (or on-error
|
||||||
(fn [error]
|
(fn [error]
|
||||||
(toast (str error))))))))
|
(toast (str error))))))))
|
||||||
|
|
||||||
|
(defn truncate-str [s max]
|
||||||
|
(if (< max (count s))
|
||||||
|
(str (subs s 0 (- max 3)) "...")
|
||||||
|
s))
|
||||||
|
|
Loading…
Reference in New Issue