Hide empty categories and categories that include only hidden channels

This commit is contained in:
Parvesh Monu 2024-05-16 15:21:30 +05:30
parent 30715a69e1
commit 052813e30e
No known key found for this signature in database
GPG Key ID: F399696520817DE9
2 changed files with 26 additions and 21 deletions

View File

@ -73,6 +73,7 @@
(into #{} (map (comp :name second) channels-list))) (into #{} (map (comp :name second) channels-list)))
:style (style/channel-list-component)} :style (style/channel-list-component)}
(for [[category-id {:keys [chats name collapsed?]}] channels-list] (for [[category-id {:keys [chats name collapsed?]}] channels-list]
(when (seq chats)
[rn/view [rn/view
{:key category-id {:key category-id
;; on-layout fires only when the component re-renders, so ;; on-layout fires only when the component re-renders, so
@ -91,7 +92,7 @@
(fn [index chat] (fn [index chat]
^{:key (:id chat)} ^{:key (:id chat)}
[channel-chat-item community-id chat (= index last-item-index)]) [channel-chat-item community-id chat (= index last-item-index)])
chats))])])]) chats))])]))])
(defn- get-access-type (defn- get-access-type
[access] [access]
@ -379,7 +380,7 @@
:fetching-community-overview :fetching-community-overview
:failed-to-fetch-community-overview)} :failed-to-fetch-community-overview)}
[quo/page-nav [quo/page-nav
{:title "Community Overview" {:title (i18n/label :t/community-overview)
:type :title :type :title
:text-align :left :text-align :left
:icon-name :i/close :icon-name :i/close
@ -387,7 +388,9 @@
[quo/empty-state [quo/empty-state
{:image (resources/get-themed-image :cat-in-box theme) {:image (resources/get-themed-image :cat-in-box theme)
:description (when-not fetching? (i18n/label :t/here-is-a-cat-in-a-box-instead)) :description (when-not fetching? (i18n/label :t/here-is-a-cat-in-a-box-instead))
:title (if fetching? "Fetching community..." "Failed to fetch community") :title (if fetching?
(i18n/label :t/fetching-community)
(i18n/label :t/failed-to-fetch-community))
:container-style {:flex 1 :justify-content :center}}]])) :container-style {:flex 1 :justify-content :center}}]]))
(defn- community-card-page-view (defn- community-card-page-view

View File

@ -268,6 +268,7 @@
"community-color": "Community colour", "community-color": "Community colour",
"community-link": "Community link", "community-link": "Community link",
"community-color-placeholder": "Pick a colour", "community-color-placeholder": "Pick a colour",
"community-overview": "Community Overview",
"membership-button": "Membership requirement", "membership-button": "Membership requirement",
"membership-none": "None", "membership-none": "None",
"membership-none-placeholder": "You can require new members to meet certain criteria before they can join. This can be changed at any time", "membership-none-placeholder": "You can require new members to meet certain criteria before they can join. This can be changed at any time",
@ -1565,6 +1566,7 @@
"with-full-encryption": "With full metadata privacy and e2e encryption", "with-full-encryption": "With full metadata privacy and e2e encryption",
"fetch-community": "Fetch community", "fetch-community": "Fetch community",
"fetching-community": "Fetching community...", "fetching-community": "Fetching community...",
"failed-to-fetch-community": "Failed to fetch community",
"seed-phrase-placeholder": "Type or paste your recovery phrase", "seed-phrase-placeholder": "Type or paste your recovery phrase",
"seed-phrase-words-exceeded": "Recovery phrase cannot exceed 24 words", "seed-phrase-words-exceeded": "Recovery phrase cannot exceed 24 words",
"seed-phrase-words-uppercase": "Recovery phrase cannot contain uppercase characters", "seed-phrase-words-uppercase": "Recovery phrase cannot contain uppercase characters",