Skip to content

Commit

Permalink
Style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alwx committed Jan 30, 2024
1 parent df8d090 commit 38a25b6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
(ns status-im.contexts.chat.messenger.composer.actions.style
(:require
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[status-im.contexts.chat.messenger.composer.constants :as constants]))

(def actions-container
Expand Down Expand Up @@ -30,3 +32,7 @@
:right -20
:bottom 0
:height constants/composer-default-height})

(def photo-limit-toast-container
{:top (+ (safe-area/get-top)
(if platform/ios? -40 14))})
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[react-native.permissions :as permissions]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im.common.alert.effects :as alert.effects]
[status-im.common.device-permissions :as device-permissions]
Expand Down Expand Up @@ -154,22 +153,20 @@
50)}]))
:max-duration-ms constants/audio-max-duration-ms}]]))

(defn images-limit-toast
(defn photo-limit-toast
[]
(rf/dispatch [:toasts/upsert
{:id :random-id
:type :negative
:container-style {:top (if platform/ios?
(- (safe-area/get-top) 40)
(- (safe-area/get-top) 40))}
:container-style style/photo-limit-toast-container
:text (i18n/label :t/hit-photos-limit
{:max-photos constants/max-album-photos})}]))


(defn go-to-camera
[images-count]
(device-permissions/camera #(if (>= images-count constants/max-album-photos)
(images-limit-toast)
(photo-limit-toast)
(rf/dispatch [:navigate-to :camera-screen]))))

(defn camera-button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(ns status-im.contexts.chat.messenger.photo-selector.style
(:require
[quo.foundations.colors :as colors]
[react-native.platform :as platform]))
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]))

(defn gradient-container
[bottom-inset]
Expand Down Expand Up @@ -75,3 +76,7 @@
{:position :absolute
:top 8
:right 8})

(def photo-limit-toast-container
{:top (+ (safe-area/get-top)
(if platform/ios? -40 14))})
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[react-native.core :as rn]
[react-native.gesture :as gesture]
[react-native.linear-gradient :as linear-gradient]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
Expand All @@ -17,13 +16,12 @@

(def min-scroll-to-blur 5)

(defn show-toast
(defn show-photo-limit-toast
[]
(rf/dispatch [:toasts/upsert
{:id :random-id
:type :negative
:container-style {:top (if platform/ios?
(- (safe-area/get-top) 40))}
:container-style style/photo-limit-toast-container
:text (i18n/label :t/hit-photos-limit
{:max-photos constants/max-album-photos})}]))

Expand Down Expand Up @@ -76,7 +74,7 @@
(if item-selected?
(swap! selected remove-selected item)
(if (>= (count @selected) constants/max-album-photos)
(show-toast)
(show-photo-limit-toast)
(swap! selected conj item))))
:accessibility-label (str "image-" index)}
[rn/image
Expand Down

0 comments on commit 38a25b6

Please sign in to comment.