From 615cc4d73a0d986f06b9b56fadbf3ad28930869c Mon Sep 17 00:00:00 2001 From: virvar Date: Fri, 20 May 2016 16:18:12 +0300 Subject: [PATCH] Chat members names menu item Former-commit-id: 34f5ab31a1da6f553810fff7f2b5793bb85208b1 --- src/status_im/chat/screen.cljs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index b1e594f977..a6020a2fda 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -1,6 +1,7 @@ (ns status-im.chat.screen (:require-macros [status-im.utils.views :refer [defview]]) (:require [re-frame.core :refer [subscribe dispatch]] + [clojure.string :as s] [status-im.components.react :refer [view text image @@ -97,13 +98,20 @@ ;; TODO stub data ('online' property) [chat-icon-view-menu-item chat-id group-chat name color true]) +(defn members-text [members] + (let [max 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 [] (let [{:keys [group-chat chat-id]} - (subscribe [:chat-properties [:group-chat :chat-id]])] + (subscribe [:chat-properties [:group-chat :chat-id]]) + members (subscribe [:current-chat-contacts])] (when-let [actions (if @group-chat [{:title "Members" - ;; TODO stub data: members - :subtitle "Justas, Geoff, Alex and you" + :subtitle (members-text @members) :icon :menu_group :icon-style {:width 25 :height 19}