[#14622] Show ugly network state icons and connection bottom sheet

This commit is contained in:
Roman Volosovskyi 2023-03-16 11:23:21 +01:00
parent 854e372f73
commit d608b88e26
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 26 additions and 1 deletions

View File

@ -58,10 +58,35 @@
:size :small} :size :small}
avatar)]]]) avatar)]]])
(defn connectivity-sheet
[]
(let [peers-count (rf/sub [:peers-count])
network-type (rf/sub [:network/type])]
[rn/view
[quo/text {:accessibility-label :peers-network-type-text} (str "NETWORK TYPE: " network-type)]
[quo/text {:accessibility-label :peers-count-text} (str "PEERS COUNT: " peers-count)]]))
(defn- right-section (defn- right-section
[{:keys [button-type search?]}] [{:keys [button-type search?]}]
(let [button-common-props (get-button-common-props button-type)] (let [button-common-props (get-button-common-props button-type)
network-type (rf/sub [:network/type])]
[rn/view {:style style/right-section} [rn/view {:style style/right-section}
(when (= network-type "cellular")
[quo/button
(merge button-common-props
{:icon false
:accessibility-label :on-cellular-network
:on-press #(rf/dispatch [:bottom-sheet/show-sheet
{:content connectivity-sheet}])})
"🦄"])
(when (= network-type "none")
[quo/button
(merge button-common-props
{:icon false
:accessibility-label :no-network-connection
:on-press #(rf/dispatch [:bottom-sheet/show-sheet
{:content connectivity-sheet}])})
"💀"])
(when search? (when search?
[quo/button [quo/button
(assoc button-common-props :accessibility-label :open-search-button) (assoc button-common-props :accessibility-label :open-search-button)