Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75d1896426 | ||
|
|
03c4814563 | ||
|
|
dbf7ca839c | ||
|
|
50135bdace | ||
|
|
61d7f08fbc | ||
|
|
17385cca94 | ||
|
|
73bc097a4e | ||
|
|
b23372f842 | ||
|
|
243c0d60da | ||
|
|
3d1c2cdccb |
@@ -3,8 +3,7 @@
|
||||
|
||||
(defn container
|
||||
[]
|
||||
{:flex 1
|
||||
:flex-direction :row
|
||||
{:flex-direction :row
|
||||
:background-color (colors/theme-colors colors/neutral-5 colors/neutral-80-opa-40)
|
||||
:padding 11
|
||||
:align-self :stretch
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
(rf/sub [:contacts/contact-name-by-identity from]))
|
||||
|
||||
(defn render-inline
|
||||
[_message-text content-type acc {:keys [type literal destination]}]
|
||||
[_message-text content-type acc {:keys [type literal destination]} use-status-tag?]
|
||||
(case type
|
||||
""
|
||||
(conj acc literal)
|
||||
@@ -82,9 +82,10 @@
|
||||
"status-tag"
|
||||
(conj acc
|
||||
[rn/text
|
||||
{:style {:color :blue
|
||||
:text-decoration-line :underline}
|
||||
:on-press #(rf/dispatch [:chat.ui/start-public-chat literal])}
|
||||
(when use-status-tag?
|
||||
{:style {:color :blue
|
||||
:text-decoration-line :underline}
|
||||
:on-press #(rf/dispatch [:chat.ui/start-public-chat literal])})
|
||||
"#"
|
||||
literal])
|
||||
|
||||
@@ -96,13 +97,15 @@
|
||||
;; TEXT
|
||||
(defn render-block
|
||||
[{:keys [content content-type edited-at in-popover?]} acc
|
||||
{:keys [type ^js literal children]}]
|
||||
{:keys [type ^js literal children]}
|
||||
use-status-tag?]
|
||||
|
||||
(case type
|
||||
|
||||
"paragraph"
|
||||
(conj acc
|
||||
(reduce
|
||||
(fn [acc e] (render-inline (:text content) content-type acc e))
|
||||
(fn [acc e] (render-inline (:text content) content-type acc e use-status-tag?))
|
||||
[rn/text (style/text-style content-type in-popover?)]
|
||||
(conj
|
||||
children
|
||||
@@ -123,11 +126,13 @@
|
||||
acc))
|
||||
|
||||
(defn render-parsed-text
|
||||
[{:keys [content] :as message-data}]
|
||||
(reduce (fn [acc e]
|
||||
(render-block message-data acc e))
|
||||
[:<>]
|
||||
(:parsed-text content)))
|
||||
[{:keys [content chat-id] :as message-data}]
|
||||
(let [{:keys [chat-type]} (rf/sub [:chats/chat chat-id])
|
||||
use-status-tag? (= constants/community-chat-type chat-type)]
|
||||
(reduce (fn [acc e]
|
||||
(render-block message-data acc e use-status-tag?))
|
||||
[:<>]
|
||||
(:parsed-text content))))
|
||||
|
||||
(defn quoted-message
|
||||
[{:keys [message-id chat-id]} reply pin?]
|
||||
@@ -288,7 +293,7 @@
|
||||
[rn/view style/status-container
|
||||
[rn/text {:style (style/status-text)}
|
||||
(reduce
|
||||
(fn [acc e] (render-inline (:text content) content-type acc e))
|
||||
(fn [acc e] (render-inline (:text content) content-type acc e false))
|
||||
[rn/text {:style (style/status-text)}]
|
||||
(-> content :parsed-text peek :children))]])
|
||||
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
:overflow :hidden})
|
||||
|
||||
(defn content-style
|
||||
[insets]
|
||||
[insets bottom-safe-area-spacing?]
|
||||
{:position :absolute
|
||||
:left 0
|
||||
:right 0
|
||||
:top 0
|
||||
:padding-top border-radius
|
||||
:padding-bottom (:bottom insets)})
|
||||
:padding-bottom (if bottom-safe-area-spacing? (:bottom insets) 0)})
|
||||
|
||||
(defn selected-background
|
||||
[]
|
||||
|
||||
@@ -81,23 +81,25 @@
|
||||
|
||||
(defn bottom-sheet
|
||||
[props children]
|
||||
(let [{on-cancel :on-cancel
|
||||
disable-drag? :disable-drag?
|
||||
show-handle? :show-handle?
|
||||
visible? :visible?
|
||||
backdrop-dismiss? :backdrop-dismiss?
|
||||
expandable? :expandable?
|
||||
selected-item :selected-item
|
||||
is-initially-expaned? :expanded?
|
||||
:or {show-handle? true
|
||||
backdrop-dismiss? true
|
||||
expandable? false
|
||||
is-initially-expaned? false}}
|
||||
(let [{on-cancel :on-cancel
|
||||
disable-drag? :disable-drag?
|
||||
show-handle? :show-handle?
|
||||
visible? :visible?
|
||||
backdrop-dismiss? :backdrop-dismiss?
|
||||
expandable? :expandable?
|
||||
bottom-safe-area-spacing? :bottom-safe-area-spacing?
|
||||
selected-item :selected-item
|
||||
is-initially-expanded? :expanded?
|
||||
:or {show-handle? true
|
||||
backdrop-dismiss? true
|
||||
expandable? false
|
||||
bottom-safe-area-spacing? true
|
||||
is-initially-expanded? false}}
|
||||
props
|
||||
content-height (reagent/atom nil)
|
||||
show-bottom-sheet? (reagent/atom nil)
|
||||
keyboard-was-shown? (reagent/atom false)
|
||||
expanded? (reagent/atom is-initially-expaned?)
|
||||
expanded? (reagent/atom is-initially-expanded?)
|
||||
gesture-running? (reagent/atom false)
|
||||
reset-atoms (fn []
|
||||
(reset! show-bottom-sheet? nil)
|
||||
@@ -226,7 +228,7 @@
|
||||
{:behaviour (if platform/ios? :padding :height)
|
||||
:style {:flex 1}}
|
||||
[rn/view
|
||||
{:style (styles/content-style insets)
|
||||
{:style (styles/content-style insets bottom-safe-area-spacing?)
|
||||
:on-layout (when-not (and
|
||||
(some? @content-height)
|
||||
(> @content-height 0))
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
:margin-bottom 20})
|
||||
|
||||
(def title-container
|
||||
{:flex 1
|
||||
:flex-direction :row
|
||||
{:flex-direction :row
|
||||
:align-items :center
|
||||
:justify-content :space-between})
|
||||
|
||||
@@ -56,10 +55,10 @@
|
||||
{:flex 1
|
||||
:margin-right 12})
|
||||
|
||||
(def request-button
|
||||
{:margin-top 32
|
||||
:margin-bottom 16
|
||||
:flex 1
|
||||
(defn bottom-container
|
||||
[safe-area-insets]
|
||||
{:padding-top 32
|
||||
:padding-bottom (:bottom safe-area-insets)
|
||||
:flex-direction :row
|
||||
:align-items :center
|
||||
:justify-content :space-evenly})
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
(ns status-im2.contexts.communities.menus.request-to-join.view
|
||||
(:require [quo.react-native :as rn]
|
||||
[quo2.core :as quo]
|
||||
(:require [react-native.core :as rn]
|
||||
[react-native.safe-area :as safe-area]
|
||||
[reagent.core :as reagent]
|
||||
[utils.i18n :as i18n]
|
||||
[status-im2.contexts.communities.menus.request-to-join.style :as style]
|
||||
[quo2.core :as quo]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]
|
||||
[utils.requests :as requests]))
|
||||
|
||||
@@ -73,60 +74,72 @@
|
||||
:render-fn community-rule-item}])
|
||||
|
||||
(defn request-to-join
|
||||
[{:keys [permissions name id images
|
||||
can-join? can-request-access?
|
||||
[{:keys [permissions
|
||||
name
|
||||
id
|
||||
images
|
||||
can-join?
|
||||
can-request-access?
|
||||
requested-to-join-at]}]
|
||||
(let [agreed-to-rules? (reagent/atom false)
|
||||
is-open? (not= 3 (:access permissions))]
|
||||
(fn []
|
||||
[rn/scroll-view {:style style/page-container}
|
||||
[rn/view
|
||||
{:style style/title-container}
|
||||
(let [agreed-to-rules? (reagent/atom false)]
|
||||
[safe-area/consumer
|
||||
(fn [insets]
|
||||
[:f>
|
||||
(fn []
|
||||
(let [{window-height :height} (rn/use-window-dimensions)
|
||||
is-open? (not= 3 (:access permissions))]
|
||||
[rn/scroll-view {:style {:max-height (- window-height (:top insets))}}
|
||||
[rn/view style/page-container
|
||||
[rn/view
|
||||
{:style style/title-container}
|
||||
|
||||
[quo/text
|
||||
{:accessibility-label :communities-join-community
|
||||
:weight :semi-bold
|
||||
:size :heading-1}
|
||||
(request-to-join-text is-open?)]
|
||||
[rn/view
|
||||
{:style style/request-icon}
|
||||
[quo/icon :i/info]]]
|
||||
[quo/context-tag
|
||||
{:style
|
||||
{:margin-right :auto
|
||||
:margin-top 8}}
|
||||
(:thumbnail images) name]
|
||||
[quo/text
|
||||
{:style {:margin-top 24}
|
||||
:accessibility-label :communities-rules-title
|
||||
:weight :semi-bold
|
||||
:size :paragraph-1}
|
||||
(i18n/label :t/community-rules)]
|
||||
[community-rules-list community-rules]
|
||||
[quo/text
|
||||
{:accessibility-label :communities-join-community
|
||||
:weight :semi-bold
|
||||
:size :heading-1}
|
||||
(request-to-join-text is-open?)]
|
||||
[rn/view
|
||||
{:style style/request-icon}
|
||||
[quo/icon :i/info]]]
|
||||
[quo/context-tag
|
||||
{:style
|
||||
{:margin-right :auto
|
||||
:margin-top 8}}
|
||||
(:thumbnail images) name]
|
||||
[quo/text
|
||||
{:style {:margin-top 24}
|
||||
:accessibility-label :communities-rules-title
|
||||
:weight :semi-bold
|
||||
:size :paragraph-1}
|
||||
(i18n/label :t/community-rules)]
|
||||
|
||||
[quo/disclaimer
|
||||
{:accessibility-label :rules-disclaimer-checkbox
|
||||
:container-style {:margin-top 20}
|
||||
:on-change #(swap! agreed-to-rules? not)}
|
||||
(i18n/label :t/accept-community-rules)]
|
||||
[rn/view
|
||||
{:style style/request-button}
|
||||
[quo/button
|
||||
{:accessibility-label :cancel
|
||||
:on-press #(rf/dispatch [:bottom-sheet/hide])
|
||||
:type :grey
|
||||
:style style/cancel-button} (i18n/label :t/cancel)]
|
||||
[quo/button
|
||||
{:accessibility-label :join-community-button
|
||||
:on-press (fn []
|
||||
(if can-join?
|
||||
(do
|
||||
(rf/dispatch [:communities/join id])
|
||||
(rf/dispatch [:bottom-sheet/hide]))
|
||||
(do (and can-request-access?
|
||||
(not (pos? requested-to-join-at))
|
||||
(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?)
|
||||
:style {:flex 1}} (request-to-join-text is-open?)]]])))
|
||||
[community-rules-list community-rules]
|
||||
|
||||
[quo/disclaimer
|
||||
{:accessibility-label :rules-disclaimer-checkbox
|
||||
:container-style {:margin-top 20}
|
||||
:on-change #(swap! agreed-to-rules? not)}
|
||||
(i18n/label :t/accept-community-rules)]
|
||||
|
||||
[rn/view {:style (style/bottom-container insets)}
|
||||
[quo/button
|
||||
{:accessibility-label :cancel
|
||||
:on-press #(rf/dispatch [:bottom-sheet/hide])
|
||||
:type :grey
|
||||
:style style/cancel-button} (i18n/label :t/cancel)]
|
||||
|
||||
[quo/button
|
||||
{:accessibility-label :join-community-button
|
||||
:on-press (fn []
|
||||
(if can-join?
|
||||
(do
|
||||
(rf/dispatch [:communities/join id])
|
||||
(rf/dispatch [:bottom-sheet/hide]))
|
||||
(do (and can-request-access?
|
||||
(not (pos? requested-to-join-at))
|
||||
(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?)
|
||||
:style {:flex 1}} (request-to-join-text is-open?)]]]]))])]))
|
||||
|
||||
@@ -119,9 +119,10 @@
|
||||
[quo/button
|
||||
{:on-press #(rf/dispatch
|
||||
[:bottom-sheet/show-sheet
|
||||
{:content (fn [] [join-menu/request-to-join
|
||||
community])
|
||||
:content-height 300}])
|
||||
{:content (fn [] [join-menu/request-to-join
|
||||
community])
|
||||
:bottom-safe-area-spacing? false
|
||||
:content-height 300}])
|
||||
:accessibility-label :show-request-to-join-screen-button
|
||||
:override-background-color community-color
|
||||
:style style/join-button
|
||||
|
||||
Reference in New Issue
Block a user