fix: hide buttons on community after joining (#14761)

This commit is contained in:
Jamie Caprani 2023-01-31 17:11:41 +00:00 committed by GitHub
parent 41124acf4d
commit 1f84128dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 13 deletions

View File

@ -170,7 +170,7 @@
(re-frame/dispatch [::failed-to-join %]))}]}) (re-frame/dispatch [::failed-to-join %]))}]})
(rf/defn request-to-join (rf/defn request-to-join
{:events [::request-to-join]} {:events [:communities/request-to-join]}
[cofx community-id] [cofx community-id]
{:json-rpc/call [{:method "wakuext_requestToJoinCommunity" {:json-rpc/call [{:method "wakuext_requestToJoinCommunity"
:params [{:communityId community-id}] :params [{:communityId community-id}]

View File

@ -323,7 +323,7 @@
[toolbar/toolbar [toolbar/toolbar
{:show-border? true {:show-border? true
:center [quo/button :center [quo/button
{:on-press #(rf/dispatch [::communities/request-to-join id]) {:on-press #(rf/dispatch [:communities/request-to-join id])
:type :secondary} :type :secondary}
(i18n/label :t/request-access)]}]) (i18n/label :t/request-access)]}])
:else :else

View File

@ -72,7 +72,7 @@
:mid-section {:type :text-with-description :mid-section {:type :text-with-description
:main-text nil :main-text nil
:description-img nil} :description-img nil}
:right-section-buttons (:right-section-buttons page-nav) :right-section-buttons page-nav
:left-section {:icon :i/close :left-section {:icon :i/close
:icon-background-color (icon-color) :icon-background-color (icon-color)
:on-press #(rf/dispatch [:navigate-back])}}] :on-press #(rf/dispatch [:navigate-back])}}]

View File

@ -2,7 +2,6 @@
(:require [quo.react-native :as rn] (:require [quo.react-native :as rn]
[quo2.core :as quo] [quo2.core :as quo]
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im.communities.core :as communities]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im2.contexts.communities.menus.request-to-join.style :as style] [status-im2.contexts.communities.menus.request-to-join.style :as style]
[utils.re-frame :as rf] [utils.re-frame :as rf]
@ -121,13 +120,13 @@
{:accessibility-label :join-community-button {:accessibility-label :join-community-button
:on-press (fn [] :on-press (fn []
(if can-join? (if can-join?
(do (rf/dispatch [:bottom-sheet/hide])
(rf/dispatch [::communities/join id]))
(do (do
(and can-request-access? (rf/dispatch [:communities/join id])
(not (pos? requested-to-join-at)) (rf/dispatch [:bottom-sheet/hide]))
(requests/can-request-access-again? requested-to-join-at)) (do (and can-request-access?
(rf/dispatch [::communities/request-to-join id]) (not (pos? requested-to-join-at))
(rf/dispatch [:bottom-sheet/hide])))) (requests/can-request-access-again? requested-to-join-at))
(rf/dispatch [:communities/request-to-join id])
(rf/dispatch [:bottom-sheet/hide]))))
:disabled (not @agreed-to-rules?) :disabled (not @agreed-to-rules?)
:style {:flex 1}} (request-to-join-text is-open?)]]]))) :style {:flex 1}} (request-to-join-text is-open?)]]])))

View File

@ -271,7 +271,7 @@
{:label (:label label) {:label (:label label)
:chevron-position :left}]]))) :chevron-position :left}]])))
(defn community-overview-right-section-buttons (defn page-nav-right-section-buttons
[id] [id]
[{:icon :i/options [{:icon :i/options
:background-color (scroll-page/icon-color) :background-color (scroll-page/icon-color)
@ -291,7 +291,7 @@
(fn [community] (fn [community]
[scroll-page/scroll-page [scroll-page/scroll-page
{:cover-image cover {:cover-image cover
:page-nav-right-section-buttons (community-overview-right-section-buttons id) :page-nav-right-section-buttons (page-nav-right-section-buttons id)
:name name :name name
:on-scroll #(reset! scroll-height %)} :on-scroll #(reset! scroll-height %)}