diff options
| author | Oliver <oliver@mohlin.dev> | 2025-03-11 14:35:49 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-03-19 15:06:37 +0100 |
| commit | 7e96f4744ce5fbf9cd15114dde4a1abec50c59b5 (patch) | |
| tree | 973e5c827c90714347744d4303afdbb38f598a25 | |
| parent | 2e91b724ecd77971fc025898666a3fea2e50a40f (diff) | |
| download | mullvadvpn-7e96f4744ce5fbf9cd15114dde4a1abec50c59b5.tar.xz mullvadvpn-7e96f4744ce5fbf9cd15114dde4a1abec50c59b5.zip | |
Add navigate-external notification type
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/renderer/components/NotificationArea.tsx | 16 | ||||
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts | 5 |
2 files changed, 18 insertions, 3 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/NotificationArea.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/NotificationArea.tsx index 514ef34882..d30fb71d3f 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/NotificationArea.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/NotificationArea.tsx @@ -16,6 +16,7 @@ import { } from '../../shared/notifications'; import { useAppContext } from '../context'; import useActions from '../lib/actionsHook'; +import { Icon } from '../lib/components'; import { Colors } from '../lib/foundations'; import { transitions, useHistory } from '../lib/history'; import { formatHtml } from '../lib/html-formatter'; @@ -27,6 +28,7 @@ import { RoutePath } from '../lib/routes'; import accountActions from '../redux/account/actions'; import { IReduxState, useSelector } from '../redux/store'; import * as AppButton from './AppButton'; +import { ExternalLink } from './ExternalLink'; import { InternalLink } from './InternalLink'; import { ModalAlert, ModalAlertType, ModalMessage, ModalMessageList } from './Modal'; import { @@ -143,17 +145,25 @@ export default function NotificationArea(props: IProps) { <NotificationSubtitle data-testid="notificationSubTitle"> {Array.isArray(notification.subtitle) ? notification.subtitle.map((subtitle, index, arr) => { - const content = - subtitle.action && subtitle.action.type === 'navigate-internal' ? ( + const content = subtitle.action ? ( + subtitle.action.type === 'navigate-internal' ? ( <InternalLink variant="labelTiny" color={Colors.white60} {...subtitle.action.link}> {formatHtml(subtitle.content)} </InternalLink> + ) : subtitle.action.type === 'navigate-external' ? ( + <ExternalLink variant="labelTiny" {...subtitle.action.link}> + {formatHtml(subtitle.content)} + <Icon icon="external" size="small" /> + </ExternalLink> ) : ( formatHtml(subtitle.content) - ); + ) + ) : ( + formatHtml(subtitle.content) + ); return ( <span key={index}> diff --git a/desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts b/desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts index 4ee2fafaef..fa31004d6a 100644 --- a/desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts +++ b/desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts @@ -1,3 +1,4 @@ +import { ExternalLinkProps } from '../../renderer/components/ExternalLink'; import { InternalLinkProps } from '../../renderer/components/InternalLink'; import { Url } from '../constants'; @@ -33,6 +34,10 @@ export type InAppNotificationAction = | { type: 'navigate-internal'; link: Pick<InternalLinkProps, 'to' | 'onClick' | 'aria-label'>; + } + | { + type: 'navigate-external'; + link: Pick<ExternalLinkProps, 'to' | 'onClick' | 'aria-label'>; }; export type InAppNotificationIndicatorType = 'success' | 'warning' | 'error'; |
