blob: 7d0fe9f29951ce8bf156f2abc4b09faea1488058 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import { sprintf } from 'sprintf-js';
import { messages } from '../../shared/gettext';
import { capitalizeEveryWord } from '../string-helpers';
import { InAppNotification, InAppNotificationProvider } from './notification';
interface NewDeviceNotificationContext {
shouldDisplay: boolean;
deviceName: string;
close: () => void;
}
export class NewDeviceNotificationProvider implements InAppNotificationProvider {
public constructor(private context: NewDeviceNotificationContext) {}
public mayDisplay = () => this.context.shouldDisplay;
public getInAppNotification(): InAppNotification {
return {
indicator: 'success',
title: messages.pgettext('in-app-notifications', 'NEW DEVICE CREATED'),
subtitle: sprintf(
messages.pgettext(
'in-app-notifications',
'Welcome, this device is now called <b>%(deviceName)s</b>. For more details see the info button in Account.',
),
{ deviceName: capitalizeEveryWord(this.context.deviceName) },
),
action: { type: 'close', close: this.context.close },
};
}
}
|