Compare commits

...
Author SHA1 Message Date
alwx 1ca9341e97 More attempts to fix that stuff 2024-04-17 13:36:56 +02:00
alwx 68957e78e4 Rolling things back 2024-04-16 12:12:39 +02:00
alwx 18660a5574 Fixes 2024-04-16 11:42:32 +02:00
alwx 9a8b9dcb3f Fixes 2024-04-16 09:37:08 +02:00
alwx 6043c918a2 Update hole-view and paddings to correctly deal with cases when alert message is present 2024-04-15 14:08:29 +02:00
15 changed files with 49 additions and 38 deletions
@@ -0,0 +1,5 @@
(ns status-im.common.alert-banner.constants)
(def ^:const border-radius 20)
(def ^:const hole-view-height 60)
(def ^:const alert-banner-height 40)
+6 -7
View File
@@ -1,20 +1,19 @@
(ns status-im.common.alert-banner.style)
(def border-radius 20)
(ns status-im.common.alert-banner.style
(:require [status-im.common.alert-banner.constants :as alert-banner.constants]))
(defn container
[background-color]
{:background-color background-color})
(def second-banner-wrapper
{:margin-top (- border-radius)
{:margin-top (- alert-banner.constants/border-radius)
:overflow :hidden
:border-top-left-radius border-radius
:border-top-right-radius border-radius})
:border-top-left-radius alert-banner.constants/border-radius
:border-top-right-radius alert-banner.constants/border-radius})
(defn hole-view
[background-color]
{:padding-top 11
:align-items :center
:height 60
:height alert-banner.constants/hole-view-height
:background-color background-color})
+9 -9
View File
@@ -5,8 +5,8 @@
[react-native.core :as rn]
[react-native.hole-view :as hole-view]
[react-native.safe-area :as safe-area]
[status-im.common.alert-banner.constants :as alert-banner.constants]
[status-im.common.alert-banner.style :as style]
[status-im.constants :as constants]
[utils.re-frame :as rf]))
(defn get-colors-map
@@ -26,10 +26,10 @@
:holes (if second-banner?
[]
[{:x 0
:y constants/alert-banner-height
:y alert-banner.constants/alert-banner-height
:width (:width (rn/get-window))
:height constants/alert-banner-height
:borderRadius style/border-radius}])}
:height alert-banner.constants/alert-banner-height
:borderRadius alert-banner.constants/border-radius}])}
[quo/text
{:size :paragraph-2
:weight :medium
@@ -38,8 +38,8 @@
(defn view
[]
(let [banners (rf/sub [:alert-banners])
theme (quo.theme/use-theme-value)
(let [banners (rf/sub [:alert-banners])
theme (quo.theme/use-theme-value)
banners-count (count banners)
alert-banner (:alert banners)
error-banner (:error banners)
@@ -49,10 +49,10 @@
;; required for fix flicker issue https://github.com/status-im/status-mobile/issues/19490
{:style {:padding-bottom 1}
:holes [{:x 0
:y (+ safe-area-top (* constants/alert-banner-height banners-count))
:y (+ safe-area-top (* alert-banner.constants/alert-banner-height banners-count))
:width (:width (rn/get-window))
:height constants/alert-banner-height
:borderRadius style/border-radius}]}
:height alert-banner.constants/alert-banner-height
:borderRadius alert-banner.constants/border-radius}]}
[rn/view {:style {:background-color colors/neutral-100}}
[rn/view
{:style {:height safe-area-top
@@ -114,9 +114,9 @@
:keyboard-vertical-offset (if platform/ios? footer-container-padding 0)
:pointer-events :box-none}
[floating-container/view
{:on-layout set-footer-container-height
:keyboard-shown? keyboard-shown?
:blur? show-background?}
{:on-layout set-footer-container-height
:keyboard-shown? keyboard-shown?
:blur? show-background?}
footer]]]])
(finally
(remove-listeners))))
-2
View File
@@ -485,8 +485,6 @@
(def ^:const bridge-name-erc-721-transfer "ERC721Transfer")
(def ^:const bridge-name-hop "Hop")
(def ^:const alert-banner-height 40)
(def ^:const status-hostname "status.app")
(def ^:const community-joined-notification-type "communityJoined")
@@ -1,6 +1,7 @@
(ns status-im.contexts.chat.group-details.style
(:require
[quo.foundations.colors :as colors]))
[quo.foundations.colors :as colors]
[status-im.contexts.shell.jump-to.constants :as jump-to.constants]))
(def actions-view
{:margin-top 8
@@ -42,4 +43,4 @@
(def floating-shell-button
{:position :absolute
:bottom 21})
:bottom jump-to.constants/default-bottom-spacing})
@@ -146,7 +146,8 @@
(defn f-composer
[props]
(let [theme (quo.theme/use-theme-value)
(let [_ (js/console.log "ALWX COMPOSER" (clj->js props))
theme (quo.theme/use-theme-value)
opacity (reanimated/use-shared-value 0)
window-height (:height (rn/get-window))
background-y (reanimated/use-shared-value (- window-height))
@@ -1,6 +1,7 @@
(ns status-im.contexts.communities.overview.style
(:require
[quo.foundations.colors :as colors]
[status-im.common.alert-banner.constants :as alert-banner.constants]
[status-im.contexts.shell.jump-to.constants :as jump-to.constants]))
(def screen-horizontal-padding 20)
@@ -49,14 +50,16 @@
:right 0
:bottom 0})
(def floating-shell-button
(defn floating-shell-button [alert-banners-top-margin]
{:position :absolute
:bottom 21})
:bottom (+ jump-to.constants/default-bottom-spacing
alert-banners-top-margin)})
(defn channel-list-component
[]
{:margin-top 8
:margin-bottom (+ 21 jump-to.constants/floating-shell-button-height)
:margin-bottom (+ jump-to.constants/default-bottom-spacing
jump-to.constants/floating-shell-button-height)
:flex 1})
(defn token-gated-container
@@ -385,12 +385,13 @@
(defn view
[id]
(let [id (or id (rf/sub [:get-screen-params :community-overview]))
customization-color (rf/sub [:profile/customization-color])]
(let [id (or id (rf/sub [:get-screen-params :community-overview]))
customization-color (rf/sub [:profile/customization-color])
alert-banners-top-margin (rf/sub [:alert-banners/top-margin])]
[rn/view {:style style/community-overview-container}
[community-card-page-view id]
[quo/floating-shell-button
{:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:customization-color customization-color
:label (i18n/label :t/jump-to)}}
style/floating-shell-button]]))
(style/floating-shell-button alert-banners-top-margin)]]))
@@ -231,7 +231,7 @@
(rf/reg-event-fx
:profile/show-testnet-mode-banner-if-enabled
(fn [{:keys [db]}]
(when (get-in db [:profile/profile :test-networks-enabled?])
(when (or true (get-in db [:profile/profile :test-networks-enabled?]))
{:fx [[:dispatch
[:alert-banners/add
{:type :alert
@@ -3,6 +3,7 @@
(def ^:const shell-animation-time 200)
(def ^:const switcher-card-size 160)
(def ^:const floating-shell-button-height 44)
(def ^:const default-bottom-spacing 21)
;; Bottom tabs
(def ^:const bottom-tabs-container-height-android 57)
@@ -29,4 +29,5 @@
{:margin-top 12
:margin-bottom 8})
(def slide-button-container {:z-index 1})
(defn slide-button-container [bottom]
{:z-index 1})
@@ -7,6 +7,7 @@
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im.common.alert-banner.constants :as alert-banner.constants]
[status-im.common.emoji-picker.utils :as emoji-picker.utils]
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.common.standard-authentication.core :as standard-auth]
@@ -127,7 +128,7 @@
(if new-keypair
(create-new-keypair-account password)
(create-existing-keypair-account
password)))
password)))
:auth-button-label (i18n/label :t/confirm)
:disabled? (empty? @account-name)
:container-style (style/slide-button-container bottom)
+2 -2
View File
@@ -1,7 +1,7 @@
(ns status-im.subs.alert-banner
(:require
[re-frame.core :as re-frame]
[status-im.constants :as constants]))
[status-im.common.alert-banner.constants :as alert-banner.constants]))
(re-frame/reg-sub
:alert-banners/top-margin
@@ -9,4 +9,4 @@
(fn [banners]
(let [banners-count (count banners)]
(when (pos? banners-count)
(+ (* constants/alert-banner-height banners-count) 8)))))
(* alert-banner.constants/alert-banner-height banners-count)))))
+3 -3
View File
@@ -13,14 +13,14 @@
:alert-banners
{:alert {:text "Alert"
:type :alert}})
(is (= (rf/sub [sub-name]) 48)))
(is (= (rf/sub [sub-name]) 40)))
(testing "returns 48 when only error banner"
(swap! rf-db/app-db assoc
:alert-banners
{:error {:text "Error"
:type :error}})
(is (= (rf/sub [sub-name]) 48)))
(is (= (rf/sub [sub-name]) 40)))
(testing "returns 88 when both alert and error banner"
(swap! rf-db/app-db assoc
@@ -29,4 +29,4 @@
:type :alert}
:error {:text "Error"
:type :error}})
(is (= (rf/sub [sub-name]) 88))))
(is (= (rf/sub [sub-name]) 80))))