communites home screen context actions (#14371)
This commit is contained in:
parent
cc733a379c
commit
e44d4c83c0
|
@ -325,7 +325,7 @@
|
|||
{:db (assoc db :communities/create-channel {})})
|
||||
|
||||
(fx/defn invite-people-pressed
|
||||
{:events [::invite-people-pressed]}
|
||||
{:events [:communities/invite-people-pressed]}
|
||||
[cofx id]
|
||||
(fx/merge cofx
|
||||
(reset-community-id-input id)
|
||||
|
@ -333,7 +333,7 @@
|
|||
(navigation/open-modal :invite-people-community {:invite? true})))
|
||||
|
||||
(fx/defn share-community-pressed
|
||||
{:events [::share-community-pressed]}
|
||||
{:events [:communities/share-community-pressed]}
|
||||
[cofx id]
|
||||
(fx/merge cofx
|
||||
(reset-community-id-input id)
|
||||
|
|
|
@ -87,14 +87,14 @@
|
|||
:title (i18n/label :t/invite-people)
|
||||
:icon :main-icons/share
|
||||
:accessibility-label :community-invite-people
|
||||
:on-press #(>evt [::communities/invite-people-pressed id])}])
|
||||
:on-press #(>evt [:communities/invite-people-pressed id])}])
|
||||
(when (and can-share? (not can-invite?))
|
||||
[quo/list-item
|
||||
{:theme :accent
|
||||
:title (i18n/label :t/invite-people)
|
||||
:icon :main-icons/share
|
||||
:accessibility-label :community-share
|
||||
:on-press #(>evt [::communities/share-community-pressed id])}])]))
|
||||
:on-press #(>evt [:communities/share-community-pressed id])}])]))
|
||||
|
||||
(defn community-actions [{:keys [id name images color can-manage-users?]}]
|
||||
(let [thumbnail-image (get-in images [:thumbnail :uri])]
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
(ns status-im.ui.screens.communities.community-options-bottom-sheet
|
||||
(:require [status-im.i18n.i18n :as i18n]
|
||||
[quo.react-native :as rn] [quo2.components.markdown.text :as text]
|
||||
[quo.react-native :as rn]
|
||||
[quo2.components.markdown.text :as text]
|
||||
[quo2.components.buttons.button :as button]
|
||||
[quo2.components.drawers.action-drawers :as action-drawers]
|
||||
[quo2.components.tags.context-tags :as context-tags]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.utils.handlers :refer [<sub >evt]]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im.communities.core :as communities]))
|
||||
|
||||
(def not-joined-options [{:icon :i/members
|
||||
(defn hide-sheet-and-dispatch [event]
|
||||
(rf/dispatch [:bottom-sheet/hide])
|
||||
(rf/dispatch event))
|
||||
|
||||
(def not-joined-options
|
||||
{:actions [{:icon :i/members
|
||||
:label (i18n/label :t/view-members)}
|
||||
{:icon :i/bullet-list
|
||||
:right-icon :i/chevron-right
|
||||
|
@ -18,27 +24,40 @@
|
|||
{:icon :i/qr-code
|
||||
:label (i18n/label :t/show-qr)}
|
||||
{:icon :i/share
|
||||
:label (i18n/label :t/share-community)}])
|
||||
:label (i18n/label :t/share-community)}]})
|
||||
|
||||
(def joined-options [{:icon :i/members
|
||||
:label (i18n/label :t/view-members)}
|
||||
(defn joined-options [id]
|
||||
{:actions [{:icon :i/members
|
||||
:accessibility-label :i/view-members
|
||||
:label (i18n/label :t/view-members)
|
||||
:on-press #(hide-sheet-and-dispatch [:navigate-to :community-members {:community-id id}])}
|
||||
{:icon :i/bullet-list
|
||||
:right-icon :i/chevron-right
|
||||
:accessibility-label :view-community-rules
|
||||
:label (i18n/label :t/view-community-rules)}
|
||||
{:icon :i/up-to-date
|
||||
:label (i18n/label :t/mark-as-read)}
|
||||
:accessibility-label :mark-as-read
|
||||
:label (i18n/label :t/mark-as-read)
|
||||
:on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-in-community-pressed id])}
|
||||
{:icon :i/muted
|
||||
:accessibility-label :mute-community
|
||||
:label (i18n/label :t/mute-community)
|
||||
:right-icon :i/chevron-right}
|
||||
{:icon :i/notifications
|
||||
:accessibility-label :community-notification-settings
|
||||
:label (i18n/label :t/community-notification-settings)
|
||||
:right-icon :i/chevron-right}
|
||||
{:icon :i/add-user
|
||||
:label (i18n/label :t/invite-contacts)}
|
||||
:accessibility-label :invite-people-from-contacts
|
||||
:label (i18n/label :t/invite-people-from-contacts)
|
||||
:on-press #(hide-sheet-and-dispatch [:communities/invite-people-pressed id])}
|
||||
{:icon :i/qr-code
|
||||
:accessibility-label :show-qr
|
||||
:label (i18n/label :t/show-qr)}
|
||||
{:icon :i/share
|
||||
:label (i18n/label :t/share-community)}])
|
||||
:accessibility-label :share-community
|
||||
:label (i18n/label :t/share-community)
|
||||
:on-press #(hide-sheet-and-dispatch [:communities/share-community-pressed id])}]})
|
||||
|
||||
(defn leave-sheet [community]
|
||||
[rn/view {:style {:flex 1 :margin-left 20 :margin-right 20 :margin-bottom 20}}
|
||||
|
@ -59,31 +78,34 @@
|
|||
:style {:margin-top 16}}
|
||||
(i18n/label :t/leave-community-message)]
|
||||
[rn/view {:style {:width "100%"
|
||||
:margin-top 16 :margin-bottom 16
|
||||
:margin-top 16
|
||||
:margin-bottom 16
|
||||
:flex 1
|
||||
:flex-direction :row
|
||||
:align-items :center
|
||||
:justify-content :space-evenly}}
|
||||
[button/button {:on-press #(>evt [:bottom-sheet/hide])
|
||||
:type :grey :style {:flex 1 :margin-right 12}} (i18n/label :t/cancel)]
|
||||
[button/button
|
||||
{:on-press (fn []
|
||||
(>evt [::communities/leave (:id community)])
|
||||
(>evt [:bottom-sheet/hide]))
|
||||
:style {:flex 1}} (i18n/label :t/leave-community)]]])
|
||||
[button/button {:on-press #(rf/dispatch [:bottom-sheet/hide])
|
||||
:type :grey
|
||||
:style {:flex 1
|
||||
:margin-right 12}}
|
||||
(i18n/label :t/cancel)]
|
||||
[button/button {:on-press (fn []
|
||||
#(rf/dispatch [::communities/leave (:id community)])
|
||||
#(rf/dispatch [:bottom-sheet/hide]))
|
||||
:style {:flex 1}}
|
||||
(i18n/label :t/leave-community)]]])
|
||||
|
||||
(defn options-menu []
|
||||
(let [community-mock (<sub [:get-screen-params :community-overview]) ;;TODO stop using mock data and only pass community id
|
||||
community (<sub [:communities/community (:id community-mock)])]
|
||||
[action-drawers/action-drawer {:actions (if (:joined community)
|
||||
joined-options
|
||||
not-joined-options)
|
||||
:actions-with-consequence
|
||||
(let [community-mock (rf/sub [:get-screen-params :community-overview]) ;;TODO stop using mock data and only pass community id
|
||||
community (rf/sub [:communities/community (:id community-mock)])]
|
||||
[action-drawers/action-drawer [(get (if (:joined community)
|
||||
(joined-options (:id community))
|
||||
not-joined-options) :actions)
|
||||
(when (:joined community)
|
||||
[{:icon :i/log-out
|
||||
:label (i18n/label :t/leave-community)
|
||||
:on-press #(>evt [:bottom-sheet/show-sheet
|
||||
:on-press #(rf/dispatch [:bottom-sheet/show-sheet
|
||||
{:content (constantly [leave-sheet community])
|
||||
:content-height 300}])}])}]))
|
||||
:content-height 300}])}])]]))
|
||||
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
:title (i18n/label :t/invite-people)
|
||||
:accessibility-label :community-invite-people
|
||||
:theme :accent
|
||||
:on-press #(>evt [::communities/invite-people-pressed community-id])}]
|
||||
:on-press #(>evt [:communities/invite-people-pressed community-id])}]
|
||||
[quo/separator {:style {:margin-vertical 8}}]])
|
||||
|
||||
(defn requests-to-join [community-id]
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
:on-press #(>evt [:navigate-back])}]
|
||||
:right-accessories [{:icon :main-icons/share
|
||||
:accessibility-label :invite-button
|
||||
:on-press #(>evt [::communities/share-community-pressed community-id])}]
|
||||
:on-press #(>evt [:communities/share-community-pressed community-id])}]
|
||||
:extended-header (profile-header/extended-header
|
||||
{:title name
|
||||
:color (or color (rand-nth colors/chat-colors))
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
[utils.re-frame :as rf]
|
||||
[i18n.i18n :as i18n]
|
||||
[quo2.core :as quo]
|
||||
|
||||
;; TODO move to status-im2
|
||||
[status-im.ui.screens.communities.community :as community]))
|
||||
[status-im.ui.screens.communities.community-options-bottom-sheet :as home-actions]))
|
||||
|
||||
(defn plus-button []
|
||||
(let [logging-in? (rf/sub [:multiaccounts/login])]
|
||||
|
@ -33,8 +31,7 @@
|
|||
(rf/dispatch [:navigate-to :community {:community-id id}]))
|
||||
:on-long-press #(rf/dispatch [:bottom-sheet/show-sheet
|
||||
{:content (fn []
|
||||
;; TODO implement with quo2
|
||||
[community/community-actions community-item])}])}
|
||||
[home-actions/options-menu community-item])}])}
|
||||
community-item]))
|
||||
|
||||
(defn get-item-layout-js [_ index]
|
||||
|
|
|
@ -694,6 +694,7 @@
|
|||
"sign-request-failed": "Could not sign message",
|
||||
"invite-friends": "Invite friends",
|
||||
"invite-people": "Invite people",
|
||||
"invite-people-from-contacts": "Invite people from contact list",
|
||||
"invite-reward": "Earn crypto for every friend you invite!",
|
||||
"invite-select-account": "Select an account to receive your referral bonus",
|
||||
"invited": "invited",
|
||||
|
@ -1710,6 +1711,7 @@
|
|||
"sort-communities": "Sort communities",
|
||||
"alphabetically": "Alphabetically",
|
||||
"active-members": "Active members",
|
||||
"only-mentions": "Only @mentions",
|
||||
"total-members": "Total members",
|
||||
"mutal-contacts": "Mutual contacts",
|
||||
"suggested-price-limit": "Suggested price limit",
|
||||
|
|
Loading…
Reference in New Issue