1- import React , { useCallback , useContext , useMemo } from 'react' ;
2- import {
3- Box ,
4- Icon ,
5- IconSize ,
6- IconName as IconNameDesignSystem ,
7- } from '@metamask/design-system-react-native' ;
1+ import { useCallback , useContext , useMemo } from 'react' ;
82import { ToastContext } from '../../../../component-library/components/Toast' ;
93import {
104 ButtonIconVariant ,
@@ -16,8 +10,6 @@ import {
1610import { IconName } from '../../../../component-library/components/Icons/Icon' ;
1711import { useAppThemeFromContext } from '../../../../util/theme' ;
1812import { notificationAsync , NotificationFeedbackType } from 'expo-haptics' ;
19- import TrophyIcon from '../../../../images/rewards/trophy.svg' ;
20- import { ButtonSize } from '../../../../component-library/components/Buttons/Button' ;
2113
2214export type RewardsToastOptions = ToastOptions & {
2315 hapticsType : NotificationFeedbackType ;
@@ -27,18 +19,6 @@ export interface RewardsToastConfig {
2719 success : ( title : string , subtitle ?: string ) => RewardsToastOptions ;
2820 error : ( title : string , subtitle ?: string ) => RewardsToastOptions ;
2921 entriesClosed : ( title : string , subtitle ?: string ) => RewardsToastOptions ;
30- campaignWon : (
31- title : string ,
32- subtitle : string ,
33- linkLabel : string ,
34- onLinkPress : ( ) => void ,
35- ) => RewardsToastOptions ;
36- campaignEnded : (
37- title : string ,
38- subtitle : string ,
39- linkLabel : string ,
40- onLinkPress : ( ) => void ,
41- ) => RewardsToastOptions ;
4222}
4323
4424const getRewardsToastLabels = ( title : string ) : ToastLabelOptions => {
@@ -137,64 +117,6 @@ const useRewardsToast = (): {
137117 } ,
138118 } ,
139119 } ) ,
140- campaignWon : (
141- title : string ,
142- subtitle : string ,
143- linkLabel : string ,
144- onLinkPress : ( ) => void ,
145- ) => ( {
146- ...( REWARDS_TOASTS_DEFAULT_OPTIONS as RewardsToastOptions ) ,
147- variant : ToastVariants . Icon ,
148- iconName : IconName . Confirmation ,
149- iconColor : theme . colors . success . default ,
150- backgroundColor : 'transparent' ,
151- hapticsType : NotificationFeedbackType . Success ,
152- labelOptions : getRewardsToastLabels ( title ) ,
153- descriptionOptions : getRewardsToastDescriptionLabels ( subtitle ) ,
154- hasNoTimeout : true ,
155- linkButtonOptions : {
156- label : linkLabel ,
157- size : ButtonSize . Sm ,
158- onPress : ( ) => {
159- onLinkPress ( ) ;
160- toastRef ?. current ?. closeToast ( ) ;
161- } ,
162- } ,
163- startAccessory : (
164- < Box twClassName = "mr-2 h-6 w-6 self-start items-center justify-center" >
165- < TrophyIcon name = "trophy" width = { 24 } height = { 24 } />
166- </ Box >
167- ) ,
168- } ) ,
169- campaignEnded : (
170- title : string ,
171- subtitle : string ,
172- linkLabel : string ,
173- onLinkPress : ( ) => void ,
174- ) => ( {
175- ...( REWARDS_TOASTS_DEFAULT_OPTIONS as RewardsToastOptions ) ,
176- variant : ToastVariants . Icon ,
177- iconName : IconName . Info ,
178- iconColor : theme . colors . icon . default ,
179- backgroundColor : 'transparent' ,
180- hapticsType : NotificationFeedbackType . Warning ,
181- labelOptions : getRewardsToastLabels ( title ) ,
182- descriptionOptions : getRewardsToastDescriptionLabels ( subtitle ) ,
183- hasNoTimeout : true ,
184- linkButtonOptions : {
185- label : linkLabel ,
186- size : ButtonSize . Sm ,
187- onPress : ( ) => {
188- onLinkPress ( ) ;
189- toastRef ?. current ?. closeToast ( ) ;
190- } ,
191- } ,
192- startAccessory : (
193- < Box twClassName = "mr-2 h-6 w-6 self-start items-center justify-center" >
194- < Icon name = { IconNameDesignSystem . Joystick } size = { IconSize . Md } />
195- </ Box >
196- ) ,
197- } ) ,
198120 } ) ,
199121 [
200122 theme . colors . success . default ,
0 commit comments