Add/Fix rebase overwritten event (#12960)

* Add/Fix rebase overwritten event

* Remove membership invitation only option

* Fix lint findings

* Replace if w/ when condition

* Remove left over code

* Add/Fix rebase overwritten event

* Remove left over code

* Add correct message to community info
This commit is contained in:
Jonathan Ferreira (Johny) 2022-01-12 11:05:44 -03:00 committed by GitHub
parent 4318bb6431
commit 83a7d3fafc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 14 deletions

View File

@ -221,12 +221,10 @@
(fx/defn create
{:events [::create-confirmation-pressed]}
[{:keys [db]}]
(let [{:keys [name description image]} (get db :communities/create)]
;; If access is ENS only, we set the access to require approval and set the rule
;; of ens only
(let [{:keys [name description membership image]} (get db :communities/create)]
(let [params {:name name
:description description
:membership constants/community-on-request-access
:membership membership
:color (rand-nth colors/chat-colors)
:image (string/replace-first (str image) #"file://" "")
:imageAx 0

View File

@ -38,7 +38,7 @@
{:padding-top subtitle-margin})))
(defn extended-header
[{:keys [title photo color subtitle subtitle-icon on-edit on-press monospace
[{:keys [title photo color membership subtitle subtitle-icon on-edit on-press monospace
bottom-separator emoji public-key community?]
:or {bottom-separator true}}]
(fn [{:keys [animation minimized]}]
@ -70,6 +70,12 @@
:accessibility-role :text
:accessibility-label :default-username}
title]
(when membership [quo/text {:number-of-lines 1
:ellipsize-mode :middle
:monospace monospace
:size (if minimized :small :base)
:color :secondary}
membership])
(when subtitle
[animated/view {:style (header-subtitle {:minimized minimized})
:pointer-events :box-none}

View File

@ -9,6 +9,7 @@
[status-im.utils.image :as utils.image]
[quo.design-system.colors :as colors]
[status-im.ui.components.react :as react]
[status-im.ui.screens.communities.membership :as memberships]
[status-im.ui.components.icons.icons :as icons]
[status-im.utils.debounce :as debounce]))
@ -128,7 +129,7 @@
(str (count text) "/" max-length)]])
(defn form []
(let [{:keys [name description]} (<sub [:communities/create])]
(let [{:keys [name description membership editing?]} (<sub [:communities/create])]
[rn/scroll-view {:keyboard-should-persist-taps :handled
:style {:flex 1}
:content-container-style {:padding-vertical 16}}
@ -156,7 +157,17 @@
:on-change-text #(>evt [::communities/create-field :description %])}]]
[quo/list-header {:color :main}
(i18n/label :t/community-thumbnail-image)]
[photo-picker]]))
[photo-picker]
(when-not editing? [:<>
[quo/separator {:style {:margin-vertical 10}}]
[quo/list-item {:title (i18n/label :t/membership-button)
:accessory-text (i18n/label (get-in memberships/options [membership :title] :t/membership-none))
:accessory :text
:on-press #(>evt [:navigate-to :community-membership])
:chevron true
:size :small}]
[quo/list-footer
(i18n/label (get-in memberships/options [membership :description] :t/membership-none-placeholder))]])]))
(defn view []
(let [{:keys [name description]} (<sub [:communities/create])]

View File

@ -10,13 +10,6 @@
(def options {constants/community-on-request-access
{:title :t/membership-approval
:description :t/membership-approval-description}
constants/community-invitation-only-access
{:title :t/membership-invite
:description :t/membership-invite-description}
; disabled for now
; constants/community-rule-ens-only
; {:title :t/membership-ens
; :description :t/membership-ens-description}
constants/community-no-membership-access
{:title :t/membership-free
:description :t/membership-free-description}})

View File

@ -23,6 +23,7 @@
roles false
notifications false
show-members-count? (not= (:access permissions) constants/community-no-membership-access)
request-membership? (= (:access permissions) constants/community-on-request-access)
members-count (count members)]
[:<>
[quo/animated-header {:left-accessories [{:icon :main-icons/arrow-left
@ -39,6 +40,8 @@
(rn/resolve-asset-source
(resources/get-image :status-logo)))
(get-in community [:images :large :uri]))
:membership (when request-membership?
(i18n/label :t/membership-approval))
:subtitle (if show-members-count?
(i18n/label-pluralize members-count :t/community-members {:count members-count})
(i18n/label :t/open-membership))