From 346574a494de4dc6ca09db3f547d508fd2f3a3d1 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 31 Mar 2022 20:18:45 +0200 Subject: [PATCH] [#13233] Proper message after clearing history in pubchat --- src/status_im/ui/screens/chat/group.cljs | 41 +++++++++++++----------- translations/en.json | 1 + 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/status_im/ui/screens/chat/group.cljs b/src/status_im/ui/screens/chat/group.cljs index a1158464c1..76663a9a38 100644 --- a/src/status_im/ui/screens/chat/group.cljs +++ b/src/status_im/ui/screens/chat/group.cljs @@ -92,13 +92,14 @@ (defn calculate-quiet-time [synced-to synced-from] - (let [quiet-hours (quot (- synced-to synced-from) - (* 60 60))] - (if (<= quiet-hours 24) - (i18n/label :t/quiet-hours - {:quiet-hours quiet-hours}) - (i18n/label :t/quiet-days - {:quiet-days (quot quiet-hours 24)})))) + (when synced-from + (let [quiet-hours (quot (- synced-to synced-from) + (* 60 60))] + (if (<= quiet-hours 24) + (i18n/label :t/quiet-hours + {:quiet-hours quiet-hours}) + (i18n/label :t/quiet-days + {:quiet-days (quot quiet-hours 24)}))))) (defview no-messages-community-chat-description-container [chat-id] (letsubs [{:keys [synced-to synced-from]} @@ -113,18 +114,20 @@ (defview no-messages-private-group-chat-description-container [chat-id] (letsubs [{:keys [synced-to synced-from]} [:chats/synced-to-and-from chat-id]] - [react/nested-text {:style (merge style/intro-header-description - {:margin-bottom 36})} - (let [quiet-time (calculate-quiet-time synced-to - synced-from)] - (i18n/label :t/empty-chat-description-public - {:quiet-hours quiet-time})) - [{:style {:color colors/blue} - :on-press #(list-selection/open-share - {:message - (i18n/label - :t/share-public-chat-text {:link (links/generate-link :public-chat :external chat-id)})})} - (i18n/label :t/empty-chat-description-public-share-this)]])) + (let [quiet-time (calculate-quiet-time synced-to + synced-from)] + [react/nested-text {:style (merge style/intro-header-description + {:margin-bottom 36})} + (if quiet-time + (i18n/label :t/empty-chat-description-public + {:quiet-hours quiet-time}) + (i18n/label :t/cleared-chat-description-public)) + [{:style {:color colors/blue} + :on-press #(list-selection/open-share + {:message + (i18n/label + :t/share-public-chat-text {:link (links/generate-link :public-chat :external chat-id)})})} + (i18n/label :t/empty-chat-description-public-share-this)]]))) (defview pending-invitation-description [inviter-pk chat-name] diff --git a/translations/en.json b/translations/en.json index be29cbfcaf..e606c1f348 100644 --- a/translations/en.json +++ b/translations/en.json @@ -449,6 +449,7 @@ "empty-chat-description": "There are no messages \nin this chat yet", "empty-chat-description-one-to-one": "Any messages you send here are encrypted and can only be read by you and ", "empty-chat-description-public": "It's been quiet here for the last {{quiet-hours}}. Start the conversation or ", + "cleared-chat-description-public": "It's been quiet here. Start the conversation or ", "empty-chat-description-community": "It's been quiet here for the last {{quiet-hours}}.", "empty-chat-description-public-share-this": "share this chat.", "enable": "Enable",