Skip to content

Commit

Permalink
Allow user to select a color for the group chat #18982
Browse files Browse the repository at this point in the history
  • Loading branch information
flexsurfer committed Mar 4, 2024
1 parent 7754460 commit 0c52d23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
25 changes: 13 additions & 12 deletions src/status_im/contexts/chat/home/new_chat/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,33 @@
:on-check on-toggle}}
item])))

(defn- view-internal
[{:keys [scroll-enabled? on-scroll close theme]}]
(let [contacts (rf/sub [:contacts/sorted-and-grouped-by-first-letter])
(defn view
[]
(let [theme (quo.theme/use-theme-value)
contacts (rf/sub [:contacts/sorted-and-grouped-by-first-letter])
selected-contacts-count (rf/sub [:selected-contacts-count])
selected-contacts (rf/sub [:group/selected-contacts])
one-contact-selected? (= selected-contacts-count 1)
contacts-selected? (pos? selected-contacts-count)
{:keys [primary-name public-key]} (when one-contact-selected?
(rf/sub [:contacts/contact-by-identity
(first selected-contacts)]))]
[rn/view {:flex 1}
[:<>
[rn/view {:padding-horizontal 20}
[quo/button
{:type :grey
:size 32
:icon-only? true
:on-press close} :i/close]
:on-press #(rf/dispatch [:navigate-back])}
:i/close]
[rn/view {:style style/contact-selection-heading}
[quo/text
{:weight :semi-bold
:size :heading-1
:style {:color (colors/theme-colors colors/neutral-100 colors/white theme)}}
(i18n/label :t/new-chat)]
(if (and contacts-selected? (not one-contact-selected?))
(i18n/label :t/new-group-chat)
(i18n/label :t/new-chat))]
(when (seq contacts)
[quo/text
{:size :paragraph-2
Expand All @@ -104,9 +108,7 @@
:sections (rf/sub [:contacts/filtered-active-sections])
:render-section-header-fn contact-list/contacts-section-header
:content-container-style {:padding-bottom 70}
:render-fn contact-item-render
:scroll-enabled @scroll-enabled?
:on-scroll on-scroll}])
:render-fn contact-item-render}])
(when contacts-selected?
[quo/button
{:type :primary
Expand All @@ -115,9 +117,8 @@
:on-press (fn []
(if one-contact-selected?
(rf/dispatch [:chat.ui/start-chat public-key])
(rf/dispatch [:navigate-to :new-group])))}
(rf/dispatch [:navigate-to-within-stack
[:new-group :start-a-new-chat]])))}
(if one-contact-selected?
(i18n/label :t/chat-with {:selected-user primary-name})
(i18n/label :t/setup-group-chat))])]))

(def view (quo.theme/with-theme view-internal))
3 changes: 2 additions & 1 deletion src/status_im/navigation/screens.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
:component chat/chat}

{:name :start-a-new-chat
:options {:sheet? true}
:options {:insets {:top? true}
:modalPresentationStyle :overCurrentContext}
:component new-chat/view}

{:name :group-add-manage-members
Expand Down

0 comments on commit 0c52d23

Please sign in to comment.