Skip to content

Commit abe4dc7

Browse files
authored
Update communities discover screen
* Fix: discover communities missing data * made community tags scrollable
1 parent 2ab491f commit abe4dc7

File tree

7 files changed

+36
-30
lines changed

7 files changed

+36
-30
lines changed

Diff for: src/quo2/components/community/community_card_view.cljs

+6-8
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
:height 230
1717
:border-radius 20}
1818
:on-press on-press}
19-
[rn/view
20-
{:flex 1}
19+
[rn/view {:style style/detail-container}
2120
[rn/view (style/community-cover-container 60)
2221
[rn/image
2322
{:source cover
24-
:style
25-
{:flex 1
26-
:border-top-right-radius 20
27-
:border-top-left-radius 20}}]]
23+
:style {:flex 1
24+
:border-top-right-radius 20
25+
:border-top-left-radius 20}}]]
2826
[rn/view (style/card-view-content-container 12)
2927
[rn/view (style/card-view-chat-icon 48)
3028
[icon/community-icon {:images images} 48]]
@@ -38,7 +36,7 @@
3836
{:title name
3937
:description description}]
4038
[rn/view {:style (style/card-stats-position)}
41-
[community-view/community-stats-column :card-view]]
39+
[community-view/community-stats-column
40+
{:type :card-view}]]
4241
[rn/view {:style (style/community-tags-position)}
4342
[community-view/community-tags tags]]]]]]])
44-

Diff for: src/quo2/components/community/community_list_view.cljs

+3-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
(merge {:style {:height 56
4747
:border-radius 16}}
4848
props)
49-
[rn/view {:flex 1}
49+
[rn/view {:style style/detail-container}
5050
[rn/view (style/list-info-container)
5151
[community-icon/community-icon
5252
{:images community-icon} 32]
@@ -64,7 +64,8 @@
6464
colors/neutral-40
6565
colors/neutral-60))}}
6666
name]
67-
[community-view/community-stats-column :list-view]]
67+
[community-view/community-stats-column
68+
{:type :list-view}]]
6869
(if (= status :gated)
6970
[community-view/permission-tag-container
7071
{:locked? locked?

Diff for: src/quo2/components/community/community_view.cljs

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[quo2.components.tags.permission-tag :as permission]
66
[quo2.components.tags.tag :as tag]
77
[quo2.foundations.colors :as colors]
8+
[quo.gesture-handler :as gesture-handler] ;;TODO move to quo2
89
[react-native.core :as rn]))
910

1011
(defn community-stats
@@ -23,7 +24,7 @@
2324
members-count]])
2425

