Implement dummy action drawers for community chats (#16227)
Implements the skeleton for all community channel drawer actions. This commit is not concerned with the actual implementation of the actions, since that would grow the scope a bit too much. Partially implements https://github.com/status-im/status-mobile/issues/16178 Notes: I also updated the actions drawer component to accept a text aligned to the right (this will be necessary to display the number of pinned messages in the action drawer). In the Design System, the text is always hidden, and that's my best guess as to why we didn't implement it. I talked to designers, and they won't update the Design System Drawer action component https://www.figma.com/file/WQZcp6S0EnzxdTL4taoKDv/Design-System-for-Mobile?type=design&node-id=1931-31188&t=hOK17fADEXTlnXPY-0) for now, but we agreed the reference in Figma > Communities for Mobile https://www.figma.com/file/h9wo4GipgZURbqqr1vShFN/Communities-for-Mobile?type=design&node-id=5483-193285&t=vOTiuhxD87zhmK2T-0) is good enough.
This commit is contained in:
parent
a5c41612a0
commit
204c8996a3
|
@ -50,8 +50,23 @@
|
||||||
:label "a sample label"
|
:label "a sample label"
|
||||||
:right-icon :i/friend
|
:right-icon :i/friend
|
||||||
:accessibility-label :first-element}]]])
|
:accessibility-label :first-element}]]])
|
||||||
(h/is-truthy (h/get-by-label-text "right-icon-for-action"))
|
(h/is-truthy (h/query-by-label-text :right-icon-for-action))
|
||||||
(h/is-truthy (h/query-by-label-text "left-icon-for-action")))
|
(h/is-truthy (h/query-by-label-text :left-icon-for-action)))
|
||||||
|
|
||||||
|
(h/test "renders right text besides icon when non-nil"
|
||||||
|
(h/render [action-drawer/action-drawer
|
||||||
|
[[{:icon :i/friend
|
||||||
|
:label "a sample label"
|
||||||
|
:right-text "20+"
|
||||||
|
:right-icon :i/friend}]]])
|
||||||
|
(h/is-truthy (h/query-by-label-text :right-text-for-action)))
|
||||||
|
|
||||||
|
(h/test "does not render right text when not present"
|
||||||
|
(h/render [action-drawer/action-drawer
|
||||||
|
[[{:icon :i/friend
|
||||||
|
:label "a sample label"
|
||||||
|
:right-icon :i/friend}]]])
|
||||||
|
(h/is-null (h/query-by-label-text :right-text-for-action)))
|
||||||
|
|
||||||
(h/test "renders a divider when the add-divider? prop is true"
|
(h/test "renders a divider when the add-divider? prop is true"
|
||||||
(h/render [action-drawer/action-drawer
|
(h/render [action-drawer/action-drawer
|
||||||
|
|
|
@ -34,8 +34,17 @@
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:justify-content :center})
|
:justify-content :center})
|
||||||
|
|
||||||
|
(def right-side-container
|
||||||
|
{:flex-direction :row
|
||||||
|
:align-items :center})
|
||||||
|
|
||||||
(def right-icon
|
(def right-icon
|
||||||
{:height 20
|
{:height 20
|
||||||
:margin-top :auto
|
:margin-top :auto
|
||||||
:margin-bottom :auto
|
:margin-bottom :auto
|
||||||
:width 20})
|
:width 20})
|
||||||
|
|
||||||
|
(defn right-text
|
||||||
|
[override-theme]
|
||||||
|
{:color (colors/theme-colors colors/neutral-50 colors/neutral-40 override-theme)
|
||||||
|
:margin-right 12})
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
colors/danger-60
|
colors/danger-60
|
||||||
(colors/theme-colors colors/neutral-50 colors/neutral-40 override-theme)))
|
(colors/theme-colors colors/neutral-50 colors/neutral-40 override-theme)))
|
||||||
|
|
||||||
(defn divider
|
(defn- divider
|
||||||
[]
|
[]
|
||||||
[rn/view
|
[rn/view
|
||||||
{:style (style/divider)
|
{:style (style/divider)
|
||||||
|
@ -29,6 +29,7 @@
|
||||||
label
|
label
|
||||||
sub-label
|
sub-label
|
||||||
right-icon
|
right-icon
|
||||||
|
right-text
|
||||||
danger?
|
danger?
|
||||||
disabled?
|
disabled?
|
||||||
on-press
|
on-press
|
||||||
|
@ -70,14 +71,22 @@
|
||||||
:style {:color
|
:style {:color
|
||||||
(colors/theme-colors colors/neutral-50 colors/neutral-40 override-theme)}}
|
(colors/theme-colors colors/neutral-50 colors/neutral-40 override-theme)}}
|
||||||
sub-label])]
|
sub-label])]
|
||||||
(when right-icon
|
(when (or right-text right-icon)
|
||||||
[rn/view
|
[rn/view {:style style/right-side-container}
|
||||||
{:style style/right-icon
|
(when right-text
|
||||||
:accessible true
|
[text/text
|
||||||
:accessibility-label :right-icon-for-action}
|
{:accessibility-label :right-text-for-action
|
||||||
[icon/icon right-icon
|
:size :paragraph-1
|
||||||
{:color (get-icon-color danger? override-theme)
|
:style (style/right-text override-theme)}
|
||||||
:size 20}]])]]]))
|
right-text])
|
||||||
|
(when right-icon
|
||||||
|
[rn/view
|
||||||
|
{:style style/right-icon
|
||||||
|
:accessible true
|
||||||
|
:accessibility-label :right-icon-for-action}
|
||||||
|
[icon/icon right-icon
|
||||||
|
{:color (get-icon-color danger? override-theme)
|
||||||
|
:size 20}]])])]]]))
|
||||||
|
|
||||||
(defn action-drawer
|
(defn action-drawer
|
||||||
[sections]
|
[sections]
|
||||||
|
|
|
@ -8,58 +8,65 @@
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[quo2.components.common.unread-grey-dot.view :refer [unread-grey-dot]]))
|
[quo2.components.common.unread-grey-dot.view :refer [unread-grey-dot]]))
|
||||||
|
|
||||||
|
(def ^:private custom-props
|
||||||
|
[:name :locked? :mentions-count :unread-messages?
|
||||||
|
:muted? :is-active-channel? :emoji :channel-color])
|
||||||
|
|
||||||
(defn list-item
|
(defn list-item
|
||||||
[{:keys [name locked? mentions-count unread-messages?
|
[{:keys [locked? mentions-count unread-messages?
|
||||||
muted? is-active-channel? emoji channel-color on-press]
|
muted? is-active-channel? emoji channel-color]
|
||||||
:or {channel-color colors/primary-50}}]
|
:or {channel-color colors/primary-50}
|
||||||
[rn/touchable-opacity {:on-press on-press}
|
:as props}]
|
||||||
[rn/view
|
(let [standard-props (apply dissoc props custom-props)
|
||||||
{:style (merge {:height 48
|
name-text (:name props)]
|
||||||
:display :flex
|
[rn/touchable-opacity standard-props
|
||||||
:border-radius 12
|
[rn/view
|
||||||
:flex-direction :row
|
{:style (merge {:height 48
|
||||||
:justify-content :space-between
|
:display :flex
|
||||||
:align-items :center
|
:border-radius 12
|
||||||
:width "100%"
|
:flex-direction :row
|
||||||
:padding-left 12
|
:justify-content :space-between
|
||||||
:padding-right 12}
|
:align-items :center
|
||||||
(when is-active-channel?
|
:width "100%"
|
||||||
{:background-color (colors/theme-alpha channel-color 0.05 0.05)}))}
|
:padding-left 12
|
||||||
[rn/view
|
:padding-right 12}
|
||||||
{:display :flex
|
(when is-active-channel?
|
||||||
:flex-direction :row
|
{:background-color (colors/theme-alpha channel-color 0.05 0.05)}))}
|
||||||
:justify-content :flex-start
|
[rn/view
|
||||||
:align-items :center
|
{:display :flex
|
||||||
:accessible true
|
:flex-direction :row
|
||||||
:accessibility-label :chat-name-text}
|
:justify-content :flex-start
|
||||||
[channel-avatar/channel-avatar
|
:align-items :center
|
||||||
{:big? true
|
:accessible true
|
||||||
:locked? locked?
|
:accessibility-label :chat-name-text}
|
||||||
:emoji-background-color (colors/theme-alpha channel-color 0.1 0.1)
|
[channel-avatar/channel-avatar
|
||||||
:emoji emoji}]
|
{:big? true
|
||||||
[quo2.text/text
|
:locked? locked?
|
||||||
{:style (merge {:margin-left 12}
|
:emoji-background-color (colors/theme-alpha channel-color 0.1 0.1)
|
||||||
(when (and (not locked?) muted?)
|
:emoji emoji}]
|
||||||
{:color (if (theme/dark?) colors/neutral-60 colors/neutral-40)}))
|
[quo2.text/text
|
||||||
:weight :medium
|
{:style (merge {:margin-left 12}
|
||||||
:size :paragraph-1} (str "# " name)]]
|
(when (and (not locked?) muted?)
|
||||||
[rn/view
|
{:color (if (theme/dark?) colors/neutral-60 colors/neutral-40)}))
|
||||||
{:style {:height 20
|
:weight :medium
|
||||||
:justify-content :center}}
|
:size :paragraph-1} (str "# " name-text)]]
|
||||||
(when (and (not locked?)
|
[rn/view
|
||||||
muted?)
|
{:style {:height 20
|
||||||
[quo2.icons/icon :i/muted
|
:justify-content :center}}
|
||||||
{:size 20
|
(when (and (not locked?)
|
||||||
:no-color true}])
|
muted?)
|
||||||
(when (and (not locked?)
|
[quo2.icons/icon :i/muted
|
||||||
(not muted?)
|
{:size 20
|
||||||
(pos? (int mentions-count)))
|
:no-color true}])
|
||||||
[rn/view
|
(when (and (not locked?)
|
||||||
{:style {:margin-right 2
|
(not muted?)
|
||||||
:margin-top 2}}
|
(pos? (int mentions-count)))
|
||||||
[quo2.counter/counter {:override-bg-color channel-color} mentions-count]])
|
[rn/view
|
||||||
(when (and (not locked?)
|
{:style {:margin-right 2
|
||||||
(not muted?)
|
:margin-top 2}}
|
||||||
(not (pos? (int mentions-count)))
|
[quo2.counter/counter {:override-bg-color channel-color} mentions-count]])
|
||||||
unread-messages?)
|
(when (and (not locked?)
|
||||||
[unread-grey-dot :unviewed-messages-public])]]])
|
(not muted?)
|
||||||
|
(not (pos? (int mentions-count)))
|
||||||
|
unread-messages?)
|
||||||
|
[unread-grey-dot :unviewed-messages-public])]]]))
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
(ns status-im2.common.home.actions.view
|
(ns status-im2.common.home.actions.view
|
||||||
(:require [utils.i18n :as i18n]
|
(:require [clojure.string :as string]
|
||||||
[quo2.core :as quo]
|
[quo2.core :as quo]
|
||||||
|
[quo2.foundations.colors :as colors]
|
||||||
|
[status-im2.contexts.communities.actions.chat.view :as chat-actions]
|
||||||
[status-im2.common.confirmation-drawer.view :as confirmation-drawer]
|
[status-im2.common.confirmation-drawer.view :as confirmation-drawer]
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[utils.re-frame :as rf]
|
|
||||||
[status-im2.contexts.contacts.drawers.nickname-drawer.view :as nickname-drawer]
|
[status-im2.contexts.contacts.drawers.nickname-drawer.view :as nickname-drawer]
|
||||||
[clojure.string :as string]
|
[utils.i18n :as i18n]
|
||||||
[quo2.foundations.colors :as colors]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- entry
|
(defn- entry
|
||||||
[{:keys [icon label on-press danger? sub-label chevron? add-divider? accessibility-label]}]
|
[{:keys [icon label on-press danger? sub-label chevron? add-divider? accessibility-label]}]
|
||||||
|
@ -462,12 +463,15 @@
|
||||||
(remove-from-group-entry contact chat-id))])]]))
|
(remove-from-group-entry contact chat-id))])]]))
|
||||||
|
|
||||||
(defn chat-actions
|
(defn chat-actions
|
||||||
[{:keys [chat-type] :as item} inside-chat?]
|
[{:keys [chat-type] :as chat} inside-chat?]
|
||||||
(case chat-type
|
(condp = chat-type
|
||||||
constants/one-to-one-chat-type
|
constants/one-to-one-chat-type
|
||||||
[one-to-one-actions item inside-chat?]
|
[one-to-one-actions chat inside-chat?]
|
||||||
constants/private-group-chat-type
|
constants/private-group-chat-type
|
||||||
[private-group-chat-actions item inside-chat?]))
|
[private-group-chat-actions chat inside-chat?]
|
||||||
|
constants/community-chat-type
|
||||||
|
[chat-actions/actions chat inside-chat?]
|
||||||
|
nil))
|
||||||
|
|
||||||
(defn group-details-actions
|
(defn group-details-actions
|
||||||
[{:keys [admins] :as group}]
|
[{:keys [admins] :as group}]
|
||||||
|
|
|
@ -6,3 +6,7 @@
|
||||||
(when content
|
(when content
|
||||||
[rn/view {:border-color :red :border-width 1}
|
[rn/view {:border-color :red :border-width 1}
|
||||||
content]))
|
content]))
|
||||||
|
|
||||||
|
(defn alert
|
||||||
|
[]
|
||||||
|
(js/alert "Feature not implemented."))
|
||||||
|
|
|
@ -97,16 +97,15 @@
|
||||||
:size :paragraph-2
|
:size :paragraph-2
|
||||||
:style (style/header-online)}
|
:style (style/header-online)}
|
||||||
(i18n/label :t/online)])]]]
|
(i18n/label :t/online)])]]]
|
||||||
(when (not= chat-type constants/community-chat-type)
|
[rn/touchable-opacity
|
||||||
[rn/touchable-opacity
|
{:active-opacity 1
|
||||||
{:active-opacity 1
|
:style (style/button-container {:margin-right 20})
|
||||||
:style (style/button-container {:margin-right 20})
|
:accessibility-label :options-button
|
||||||
:accessibility-label :options-button
|
:on-press (fn []
|
||||||
:on-press (fn []
|
(rf/dispatch [:dismiss-keyboard])
|
||||||
(rf/dispatch [:dismiss-keyboard])
|
(rf/dispatch [:show-bottom-sheet
|
||||||
(rf/dispatch [:show-bottom-sheet
|
{:content (fn [] [actions/chat-actions chat true])}]))}
|
||||||
{:content (fn [] [actions/chat-actions chat true])}]))}
|
[quo/icon :i/options {:size 20 :color (colors/theme-colors colors/black colors/white)}]]]
|
||||||
[quo/icon :i/options {:size 20 :color (colors/theme-colors colors/black colors/white)}]])]
|
|
||||||
|
|
||||||
[pin.banner/banner
|
[pin.banner/banner
|
||||||
{:chat-id chat-id
|
{:chat-id chat-id
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
(ns status-im2.contexts.communities.actions.chat.view
|
||||||
|
(:require [quo2.core :as quo]
|
||||||
|
[status-im2.common.not-implemented :as not-implemented]
|
||||||
|
[utils.i18n :as i18n]))
|
||||||
|
|
||||||
|
(defn- action-view-members-and-details
|
||||||
|
[]
|
||||||
|
{:icon :i/members
|
||||||
|
:accessibility-label :chat-view-members-and-details
|
||||||
|
:label (i18n/label :t/view-channel-members-and-details)
|
||||||
|
:on-press not-implemented/alert})
|
||||||
|
|
||||||
|
(defn- action-token-requirements
|
||||||
|
[]
|
||||||
|
{:icon :i/token
|
||||||
|
:right-icon :i/chevron-right
|
||||||
|
:accessibility-label :chat-view-token-requirements
|
||||||
|
:on-press not-implemented/alert
|
||||||
|
:label (i18n/label :t/view-token-gating)})
|
||||||
|
|
||||||
|
(defn- action-mark-as-read
|
||||||
|
[]
|
||||||
|
{:icon :i/mark-as-read
|
||||||
|
:right-icon :i/chevron-right
|
||||||
|
:accessibility-label :chat-mark-as-read
|
||||||
|
:on-press not-implemented/alert
|
||||||
|
:label (i18n/label :t/mute-channel)})
|
||||||
|
|
||||||
|
(defn- action-toggle-muted
|
||||||
|
[]
|
||||||
|
{:icon :i/muted
|
||||||
|
:right-icon :i/chevron-right
|
||||||
|
:accessibility-label :chat-toggle-muted
|
||||||
|
:on-press not-implemented/alert
|
||||||
|
:label (i18n/label :t/mute-channel)})
|
||||||
|
|
||||||
|
(defn- action-notification-settings
|
||||||
|
[]
|
||||||
|
{:icon :i/notifications
|
||||||
|
:right-icon :i/chevron-right
|
||||||
|
:accessibility-label :chat-notification-settings
|
||||||
|
:on-press not-implemented/alert
|
||||||
|
:label (i18n/label :t/notification-settings)
|
||||||
|
:sub-label (i18n/label :t/only-mentions)})
|
||||||
|
|
||||||
|
(defn- action-pinned-messages
|
||||||
|
[]
|
||||||
|
{:icon :i/pin
|
||||||
|
:right-icon :i/chevron-right
|
||||||
|
:accessibility-label :chat-pinned-messages
|
||||||
|
:on-press not-implemented/alert
|
||||||
|
:label (i18n/label :t/pinned-messages)})
|
||||||
|
|
||||||
|
(defn- action-fetch-messages
|
||||||
|
[]
|
||||||
|
{:icon :i/download
|
||||||
|
:right-icon :i/chevron-right
|
||||||
|
:accessibility-label :chat-fetch-messages
|
||||||
|
:on-press not-implemented/alert
|
||||||
|
:label (i18n/label :t/fetch-messages)})
|
||||||
|
|
||||||
|
(defn- action-invite-people
|
||||||
|
[]
|
||||||
|
{:icon :i/add-user
|
||||||
|
:accessibility-label :chat-invite-people
|
||||||
|
:on-press not-implemented/alert
|
||||||
|
:label (i18n/label :t/invite-people-from-contacts)})
|
||||||
|
|
||||||
|
(defn- action-qr-code
|
||||||
|
[]
|
||||||
|
{:icon :i/qr-code
|
||||||
|
:accessibility-label :chat-show-qr-code
|
||||||
|
:on-press not-implemented/alert
|
||||||
|
:label (i18n/label :t/show-qr)})
|
||||||
|
|
||||||
|
(defn- action-share
|
||||||
|
[]
|
||||||
|
{:icon :i/share
|
||||||
|
:accessibility-label :chat-share
|
||||||
|
:on-press not-implemented/alert
|
||||||
|
:label (i18n/label :t/share-channel)})
|
||||||
|
|
||||||
|
(defn actions
|
||||||
|
[{:keys [locked?]} inside-chat?]
|
||||||
|
(cond
|
||||||
|
locked?
|
||||||
|
[quo/action-drawer
|
||||||
|
[[(action-invite-people)
|
||||||
|
(action-token-requirements)
|
||||||
|
(action-qr-code)
|
||||||
|
(action-share)]]]
|
||||||
|
|
||||||
|
(and (not inside-chat?) (not locked?))
|
||||||
|
[quo/action-drawer
|
||||||
|
[[(action-view-members-and-details)
|
||||||
|
(action-mark-as-read)
|
||||||
|
(action-toggle-muted)
|
||||||
|
(action-notification-settings)
|
||||||
|
(action-pinned-messages)
|
||||||
|
(action-invite-people)
|
||||||
|
(action-qr-code)
|
||||||
|
(action-share)]]]
|
||||||
|
|
||||||
|
(and inside-chat? (not locked?))
|
||||||
|
[quo/action-drawer
|
||||||
|
[[(action-view-members-and-details)
|
||||||
|
(action-token-requirements)
|
||||||
|
(action-mark-as-read)
|
||||||
|
(action-toggle-muted)
|
||||||
|
(action-notification-settings)
|
||||||
|
(action-fetch-messages)
|
||||||
|
(action-invite-people)
|
||||||
|
(action-qr-code)
|
||||||
|
(action-share)]]]
|
||||||
|
|
||||||
|
:else nil))
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
(ns status-im2.contexts.communities.actions.community-options.component-spec
|
(ns status-im2.contexts.communities.actions.community-options.component-spec
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[test-helpers.component :as h]
|
[test-helpers.component :as h]
|
||||||
|
@ -24,7 +23,7 @@
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :mute-community))
|
(-> (h/expect (h/get-by-translation-text :mute-community))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :community-notification-settings))
|
(-> (h/expect (h/get-by-translation-text :notification-settings))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :invite-people-from-contacts))
|
(-> (h/expect (h/get-by-translation-text :invite-people-from-contacts))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
|
@ -50,7 +49,7 @@
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :mute-community))
|
(-> (h/expect (h/get-by-translation-text :mute-community))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :community-notification-settings))
|
(-> (h/expect (h/get-by-translation-text :notification-settings))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :invite-people-from-contacts))
|
(-> (h/expect (h/get-by-translation-text :invite-people-from-contacts))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
|
@ -73,7 +72,7 @@
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :mute-community))
|
(-> (h/expect (h/get-by-translation-text :mute-community))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :community-notification-settings))
|
(-> (h/expect (h/get-by-translation-text :notification-settings))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :invite-people-from-contacts))
|
(-> (h/expect (h/get-by-translation-text :invite-people-from-contacts))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
|
@ -95,7 +94,7 @@
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :mute-community))
|
(-> (h/expect (h/get-by-translation-text :mute-community))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :community-notification-settings))
|
(-> (h/expect (h/get-by-translation-text :notification-settings))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
(-> (h/expect (h/get-by-translation-text :invite-people-from-contacts))
|
(-> (h/expect (h/get-by-translation-text :invite-people-from-contacts))
|
||||||
(.toBeTruthy))
|
(.toBeTruthy))
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
[id]
|
[id]
|
||||||
{:icon :i/notifications
|
{:icon :i/notifications
|
||||||
:accessibility-label :community-notification-settings
|
:accessibility-label :community-notification-settings
|
||||||
:label (i18n/label :t/community-notification-settings)
|
:label (i18n/label :t/notification-settings)
|
||||||
:on-press #(js/alert (str "implement action" id))
|
:on-press #(js/alert (str "implement action" id))
|
||||||
:right-icon :i/chevron-right})
|
:right-icon :i/chevron-right})
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
(ns status-im2.contexts.communities.overview.view
|
(ns status-im2.contexts.communities.overview.view
|
||||||
(:require [utils.i18n :as i18n]
|
(:require [oops.core :as oops]
|
||||||
[oops.core :as oops]
|
[quo2.components.navigation.floating-shell-button :as floating-shell-button]
|
||||||
[quo2.core :as quo]
|
[quo2.core :as quo]
|
||||||
[quo2.foundations.colors :as colors]
|
[quo2.foundations.colors :as colors]
|
||||||
[react-native.core :as rn]
|
|
||||||
[react-native.blur :as blur]
|
[react-native.blur :as blur]
|
||||||
|
[react-native.core :as rn]
|
||||||
[react-native.platform :as platform]
|
[react-native.platform :as platform]
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[status-im2.constants :as constants]
|
[status-im2.common.home.actions.view :as actions]
|
||||||
[status-im2.common.scroll-page.view :as scroll-page]
|
|
||||||
[status-im2.contexts.communities.overview.style :as style]
|
|
||||||
[status-im2.contexts.communities.actions.community-options.view :as options]
|
|
||||||
[quo2.components.navigation.floating-shell-button :as floating-shell-button]
|
|
||||||
[status-im2.contexts.communities.overview.utils :as utils]
|
|
||||||
[status-im2.common.password-authentication.view :as password-authentication]
|
[status-im2.common.password-authentication.view :as password-authentication]
|
||||||
|
[status-im2.common.scroll-page.view :as scroll-page]
|
||||||
|
[status-im2.constants :as constants]
|
||||||
|
[status-im2.contexts.communities.actions.community-options.view :as options]
|
||||||
|
[status-im2.contexts.communities.overview.style :as style]
|
||||||
|
[status-im2.contexts.communities.overview.utils :as utils]
|
||||||
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn preview-user-list
|
(defn preview-user-list
|
||||||
|
@ -54,37 +55,41 @@
|
||||||
(int (Math/ceil (layout-y %))))
|
(int (Math/ceil (layout-y %))))
|
||||||
(into #{} (map (comp :name second) channels-list)))
|
(into #{} (map (comp :name second) channels-list)))
|
||||||
:style {:margin-top 20 :flex 1}}
|
:style {:margin-top 20 :flex 1}}
|
||||||
(map
|
(for [[category-id {:keys [chats name collapsed?]}] channels-list]
|
||||||
(fn [[category-id {:keys [chats name collapsed?]}]]
|
[rn/view
|
||||||
[rn/view
|
{:flex 1
|
||||||
{:flex 1
|
:key category-id
|
||||||
:key category-id
|
;; on-layout fires only when the component re-renders, so
|
||||||
;; on-layout fires only when the component re-renders, so
|
;; in case the category hasn't changed, it will not be fired
|
||||||
;; in case the category hasn't changed, it will not be fired
|
:on-layout #(on-category-layout name (int (layout-y %)))}
|
||||||
:on-layout #(on-category-layout name (int (layout-y %)))}
|
(when-not (= constants/empty-category-id category-id)
|
||||||
|
[quo/divider-label
|
||||||
(when-not (= constants/empty-category-id category-id)
|
{:label name
|
||||||
[quo/divider-label
|
:on-press #(collapse-category
|
||||||
{:label name
|
community-id
|
||||||
:on-press #(collapse-category
|
category-id
|
||||||
community-id
|
collapsed?)
|
||||||
category-id
|
:chevron-icon (if collapsed? :main-icons/chevron-right :main-icons/chevron-down)
|
||||||
collapsed?)
|
:padding-bottom (if collapsed? 7 0)
|
||||||
:chevron-icon (if collapsed? :main-icons/chevron-right :main-icons/chevron-down)
|
:chevron-position :left}])
|
||||||
:padding-bottom (if collapsed? 7 0)
|
(when-not collapsed?
|
||||||
:chevron-position :left}])
|
[rn/view
|
||||||
(when-not collapsed?
|
{:style {:margin-left 8
|
||||||
[rn/view
|
:margin-top 10
|
||||||
{:margin-left 8
|
:margin-bottom 8}}
|
||||||
:margin-top 10
|
(for [chat chats
|
||||||
:margin-bottom 8}
|
:let [chat (assoc chat :chat-type constants/community-chat-type)]]
|
||||||
(map (fn [channel]
|
[rn/view
|
||||||
[rn/view
|
{:key (:id chat)
|
||||||
{:key (:id channel)
|
:style {:margin-top 4}}
|
||||||
:margin-top 4}
|
[quo/channel-list-item
|
||||||
[quo/channel-list-item channel]])
|
(assoc chat
|
||||||
chats)])])
|
:on-long-press
|
||||||
channels-list)])
|
(fn []
|
||||||
|
(rf/dispatch [:show-bottom-sheet
|
||||||
|
{:content (fn [] [actions/chat-actions chat false])
|
||||||
|
:selected-item (fn []
|
||||||
|
[quo/channel-list-item chat])}])))]])])])])
|
||||||
|
|
||||||
(defn request-to-join-text
|
(defn request-to-join-text
|
||||||
[is-open?]
|
[is-open?]
|
||||||
|
|
|
@ -15,44 +15,59 @@
|
||||||
:type :boolean}
|
:type :boolean}
|
||||||
{:label "Show red options?"
|
{:label "Show red options?"
|
||||||
:key :show-red-options?
|
:key :show-red-options?
|
||||||
:type :boolean}])
|
:type :boolean}
|
||||||
|
{:label "Override theme"
|
||||||
|
:key :override-theme
|
||||||
|
:type :select
|
||||||
|
:options [{:key :dark :value "Dark"}
|
||||||
|
{:key :light :value "Light"}
|
||||||
|
{:key nil :value "System"}]}])
|
||||||
|
|
||||||
(def options-with-consequences
|
(defn options-with-consequences
|
||||||
[{:icon :i/delete
|
[override-theme]
|
||||||
:danger? true
|
[{:icon :i/delete
|
||||||
:label "Clear history"
|
:danger? true
|
||||||
:add-divider? true
|
:label "Clear history"
|
||||||
:on-press #(js/alert "clear history")}])
|
:override-theme override-theme
|
||||||
|
:add-divider? true
|
||||||
|
:on-press #(js/alert "clear history")}])
|
||||||
|
|
||||||
(defn render-action-sheet
|
(defn render-action-sheet
|
||||||
[state]
|
[state]
|
||||||
[rn/view
|
(let [override-theme (:override-theme @state)]
|
||||||
{:height 300
|
[rn/view
|
||||||
:background-color (colors/theme-colors colors/white colors/neutral-95)}
|
{:height 300
|
||||||
[quo/action-drawer
|
:background-color (colors/theme-colors colors/white colors/neutral-95)}
|
||||||
(cond->
|
[quo/action-drawer
|
||||||
[[{:icon :i/friend
|
(cond->
|
||||||
:label "View channel members and details"
|
[[{:icon :i/friend
|
||||||
:on-press #(js/alert "View channel members and details")}
|
:label "View channel members and details"
|
||||||
{:icon :i/communities
|
:override-theme override-theme
|
||||||
:label "Mark as read"
|
:on-press #(js/alert "View channel members and details")}
|
||||||
:disabled? (:mark-as-read-disabled? @state)
|
{:icon :i/communities
|
||||||
:on-press #(js/alert "Mark as read")}
|
:label "Mark as read"
|
||||||
{:icon :i/muted
|
:override-theme override-theme
|
||||||
:label (if (:muted? @state) "Unmute channel" "Mute channel")
|
:disabled? (:mark-as-read-disabled? @state)
|
||||||
:on-press #(js/alert (if (:muted? @state) "Unmute channel" "Mute channel"))
|
:on-press #(js/alert "Mark as read")}
|
||||||
:right-icon :i/chevron-right
|
{:icon :i/muted
|
||||||
:sub-label (when (:muted? @state) "Muted for 15 min")}
|
:label (if (:muted? @state) "Unmute channel" "Mute channel")
|
||||||
{:icon :i/scan
|
:override-theme override-theme
|
||||||
:on-press #(js/alert "Fetch messages")
|
:on-press #(js/alert (if (:muted? @state) "Unmute channel" "Mute channel"))
|
||||||
:right-icon :i/chevron-right
|
:right-icon :i/chevron-right
|
||||||
:label "Fetch messages"}
|
:sub-label (when (:muted? @state) "Muted for 15 min")}
|
||||||
{:icon :i/add-user
|
{:icon :i/scan
|
||||||
:on-press #(js/alert "Share link to the channel")
|
:on-press #(js/alert "Fetch messages")
|
||||||
:label "Share link to the channel"}]]
|
:override-theme override-theme
|
||||||
|
:right-icon :i/chevron-right
|
||||||
|
:right-text "3"
|
||||||
|
:label "Fetch messages"}
|
||||||
|
{:icon :i/add-user
|
||||||
|
:override-theme override-theme
|
||||||
|
:on-press #(js/alert "Share link to the channel")
|
||||||
|
:label "Share link to the channel"}]]
|
||||||
|
|
||||||
(:show-red-options? @state)
|
(:show-red-options? @state)
|
||||||
(conj options-with-consequences))]])
|
(conj (options-with-consequences override-theme)))]]))
|
||||||
|
|
||||||
(defn cool-preview
|
(defn cool-preview
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -1041,7 +1041,7 @@
|
||||||
"remote-notifications-subtitle": "Enable google push notifications",
|
"remote-notifications-subtitle": "Enable google push notifications",
|
||||||
"show-notifications": "Show notifications",
|
"show-notifications": "Show notifications",
|
||||||
"notification-settings": "Notifications",
|
"notification-settings": "Notifications",
|
||||||
"community-notification-settings": "Notification settings",
|
"notification-settings": "Notification settings",
|
||||||
"notifications-servers": "Notification servers",
|
"notifications-servers": "Notification servers",
|
||||||
"notifications-preferences": "Notification preferences",
|
"notifications-preferences": "Notification preferences",
|
||||||
"notifications-switch": "Show notifications",
|
"notifications-switch": "Show notifications",
|
||||||
|
@ -1254,6 +1254,7 @@
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"share": "Share",
|
"share": "Share",
|
||||||
"shared": "Shared",
|
"shared": "Shared",
|
||||||
|
"share-channel": "Share channel",
|
||||||
"share-address": "Share address",
|
"share-address": "Share address",
|
||||||
"share-chat": "Share chat",
|
"share-chat": "Share chat",
|
||||||
"share-contact-code": "Share my chat key",
|
"share-contact-code": "Share my chat key",
|
||||||
|
@ -1447,6 +1448,7 @@
|
||||||
"view-gitcoin": "View in Gitcoin",
|
"view-gitcoin": "View in Gitcoin",
|
||||||
"view-members": "View members",
|
"view-members": "View members",
|
||||||
"view-profile": "View profile",
|
"view-profile": "View profile",
|
||||||
|
"view-channel-members-and-details": "View channel member and details",
|
||||||
"view-details": "View Details",
|
"view-details": "View Details",
|
||||||
"view-signing": "View signing phrase",
|
"view-signing": "View signing phrase",
|
||||||
"view-superrare": "View in SuperRare",
|
"view-superrare": "View in SuperRare",
|
||||||
|
|
Loading…
Reference in New Issue