Skip to content

Commit

Permalink
fix: toast usage
Browse files Browse the repository at this point in the history
  • Loading branch information
codemaster115 committed Dec 20, 2023
1 parent 6f089f7 commit c22df18
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 76 deletions.
22 changes: 10 additions & 12 deletions src/quo/core_spec.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
(ns quo.core-spec
(:require
(:require ;; [quo.components.list-items.account.component-spec]
;; [quo.components.list-items.address.component-spec]
;; [quo.components.list-items.saved-address.component-spec]
;; [quo.components.list-items.saved-contact-address.component-spec]
;; [quo.components.list-items.saved-contact-address.component-spec]
;; [quo.components.list-items.token-network.component-spec]
[quo.components.avatars.account-avatar.component-spec]
[quo.components.avatars.user-avatar.component-spec]
[quo.components.banners.banner.component-spec]
Expand Down Expand Up @@ -30,25 +35,18 @@
[quo.components.dropdowns.dropdown.component-spec]
[quo.components.dropdowns.network-dropdown.component-spec]
[quo.components.gradient.gradient-cover.component-spec]
[quo.components.graph.wallet-graph.component-spec]
;; [quo.components.inputs.address-input.component-spec]
[quo.components.graph.wallet-graph.component-spec] ;; [quo.components.inputs.address-input.component-spec]
[quo.components.inputs.input.component-spec]
[quo.components.inputs.locked-input.component-spec]
[quo.components.inputs.profile-input.component-spec]
[quo.components.inputs.recovery-phrase.component-spec]
;; [quo.components.inputs.title-input.component-spec]
[quo.components.inputs.recovery-phrase.component-spec] ;; [quo.components.inputs.title-input.component-spec]
[quo.components.keycard.component-spec]
[quo.components.links.link-preview.component-spec]
[quo.components.links.url-preview-list.component-spec]
[quo.components.links.url-preview.component-spec]
;; [quo.components.list-items.account.component-spec]
;; [quo.components.list-items.address.component-spec]
[quo.components.links.url-preview.component-spec] ;; [quo.components.list-items.account.component-spec]
[quo.components.list-items.channel.component-spec]
[quo.components.list-items.community.component-spec]
[quo.components.list-items.dapp.component-spec]
;; [quo.components.list-items.saved-address.component-spec]
;; [quo.components.list-items.saved-contact-address.component-spec]
;; [quo.components.list-items.token-network.component-spec]
[quo.components.list-items.dapp.component-spec] ;; [quo.components.list-items.saved-address.component-spec]
[quo.components.list-items.token-value.component-spec]
[quo.components.loaders.skeleton-list.component-spec]
[quo.components.markdown.list.component-spec]
Expand Down
13 changes: 5 additions & 8 deletions src/status_im/common/home/actions/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.foundations.colors :as colors]
[status-im.common.confirmation-drawer.view :as confirmation-drawer]
[status-im.common.mute-drawer.view :as mute-drawer]
[status-im.common.muting.helpers :refer [format-mute-till]]
Expand Down Expand Up @@ -221,13 +220,11 @@
(do
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:toasts/upsert
{:id :remove-nickname
:icon :i/correct
:icon-color (colors/theme-colors colors/success-60
colors/success-50)
:text (i18n/label
:t/remove-nickname-toast
{:secondary-name secondary-name})}])
{:id :remove-nickname
:type :positive
:text (i18n/label
:t/remove-nickname-toast
{:secondary-name secondary-name})}])
(rf/dispatch [:contacts/update-nickname public-key ""]))))
:danger? false
:accessibility-label :add-nickname
Expand Down
6 changes: 2 additions & 4 deletions src/status_im/common/pairing/events.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.common.pairing.events
(:require
[quo.foundations.colors :as colors]
[status-im.constants :as constants]
[status-im.contexts.communities.discover.events]
[taoensso.timbre :as log]
Expand Down Expand Up @@ -63,6 +62,5 @@

(and error-on-pairing? (some? error))
{:dispatch [:toasts/upsert
{:icon :i/alert
:icon-color colors/danger-50
:text error}]}))))
{:type :negative
:text error}]}))))
9 changes: 3 additions & 6 deletions src/status_im/contexts/chat/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[clojure.set :as set]
[legacy.status-im.chat.models.loading :as loading]
[legacy.status-im.data-store.chats :as chats-store]
[quo.foundations.colors :as colors]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im.common.muting.helpers :refer [format-mute-till]]
Expand Down Expand Up @@ -350,11 +349,9 @@
:t/channel-unmuted-successfully))))]
{:db (assoc-in db [:chats chat-id :muted-till] muted-till)
:dispatch [:toasts/upsert
{:icon :i/correct
:icon-color (colors/theme-colors colors/success-60
colors/success-50)
:text (mute-duration-text (when (some? muted-till)
(str (format-mute-till muted-till))))}]}))
{:type :positive
:text (mute-duration-text (when (some? muted-till)
(str (format-mute-till muted-till))))}]}))

