-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Community token gating component #19642
Conversation
Jenkins BuildsClick to see older builds (58)
|
4700b9c
to
83b9e97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool PR :) Approving in advance. Just left a few minor comments.
{:container-style style/divider} | ||
[text/text | ||
{:size :label | ||
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better if we can pass the theme
argument from the parent component view
to theme-colors
. Eventually we will be able to completely remove the dependency of theme-colors
in the global state quo.theme/theme-state
.
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40)}} | ||
(string/lower-case (i18n/label :t/or))]])]) | ||
|
||
(defn view-internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick one: missing private metadata.
:style style/you-hodl} | ||
(i18n/label (if satisfied? :t/you-hodl :t/you-must-hold))] | ||
(map-indexed (fn [index tokens-item] | ||
^{:key (str role "-tokens-" index)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unnecessary to concatenate strings for humans to form the unique key.
[tokens-row | ||
{:tokens tokens-item | ||
:first? (zero? index) | ||
:divider? (= index (dec (count tokens)))}]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can extract this calculation from the loop, and thus calculate the last index once outside.
Also, if I'm not my mistaken, count
is O(N) on sequences, so not ideal to be called in a loop.
(let [theme (theme/use-theme-value)] | ||
[rn/view {:style (style/container theme)} | ||
[rn/view | ||
{:style style/eligibility-row} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible while reviewing your code for style, consider checking if you can join these {:style ...}
lines on the line preceding it. There are lots of these unnecessary line breaks in the codebase (it's not just from your PR), and unfortunately for us, zprint can't auto-format this case without causing other headaches. A few lines below the {:on-press ...}
can also be moved to the previous line.
@@ -140,46 +121,39 @@ | |||
highest-permission-role]} (rf/sub [:community/token-gated-overview id]) | |||
highest-role-text | |||
(i18n/label | |||
(communities.utils/role->translation-key highest-permission-role :t/member))] | |||
(communities.utils/role->translation-key highest-permission-role :t/member)) | |||
info-button-handler (fn [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the function is not closing over any value, it's better to extract it to its own var for performance reasons and for clarity.
:on-press (if config/community-accounts-selection-enabled? | ||
#(rf/dispatch [:open-modal :community-account-selection-sheet | ||
{:community-id id}]) | ||
#(rf/dispatch [:open-modal :community-requests-to-join |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can cache these functions with use-callback
, especially because they only depend on the id
, which basically won't ever change. This should help Reagent not needlessly process community-token-gating
.
c8d2b9e
to
2a4ed2d
Compare
87% of end-end tests have passed
Failed tests (5)Click to expandClass TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestActivityCenterContactRequestMultipleDevicePR:
Class TestWalletMultipleDevice:
Expected to fail tests (2)Click to expandClass TestGroupChatMultipleDeviceMergedNewUI:
Class TestCommunityOneDeviceMerged:
Passed tests (45)Click to expandClass TestGroupChatMultipleDeviceMergedNewUI:
Class TestActivityMultipleDevicePRTwo:
Class TestCommunityMultipleDeviceMerged:
Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:
Class TestCommunityOneDeviceMerged:
Class TestDeepLinksOneDevice:
Class TestCommunityMultipleDeviceMergedTwo:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestActivityMultipleDevicePR:
Class TestActivityCenterContactRequestMultipleDevicePR:
Class TestWalletOneDevice:
|
Hi @ajayesivan ! Thanks for your PR! |
Hi @ajayesivan ! |
Hi @mariia-skrypnyk, Apologies for the delay in reply. I was AFK.
This PR implements the whole "Community token gating" component. Which means all variations should work as per the design.
Let me know if you have further questions. Thank you! |
Hi @ajayesivan ! |
@mariia-skrypnyk that makes sense. We can skip manual qa. |
@Francesca-G can you review when you have a time? Thanks!! |
2a4ed2d
to
61f4821
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the design review :)
Hey @ajayesivan ! Please take a look at design review of Francesca placed above 👆. |
4da5d7c
to
9e82bb3
Compare
Hi @Francesca-G, I have fixed the spacing issue. The button text color issue in the disabled state is not related to this PR. It seems like an issue with the button component implementation. The fix may not be straightforward since the opacity property behaves differently in iOS and Android as mentioned here. Also, the button component has many variations and requires a good amount of testing when introducing a change to avoid further regressions. Is it okay if we address it as a follow-up? |
The vertical spacing seems to be only fixed in the top section where the text is. Please have a look here
Sure 👍 |
986ff43
to
16109aa
Compare
Hi @Francesca-G, I have fixed the design issues. Could you take another look? Thanks! |
Followup issue: #20056 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all good now 👍
9eeaa2e
to
0a969fb
Compare
0a969fb
to
71abfe3
Compare
fixes #19320
Summary
This PR implements the
community/community-token-gating
component and uses it in the community overview screen.Resulting fixes or changes
token-gating
componentAreas that may be impacted
Screenshots
status: ready