Compare commits

...
Author SHA1 Message Date
ibrkhalil 757d731eed Show community members if a member permission doesn't exist 2024-05-11 10:31:56 +03:00
ibrkhalil 7b536451ef Fix component tests 2024-05-11 07:25:42 +03:00
ibrkhalil 13febab085 Rebase 2024-05-11 07:25:42 +03:00
ibrkhalil 7a3652c8eb Less confusion 2024-05-11 07:25:41 +03:00
ibrkhalil 925bf82621 Chus idea, hide count by default until community data is in app-db if the data doesn't exist 2024-05-11 07:25:41 +03:00
ibrkhalil d1c36e32c7 clean 2024-05-11 07:25:40 +03:00
ibrkhalil 248354e868 Directory changes and following guidelines 2024-05-11 07:25:39 +03:00
ibrkhalil d2fc803f47 grammar 2024-05-11 07:25:39 +03:00
ibrkhalil 641523f011 Update case information 2024-05-11 07:25:38 +03:00
ibrkhalil af993cc227 Update KNOWN_ISSUES.md 2024-05-11 07:25:38 +03:00
Ibrahem Khalil 3c36577e26 clean 2024-05-11 07:25:37 +03:00
Ibrahem Khalil 9bc9998b49 clean 2024-05-11 07:25:37 +03:00
Ibrahem Khalil aa1ce42079 clean 2024-05-11 07:25:36 +03:00
Ibrahem Khalil cabe377938 clean 2024-05-11 07:25:36 +03:00
Ibrahem Khalil 5e5989ffa7 Hide member count on token-gated community link preview 2024-05-11 07:25:35 +03:00
Icaro Motta 22392464e0 Don't preload user & dev.user namespaces (#19985)
Reverts the preloading mechanism from PR
https://github.com/status-im/status-mobile/pull/19927, which introduced a
problem I couldn't find any satisfactory solution. The namespaces user and
dev.user were being preloaded by shadow-cljs, but the problem is that preloading
will fail if those namespaces don't exist in your file system.

I couldn't find any solution to conditionally preload namespaces via shadow-cljs
and ClojureScript unfortunately doesn't support conditional requires like
Clojure.

At least we got to keep the code to not lint them and the whole idea to start to
commit dev-only code inside src/dev/.
2024-05-10 15:42:04 -03:00
6 changed files with 62 additions and 41 deletions
+1 -8
View File
@@ -53,14 +53,7 @@
:dev {:devtools {:before-load-async status-im.setup.hot-reload/before-reload
:after-load-async status-im.setup.hot-reload/reload
:build-notify status-im.setup.hot-reload/build-notify
:preloads [;; We preload user namespaces so that
;; their symbols are available without
;; the developer having to manually
;; evaluate them after app
;; initialization.
user
dev.user
re-frisk-remote.preload
:preloads [re-frisk-remote.preload
status-im.setup.schema-preload
;; In order to use component test helpers in the REPL we
;; need to preload namespaces that are not normally required
@@ -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])
@@ -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?}])))])))
+16
View File
@@ -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)))))