Fix bubble click url

This commit is contained in:
Bill 2022-03-21 02:18:34 -04:00
parent 51960f7e50
commit 6e4c5e26b7

View File

@ -1,5 +1,5 @@
import { FC } from 'react'; import { FC } from 'react';
import { NotificationBubbleItem } from '../../../../api'; import { NotificationBubbleItem, NotificationUtilities } from '../../../../api';
import { Flex, LayoutNotificationBubbleView, LayoutNotificationBubbleViewProps, Text } from '../../../../common'; import { Flex, LayoutNotificationBubbleView, LayoutNotificationBubbleViewProps, Text } from '../../../../common';
export interface NotificationDefaultBubbleViewProps extends LayoutNotificationBubbleViewProps export interface NotificationDefaultBubbleViewProps extends LayoutNotificationBubbleViewProps
@ -13,8 +13,10 @@ export const NotificationDefaultBubbleView: FC<NotificationDefaultBubbleViewProp
const htmlText = item.message.replace(/\r\n|\r|\n/g, '<br />'); const htmlText = item.message.replace(/\r\n|\r|\n/g, '<br />');
NotificationUtilities.openUrl(item.linkUrl);
return ( return (
<LayoutNotificationBubbleView close={ close } gap={ 2 } alignItems="center" { ...rest }> <LayoutNotificationBubbleView close={ close } gap={ 2 } alignItems="center" onClick={ event => (item.linkUrl && item.linkUrl.length && NotificationUtilities.openUrl(item.linkUrl)) } { ...rest }>
<Flex center className="bubble-image-container"> <Flex center className="bubble-image-container">
{ (item.iconUrl && item.iconUrl.length) && { (item.iconUrl && item.iconUrl.length) &&
<img className="no-select" src={ item.iconUrl } alt="" /> } <img className="no-select" src={ item.iconUrl } alt="" /> }