-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(toasts): Show correct place name in saved place toast confir…
…mations.
- Loading branch information
1 parent
1bc97f5
commit e1c6453
Showing
6 changed files
with
33 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { IntlShape } from 'react-intl' | ||
import React from 'react' | ||
import toast from 'react-hot-toast' | ||
|
||
import { getPlaceMainText } from '../../util/user' | ||
import { UserSavedLocation } from '../user/types' | ||
|
||
// Note: the HTML for toasts is rendered outside of the IntlProvider context, | ||
// so intl.formatMessage and others have to be used instead of <FormattedMessage> tags. | ||
|
||
/** | ||
* Helper that will display a toast notification when a place is saved. | ||
*/ | ||
export function toastOnPlaceSaved( | ||
place: UserSavedLocation, | ||
intl: IntlShape | ||
): void { | ||
toast.success( | ||
<span> | ||
<strong>{getPlaceMainText(place, intl)}</strong> | ||
<br /> | ||
{intl.formatMessage({ | ||
id: 'actions.user.placeRemembered' | ||
})} | ||
</span> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters