code review, renamed chats-list to home
This commit is contained in:
parent
d582e6e366
commit
a3cffebb23
|
@ -48,7 +48,7 @@
|
||||||
(register-handler
|
(register-handler
|
||||||
:leave-group-chat
|
:leave-group-chat
|
||||||
;; todo order of operations tbd
|
;; todo order of operations tbd
|
||||||
(after (fn [_ _] (dispatch [:navigation-replace :chat-list])))
|
(after (fn [_ _] (dispatch [:navigation-replace :home])))
|
||||||
(u/side-effect!
|
(u/side-effect!
|
||||||
(fn [{:keys [web3 current-chat-id chats current-public-key]} _]
|
(fn [{:keys [web3 current-chat-id chats current-public-key]} _]
|
||||||
(let [{:keys [public-key private-key public?]} (chats current-chat-id)]
|
(let [{:keys [public-key private-key public?]} (chats current-chat-id)]
|
||||||
|
@ -136,7 +136,7 @@
|
||||||
::save-public-chat chat
|
::save-public-chat chat
|
||||||
::start-watching-group (merge {:group-id topic}
|
::start-watching-group (merge {:group-id topic}
|
||||||
(select-keys db [:web3 :current-public-key]))})
|
(select-keys db [:web3 :current-public-key]))})
|
||||||
{:dispatch-n [[:navigate-to-clean :chat-list]
|
{:dispatch-n [[:navigate-to-clean :home]
|
||||||
[:navigate-to-chat topic]]}))))
|
[:navigate-to-chat topic]]}))))
|
||||||
|
|
||||||
(reg-fx
|
(reg-fx
|
||||||
|
@ -207,7 +207,7 @@
|
||||||
::save-chat new-chat
|
::save-chat new-chat
|
||||||
::start-listen-group (merge {:new-chat new-chat}
|
::start-listen-group (merge {:new-chat new-chat}
|
||||||
(select-keys db [:web3 :current-public-key]))
|
(select-keys db [:web3 :current-public-key]))
|
||||||
:dispatch-n [[:navigate-to-clean :chat-list]
|
:dispatch-n [[:navigate-to-clean :home]
|
||||||
[:navigate-to-chat (:chat-id new-chat)]]})))
|
[:navigate-to-chat (:chat-id new-chat)]]})))
|
||||||
|
|
||||||
(register-handler-fx
|
(register-handler-fx
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
(ns status-im.ui.components.chat-preview
|
(ns status-im.ui.components.chat-preview
|
||||||
(:require [status-im.ui.components.react :as components]
|
(:require [status-im.ui.components.react :as components]
|
||||||
[status-im.ui.screens.chats-list.styles :as st]
|
[status-im.ui.screens.home.styles :as home.styles]
|
||||||
[status-im.utils.utils :as utils]))
|
[status-im.utils.utils :as utils]))
|
||||||
|
|
||||||
(def default-attributes
|
(def default-attributes
|
||||||
{:style st/last-message-text
|
{:style home.styles/last-message-text
|
||||||
:number-of-lines 1})
|
:number-of-lines 1})
|
||||||
|
|
||||||
(defn text [attributes s]
|
(defn text [attributes s]
|
||||||
|
|
|
@ -23,14 +23,7 @@
|
||||||
(def use-def (get-class "Use"))
|
(def use-def (get-class "Use"))
|
||||||
(def defs (get-class "Defs"))
|
(def defs (get-class "Defs"))
|
||||||
|
|
||||||
(def icons {;;NOT USED IN MVP
|
(def icons {:icons/home (slurp-svg "./resources/icons/bottom/home_gray.svg")
|
||||||
;;:icons/chats (slurp-svg "./resources/icons/bottom/chats_gray.svg")
|
|
||||||
;;:icons/chats-active (slurp-svg "./resources/icons/bottom/chats_active.svg")
|
|
||||||
;;:icons/contacts (slurp-svg "./resources/icons/bottom/contacts_gray.svg")
|
|
||||||
;;:icons/contacts-active (slurp-svg "./resources/icons/bottom/contacts_active.svg")
|
|
||||||
;;:icons/discover (slurp-svg "./resources/icons/bottom/discover_gray.svg")
|
|
||||||
;;:icons/discover-active (slurp-svg "./resources/icons/bottom/discover_active.svg")
|
|
||||||
:icons/home (slurp-svg "./resources/icons/bottom/home_gray.svg")
|
|
||||||
:icons/home-active (slurp-svg "./resources/icons/bottom/home_blue.svg")
|
:icons/home-active (slurp-svg "./resources/icons/bottom/home_blue.svg")
|
||||||
:icons/profile (slurp-svg "./resources/icons/bottom/profile_gray.svg")
|
:icons/profile (slurp-svg "./resources/icons/bottom/profile_gray.svg")
|
||||||
:icons/profile-active (slurp-svg "./resources/icons/bottom/profile_blue.svg")
|
:icons/profile-active (slurp-svg "./resources/icons/bottom/profile_blue.svg")
|
||||||
|
|
|
@ -131,8 +131,8 @@
|
||||||
(when (or new-account? recover-in-progress?)
|
(when (or new-account? recover-in-progress?)
|
||||||
[[:chat-received-message/add console-chat/phone-number-request-message]
|
[[:chat-received-message/add console-chat/phone-number-request-message]
|
||||||
[:chat-received-message/add console-chat/shake-your-phone-message]])]
|
[:chat-received-message/add console-chat/shake-your-phone-message]])]
|
||||||
[:navigate-to-clean :chat-list]
|
[:navigate-to-clean :home]
|
||||||
(if new-account?
|
(if new-account?
|
||||||
[:navigate-to-chat console-chat-id]
|
[:navigate-to-chat console-chat-id]
|
||||||
[:navigate-to :chat-list])]}
|
[:navigate-to :home])]}
|
||||||
(log/debug "Error changing acount: " error)))))
|
(log/debug "Error changing acount: " error)))))
|
||||||
|
|
|
@ -427,7 +427,7 @@
|
||||||
:open-chat-with-contact
|
:open-chat-with-contact
|
||||||
(fn [_ [_ {:keys [whisper-identity dapp?] :as contact}]]
|
(fn [_ [_ {:keys [whisper-identity dapp?] :as contact}]]
|
||||||
{:dispatch-n (concat
|
{:dispatch-n (concat
|
||||||
[[:navigate-to-clean :chat-list]
|
[[:navigate-to-clean :home]
|
||||||
[:start-chat whisper-identity]]
|
[:start-chat whisper-identity]]
|
||||||
(when-not dapp?
|
(when-not dapp?
|
||||||
[[::send-contact-request contact]]))}))
|
[[::send-contact-request contact]]))}))
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
[status-im.utils.utils :as u]
|
[status-im.utils.utils :as u]
|
||||||
[status-im.i18n :refer [label]]
|
[status-im.i18n :refer [label]]
|
||||||
[status-im.ui.screens.contacts.styles :as st]
|
[status-im.ui.screens.contacts.styles :as st]
|
||||||
[status-im.ui.screens.chats-list.styles :as chats-list.styles]
|
[status-im.ui.screens.home.styles :as home.styles]
|
||||||
[status-im.ui.components.styles :refer [color-blue]]))
|
[status-im.ui.components.styles :refer [color-blue]]))
|
||||||
|
|
||||||
(def ^:const contacts-limit 5)
|
(def ^:const contacts-limit 5)
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
:buttonColor :#9b59b6
|
:buttonColor :#9b59b6
|
||||||
:onPress #(dispatch [:navigate-to :new-contact])}
|
:onPress #(dispatch [:navigate-to :new-contact])}
|
||||||
[ion-icon {:name :md-create
|
[ion-icon {:name :md-create
|
||||||
:style chats-list.styles/create-icon}]]])
|
:style home.styles/create-icon}]]])
|
||||||
|
|
||||||
(defview contact-groups-list [_]
|
(defview contact-groups-list [_]
|
||||||
(letsubs [contacts [:get-added-contacts-with-limit contacts-limit]
|
(letsubs [contacts [:get-added-contacts-with-limit contacts-limit]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im.ui.screens.chats-list.styles
|
(ns status-im.ui.screens.home.styles
|
||||||
(:require-macros [status-im.utils.styles :refer [defstyle defnstyle]])
|
(:require-macros [status-im.utils.styles :refer [defstyle defnstyle]])
|
||||||
(:require [status-im.ui.components.styles :as component.styles]))
|
(:require [status-im.ui.components.styles :as component.styles]))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im.ui.screens.chats-list.subs
|
(ns status-im.ui.screens.home.subs
|
||||||
(:require [re-frame.core :refer [reg-sub subscribe]]
|
(:require [re-frame.core :refer [reg-sub subscribe]]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as str]))
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
:<- [:get-in [:toolbar-search :text]]
|
:<- [:get-in [:toolbar-search :text]]
|
||||||
:<- [:get-in [:toolbar-search :show]]
|
:<- [:get-in [:toolbar-search :show]]
|
||||||
(fn [[chats search-text show-search]]
|
(fn [[chats search-text show-search]]
|
||||||
(let [unordered-chats (if (and (= show-search :chat-list) search-text)
|
(let [unordered-chats (if (and (= show-search :home) search-text)
|
||||||
(filter #(search-filter search-text (second %))
|
(filter #(search-filter search-text (second %))
|
||||||
chats)
|
chats)
|
||||||
chats)]
|
chats)]
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im.ui.screens.chats-list.views
|
(ns status-im.ui.screens.home.views
|
||||||
(:require-macros [status-im.utils.views :as views])
|
(:require-macros [status-im.utils.views :as views])
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.ui.components.common.common :as components.common]
|
[status-im.ui.components.common.common :as components.common]
|
||||||
|
@ -9,8 +9,8 @@
|
||||||
[status-im.ui.components.toolbar.view :as toolbar]
|
[status-im.ui.components.toolbar.view :as toolbar]
|
||||||
[status-im.ui.components.toolbar.actions :as toolbar.actions]
|
[status-im.ui.components.toolbar.actions :as toolbar.actions]
|
||||||
[status-im.ui.components.sync-state.offline :refer [offline-view]]
|
[status-im.ui.components.sync-state.offline :refer [offline-view]]
|
||||||
[status-im.ui.screens.chats-list.views.inner-item :as inner-item]
|
[status-im.ui.screens.home.views.inner-item :as inner-item]
|
||||||
[status-im.ui.screens.chats-list.styles :as styles]
|
[status-im.ui.screens.home.styles :as styles]
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
[status-im.utils.platform :as platform]))
|
[status-im.utils.platform :as platform]))
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
(when platform/ios?
|
(when platform/ios?
|
||||||
[(toolbar.actions/add #(re-frame/dispatch [:navigate-to :new-chat]))])]])
|
[(toolbar.actions/add #(re-frame/dispatch [:navigate-to :new-chat]))])]])
|
||||||
|
|
||||||
(defn chats-action-button []
|
(defn home-action-button []
|
||||||
[native-action-button {:button-color components.styles/color-blue
|
[native-action-button {:button-color components.styles/color-blue
|
||||||
:offset-x 16
|
:offset-x 16
|
||||||
:offset-y 40
|
:offset-y 40
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
[react/view
|
[react/view
|
||||||
[inner-item/chat-list-item-inner-view (assoc chat :chat-id chat-id) edit?]]])
|
[inner-item/chat-list-item-inner-view (assoc chat :chat-id chat-id) edit?]]])
|
||||||
|
|
||||||
(views/defview chats-list []
|
(views/defview home []
|
||||||
(views/letsubs [chats [:filtered-chats]
|
(views/letsubs [chats [:filtered-chats]
|
||||||
edit? [:get-in [:chat-list-ui-props :edit?]]
|
edit? [:get-in [:chat-list-ui-props :edit?]]
|
||||||
show-search [:get-in [:toolbar-search :show]]
|
show-search [:get-in [:toolbar-search :show]]
|
||||||
|
@ -53,5 +53,5 @@
|
||||||
[components.common/bottom-shadow]])}]
|
[components.common/bottom-shadow]])}]
|
||||||
|
|
||||||
(when platform/android?
|
(when platform/android?
|
||||||
[chats-action-button])
|
[home-action-button])
|
||||||
[offline-view]]))
|
[offline-view]]))
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im.ui.screens.chats-list.views.inner-item
|
(ns status-im.ui.screens.home.views.inner-item
|
||||||
(:require-macros [status-im.utils.views :refer [defview letsubs]])
|
(:require-macros [status-im.utils.views :refer [defview letsubs]])
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
[status-im.ui.components.icons.vector-icons :as vi]
|
[status-im.ui.components.icons.vector-icons :as vi]
|
||||||
[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.context-menu :as context-menu]
|
[status-im.ui.components.context-menu :as context-menu]
|
||||||
[status-im.ui.screens.chats-list.styles :as st]
|
[status-im.ui.screens.home.styles :as st]
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.utils :as utils]
|
||||||
[status-im.commands.utils :as commands-utils]
|
[status-im.commands.utils :as commands-utils]
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
|
@ -5,31 +5,25 @@
|
||||||
[status-im.ui.components.status-bar.view :as status-bar.view]
|
[status-im.ui.components.status-bar.view :as status-bar.view]
|
||||||
[status-im.ui.components.styles :as common.styles]
|
[status-im.ui.components.styles :as common.styles]
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
[status-im.ui.screens.chats-list.views :as chats-list.views]
|
[status-im.ui.screens.home.views :as home.views]
|
||||||
[status-im.ui.screens.profile.views :as profile.views]
|
[status-im.ui.screens.profile.views :as profile.views]
|
||||||
[status-im.ui.screens.wallet.main.views :as wallet.views]
|
[status-im.ui.screens.wallet.main.views :as wallet.views]
|
||||||
[status-im.ui.screens.main-tabs.styles :as styles]
|
[status-im.ui.screens.main-tabs.styles :as styles]
|
||||||
[re-frame.core :as re-frame]))
|
[re-frame.core :as re-frame]))
|
||||||
|
|
||||||
(def tabs-list-data
|
(def tabs-list-data
|
||||||
{:chat-list
|
[{:view-id :home
|
||||||
{:view-id :chat-list
|
|
||||||
:content {:title (i18n/label :t/home)
|
:content {:title (i18n/label :t/home)
|
||||||
:icon-inactive :icons/home
|
:icon-inactive :icons/home
|
||||||
:icon-active :icons/home-active}
|
:icon-active :icons/home-active}}
|
||||||
:screen chats-list.views/chats-list}
|
|
||||||
:wallet
|
|
||||||
{:view-id :wallet
|
{:view-id :wallet
|
||||||
:content {:title (i18n/label :t/wallet)
|
:content {:title (i18n/label :t/wallet)
|
||||||
:icon-inactive :icons/wallet
|
:icon-inactive :icons/wallet
|
||||||
:icon-active :icons/wallet-active}
|
:icon-active :icons/wallet-active}}
|
||||||
:screen wallet.views/wallet}
|
|
||||||
:my-profile
|
|
||||||
{:view-id :my-profile
|
{:view-id :my-profile
|
||||||
:content {:title (i18n/label :t/profile)
|
:content {:title (i18n/label :t/profile)
|
||||||
:icon-inactive :icons/profile
|
:icon-inactive :icons/profile
|
||||||
:icon-active :icons/profile-active}
|
:icon-active :icons/profile-active}}])
|
||||||
:screen profile.views/my-profile}})
|
|
||||||
|
|
||||||
(defn- tab-content [{:keys [title icon-active icon-inactive]}]
|
(defn- tab-content [{:keys [title icon-active icon-inactive]}]
|
||||||
(fn [active?]
|
(fn [active?]
|
||||||
|
@ -41,7 +35,7 @@
|
||||||
[react/text {:style (styles/tab-title active?)}
|
[react/text {:style (styles/tab-title active?)}
|
||||||
title]]]))
|
title]]]))
|
||||||
|
|
||||||
(def tabs-list (map #(update % :content tab-content) (vals tabs-list-data)))
|
(def tabs-list (map #(update % :content tab-content) tabs-list-data))
|
||||||
|
|
||||||
(defn tab [view-id content active?]
|
(defn tab [view-id content active?]
|
||||||
[react/touchable-highlight {:style common.styles/flex
|
[react/touchable-highlight {:style common.styles/flex
|
||||||
|
@ -57,9 +51,11 @@
|
||||||
|
|
||||||
(views/defview main-tabs []
|
(views/defview main-tabs []
|
||||||
(views/letsubs [view-id [:get :view-id]]
|
(views/letsubs [view-id [:get :view-id]]
|
||||||
(let [screen (get-in tabs-list-data [view-id :screen])]
|
|
||||||
[react/view common.styles/flex
|
[react/view common.styles/flex
|
||||||
[status-bar.view/status-bar {:type (if (= view-id :wallet) :wallet :main)}]
|
[status-bar.view/status-bar {:type (if (= view-id :wallet) :wallet :main)}]
|
||||||
[react/view common.styles/main-container
|
[react/view common.styles/main-container
|
||||||
[screen]
|
[(case view-id
|
||||||
[tabs view-id]]])))
|
:home home.views/home
|
||||||
|
:wallet wallet.views/wallet
|
||||||
|
:my-profile profile.views/my-profile)]
|
||||||
|
[tabs view-id]]]))
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
(defn- replace-top-element [stack view-id]
|
(defn- replace-top-element [stack view-id]
|
||||||
(let [stack' (if (> 2 (count stack))
|
(let [stack' (if (> 2 (count stack))
|
||||||
(list :chat-list)
|
(list :home)
|
||||||
(pop stack))]
|
(pop stack))]
|
||||||
(conj stack' view-id)))
|
(conj stack' view-id)))
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
status-im.chat.subs
|
status-im.chat.subs
|
||||||
status-im.commands.subs
|
status-im.commands.subs
|
||||||
status-im.ui.screens.accounts.subs
|
status-im.ui.screens.accounts.subs
|
||||||
status-im.ui.screens.chats-list.subs
|
status-im.ui.screens.home.subs
|
||||||
status-im.ui.screens.group.chat-settings.subs
|
status-im.ui.screens.group.chat-settings.subs
|
||||||
status-im.ui.screens.discover.subs
|
status-im.ui.screens.discover.subs
|
||||||
status-im.ui.screens.contacts.subs
|
status-im.ui.screens.contacts.subs
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
:<- [:get :view-id]
|
:<- [:get :view-id]
|
||||||
(fn [[search-mode? chats-edit-mode? contacts-edit-mode? view-id]]
|
(fn [[search-mode? chats-edit-mode? contacts-edit-mode? view-id]]
|
||||||
(or search-mode?
|
(or search-mode?
|
||||||
(and (= view-id :chat-list) chats-edit-mode?)
|
(and (= view-id :home) chats-edit-mode?)
|
||||||
(and (= view-id :contact-list) contacts-edit-mode?))))
|
(and (= view-id :contact-list) contacts-edit-mode?))))
|
||||||
|
|
||||||
(reg-sub :network
|
(reg-sub :network
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
(when view-id
|
(when view-id
|
||||||
(let [current-view (validate-current-view view-id signed-up?)]
|
(let [current-view (validate-current-view view-id signed-up?)]
|
||||||
(let [component (case current-view
|
(let [component (case current-view
|
||||||
(:wallet :chat-list :my-profile) main-tabs
|
(:home :wallet :my-profile) main-tabs
|
||||||
:wallet-list wallet-list-screen
|
:wallet-list wallet-list-screen
|
||||||
:wallet-send-transaction send-transaction
|
:wallet-send-transaction send-transaction
|
||||||
:wallet-transaction-sent transaction-sent
|
:wallet-transaction-sent transaction-sent
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
[re-frame/trim-v]
|
[re-frame/trim-v]
|
||||||
(fn [{{:keys [wallet]} :db} [{:keys [whisper-identity]}]]
|
(fn [{{:keys [wallet]} :db} [{:keys [whisper-identity]}]]
|
||||||
{:dispatch-n [[:navigate-back]
|
{:dispatch-n [[:navigate-back]
|
||||||
[:navigate-to-clean :chat-list]
|
[:navigate-to-clean :home]
|
||||||
[:add-chat-loaded-event whisper-identity
|
[:add-chat-loaded-event whisper-identity
|
||||||
[::wallet-send-chat-request (some-> wallet :request-transaction :amount money/wei->ether str)]]
|
[::wallet-send-chat-request (some-> wallet :request-transaction :amount money/wei->ether str)]]
|
||||||
[:start-chat whisper-identity]]}))
|
[:start-chat whisper-identity]]}))
|
||||||
|
|
|
@ -211,9 +211,9 @@
|
||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
[toolbar-view current-tab unsigned-transactions-count filter-data]
|
[toolbar-view current-tab unsigned-transactions-count filter-data]
|
||||||
[tabs current-tab]
|
[tabs current-tab]
|
||||||
(case current-tab
|
[(case current-tab
|
||||||
:transactions-history [history-list]
|
:transactions-history history-list
|
||||||
:unsigned-transactions [unsigned-list])]))
|
:unsigned-transactions unsigned-list)]]))
|
||||||
|
|
||||||
(defn- pretty-print-asset [symbol amount]
|
(defn- pretty-print-asset [symbol amount]
|
||||||
(case symbol
|
(case symbol
|
||||||
|
|
Loading…
Reference in New Issue