(rf/defn mute-chat
{:events [:chat.ui/mute]}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.contexts.chat.messages.delete-message.events
(:require
[quo.foundations.colors :as colors]
[status-im.contexts.chat.messages.list.events :as message-list]
[taoensso.timbre :as log]
[utils.datetime :as datetime]
Expand Down Expand Up @@ -106,8 +105,7 @@
[[:toasts/close :delete-message-for-everyone]
[:toasts/upsert
{:id :delete-message-for-everyone
:icon :i/info
:icon-color colors/danger-50-opa-40
:type :negative
:message-deleted-for-everyone-count toast-count
:message-deleted-for-everyone-undos existing-undos
:text (i18n/label-pluralize
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.contexts.chat.messages.delete-message-for-me.events
(:require
[quo.foundations.colors :as colors]
[status-im.contexts.chat.messages.list.events :as message-list]
[taoensso.timbre :as log]
[utils.datetime :as datetime]
Expand Down Expand Up @@ -62,8 +61,7 @@
:dispatch-n [[:toasts/close :delete-message-for-me]
[:toasts/upsert
{:id :delete-message-for-me
:icon :i/info
:icon-color colors/danger-50-opa-40
:type :negative
:message-deleted-for-me-count toast-count
:message-deleted-for-me-undos existing-undos
:text (i18n/label-pluralize toast-count
Expand Down
6 changes: 2 additions & 4 deletions src/status_im/contexts/chat/messages/pin/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(:require
[legacy.status-im.data-store.messages :as data-store.messages]
[legacy.status-im.data-store.pin-messages :as data-store.pin-messages]
[quo.foundations.colors :as colors]
[re-frame.core :as re-frame]
[status-im.common.toasts.events :as toasts]
[status-im.constants :as constants]
Expand Down Expand Up @@ -123,9 +122,8 @@
{:events [:pin-message/show-pin-limit-modal]}
[cofx]
(toasts/upsert cofx
{:icon :alert
:icon-color colors/danger-50
:text (i18n/label :t/pin-limit-reached)}))
{:type :negative
:text (i18n/label :t/pin-limit-reached)}))

(rf/defn show-pins-bottom-sheet
{:events [:pin-message/show-pins-bottom-sheet]}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.contexts.communities.actions.community-options.events
(:require [quo.foundations.colors :as quo.colors]
[status-im.common.muting.helpers :as muting.helpers]
(:require [status-im.common.muting.helpers :as muting.helpers]
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
Expand All @@ -26,13 +25,12 @@
{:db (assoc-in db [:communities community-id :muted-till] muted-till)
:dispatch-n [[:community/update-community-chats-mute-status community-id muted? muted-till]
[:toasts/upsert
{:icon :correct
:icon-color (quo.colors/theme-colors quo.colors/success-60 quo.colors/success-50)
:text (if muted?
(when (some? muted-till)
(time-string :t/muted-until
(muting.helpers/format-mute-till muted-till)))
(i18n/label :t/community-unmuted))}]]})))
{:type :positive
:text (if muted?
(when (some? muted-till)
(time-string :t/muted-until
(muting.helpers/format-mute-till muted-till)))
(i18n/label :t/community-unmuted))}]]})))

(rf/reg-event-fx :community/set-muted
(fn [{:keys [db]} [community-id muted? muted-type]]
Expand Down
13 changes: 5 additions & 8 deletions src/status_im/contexts/communities/actions/leave/events.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.contexts.communities.actions.leave.events
(:require [legacy.status-im.ui.components.colors :as colors]
[taoensso.timbre :as log]
(:require [taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

Expand All @@ -9,9 +8,8 @@
{:fx [[:dispatch [:sanitize-messages-and-process-response response-js]]
[:dispatch
[:toasts/upsert
{:icon :correct
:icon-color (:positive-01 @colors/theme)
:text (i18n/label :t/you-canceled-the-request)}]]]}))
{:type :positive
:text (i18n/label :t/you-canceled-the-request)}]]]}))

