[Fix] Chat list sort in home screen (#15974)
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
parent
e8ced0a714
commit
6975d6ac48
|
@ -22,11 +22,12 @@
|
||||||
[_ index]
|
[_ index]
|
||||||
#js {:length 56 :offset (* 56 index) :index index})
|
#js {:length 56 :offset (* 56 index) :index index})
|
||||||
|
|
||||||
(defn filter-items-by-tab
|
(defn filter-and-sort-items-by-tab
|
||||||
[tab items]
|
[tab items]
|
||||||
(if (= tab :tab/groups)
|
(let [key (if (= tab :tab/groups) :group-chat :chat-id)]
|
||||||
(filter :group-chat items)
|
(->> items
|
||||||
(filter :chat-id items)))
|
(filter key)
|
||||||
|
(sort-by :timestamp >))))
|
||||||
|
|
||||||
(defn welcome-blank-chats
|
(defn welcome-blank-chats
|
||||||
[]
|
[]
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
(defn chats
|
(defn chats
|
||||||
[selected-tab top]
|
[selected-tab top]
|
||||||
(let [unfiltered-items (rf/sub [:chats-stack-items])
|
(let [unfiltered-items (rf/sub [:chats-stack-items])
|
||||||
items (filter-items-by-tab selected-tab unfiltered-items)]
|
items (filter-and-sort-items-by-tab selected-tab unfiltered-items)]
|
||||||
(if (empty? items)
|
(if (empty? items)
|
||||||
[welcome-blank-chats]
|
[welcome-blank-chats]
|
||||||
[rn/flat-list
|
[rn/flat-list
|
||||||
|
|
Loading…
Reference in New Issue