Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cammellos committed May 4, 2022
1 parent b00c3e0 commit a20baf5
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 65 deletions.
8 changes: 7 additions & 1 deletion src/status_im/constants.cljs
Expand Up @@ -15,6 +15,12 @@
(def ^:const content-type-gap 10)
(def ^:const content-type-contact-request 11) ;; TODO: temp, will be removed

(def ^:const contact-request-state-none 0)
(def ^:const contact-request-state-mutual 1)
(def ^:const contact-request-state-sent 2)
(def ^:const contact-request-state-received 3)
(def ^:const contact-request-state-dismissed 4)

(def ^:const emoji-reaction-love 1)
(def ^:const emoji-reaction-thumbs-up 2)
(def ^:const emoji-reaction-thumbs-down 3)
Expand Down Expand Up @@ -172,4 +178,4 @@
(def ^:const visibility-status-inactive 4)

(def ^:const wallet-connect-version-1 1)
(def ^:const wallet-connect-version-2 2)
(def ^:const wallet-connect-version-2 2)
1 change: 1 addition & 0 deletions src/status_im/data_store/contacts.cljs
Expand Up @@ -11,6 +11,7 @@
:ensVerified :ens-verified
:ensVerificationRetries :ens-verification-retries
:hasAddedUs :has-added-us
:contactRequestState :contact-request-state
:lastENSClockValue :last-ens-clock-value
:lastUpdated :last-updated
:localNickname :nickname})
Expand Down
5 changes: 4 additions & 1 deletion src/status_im/ui/screens/chat/views.cljs
Expand Up @@ -135,7 +135,10 @@
(and
enable-mutual-contact-requests?
(= chat-type constants/one-to-one-chat-type)
(not (and contact-added? no-messages?)))
(or
(= contact-request-state constants/contact-request-state-none)
(= contact-request-state constants/contact-request-state-received)
(= contact-request-state constants/contact-request-state-dismissed)))
[contact-request])])

(defn chat-intro-one-to-one [{:keys [chat-id chat-type] :as opts}]
Expand Down
110 changes: 47 additions & 63 deletions src/status_im/ui/screens/home/views.cljs
Expand Up @@ -38,21 +38,6 @@
:size :small}
amount]])

(defn contact-request-indicator []
[react/touchable-opacity {:style {:height 47
:width "100%"
:border-top-width 1
:border-bottom-width 1
:border-color colors/gray-lighter}}
[react/view {:style {:flex 1
:flex-direction :row
:padding-horizontal 16
:align-items :center
:justify-content :space-between}}
[quo/text {:weight :medium}
"👋 Contact requests"]
[contact-request-number-indicator 1]]])

(defn home-tooltip-view []
[react/view (styles/chat-tooltip)
[react/view {:style {:width 66 :position :absolute :top -6 :background-color colors/white
Expand Down Expand Up @@ -147,63 +132,62 @@
(views/defview communities-and-chats []
(views/letsubs [{:keys [items search-filter]} [:home-items]
hide-home-tooltip? [:hide-home-tooltip?]]
(if (and (empty? items)
(empty? search-filter)
hide-home-tooltip?
(not @search-active?))
[welcome-blank-page]
[list/flat-list
{:key-fn chat-list-key-fn
:getItemLayout get-item-layout
:on-end-reached #(re-frame/dispatch [:chat.ui/show-more-chats])
:keyboard-should-persist-taps :always
:data items
:render-fn render-fn
:header [:<>
(when (or (seq items) @search-active? (seq search-filter))
[search-input-wrapper search-filter (empty? items)])
[contact-request-indicator]
[referral-item/list-item]
(when (and (empty? items)
(or @search-active? (seq search-filter)))
[start-suggestion search-filter])]
:footer (if (and (not hide-home-tooltip?) (not @search-active?))
[home-tooltip-view]
[react/view {:height 68}])}])))
(if (and (empty? items)
(empty? search-filter)
hide-home-tooltip?
(not @search-active?))
[welcome-blank-page]
[list/flat-list
{:key-fn chat-list-key-fn
:getItemLayout get-item-layout
:on-end-reached #(re-frame/dispatch [:chat.ui/show-more-chats])
:keyboard-should-persist-taps :always
:data items
:render-fn render-fn
:header [:<>
(when (or (seq items) @search-active? (seq search-filter))
[search-input-wrapper search-filter (empty? items)])
[referral-item/list-item]
(when (and (empty? items)
(or @search-active? (seq search-filter)))
[start-suggestion search-filter])]
:footer (if (and (not hide-home-tooltip?) (not @search-active?))
[home-tooltip-view]
[react/view {:height 68}])}])))

(views/defview chats-list []
(views/letsubs [loading? [:chats/loading?]]
[:<>
[connectivity/loading-indicator]
(if loading?
[react/view {:flex 1 :align-items :center :justify-content :center}
[react/activity-indicator {:animating true}]]
[communities-and-chats])]))
[:<>
[connectivity/loading-indicator]
(if loading?
[react/view {:flex 1 :align-items :center :justify-content :center}
[react/activity-indicator {:animating true}]]
[communities-and-chats])]))

(views/defview plus-button []
(views/letsubs [logging-in? [:multiaccounts/login]]
[components.plus-button/plus-button
{:on-press (when-not logging-in?
#(re-frame/dispatch [:bottom-sheet/show-sheet :add-new {}]))
:loading logging-in?
:accessibility-label :new-chat-button}]))
[components.plus-button/plus-button
{:on-press (when-not logging-in?
#(re-frame/dispatch [:bottom-sheet/show-sheet :add-new {}]))
:loading logging-in?
:accessibility-label :new-chat-button}]))

(views/defview notifications-button []
(views/letsubs [notif-count [:activity.center/notifications-count]]
[react/view
[quo/button {:type :icon
:style {:margin-left 10}
:accessibility-label "notifications-button"
:on-press #(do
(re-frame/dispatch [:mark-all-activity-center-notifications-as-read])
(re-frame/dispatch [:navigate-to :notifications-center]))
:theme :icon}
:main-icons/notification]
(when (pos? notif-count)
[react/view {:style (merge (styles/counter-public-container) {:top 5 :right 5})
:pointer-events :none}
[react/view {:style styles/counter-public
:accessibility-label :notifications-unread-badge}]])]))
[react/view
[quo/button {:type :icon
:style {:margin-left 10}
:accessibility-label "notifications-button"
:on-press #(do
(re-frame/dispatch [:mark-all-activity-center-notifications-as-read])
(re-frame/dispatch [:navigate-to :notifications-center]))
:theme :icon}
:main-icons/notification]
(when (pos? notif-count)
[react/view {:style (merge (styles/counter-public-container) {:top 5 :right 5})
:pointer-events :none}
[react/view {:style styles/counter-public
:accessibility-label :notifications-unread-badge}]])]))

(defn home []
(reagent/create-class
Expand Down

0 comments on commit a20baf5

Please sign in to comment.