|
12 | 12 | [utils.i18n :as i18n]
|
13 | 13 | [utils.re-frame :as rf]))
|
14 | 14 |
|
15 |
| -(defn back-button |
16 |
| - [] |
17 |
| - [quo/button |
18 |
| - {:type :grey |
19 |
| - :size 32 |
20 |
| - :icon-only? true |
21 |
| - :container-style {:margin-left 20} |
22 |
| - :accessibility-label :back-button |
23 |
| - :on-press #(rf/dispatch [:navigate-back])} |
24 |
| - :i/arrow-left]) |
25 |
| - |
26 |
| -(defn options-button |
27 |
| - [group] |
28 |
| - [quo/button |
29 |
| - {:type :grey |
30 |
| - :size 32 |
31 |
| - :icon-only? true |
32 |
| - :container-style {:margin-right 20} |
33 |
| - :accessibility-label :options-button |
34 |
| - :on-press #(rf/dispatch [:show-bottom-sheet |
35 |
| - {:content (fn [] [actions/group-details-actions group])}])} |
36 |
| - :i/options]) |
37 |
| - |
38 |
| -(defn count-container |
39 |
| - [amount accessibility-label] |
40 |
| - [rn/view |
41 |
| - {:style (style/count-container) |
42 |
| - :accessibility-label accessibility-label} |
43 |
| - [quo/text |
44 |
| - {:size :label |
45 |
| - :weight :medium |
46 |
| - :style {:text-align :center}} |
47 |
| - amount]]) |
48 |
| - |
49 |
| -(defn contacts-section-header |
50 |
| - [{:keys [title]}] |
51 |
| - [rn/view |
52 |
| - {:style {:padding-horizontal 20 |
53 |
| - :border-top-width 1 |
54 |
| - :border-top-color colors/neutral-20 |
55 |
| - :padding-vertical 8 |
56 |
| - :margin-top 8}} |
57 |
| - [quo/text |
58 |
| - {:size :paragraph-2 |
59 |
| - :weight :medium |
60 |
| - :style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40)}} title]]) |
61 |
| - |
62 | 15 | (defn group-chat-member-toggle
|
63 | 16 | [member? selected? public-key]
|
64 | 17 | (if-not member?
|
|
143 | 96 | :on-press show-profile-actions}})
|
144 | 97 | item]))
|
145 | 98 |
|
| 99 | +(defn contacts-section-header |
| 100 | + [{:keys [title]}] |
| 101 | + [quo/divider-label {:tight? true} title]) |
| 102 | + |
| 103 | +(defn contacts-section-footer |
| 104 | + [_] |
| 105 | + [rn/view {:style {:height 8}}]) |
| 106 | + |
146 | 107 | (defn group-details
|
147 | 108 | []
|
148 | 109 | (let [chat-id (rf/sub [:get-screen-params :group-chat-profile])
|
149 |
| - {:keys [admins chat-id chat-name color public? |
150 |
| - muted contacts] |
| 110 | + {:keys [admins chat-id chat-name color muted contacts] |
151 | 111 | :as group} (rf/sub [:chats/chat-by-id chat-id])
|
152 | 112 | members (rf/sub [:contacts/group-members-sections chat-id])
|
153 | 113 | pinned-messages (rf/sub [:chats/pinned chat-id])
|
154 | 114 | current-pk (rf/sub [:multiaccount/public-key])
|
155 | 115 | admin? (get admins current-pk)]
|
156 |
| - [rn/view |
157 |
| - {:style {:flex 1 |
158 |
| - :background-color (colors/theme-colors colors/white colors/neutral-95)}} |
159 |
| - [quo/header |
160 |
| - {:left-component [back-button] |
161 |
| - :right-component [options-button group] |
162 |
| - :background (colors/theme-colors colors/white colors/neutral-95)}] |
163 |
| - [rn/view |
164 |
| - {:style {:flex-direction :row |
165 |
| - :margin-top 24 |
166 |
| - :padding-horizontal 20}} |
167 |
| - [quo/group-avatar |
168 |
| - {:customization-color color |
169 |
| - :size :size-32}] |
170 |
| - [quo/text |
171 |
| - {:weight :semi-bold |
172 |
| - :size :heading-1 |
173 |
| - :style {:margin-horizontal 8}} chat-name] |
174 |
| - [rn/view {:style {:margin-top 8}} |
175 |
| - [quo/icon (if public? :i/world :i/privacy) |
176 |
| - {:size 20 :color (colors/theme-colors colors/neutral-50 colors/neutral-40)}]]] |
177 |
| - [rn/view {:style (style/actions-view)} |
178 |
| - [rn/touchable-opacity |
179 |
| - {:style (style/action-container color) |
180 |
| - :accessibility-label :pinned-messages |
181 |
| - :on-press (fn [] |
182 |
| - (rf/dispatch [:dismiss-keyboard]) |
183 |
| - (rf/dispatch [:pin-message/show-pins-bottom-sheet chat-id]))} |
184 |
| - [rn/view |
185 |
| - {:style {:flex-direction :row |
186 |
| - :justify-content :space-between}} |
187 |
| - [quo/icon :i/pin {:size 20 :color (colors/theme-colors colors/neutral-100 colors/white)}] |
188 |
| - [count-container (count pinned-messages) :pinned-count]] |
189 |
| - [quo/text {:style {:margin-top 16} :size :paragraph-1 :weight :medium} |
190 |
| - (i18n/label :t/pinned-messages)]] |
191 |
| - [rn/touchable-opacity |
192 |
| - {:style (style/action-container color) |
193 |
| - :accessibility-label :toggle-mute |
194 |
| - :on-press #(rf/dispatch [:chat.ui/mute chat-id (not muted) |
195 |
| - (when-not muted constants/mute-till-unmuted)])} |
196 |
| - [quo/icon (if muted :i/muted :i/activity-center) |
197 |
| - {:size 20 :color (colors/theme-colors colors/neutral-100 colors/white)}] |
198 |
| - [quo/text {:style {:margin-top 16} :size :paragraph-1 :weight :medium} |
199 |
| - (i18n/label (if muted :unmute-group :mute-group))]] |
200 |
| - [rn/touchable-opacity |
201 |
| - {:style (style/action-container color) |
202 |
| - :accessibility-label :manage-members |
203 |
| - :on-press (fn [] |
204 |
| - (rf/dispatch [:group/clear-added-participants]) |
205 |
| - (rf/dispatch [:group/clear-removed-members]) |
206 |
| - (rf/dispatch [:open-modal :group-add-manage-members chat-id]))} |
207 |
| - [rn/view |
208 |
| - {:style {:flex-direction :row |
209 |
| - :justify-content :space-between}} |
210 |
| - [quo/icon :i/add-user {:size 20 :color (colors/theme-colors colors/neutral-100 colors/white)}] |
211 |
| - [count-container (count contacts) :members-count]] |
212 |
| - [quo/text {:style {:margin-top 16} :size :paragraph-1 :weight :medium} |
213 |
| - (i18n/label (if admin? :t/manage-members :t/add-members))]]] |
| 116 | + [:<> |
| 117 | + [quo/gradient-cover |
| 118 | + {:height 286 |
| 119 | + :customization-color color}] |
| 120 | + [quo/page-nav |
| 121 | + {:type :no-title |
| 122 | + :background :photo |
| 123 | + :right-side [{:icon-name :i/options |
| 124 | + :on-press #(rf/dispatch [:show-bottom-sheet |
| 125 | + {:content (fn [] [actions/group-details-actions |
| 126 | + group])}])}] |
| 127 | + :icon-name :i/arrow-left |
| 128 | + :on-press #(rf/dispatch [:navigate-back])}] |
| 129 | + |
| 130 | + [quo/page-top |
| 131 | + {:title chat-name |
| 132 | + :avatar {:customization-color color}}] |
| 133 | + [quo/channel-actions |
| 134 | + {:container-style style/actions-view |
| 135 | + :actions [{:accessibility-label :pinned-messages |
| 136 | + :label (i18n/label :t/pinned-messages) |
| 137 | + :color color |
| 138 | + :icon :i/pin |
| 139 | + :counter-value (count pinned-messages) |
| 140 | + :on-press (fn [] |
| 141 | + (rf/dispatch [:dismiss-keyboard]) |
| 142 | + (rf/dispatch [:pin-message/show-pins-bottom-sheet |
| 143 | + chat-id]))} |
| 144 | + {:accessibility-label :toggle-mute |
| 145 | + :color color |
| 146 | + :icon (if muted :i/muted :i/activity-center) |
| 147 | + :label (i18n/label (if muted :unmute-group :mute-group)) |
| 148 | + :on-press #(rf/dispatch [:chat.ui/mute chat-id (not muted) |
| 149 | + (when-not muted |
| 150 | + constants/mute-till-unmuted)])} |
| 151 | + {:accessibility-label :manage-members |
| 152 | + :color color |
| 153 | + :icon :i/add-user |
| 154 | + :label (i18n/label (if admin? :t/manage-members :t/add-members)) |
| 155 | + :counter-value (count contacts) |
| 156 | + :on-press (fn [] |
| 157 | + (rf/dispatch [:group/clear-added-participants]) |
| 158 | + (rf/dispatch [:group/clear-removed-members]) |
| 159 | + (rf/dispatch [:open-modal :group-add-manage-members |
| 160 | + chat-id]))}]}] |
214 | 161 | [rn/section-list
|
215 | 162 | {:key-fn :title
|
216 | 163 | :sticky-section-headers-enabled false
|
217 | 164 | :sections members
|
218 | 165 | :render-section-header-fn contacts-section-header
|
| 166 | + :render-section-footer-fn contacts-section-footer |
219 | 167 | :render-data {:chat-id chat-id
|
220 | 168 | :admin? admin?}
|
221 | 169 | :render-fn contact-item-render}]]))
|
0 commit comments