Fix loading screen for fetching community (#19968)

This commit is contained in:
Parvesh Monu 2024-05-13 20:52:05 +05:30 committed by GitHub
parent 112768d13a
commit a6cd97482c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 15 deletions

View File

@ -21,12 +21,10 @@
:align-items :center :align-items :center
:margin-top 20}) :margin-top 20})
(def fetching-placeholder (defn fetching-placeholder
{:align-items :center [top-inset]
:justify-content :center {:flex 1
:flex 1}) :margin-top top-inset})
(def fetching-text {:color :red})
(def blur-channel-header (def blur-channel-header
{:position :absolute {:position :absolute

View File

@ -6,9 +6,10 @@
[quo.theme] [quo.theme]
[react-native.blur :as blur] [react-native.blur :as blur]
[react-native.core :as rn] [react-native.core :as rn]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im.common.home.actions.view :as actions] [status-im.common.home.actions.view :as actions]
[status-im.common.not-implemented :as not-implemented] [status-im.common.resources :as resources]
[status-im.common.scroll-page.style :as scroll-page.style] [status-im.common.scroll-page.style :as scroll-page.style]
[status-im.common.scroll-page.view :as scroll-page] [status-im.common.scroll-page.view :as scroll-page]
[status-im.config :as config] [status-im.config :as config]
@ -369,18 +370,25 @@
(defn- community-fetching-placeholder (defn- community-fetching-placeholder
[id] [id]
(let [fetching? (rf/sub [:communities/fetching-community id])] (let [theme (quo.theme/use-theme)
top-inset (safe-area/get-top)
fetching? (rf/sub [:communities/fetching-community id])]
[rn/view [rn/view
{:style style/fetching-placeholder {:style (style/fetching-placeholder top-inset)
:accessibility-label (if fetching? :accessibility-label (if fetching?
:fetching-community-overview :fetching-community-overview
:failed-to-fetch-community-overview)} :failed-to-fetch-community-overview)}
[not-implemented/not-implemented [quo/page-nav
[rn/text {:title "Community Overview"
{:style style/fetching-text} :type :title
(if fetching? :text-align :left
"Fetching community..." :icon-name :i/close
"Failed to fetch community")]]])) :on-press #(rf/dispatch [:navigate-back])}]
[quo/empty-state
{:image (resources/get-themed-image :cat-in-box theme)
:description (when-not fetching? (i18n/label :t/here-is-a-cat-in-a-box-instead))
:title (if fetching? "Fetching community..." "Failed to fetch community")
:container-style {:flex 1 :justify-content :center}}]]))
(defn- community-card-page-view (defn- community-card-page-view
[id] [id]