Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
757d731eed | ||
|
|
7b536451ef | ||
|
|
13febab085 | ||
|
|
7a3652c8eb | ||
|
|
925bf82621 | ||
|
|
d1c36e32c7 | ||
|
|
248354e868 | ||
|
|
d2fc803f47 | ||
|
|
641523f011 | ||
|
|
af993cc227 | ||
|
|
3c36577e26 | ||
|
|
9bc9998b49 | ||
|
|
aa1ce42079 | ||
|
|
cabe377938 | ||
|
|
5e5989ffa7 |
@@ -9,26 +9,31 @@
|
||||
[schema.core :as schema]))
|
||||
|
||||
(defn- description-comp
|
||||
[description members-count active-members-count]
|
||||
[rn/view
|
||||
[text/text
|
||||
{:size :paragraph-2
|
||||
:number-of-lines 3
|
||||
:accessibility-label :description}
|
||||
description]
|
||||
[rn/view {:style style/stat-container}
|
||||
[community-stat/view
|
||||
{:value members-count
|
||||
:icon :i/members
|
||||
:accessibility-label :members-count
|
||||
:style {:margin-right 12}
|
||||
:text-size :paragraph-2}]
|
||||
(when active-members-count
|
||||
[community-stat/view
|
||||
{:value active-members-count
|
||||
:icon :i/active-members
|
||||
:accessibility-label :active-members-count
|
||||
:text-size :paragraph-2}])]])
|
||||
[description members-count active-members-count show-members-count?]
|
||||
(let [has-members? (pos? members-count)
|
||||
has-active-members? (pos? active-members-count)]
|
||||
[rn/view
|
||||
[text/text
|
||||
{:size :paragraph-2
|
||||
:number-of-lines 3
|
||||
:accessibility-label :description}
|
||||
description]
|
||||
(when show-members-count?
|
||||
[rn/view
|
||||
{:style style/stat-container}
|
||||
(when has-members?
|
||||
[community-stat/view
|
||||
{:value members-count
|
||||
:icon :i/members
|
||||
:accessibility-label :members-count
|
||||
:style {:margin-right 12}
|
||||
:text-size :paragraph-2}])
|
||||
(when has-active-members?
|
||||
[community-stat/view
|
||||
{:value active-members-count
|
||||
:icon :i/active-members
|
||||
:accessibility-label :active-members-count
|
||||
:text-size :paragraph-2}])])]))
|
||||
|
||||
(defn- title-comp
|
||||
[title]
|
||||
@@ -74,7 +79,7 @@
|
||||
|
||||
(defn- view-internal
|
||||
[{:keys [title description loading? icon banner members-count active-members-count
|
||||
on-press size]}]
|
||||
on-press size show-members-count?]}]
|
||||
(let [theme (quo.theme/use-theme)]
|
||||
[rn/pressable
|
||||
{:style (style/container size theme)
|
||||
@@ -88,7 +93,7 @@
|
||||
[logo-comp icon])
|
||||
[title-comp title]]
|
||||
(when description
|
||||
[description-comp description members-count active-members-count])
|
||||
[description-comp description members-count active-members-count show-members-count?])
|
||||
(when banner
|
||||
[thumbnail-comp banner size])])]))
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
:members-count "20"
|
||||
:loading? false
|
||||
:active-members-count "15"
|
||||
:type :community})
|
||||
:type :community
|
||||
:show-members-count? true})
|
||||
|
||||
(h/describe "Internal link card - Community"
|
||||
(h/test "renders with most common props"
|
||||
|
||||
@@ -18,5 +18,6 @@
|
||||
[:active-members-count {:optional true} [:maybe [:or :int :string]]]
|
||||
[:customization-color {:optional true} [:maybe :schema.common/customization-color]]
|
||||
[:emoji-hash {:optional true} [:maybe :string]]
|
||||
[:size {:optional true} [:maybe :keyword]]]]]
|
||||
[:size {:optional true} [:maybe :keyword]]
|
||||
[:show-members-count? {:optional true} [:maybe :boolean]]]]]
|
||||
:any])
|
||||
|
||||
+14
-9
@@ -15,14 +15,19 @@
|
||||
community-icon :icon
|
||||
community-banner :banner
|
||||
community-name :display-name
|
||||
members-count :members-count} community]
|
||||
members-count :members-count
|
||||
community-id :community-id} community
|
||||
token-gated-not-a-member? (rf/sub
|
||||
[:communities/token-gated-not-a-member?
|
||||
community-id])]
|
||||
^{:key url}
|
||||
[quo/internal-link-card
|
||||
{:type :community
|
||||
:size :message
|
||||
:description community-description
|
||||
:members-count members-count
|
||||
:title community-name
|
||||
:banner (:url community-banner)
|
||||
:icon (:url community-icon)
|
||||
:on-press #(rf/dispatch [:universal-links/handle-url url])}])))])))
|
||||
{:type :community
|
||||
:size :message
|
||||
:description community-description
|
||||
:members-count members-count
|
||||
:title community-name
|
||||
:banner (:url community-banner)
|
||||
:icon (:url community-icon)
|
||||
:on-press #(rf/dispatch [:universal-links/handle-url url])
|
||||
:show-members-count? token-gated-not-a-member?}])))])))
|
||||
|
||||
@@ -427,3 +427,19 @@
|
||||
(fn [[permissions] _]
|
||||
(let [all-tokens (apply concat (map :tokens permissions))]
|
||||
(boolean (some seq all-tokens)))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:communities/token-gated-not-a-member?
|
||||
(fn [[_ community-id]]
|
||||
[(re-frame/subscribe [:communities/community community-id])])
|
||||
(fn [{:keys [token-permissions joined] :as community}]
|
||||
(let [token-permission-to-become-member-or-admin (->> token-permissions
|
||||
(into {})
|
||||
vals
|
||||
(some (fn [{community-permission-type :type}]
|
||||
(boolean
|
||||
(constants/community-role-permissions
|
||||
community-permission-type)))))]
|
||||
(or joined
|
||||
(and (not joined) (empty? token-permissions) (seq community))
|
||||
(not token-permission-to-become-member-or-admin)))))
|
||||
|
||||
Reference in New Issue
Block a user