Skip to content

Commit 7af409b

Browse files
committedApr 9, 2024
feat: Make toasts clickable
1 parent 7ecba6d commit 7af409b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎src/client/notifications.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import { ToastAction } from '@/components/ui/toast';
12
import { toast } from '@/components/ui/use-toast';
3+
import { createElement } from 'react';
4+
import { client } from './client';
25

36
export type RoomNotification = {
47
mentions: number;
@@ -41,6 +44,10 @@ class NotificationsEngine {
4144
toast({
4245
title,
4346
description: limitString(notification.message, 150),
47+
// action: <ToastAction altText="Try again">Try again</ToastAction>,
48+
action: createElement(ToastAction, { altText: 'View', onClick: () => {
49+
client.selectRoom(notification.room);
50+
} }, 'View') as any,
4451
});
4552
}
4653
} else {

0 commit comments

Comments
 (0)