(rf/reg-event-fx :communities/cancel-request-to-join
(fn [_ [request-to-join-id]]
Expand All @@ -28,9 +26,8 @@
{:fx [[:dispatch [:sanitize-messages-and-process-response response-js]]
[:dispatch
[:toasts/upsert
{:icon :correct
:icon-color (:positive-01 @colors/theme)
:text (i18n/label :t/left-community {:community community-name})}]]
{:type :positive
:text (i18n/label :t/left-community {:community community-name})}]]
[:dispatch [:activity-center.notifications/fetch-unread-count]]
[:dispatch [:navigate-back]]]})))

Expand Down
8 changes: 3 additions & 5 deletions src/status_im/contexts/communities/events.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns status-im.contexts.communities.events
(:require [clojure.set :as set]
[clojure.walk :as walk]
[legacy.status-im.ui.components.colors :as colors]
[status-im.constants :as constants]
status-im.contexts.communities.actions.community-options.events
status-im.contexts.communities.actions.leave.events
Expand Down Expand Up @@ -82,10 +81,9 @@
(assoc-in db [:communities/my-pending-requests-to-join community-id] request)
(and (= constants/community-request-to-join-state-accepted state) (not deleted))
(do (rf/dispatch [:toasts/upsert
{:icon :i/correct
:id :joined-community
:icon-color (:positive-01 @colors/theme)
:text (i18n/label :t/joined-community {:community name})}])
{:id :joined-community
:type :positive
:text (i18n/label :t/joined-community {:community name})}])
(update-in db [:communities/my-pending-requests-to-join] dissoc community-id))
:else (update-in db [:communities/my-pending-requests-to-join] dissoc community-id))))

Expand Down
10 changes: 4 additions & 6 deletions src/status_im/contexts/communities/overview/events.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns status-im.contexts.communities.overview.events
(:require
[legacy.status-im.data-store.communities :as data-store]
[legacy.status-im.ui.components.colors :as colors]
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
Expand Down Expand Up @@ -85,11 +84,10 @@
[:dispatch [:hide-bottom-sheet]]
[:dispatch
[:toasts/upsert
{:icon :correct
:icon-color (:positive-01 @colors/theme)
:text (i18n/label
:t/requested-to-join-community
{:community community-name})}]]]})))
{:type :positive
:text (i18n/label
:t/requested-to-join-community
{:community community-name})}]]]})))

(defn request-to-join-with-signatures
[_ [community-id addresses-to-reveal signatures]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
:undo-duration 4
:undo-on-press #(do
(rf/dispatch [:toasts/upsert
{:type :success
{:type :positive
:text "Undo pressed"}])
(rf/dispatch [:toasts/close
"Toast: with undo action"]))}])
Expand Down
6 changes: 2 additions & 4 deletions src/status_im/contexts/shell/share/events.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.contexts.shell.share.events
(:require
[quo.foundations.colors :as colors]
[status-im.common.toasts.events :as toasts]
[utils.re-frame :as rf]))

Expand All @@ -10,8 +9,7 @@
(rf/merge cofx
{:copy-to-clipboard text-to-copy}
(toasts/upsert
{:icon :correct
:id :successful-copy-toast-message
:icon-color colors/success-50
{:id :successful-copy-toast-message
:type :positive
:override-theme :dark
:text post-copy-message})))
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@
:label (i18n/label :t/copy-address)
:on-press (fn []
(rf/dispatch [:toasts/upsert
{:icon :i/correct
:icon-color (colors/resolve-color :success theme)
:text (i18n/label :t/address-copied)}])
{:type :positive
:text (i18n/label :t/address-copied)}])
(clipboard/set-string address))}
{:icon :i/share
:accessibility-label :share-account
Expand Down

0 comments on commit c22df18

Please sign in to comment.