mirror of
https://github.com/status-im/status-react.git
synced 2025-01-24 01:39:12 +00:00
replace to-datasource2
Former-commit-id: 85e05a451dcd87db0df35b25db6e3a23bbe7fcbe
This commit is contained in:
parent
96821edf6b
commit
8de3be1f6f
@ -10,7 +10,7 @@
|
|||||||
list-item]]
|
list-item]]
|
||||||
[syng-im.chat.styles.chat :as st]
|
[syng-im.chat.styles.chat :as st]
|
||||||
[syng-im.resources :as res]
|
[syng-im.resources :as res]
|
||||||
[syng-im.utils.listview :refer [to-datasource2]]
|
[syng-im.utils.listview :refer [to-datasource]]
|
||||||
[syng-im.components.invertible-scroll-view :refer [invertible-scroll-view]]
|
[syng-im.components.invertible-scroll-view :refer [invertible-scroll-view]]
|
||||||
[syng-im.chat.views.message :refer [chat-message]]
|
[syng-im.chat.views.message :refer [chat-message]]
|
||||||
[syng-im.chat.views.new-message :refer [chat-message-new]]))
|
[syng-im.chat.views.new-message :refer [chat-message-new]]))
|
||||||
@ -169,7 +169,7 @@
|
|||||||
:renderScrollComponent #(invertible-scroll-view (js->clj %))
|
:renderScrollComponent #(invertible-scroll-view (js->clj %))
|
||||||
:onEndReached #(dispatch [:load-more-messages])
|
:onEndReached #(dispatch [:load-more-messages])
|
||||||
:enableEmptySections true
|
:enableEmptySections true
|
||||||
:dataSource (to-datasource2 @messages)}]))))
|
:dataSource (to-datasource @messages)}]))))
|
||||||
|
|
||||||
(defn chat []
|
(defn chat []
|
||||||
(let [is-active (subscribe [:chat :is-active])
|
(let [is-active (subscribe [:chat :is-active])
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
(ns syng-im.chat.views.suggestions
|
(ns syng-im.chat.views.suggestions
|
||||||
(:require-macros
|
|
||||||
[natal-shell.core :refer [with-error-view]])
|
|
||||||
(:require [re-frame.core :refer [subscribe dispatch]]
|
(:require [re-frame.core :refer [subscribe dispatch]]
|
||||||
[syng-im.components.react :refer [view
|
[syng-im.components.react :refer [view
|
||||||
text
|
text
|
||||||
@ -25,7 +23,7 @@
|
|||||||
[text {:style st/suggestion-description} description]]])
|
[text {:style st/suggestion-description} description]]])
|
||||||
|
|
||||||
(defn render-row [row _ _]
|
(defn render-row [row _ _]
|
||||||
(list-item [suggestion-list-item (js->clj row :keywordize-keys true)]))
|
(list-item [suggestion-list-item row]))
|
||||||
|
|
||||||
(defn suggestions-view []
|
(defn suggestions-view []
|
||||||
(let [suggestions-atom (subscribe [:get-suggestions])]
|
(let [suggestions-atom (subscribe [:get-suggestions])]
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
text
|
text
|
||||||
image
|
image
|
||||||
touchable-highlight]]
|
touchable-highlight]]
|
||||||
[syng-im.utils.listview :refer [to-datasource2]]
|
[syng-im.utils.listview :refer [to-datasource]]
|
||||||
[reagent.core :as r]
|
[reagent.core :as r]
|
||||||
[syng-im.chats-list.views.chat-list-item :refer [chat-list-item]]
|
[syng-im.chats-list.views.chat-list-item :refer [chat-list-item]]
|
||||||
[syng-im.components.action-button :refer [action-button
|
[syng-im.components.action-button :refer [action-button
|
||||||
@ -31,7 +31,7 @@
|
|||||||
(fn []
|
(fn []
|
||||||
[view st/chats-container
|
[view st/chats-container
|
||||||
[chats-list-toolbar]
|
[chats-list-toolbar]
|
||||||
[list-view {:dataSource (to-datasource2 (vals @chats))
|
[list-view {:dataSource (to-datasource (vals @chats))
|
||||||
:renderRow (fn [row _ _]
|
:renderRow (fn [row _ _]
|
||||||
(list-item [chat-list-item row]))
|
(list-item [chat-list-item row]))
|
||||||
:style st/list-container}]
|
:style st/list-container}]
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
(defn contact-list []
|
(defn contact-list []
|
||||||
(let [contacts (subscribe [:get :contacts])]
|
(let [contacts (subscribe [:get :contacts])]
|
||||||
(fn []
|
(fn []
|
||||||
(let [contacts-ds (lw/to-datasource2 @contacts)]
|
(let [contacts-ds (lw/to-datasource @contacts)]
|
||||||
[view st/contacts-list-container
|
[view st/contacts-list-container
|
||||||
[contact-list-toolbar]
|
[contact-list-toolbar]
|
||||||
(when contacts-ds
|
(when contacts-ds
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
(:require
|
(:require
|
||||||
[re-frame.core :refer [subscribe dispatch]]
|
[re-frame.core :refer [subscribe dispatch]]
|
||||||
[syng-im.utils.logging :as log]
|
[syng-im.utils.logging :as log]
|
||||||
[syng-im.utils.listview :refer [to-datasource2]]
|
[syng-im.utils.listview :refer [to-datasource]]
|
||||||
[syng-im.components.react :refer [view text list-view list-item]]
|
[syng-im.components.react :refer [view text list-view list-item]]
|
||||||
[syng-im.components.toolbar :refer [toolbar]]
|
[syng-im.components.toolbar :refer [toolbar]]
|
||||||
[syng-im.discovery.views.popular-list-item :refer [popular-list-item]]
|
[syng-im.discovery.views.popular-list-item :refer [popular-list-item]]
|
||||||
@ -25,7 +25,7 @@
|
|||||||
(log/debug "Got discoveries: " @discoveries)
|
(log/debug "Got discoveries: " @discoveries)
|
||||||
(fn []
|
(fn []
|
||||||
(let [items @discoveries
|
(let [items @discoveries
|
||||||
datasource (to-datasource2 items)]
|
datasource (to-datasource items)]
|
||||||
[view st/discovery-tag-container
|
[view st/discovery-tag-container
|
||||||
[toolbar {:nav-action {:image {:source {:uri :icon_back}
|
[toolbar {:nav-action {:image {:source {:uri :icon_back}
|
||||||
:style st/icon-back}
|
:style st/icon-back}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
touchable-highlight
|
touchable-highlight
|
||||||
text]]
|
text]]
|
||||||
[syng-im.discovery.styles :as st]
|
[syng-im.discovery.styles :as st]
|
||||||
[syng-im.utils.listview :refer [to-datasource2]]
|
[syng-im.utils.listview :refer [to-datasource]]
|
||||||
[syng-im.discovery.views.popular-list-item :refer [popular-list-item]]))
|
[syng-im.discovery.views.popular-list-item :refer [popular-list-item]]))
|
||||||
|
|
||||||
(defn render-row [row _ _]
|
(defn render-row [row _ _]
|
||||||
@ -27,7 +27,7 @@
|
|||||||
[text {:style st/tag-name} (str " #" (name tag))]]]
|
[text {:style st/tag-name} (str " #" (name tag))]]]
|
||||||
[view st/tag-count-container
|
[view st/tag-count-container
|
||||||
[text {:style st/tag-count} count]]]
|
[text {:style st/tag-count} count]]]
|
||||||
[list-view {:dataSource (to-datasource2 @discoveries)
|
[list-view {:dataSource (to-datasource @discoveries)
|
||||||
:enableEmptySections true
|
:enableEmptySections true
|
||||||
:renderRow render-row
|
:renderRow render-row
|
||||||
:renderSeparator render-separator
|
:renderSeparator render-separator
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
(:require
|
(:require
|
||||||
[re-frame.core :refer [subscribe]]
|
[re-frame.core :refer [subscribe]]
|
||||||
[syng-im.components.react :refer [view list-view list-item]]
|
[syng-im.components.react :refer [view list-view list-item]]
|
||||||
[syng-im.utils.listview :refer [to-datasource2]]
|
[syng-im.utils.listview :refer [to-datasource]]
|
||||||
[syng-im.discovery.styles :as st]
|
[syng-im.discovery.styles :as st]
|
||||||
[syng-im.discovery.views.popular-list-item
|
[syng-im.discovery.views.popular-list-item
|
||||||
:refer [popular-list-item]]))
|
:refer [popular-list-item]]))
|
||||||
@ -18,7 +18,7 @@
|
|||||||
(let [discoveries (subscribe [:get :discoveries])]
|
(let [discoveries (subscribe [:get :discoveries])]
|
||||||
(fn []
|
(fn []
|
||||||
;; todo fetch more on :onEndReached
|
;; todo fetch more on :onEndReached
|
||||||
[list-view {:dataSource (to-datasource2 @discoveries)
|
[list-view {:dataSource (to-datasource @discoveries)
|
||||||
:renderRow render-row
|
:renderRow render-row
|
||||||
:renderSeparator render-separator
|
:renderSeparator render-separator
|
||||||
:style st/recent-list}])))
|
:style st/recent-list}])))
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
list-item]]
|
list-item]]
|
||||||
[syng-im.components.styles :refer [color-purple]]
|
[syng-im.components.styles :refer [color-purple]]
|
||||||
[syng-im.components.toolbar :refer [toolbar]]
|
[syng-im.components.toolbar :refer [toolbar]]
|
||||||
[syng-im.utils.listview :refer [to-datasource2]]
|
[syng-im.utils.listview :refer [to-datasource]]
|
||||||
[syng-im.new-group.views.contact :refer [new-group-contact]]
|
[syng-im.new-group.views.contact :refer [new-group-contact]]
|
||||||
[syng-im.new-group.styles :as st]))
|
[syng-im.new-group.styles :as st]))
|
||||||
|
|
||||||
@ -40,7 +40,7 @@
|
|||||||
(defn new-group []
|
(defn new-group []
|
||||||
(let [contacts (subscribe [:all-contacts])]
|
(let [contacts (subscribe [:all-contacts])]
|
||||||
(fn []
|
(fn []
|
||||||
(let [contacts-ds (to-datasource2 @contacts)]
|
(let [contacts-ds (to-datasource @contacts)]
|
||||||
[view st/new-group-container
|
[view st/new-group-container
|
||||||
[new-group-toolbar]
|
[new-group-toolbar]
|
||||||
[view st/chat-name-container
|
[view st/chat-name-container
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
[syng-im.resources :as res]
|
[syng-im.resources :as res]
|
||||||
[syng-im.components.react :refer [view list-view list-item]]
|
[syng-im.components.react :refer [view list-view list-item]]
|
||||||
[syng-im.components.toolbar :refer [toolbar]]
|
[syng-im.components.toolbar :refer [toolbar]]
|
||||||
[syng-im.utils.listview :refer [to-datasource2]]
|
[syng-im.utils.listview :refer [to-datasource]]
|
||||||
[syng-im.participants.views.contact
|
[syng-im.participants.views.contact
|
||||||
:refer [participant-contact]]
|
:refer [participant-contact]]
|
||||||
[reagent.core :as r]
|
[reagent.core :as r]
|
||||||
@ -24,7 +24,7 @@
|
|||||||
(defn new-participants [{:keys [navigator]}]
|
(defn new-participants [{:keys [navigator]}]
|
||||||
(let [contacts (subscribe [:all-new-contacts])]
|
(let [contacts (subscribe [:all-new-contacts])]
|
||||||
(fn []
|
(fn []
|
||||||
(let [contacts-ds (to-datasource2 @contacts)]
|
(let [contacts-ds (to-datasource @contacts)]
|
||||||
[view st/participants-container
|
[view st/participants-container
|
||||||
[new-participants-toolbar navigator]
|
[new-participants-toolbar navigator]
|
||||||
[list-view {:dataSource contacts-ds
|
[list-view {:dataSource contacts-ds
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
touchable-highlight list-view
|
touchable-highlight list-view
|
||||||
list-item]]
|
list-item]]
|
||||||
[syng-im.components.toolbar :refer [toolbar]]
|
[syng-im.components.toolbar :refer [toolbar]]
|
||||||
[syng-im.utils.listview :refer [to-datasource2]]
|
[syng-im.utils.listview :refer [to-datasource]]
|
||||||
[syng-im.participants.views.contact
|
[syng-im.participants.views.contact
|
||||||
:refer [participant-contact]]
|
:refer [participant-contact]]
|
||||||
[reagent.core :as r]
|
[reagent.core :as r]
|
||||||
@ -25,7 +25,7 @@
|
|||||||
(defn remove-participants []
|
(defn remove-participants []
|
||||||
(let [contacts (subscribe [:current-chat-contacts])]
|
(let [contacts (subscribe [:current-chat-contacts])]
|
||||||
(fn []
|
(fn []
|
||||||
(let [contacts-ds (to-datasource2 @contacts)]
|
(let [contacts-ds (to-datasource @contacts)]
|
||||||
[view st/participants-container
|
[view st/participants-container
|
||||||
[remove-participants-toolbar]
|
[remove-participants-toolbar]
|
||||||
[list-view {:dataSource contacts-ds
|
[list-view {:dataSource contacts-ds
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
(ns syng-im.utils.listview
|
(ns syng-im.utils.listview
|
||||||
(:require-macros [natal-shell.data-source :refer [data-source clone-with-rows]])
|
(:require-macros [natal-shell.data-source :refer [data-source]])
|
||||||
(:require [syng-im.components.realm]))
|
(:require [syng-im.components.realm]))
|
||||||
|
|
||||||
(defn to-datasource [items]
|
(defn clone-with-rows [ds rows]
|
||||||
(clone-with-rows (data-source {:rowHasChanged not=}) items))
|
|
||||||
|
|
||||||
(defn clone-with-rows2 [ds rows]
|
|
||||||
(.cloneWithRows ds (reduce (fn [ac el] (.push ac el) ac)
|
(.cloneWithRows ds (reduce (fn [ac el] (.push ac el) ac)
|
||||||
(clj->js []) rows)))
|
(clj->js []) rows)))
|
||||||
|
|
||||||
(defn to-datasource2 [items]
|
(defn to-datasource [items]
|
||||||
(clone-with-rows2 (data-source {:rowHasChanged not=}) items))
|
(clone-with-rows (data-source {:rowHasChanged not=}) items))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user