Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol-designer): add announcement toast #16562

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export const useAnnouncements = (): Announcement[] => {
),
},
{
announcementKey: 'redesign9.0',
announcementKey: process.env.OT_PD_VERSION ?? 'redesign9.0',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm i am reluctant to use the OT_PD_VERSION here because it is for an announcementKey. I know that we don't see previous announcements but i think it is sort of for legacy tracking of the previous versions.

can this instead be:

announcementKey: 'redesign8.2'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean changing that manually?

image: <Flex />,
heading: t('announcements.redesign.body1'),
message: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const AnnouncementModal = (
justifyContent={JUSTIFY_CENTER}
gridGap={SPACING.spacing12}
>
{image && image}
{image != null && image}
{message}
</Flex>
</Modal>
Expand Down
5 changes: 3 additions & 2 deletions protocol-designer/src/pages/Landing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function Landing(): JSX.Element {
const [showAnnouncementModal, setShowAnnouncementModal] = useState<boolean>(
false
)
const { bakeToast } = useKitchen()
const { bakeToast, eatToast } = useKitchen()
const announcements = useAnnouncements()
const lastAnnouncement = announcements[announcements.length - 1]
const announcementKey = lastAnnouncement
Expand All @@ -50,14 +50,15 @@ export function Landing(): JSX.Element {

useEffect(() => {
if (userHasNotSeenAnnouncement) {
bakeToast(
const toastId = bakeToast(
t('learn_more', { version: process.env.OT_PD_VERSION }) as string,
INFO_TOAST,
{
heading: t('updated_protocol_designer'),
closeButton: true,
linkText: t('view_release_notes'),
onLinkClick: () => {
eatToast(toastId)
setShowAnnouncementModal(true)
},
disableTimeout: true,
Expand Down
Loading