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]))
|
[schema.core :as schema]))
|
||||||
|
|
||||||
(defn- description-comp
|
(defn- description-comp
|
||||||
[description members-count active-members-count]
|
[description members-count active-members-count show-members-count?]
|
||||||
[rn/view
|
(let [has-members? (pos? members-count)
|
||||||
[text/text
|
has-active-members? (pos? active-members-count)]
|
||||||
{:size :paragraph-2
|
[rn/view
|
||||||
:number-of-lines 3
|
[text/text
|
||||||
:accessibility-label :description}
|
{:size :paragraph-2
|
||||||
description]
|
:number-of-lines 3
|
||||||
[rn/view {:style style/stat-container}
|
:accessibility-label :description}
|
||||||
[community-stat/view
|
description]
|
||||||
{:value members-count
|
(when show-members-count?
|
||||||
:icon :i/members
|
[rn/view
|
||||||
:accessibility-label :members-count
|
{:style style/stat-container}
|
||||||
:style {:margin-right 12}
|
(when has-members?
|
||||||
:text-size :paragraph-2}]
|
[community-stat/view
|
||||||
(when active-members-count
|
{:value members-count
|
||||||
[community-stat/view
|
:icon :i/members
|
||||||
{:value active-members-count
|
:accessibility-label :members-count
|
||||||
:icon :i/active-members
|
:style {:margin-right 12}
|
||||||
:accessibility-label :active-members-count
|
:text-size :paragraph-2}])
|
||||||
: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
|
(defn- title-comp
|
||||||
[title]
|
[title]
|
||||||
@@ -74,7 +79,7 @@
|
|||||||
|
|
||||||
(defn- view-internal
|
(defn- view-internal
|
||||||
[{:keys [title description loading? icon banner members-count active-members-count
|
[{: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)]
|
(let [theme (quo.theme/use-theme)]
|
||||||
[rn/pressable
|
[rn/pressable
|
||||||
{:style (style/container size theme)
|
{:style (style/container size theme)
|
||||||
@@ -88,7 +93,7 @@
|
|||||||
[logo-comp icon])
|
[logo-comp icon])
|
||||||
[title-comp title]]
|
[title-comp title]]
|
||||||
(when description
|
(when description
|
||||||
[description-comp description members-count active-members-count])
|
[description-comp description members-count active-members-count show-members-count?])
|
||||||
(when banner
|
(when banner
|
||||||
[thumbnail-comp banner size])])]))
|
[thumbnail-comp banner size])])]))
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@
|
|||||||
:members-count "20"
|
:members-count "20"
|
||||||
:loading? false
|
:loading? false
|
||||||
:active-members-count "15"
|
:active-members-count "15"
|
||||||
:type :community})
|
:type :community
|
||||||
|
:show-members-count? true})
|
||||||
|
|
||||||
(h/describe "Internal link card - Community"
|
(h/describe "Internal link card - Community"
|
||||||
(h/test "renders with most common props"
|
(h/test "renders with most common props"
|
||||||
|
|||||||
@@ -18,5 +18,6 @@
|
|||||||
[:active-members-count {:optional true} [:maybe [:or :int :string]]]
|
[:active-members-count {:optional true} [:maybe [:or :int :string]]]
|
||||||
[:customization-color {:optional true} [:maybe :schema.common/customization-color]]
|
[:customization-color {:optional true} [:maybe :schema.common/customization-color]]
|
||||||
[:emoji-hash {:optional true} [:maybe :string]]
|
[:emoji-hash {:optional true} [:maybe :string]]
|
||||||
[:size {:optional true} [:maybe :keyword]]]]]
|
[:size {:optional true} [:maybe :keyword]]
|
||||||
|
[:show-members-count? {:optional true} [:maybe :boolean]]]]]
|
||||||
:any])
|
:any])
|
||||||
|
|||||||
+14
-9
@@ -15,14 +15,19 @@
|
|||||||
community-icon :icon
|
community-icon :icon
|
||||||
community-banner :banner
|
community-banner :banner
|
||||||
community-name :display-name
|
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}
|
^{:key url}
|
||||||
[quo/internal-link-card
|
[quo/internal-link-card
|
||||||
{:type :community
|
{:type :community
|
||||||
:size :message
|
:size :message
|
||||||
:description community-description
|
:description community-description
|
||||||
:members-count members-count
|
:members-count members-count
|
||||||
:title community-name
|
:title community-name
|
||||||
:banner (:url community-banner)
|
:banner (:url community-banner)
|
||||||
:icon (:url community-icon)
|
:icon (:url community-icon)
|
||||||
:on-press #(rf/dispatch [:universal-links/handle-url url])}])))])))
|
:on-press #(rf/dispatch [:universal-links/handle-url url])
|
||||||
|
:show-members-count? token-gated-not-a-member?}])))])))
|
||||||
|
|||||||
@@ -427,3 +427,19 @@
|
|||||||
(fn [[permissions] _]
|
(fn [[permissions] _]
|
||||||
(let [all-tokens (apply concat (map :tokens permissions))]
|
(let [all-tokens (apply concat (map :tokens permissions))]
|
||||||
(boolean (some seq all-tokens)))))
|
(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