-
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
Account selection: Use bottom sheet component #18919
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,81 +5,92 @@ | |
[react-native.gesture :as gesture] | ||
[status-im.common.password-authentication.view :as password-authentication] | ||
[status-im.contexts.communities.actions.accounts-selection.style :as style] | ||
[status-im.contexts.communities.actions.addresses-for-permissions.view :as addresses-for-permissions] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw, I'm trying to comment this as close to the ns as possible. Is this accounts selection really communities specific?? Will there be other areas in the application where we want to select the specific accounts?? For example purchasing ens names might have some feature similar to this needed? cc @clauxx There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @J-Son89, I think this question could be redirected to a designer or to the PO if you want to be really certain. My current understanding and what I remember from interactions with designers is that the account selection is very specific to communities and the UI is built for this use case. So even if we have a similar account selection feature like you mentioned, they would probably redesign some important parts. For example, in the account selection screen, the elements displayed are all tied to the concept of token permissions, which is stored at the community level. |
||
[status-im.contexts.communities.actions.airdrop-addresses.view :as airdrop-addresses] | ||
[status-im.contexts.communities.actions.community-rules.view :as community-rules] | ||
[status-im.contexts.communities.utils :as communities.utils] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn- join-community-and-navigate-back | ||
[id] | ||
(rf/dispatch [:password-authentication/show {:content (fn [] [password-authentication/view])} | ||
{:label (i18n/label :t/join-open-community) | ||
:on-press #(rf/dispatch [:communities/request-to-join-with-addresses | ||
{:community-id id :password %}])}]) | ||
(rf/dispatch [:navigate-back])) | ||
|
||
(defn view | ||
[] | ||
(let [{id :community-id} (rf/sub [:get-screen-params]) | ||
{:keys [name color images]} (rf/sub [:communities/community id]) | ||
airdrop-account (rf/sub [:communities/airdrop-account id]) | ||
selected-accounts (rf/sub [:communities/selected-permission-accounts id]) | ||
{:keys [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))] | ||
[rn/safe-area-view {:style style/container} | ||
[quo/page-nav | ||
{:text-align :left | ||
:icon-name :i/close | ||
:on-press #(rf/dispatch [:navigate-back]) | ||
:accessibility-label :back-button}] | ||
[quo/page-top | ||
{:title (i18n/label :t/request-to-join) | ||
:description :context-tag | ||
:context-tag {:type :community | ||
:size 24 | ||
:community-logo (get-in images [:thumbnail :uri]) | ||
:community-name name}}] | ||
[gesture/scroll-view | ||
[:<> | ||
[quo/text | ||
{:style style/section-title | ||
:accessibility-label :community-rules-title | ||
:weight :semi-bold | ||
:size :paragraph-1} | ||
(i18n/label :t/address-to-share)] | ||
[quo/category | ||
{:list-type :settings | ||
:data [{:title (i18n/label :t/join-as-a {:role highest-role-text}) | ||
:on-press #(rf/dispatch [:open-modal :addresses-for-permissions | ||
{:community-id id}]) | ||
:description :text | ||
:action :arrow | ||
:label :preview | ||
:label-props {:type :accounts | ||
:data selected-accounts} | ||
:description-props {:text (i18n/label :t/all-addresses)}} | ||
{:title (i18n/label :t/for-airdrops) | ||
:on-press #(rf/dispatch [:open-modal :airdrop-addresses | ||
{:community-id id}]) | ||
:description :text | ||
:action :arrow | ||
:label :preview | ||
:label-props {:type :accounts | ||
:data [airdrop-account]} | ||
:description-props {:text (:name airdrop-account)}}]}] | ||
[quo/text | ||
{:style style/section-title | ||
:accessibility-label :community-rules-title | ||
:weight :semi-bold | ||
:size :paragraph-1} | ||
(i18n/label :t/community-rules)] | ||
[community-rules/view id]]] | ||
[rn/view {:style (style/bottom-actions)} | ||
[quo/slide-button | ||
{:size :size-48 | ||
:track-text (i18n/label :t/slide-to-request-to-join) | ||
:track-icon :i/face-id | ||
:customization-color color | ||
:on-complete #(join-community-and-navigate-back id)}]]])) | ||
(let [{id :community-id} (rf/sub [:get-screen-params]) | ||
show-addresses-for-permissions (fn [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI: This is a performance optimization pattern we can apply more often. The community ID or most IDs for that matter will never change, so we can extract the community ID to a |
||
(rf/dispatch [:show-bottom-sheet | ||
{:community-id id | ||
:content addresses-for-permissions/view}])) | ||
show-airdrop-addresses (fn [] | ||
(rf/dispatch [:show-bottom-sheet | ||
{:community-id id | ||
:content airdrop-addresses/view}])) | ||
navigate-back #(rf/dispatch [:navigate-back]) | ||
join-and-go-back (fn [] | ||
(rf/dispatch [:password-authentication/show | ||
{:content (fn [] [password-authentication/view])} | ||
{:label (i18n/label :t/join-open-community) | ||
:on-press | ||
#(rf/dispatch | ||
[:communities/request-to-join-with-addresses | ||
{:community-id id :password %}])}]) | ||
(navigate-back))] | ||
(fn [] | ||
(let [{:keys [name color images]} (rf/sub [:communities/community id]) | ||
airdrop-account (rf/sub [:communities/airdrop-account id]) | ||
selected-accounts (rf/sub [:communities/selected-permission-accounts id]) | ||
{:keys [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))] | ||
[rn/safe-area-view {:style style/container} | ||
[quo/page-nav | ||
{:text-align :left | ||
:icon-name :i/close | ||
:on-press navigate-back | ||
:accessibility-label :back-button}] | ||
[quo/page-top | ||
{:title (i18n/label :t/request-to-join) | ||
:description :context-tag | ||
:context-tag {:type :community | ||
:size 24 | ||
:community-logo (get-in images [:thumbnail :uri]) | ||
:community-name name}}] | ||
[gesture/scroll-view | ||
[:<> | ||
[quo/text | ||
{:style style/section-title | ||
:accessibility-label :community-rules-title | ||
:weight :semi-bold | ||
:size :paragraph-1} | ||
(i18n/label :t/address-to-share)] | ||
[quo/category | ||
{:list-type :settings | ||
:data [{:title (i18n/label :t/join-as-a {:role highest-role-text}) | ||
:on-press show-addresses-for-permissions | ||
:description :text | ||
:action :arrow | ||
:label :preview | ||
:label-props {:type :accounts | ||
:data selected-accounts} | ||
:description-props {:text (i18n/label :t/all-addresses)}} | ||
{:title (i18n/label :t/for-airdrops) | ||
:on-press show-airdrop-addresses | ||
:description :text | ||
:action :arrow | ||
:label :preview | ||
:label-props {:type :accounts | ||
:data [airdrop-account]} | ||
:description-props {:text (:name airdrop-account)}}]}] | ||
[quo/text | ||
{:style style/section-title | ||
:accessibility-label :community-rules-title | ||
:weight :semi-bold | ||
:size :paragraph-1} | ||
(i18n/label :t/community-rules)] | ||
[community-rules/view id]]] | ||
[rn/view {:style (style/bottom-actions)} | ||
[quo/slide-button | ||
{:size :size-48 | ||
:track-text (i18n/label :t/slide-to-request-to-join) | ||
:track-icon :i/face-id | ||
:customization-color color | ||
:on-complete join-and-go-back}]]])))) |
This file was deleted.
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.
FYI:
style/container
is a function, so this is currently a bug. I just made this component identical in behavior to its cousinsettings.category.settings.view
.