2526
(defn community-stats-column
26-
[type]
27+
[{:keys [type]}]
2728
(let [icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40)]
2829
[rn/view
2930
(if (= type :card-view)
@@ -41,7 +42,9 @@
4142

4243
(defn community-tags
4344
[tags]
44-
[rn/view (style/community-tags-container)
45+
[gesture-handler/scroll-view
46+
{:shows-horizontal-scroll-indicator false
47+
:horizontal true}
4548
(for [{:keys [name emoji]} tags]
4649
^{:key name}
4750
[rn/view {:margin-right 8}

Diff for: src/quo2/components/community/style.cljs

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
colors/white
2323
colors/neutral-90)})
2424

25+
(def detail-container
26+
{:flex 1})
27+
2528
(defn stats-count-container
2629
[]
2730
{:flex-direction :row
@@ -37,10 +40,6 @@
3740
{:flex-direction :row
3841
:align-items :center})
3942

40-
(defn community-tags-container
41-
[]
42-
{:flex-direction :row})
43-
4443
(defn card-stats-position
4544
[]
4645
{:position :absolute
@@ -62,7 +61,7 @@
6261
:bottom 0
6362
:left 0
6463
:right 0
65-
:height 20
64+
:border-radius 20
6665
:padding-horizontal padding-horizontal
6766
:border-top-right-radius 16
6867
:border-top-left-radius 16

Diff for: src/status_im2/contexts/communities/discover/style.cljs

+5-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222

2323
(def featured-list-container
2424
{:flex-direction :row
25-
:overflow :hidden
26-
:margin-bottom 24
27-
:margin-left 20
28-
:padding-right 20})
25+
:overflow :hidden})
26+
27+
(def flat-list-container
28+
{:padding-bottom 24
29+
:padding-horizontal 20})
2930

3031
(def other-communities-container
3132
{:flex 1

Diff for: src/status_im2/contexts/communities/discover/view.cljs

+12-8
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
[quo2.core :as quo]
55
[quo2.foundations.colors :as colors]
66
[react-native.core :as rn]
7+
[react-native.platform :as platform]
78
[reagent.core :as reagent]
89
[status-im2.common.resources :as resources]
910
[status-im2.contexts.communities.menus.community-options.view :as options]
1011
[status-im.ui.screens.communities.community :as community]
1112
[status-im.ui.components.react :as react]
12-
[react-native.platform :as platform]
1313
[status-im2.common.scroll-page.view :as scroll-page]
1414
[status-im2.contexts.communities.discover.style :as style]
1515
[utils.re-frame :as rf]))
@@ -22,7 +22,7 @@
2222
:group [{:id 1
2323
:token-icon (resources/get-mock-image :status-logo)}]}]}})
2424

25-
(defn render-fn
25+
(defn community-list-item
2626
[community-item _ _ {:keys [width view-type]}]
2727
(let [item (merge community-item
2828
(get mock-community-item-data :data))
@@ -98,18 +98,20 @@
9898
{:style style/featured-list-container
9999
:on-layout #(swap! view-size
100100
(fn []
101-
(- (oops/oget % "nativeEvent.layout.width") 20)))}
101+
(- (oops/oget % "nativeEvent.layout.width") 40)))}
102102
(when-not (= @view-size 0)
103103
[rn/flat-list
104104
{:key-fn :id
105105
:horizontal true
106106
:keyboard-should-persist-taps :always
107107
:shows-horizontal-scroll-indicator false
108+
:nestedScrollEnabled true
108109
:separator [rn/view {:width 12}]
109110
:data communities
110-
:render-fn render-fn
111+
:render-fn community-list-item
111112
:render-data {:width @view-size
112-
:view-type view-type}}])])))
113+
:view-type view-type}
114+
:content-container-style style/flat-list-container}])])))
113115

114116
(defn discover-communities-header
115117
[{:keys [featured-communities-count
@@ -120,7 +122,7 @@
120122
[screen-title]
121123
[featured-communities-header featured-communities-count]
122124
[featured-list featured-communities view-type]
123-
[quo/separator]
125+
[quo/separator {:style {:margin-horizontal 20}}]
124126
[discover-communities-segments selected-tab false]])
125127

126128
(defn other-communities-list
@@ -131,14 +133,16 @@
131133
(let [community-id (when communities-ids item)
132134
community (if communities
133135
item
134-
[rf/sub [:communities/home-item community-id]])]
136+
(rf/sub [:communities/home-item community-id]))
137+
cover {:uri (get-in (:images item) [:banner :uri])}]
135138
[rn/view
136139
{:key (str inner-index (:id community))
137140
:margin-bottom 16}
138141
(if (= view-type :card-view)
139142
[quo/community-card-view-item
140143
(merge community
141-
(get mock-community-item-data :data))
144+
(get mock-community-item-data :data)
145+
{:cover cover})
142146
#(rf/dispatch [:navigate-to :community-overview (:id community)])]
143147
[quo/communities-list-view-item
144148
{:on-press (fn []

Diff for: src/status_im2/contexts/quo_preview/tags/tag.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
(:labelled? @state))
8484
:resource (if (= :emoji (:type @state))
8585
(resources/get-image :music)
86-
:main-icons2/placeholder)})]]]]])))
86+
:i/placeholder)})]]]]])))
8787
(defn preview-tag
8888
[]
8989
[rn/view

0 commit comments

Comments
 (0)