@pushwoosh/dumb-components 1.1.134 → 1.1.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AccessForbidden/AccessForbidden.js +10 -2
- package/AccessForbidden/polyglot/index.d.ts +2 -0
- package/AccessForbidden/polyglot/index.js +10 -0
- package/AccessForbidden/polyglot/messages_en.d.ts +3 -0
- package/AccessForbidden/polyglot/messages_en.js +4 -0
- package/AccessForbidden/polyglot/messages_ru.d.ts +3 -0
- package/AccessForbidden/polyglot/messages_ru.js +4 -0
- package/AccessForbidden/polyglot/types.d.ts +5 -0
- package/AccessForbidden/polyglot/types.js +1 -0
- package/CrashScreen/CrashScreen.js +6 -1
- package/CrashScreen/polyglot/index.d.ts +2 -0
- package/CrashScreen/polyglot/index.js +10 -0
- package/CrashScreen/polyglot/messages_en.d.ts +3 -0
- package/CrashScreen/polyglot/messages_en.js +4 -0
- package/CrashScreen/polyglot/messages_ru.d.ts +3 -0
- package/CrashScreen/polyglot/messages_ru.js +4 -0
- package/CrashScreen/polyglot/types.d.ts +5 -0
- package/CrashScreen/polyglot/types.js +1 -0
- package/DateTimePicker/components/DatePickerField/DatePickerField.js +4 -1
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +4 -1
- package/DateTimePicker/components/Month/Month.js +16 -1
- package/DateTimePicker/polyglot/index.d.ts +2 -0
- package/DateTimePicker/polyglot/index.js +9 -0
- package/DateTimePicker/polyglot/messages_en.d.ts +3 -0
- package/DateTimePicker/polyglot/messages_en.js +11 -0
- package/DateTimePicker/polyglot/messages_ru.d.ts +3 -0
- package/DateTimePicker/polyglot/messages_ru.js +11 -0
- package/DateTimePicker/polyglot/types.d.ts +12 -0
- package/DateTimePicker/polyglot/types.js +1 -0
- package/Drawer/components/DrawerDocs/DrawerDocs.js +9 -3
- package/Drawer/polyglot/index.d.ts +2 -0
- package/Drawer/polyglot/index.js +10 -0
- package/Drawer/polyglot/messages_en.d.ts +3 -0
- package/Drawer/polyglot/messages_en.js +4 -0
- package/Drawer/polyglot/messages_ru.d.ts +3 -0
- package/Drawer/polyglot/messages_ru.js +4 -0
- package/Drawer/polyglot/types.d.ts +5 -0
- package/Drawer/polyglot/types.js +1 -0
- package/EditableField/EditableField.js +7 -2
- package/EditableField/polyglot/index.d.ts +2 -0
- package/EditableField/polyglot/index.js +9 -0
- package/EditableField/polyglot/messages_en.d.ts +3 -0
- package/EditableField/polyglot/messages_en.js +4 -0
- package/EditableField/polyglot/messages_ru.d.ts +3 -0
- package/EditableField/polyglot/messages_ru.js +4 -0
- package/EditableField/polyglot/types.d.ts +5 -0
- package/EditableField/polyglot/types.js +1 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +11 -3
- package/EmailTemplatePreview/polyglot/index.d.ts +2 -0
- package/EmailTemplatePreview/polyglot/index.js +10 -0
- package/EmailTemplatePreview/polyglot/messages_en.d.ts +3 -0
- package/EmailTemplatePreview/polyglot/messages_en.js +5 -0
- package/EmailTemplatePreview/polyglot/messages_ru.d.ts +3 -0
- package/EmailTemplatePreview/polyglot/messages_ru.js +5 -0
- package/EmailTemplatePreview/polyglot/types.d.ts +6 -0
- package/EmailTemplatePreview/polyglot/types.js +1 -0
- package/Modal/components/ModalConfirm/ModalConfirm.js +21 -8
- package/Modal/components/ModalConfirm/types.d.ts +1 -1
- package/Modal/polyglot/index.d.ts +2 -0
- package/Modal/polyglot/index.js +9 -0
- package/Modal/polyglot/messages_en.d.ts +3 -0
- package/Modal/polyglot/messages_en.js +6 -0
- package/Modal/polyglot/messages_ru.d.ts +3 -0
- package/Modal/polyglot/messages_ru.js +6 -0
- package/Modal/polyglot/types.d.ts +7 -0
- package/Modal/polyglot/types.js +1 -0
- package/NotificationInbox/NotificationBell.js +7 -1
- package/NotificationInbox/NotificationInbox.js +19 -5
- package/NotificationInbox/polyglot/index.d.ts +2 -0
- package/NotificationInbox/polyglot/index.js +10 -0
- package/NotificationInbox/polyglot/messages_en.d.ts +3 -0
- package/NotificationInbox/polyglot/messages_en.js +8 -0
- package/NotificationInbox/polyglot/messages_ru.d.ts +3 -0
- package/NotificationInbox/polyglot/messages_ru.js +8 -0
- package/NotificationInbox/polyglot/types.d.ts +11 -0
- package/NotificationInbox/polyglot/types.js +1 -0
- package/PushPreview/components/MissedContentPreview/MissedContentPreview.js +7 -2
- package/PushPreview/polyglot/index.d.ts +2 -0
- package/PushPreview/polyglot/index.js +9 -0
- package/PushPreview/polyglot/messages_en.d.ts +3 -0
- package/PushPreview/polyglot/messages_en.js +4 -0
- package/PushPreview/polyglot/messages_ru.d.ts +3 -0
- package/PushPreview/polyglot/messages_ru.js +4 -0
- package/PushPreview/polyglot/types.d.ts +5 -0
- package/PushPreview/polyglot/types.js +1 -0
- package/package.json +1 -1
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import accessForbiddenImage from './assets/AccessForbidden.svg?url';
|
|
3
|
+
import { Lang, useLang } from './polyglot';
|
|
3
4
|
import { RootBox, ImageBox, TitleBox, DescriptionBox } from './styles';
|
|
4
5
|
export function AccessForbidden() {
|
|
6
|
+
const lang = useLang();
|
|
5
7
|
return React.createElement(RootBox, null, React.createElement(ImageBox, {
|
|
6
|
-
alt:
|
|
8
|
+
alt: lang({
|
|
9
|
+
message: 'DUMB.ACCESS_FORBIDDEN.TITLE'
|
|
10
|
+
}),
|
|
7
11
|
src: accessForbiddenImage
|
|
8
|
-
}), React.createElement(TitleBox, null,
|
|
12
|
+
}), React.createElement(TitleBox, null, React.createElement(Lang, {
|
|
13
|
+
message: "DUMB.ACCESS_FORBIDDEN.TITLE"
|
|
14
|
+
})), React.createElement(DescriptionBox, null, React.createElement(Lang, {
|
|
15
|
+
message: "DUMB.ACCESS_FORBIDDEN.DESCRIPTION"
|
|
16
|
+
})));
|
|
9
17
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Color } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { WarningRoundIcon } from '@pushwoosh/kit-icons';
|
|
4
|
+
import { Lang } from './polyglot';
|
|
4
5
|
import { RootBox, IconBox, TitleBox, DescriptionBox } from './styles';
|
|
5
6
|
export function CrashScreen() {
|
|
6
7
|
return React.createElement(RootBox, null, React.createElement(IconBox, null, React.createElement(WarningRoundIcon, {
|
|
7
8
|
size: "medium",
|
|
8
9
|
view: "filled",
|
|
9
10
|
color: Color.WARNING
|
|
10
|
-
})), React.createElement(TitleBox, null,
|
|
11
|
+
})), React.createElement(TitleBox, null, React.createElement(Lang, {
|
|
12
|
+
message: "DUMB.CRASH_SCREEN.TITLE"
|
|
13
|
+
})), React.createElement(DescriptionBox, null, React.createElement(Lang, {
|
|
14
|
+
message: "DUMB.CRASH_SCREEN.DESCRIPTION"
|
|
15
|
+
})));
|
|
11
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import { useFloating, offset, autoPlacement } from '@floating-ui/react-dom';
|
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
3
|
import { CalendarIcon } from '@pushwoosh/kit-icons';
|
|
4
4
|
import { format, monthName, get } from '../../helpers';
|
|
5
|
+
import { Lang } from '../../polyglot';
|
|
5
6
|
import { InputFrame } from '../../styles';
|
|
6
7
|
import { DatePicker } from '../DatePicker';
|
|
7
8
|
export function DatePickerField(props) {
|
|
@@ -56,7 +57,9 @@ export function DatePickerField(props) {
|
|
|
56
57
|
}, React.createElement(CalendarIcon, {
|
|
57
58
|
size: "medium",
|
|
58
59
|
view: "lined"
|
|
59
|
-
}), value ? React.createElement(React.Fragment, null, format(value, 'day '), monthName(get(value, 'month'), 'long'), format(value, ' year')) :
|
|
60
|
+
}), value ? React.createElement(React.Fragment, null, format(value, 'day '), monthName(get(value, 'month'), 'long'), format(value, ' year')) : React.createElement(Lang, {
|
|
61
|
+
message: "DUMB.DATE_TIME_PICKER.SELECT_DATE"
|
|
62
|
+
})), showPicker && React.createElement("div", {
|
|
60
63
|
ref: refs.setFloating,
|
|
61
64
|
style: {
|
|
62
65
|
...floatingStyles,
|
|
@@ -2,6 +2,7 @@ import { useFloating, offset, autoPlacement } from '@floating-ui/react-dom';
|
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
3
|
import { CalendarIcon } from '@pushwoosh/kit-icons';
|
|
4
4
|
import { useUTCDate } from './helpers';
|
|
5
|
+
import { Lang } from '../../polyglot';
|
|
5
6
|
import { InputFrame } from '../../styles';
|
|
6
7
|
import { DateTimePicker } from '../DateTimePicker';
|
|
7
8
|
export function DateTimePickerField(props) {
|
|
@@ -63,7 +64,9 @@ export function DateTimePickerField(props) {
|
|
|
63
64
|
}, React.createElement(CalendarIcon, {
|
|
64
65
|
size: "medium",
|
|
65
66
|
view: "lined"
|
|
66
|
-
}), value ? `${day} ${month} ${year} ${hours}:${minutes}` :
|
|
67
|
+
}), value ? `${day} ${month} ${year} ${hours}:${minutes}` : React.createElement(Lang, {
|
|
68
|
+
message: "DUMB.DATE_TIME_PICKER.SELECT_DATE_TIME"
|
|
69
|
+
})), showPicker && React.createElement("div", {
|
|
67
70
|
ref: refs.setFloating,
|
|
68
71
|
style: {
|
|
69
72
|
...floatingStyles,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { Columns } from '@pushwoosh/kit-helpers';
|
|
3
3
|
import { format, firstDayOfWeek, parseStringToDate, differenceInDays, isSamePeriod, isInRange } from '../../helpers';
|
|
4
|
+
import { Lang } from '../../polyglot';
|
|
4
5
|
import { CellBox, DayHeader } from '../../styles';
|
|
5
6
|
export function Month(props) {
|
|
6
7
|
const {
|
|
@@ -26,7 +27,21 @@ export function Month(props) {
|
|
|
26
27
|
return React.createElement(Columns, {
|
|
27
28
|
"$sizes": 7,
|
|
28
29
|
"$gap": 4
|
|
29
|
-
}, React.createElement(DayHeader, null,
|
|
30
|
+
}, React.createElement(DayHeader, null, React.createElement(Lang, {
|
|
31
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_SUN"
|
|
32
|
+
})), React.createElement(DayHeader, null, React.createElement(Lang, {
|
|
33
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_MON"
|
|
34
|
+
})), React.createElement(DayHeader, null, React.createElement(Lang, {
|
|
35
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_TUE"
|
|
36
|
+
})), React.createElement(DayHeader, null, React.createElement(Lang, {
|
|
37
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_WED"
|
|
38
|
+
})), React.createElement(DayHeader, null, React.createElement(Lang, {
|
|
39
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_THU"
|
|
40
|
+
})), React.createElement(DayHeader, null, React.createElement(Lang, {
|
|
41
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_FRI"
|
|
42
|
+
})), React.createElement(DayHeader, null, React.createElement(Lang, {
|
|
43
|
+
message: "DUMB.DATE_TIME_PICKER.WEEKDAY_SAT"
|
|
44
|
+
})), Array.from({
|
|
30
45
|
length: days
|
|
31
46
|
}).map((_, i) => {
|
|
32
47
|
const curDay = new Date(Date.UTC(firstDayDate.getUTCFullYear(), firstDayDate.getUTCMonth(), firstDayDate.getUTCDate() + i));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const messages = {
|
|
2
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_SUN': 'Sun',
|
|
3
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_MON': 'Mon',
|
|
4
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_TUE': 'Tue',
|
|
5
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_WED': 'Wed',
|
|
6
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_THU': 'Thu',
|
|
7
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_FRI': 'Fri',
|
|
8
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_SAT': 'Sat',
|
|
9
|
+
'DUMB.DATE_TIME_PICKER.SELECT_DATE': 'Select date',
|
|
10
|
+
'DUMB.DATE_TIME_PICKER.SELECT_DATE_TIME': 'Select date and time'
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const messages = {
|
|
2
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_SUN': 'Вс',
|
|
3
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_MON': 'Пн',
|
|
4
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_TUE': 'Вт',
|
|
5
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_WED': 'Ср',
|
|
6
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_THU': 'Чт',
|
|
7
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_FRI': 'Пт',
|
|
8
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_SAT': 'Сб',
|
|
9
|
+
'DUMB.DATE_TIME_PICKER.SELECT_DATE': 'Выберите дату',
|
|
10
|
+
'DUMB.DATE_TIME_PICKER.SELECT_DATE_TIME': 'Выберите дату и время'
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NoParams } from '../../polyglot';
|
|
2
|
+
export type DateTimePickerMessages = {
|
|
3
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_SUN': NoParams;
|
|
4
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_MON': NoParams;
|
|
5
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_TUE': NoParams;
|
|
6
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_WED': NoParams;
|
|
7
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_THU': NoParams;
|
|
8
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_FRI': NoParams;
|
|
9
|
+
'DUMB.DATE_TIME_PICKER.WEEKDAY_SAT': NoParams;
|
|
10
|
+
'DUMB.DATE_TIME_PICKER.SELECT_DATE': NoParams;
|
|
11
|
+
'DUMB.DATE_TIME_PICKER.SELECT_DATE_TIME': NoParams;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { DrawerBodyIframe, IframeElement, LoadingBox } from './styles';
|
|
2
3
|
import { Spinner } from '../../../Spinner';
|
|
4
|
+
import { Lang, useLang } from '../../polyglot';
|
|
3
5
|
import { Drawer } from '../Drawer';
|
|
4
|
-
import { DrawerBodyIframe, IframeElement, LoadingBox } from './styles';
|
|
5
6
|
export function DrawerDocs(props) {
|
|
6
7
|
const {
|
|
7
8
|
isOpen,
|
|
8
9
|
url,
|
|
9
10
|
onClose
|
|
10
11
|
} = props;
|
|
12
|
+
const lang = useLang();
|
|
11
13
|
const [drawerWidth, setDrawerWidth] = useState(0);
|
|
12
14
|
const [iframeLoaded, setIframeLoaded] = useState(false);
|
|
13
15
|
const drawerDocsRef = useRef(null);
|
|
@@ -33,10 +35,14 @@ export function DrawerDocs(props) {
|
|
|
33
35
|
ref: drawerDocsRef
|
|
34
36
|
}, !iframeLoaded && React.createElement(LoadingBox, null, React.createElement(Spinner, {
|
|
35
37
|
size: "medium"
|
|
36
|
-
}), ' ',
|
|
38
|
+
}), ' ', React.createElement(Lang, {
|
|
39
|
+
message: "DUMB.DRAWER.DOCS_LOADING"
|
|
40
|
+
})), React.createElement(IframeElement, {
|
|
37
41
|
src: url,
|
|
38
42
|
ref: iframeRef,
|
|
39
|
-
title:
|
|
43
|
+
title: lang({
|
|
44
|
+
message: 'DUMB.DRAWER.DOCS_TITLE'
|
|
45
|
+
}),
|
|
40
46
|
width: drawerWidth,
|
|
41
47
|
height: "95%",
|
|
42
48
|
"$isLoaded": iframeLoaded,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,7 @@ import { DropdownIcon, EditIcon } from '@pushwoosh/kit-icons';
|
|
|
5
5
|
import { Button } from '../Button';
|
|
6
6
|
import { useOnClickOutside } from '../hooks';
|
|
7
7
|
import { Popover, PopoverContainer } from '../Popover';
|
|
8
|
+
import { Lang } from './polyglot';
|
|
8
9
|
import { FieldBox, TitleBox, ButtonsGroup } from './styles';
|
|
9
10
|
export function EditableField({
|
|
10
11
|
value,
|
|
@@ -53,11 +54,15 @@ export function EditableField({
|
|
|
53
54
|
size: "compact",
|
|
54
55
|
isLoading: loading,
|
|
55
56
|
onClick: onSubmit
|
|
56
|
-
},
|
|
57
|
+
}, React.createElement(Lang, {
|
|
58
|
+
message: "DUMB.EDITABLE_FIELD.SUBMIT"
|
|
59
|
+
})), React.createElement(Button, {
|
|
57
60
|
view: "shape",
|
|
58
61
|
color: "secondary",
|
|
59
62
|
size: "compact",
|
|
60
63
|
isDisabled: loading,
|
|
61
64
|
onClick: onCancel
|
|
62
|
-
},
|
|
65
|
+
}, React.createElement(Lang, {
|
|
66
|
+
message: "DUMB.EDITABLE_FIELD.CANCEL"
|
|
67
|
+
}))))));
|
|
63
68
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,9 @@ import { Vertical } from '@pushwoosh/kit-helpers';
|
|
|
4
4
|
import { Text } from '@pushwoosh/kit-typography';
|
|
5
5
|
import Email from './assets/email.svg?url';
|
|
6
6
|
import { Container, PreviewMock } from './styles';
|
|
7
|
+
import { Lang, useLang } from '../../polyglot';
|
|
7
8
|
export function NoEmailTemplatePreview() {
|
|
9
|
+
const lang = useLang();
|
|
8
10
|
return React.createElement(Container, {
|
|
9
11
|
"$padding": "12px 12px 24px",
|
|
10
12
|
"$gap": 12
|
|
@@ -13,12 +15,18 @@ export function NoEmailTemplatePreview() {
|
|
|
13
15
|
"$justifyContent": "center"
|
|
14
16
|
}, React.createElement("img", {
|
|
15
17
|
src: Email,
|
|
16
|
-
alt:
|
|
18
|
+
alt: lang({
|
|
19
|
+
message: 'DUMB.EMAIL_TEMPLATE_PREVIEW.ALT'
|
|
20
|
+
})
|
|
17
21
|
})), React.createElement(Vertical, null, React.createElement(Text, {
|
|
18
22
|
"$variant": "footnote",
|
|
19
23
|
"$color": Color.LOCKED
|
|
20
|
-
},
|
|
24
|
+
}, React.createElement(Lang, {
|
|
25
|
+
message: "DUMB.EMAIL_TEMPLATE_PREVIEW.CONTENT_MISSED"
|
|
26
|
+
})), React.createElement(Text, {
|
|
21
27
|
"$variant": "footnote",
|
|
22
28
|
"$color": Color.LOCKED
|
|
23
|
-
},
|
|
29
|
+
}, React.createElement(Lang, {
|
|
30
|
+
message: "DUMB.EMAIL_TEMPLATE_PREVIEW.HINT"
|
|
31
|
+
}))));
|
|
24
32
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,22 +2,33 @@ import React, { useState, useCallback } from 'react';
|
|
|
2
2
|
import { Vertical, Horizontal } from '@pushwoosh/kit-helpers';
|
|
3
3
|
import { Banner } from '../../../Banner';
|
|
4
4
|
import { Button } from '../../../Button';
|
|
5
|
+
import { useLang } from '../../polyglot';
|
|
5
6
|
import { Modal } from '../Modal';
|
|
6
7
|
import { ModalHeader, ModalBody, ModalFooter } from '../ModalContent';
|
|
7
8
|
import { ModalTitle } from '../ModalTitle';
|
|
8
9
|
export function ModalConfirm(props) {
|
|
10
|
+
const lang = useLang();
|
|
9
11
|
const {
|
|
10
12
|
isOpen,
|
|
11
|
-
title
|
|
13
|
+
title,
|
|
12
14
|
size = 'small',
|
|
13
15
|
description = '',
|
|
14
|
-
confirmButtonText
|
|
15
|
-
cancelButtonText
|
|
16
|
+
confirmButtonText,
|
|
17
|
+
cancelButtonText,
|
|
16
18
|
confirmButtonColor = 'primary',
|
|
17
19
|
callback,
|
|
18
20
|
onAccept,
|
|
19
21
|
onCancel
|
|
20
22
|
} = props;
|
|
23
|
+
const resolvedTitle = title ?? lang({
|
|
24
|
+
message: 'DUMB.MODAL.CONFIRM_TITLE'
|
|
25
|
+
});
|
|
26
|
+
const resolvedConfirmText = confirmButtonText ?? lang({
|
|
27
|
+
message: 'DUMB.MODAL.CONFIRM'
|
|
28
|
+
});
|
|
29
|
+
const resolvedCancelText = cancelButtonText ?? lang({
|
|
30
|
+
message: 'DUMB.MODAL.CANCEL'
|
|
31
|
+
});
|
|
21
32
|
const [isLoading, setIsLoading] = useState(false);
|
|
22
33
|
const [errorMessage, setErrorMessage] = useState('');
|
|
23
34
|
const handleConfirm = useCallback(async () => {
|
|
@@ -27,18 +38,20 @@ export function ModalConfirm(props) {
|
|
|
27
38
|
await (callback === null || callback === void 0 ? void 0 : callback());
|
|
28
39
|
await onAccept();
|
|
29
40
|
} catch (error) {
|
|
30
|
-
setErrorMessage((error === null || error === void 0 ? void 0 : error.message) ||
|
|
41
|
+
setErrorMessage((error === null || error === void 0 ? void 0 : error.message) || lang({
|
|
42
|
+
message: 'DUMB.MODAL.UNEXPECTED_ERROR'
|
|
43
|
+
}));
|
|
31
44
|
} finally {
|
|
32
45
|
setIsLoading(false);
|
|
33
46
|
}
|
|
34
|
-
}, [callback, onAccept]);
|
|
47
|
+
}, [callback, onAccept, lang]);
|
|
35
48
|
return React.createElement(Modal, {
|
|
36
49
|
size: size,
|
|
37
50
|
isOpen: isOpen,
|
|
38
51
|
onClose: onCancel
|
|
39
52
|
}, React.createElement(ModalHeader, null, React.createElement(Vertical, {
|
|
40
53
|
"$gap": 8
|
|
41
|
-
}, React.createElement(ModalTitle, null,
|
|
54
|
+
}, React.createElement(ModalTitle, null, resolvedTitle), errorMessage && React.createElement(Banner, {
|
|
42
55
|
type: "error",
|
|
43
56
|
title: errorMessage
|
|
44
57
|
}))), description && React.createElement(ModalBody, null, description), React.createElement(ModalFooter, null, React.createElement(Horizontal, {
|
|
@@ -47,9 +60,9 @@ export function ModalConfirm(props) {
|
|
|
47
60
|
}, React.createElement(Button, {
|
|
48
61
|
color: "secondary",
|
|
49
62
|
onClick: onCancel
|
|
50
|
-
},
|
|
63
|
+
}, resolvedCancelText), React.createElement(Button, {
|
|
51
64
|
color: confirmButtonColor,
|
|
52
65
|
isLoading: isLoading,
|
|
53
66
|
onClick: handleConfirm
|
|
54
|
-
},
|
|
67
|
+
}, resolvedConfirmText))));
|
|
55
68
|
}
|
|
@@ -3,7 +3,7 @@ import { type modalSizes } from '../Modal/maps';
|
|
|
3
3
|
export type ConfirmButtonColor = 'primary' | 'secondary' | 'danger';
|
|
4
4
|
export interface ModalConfirmProps {
|
|
5
5
|
isOpen: boolean;
|
|
6
|
-
title
|
|
6
|
+
title?: string;
|
|
7
7
|
size?: keyof typeof modalSizes;
|
|
8
8
|
description?: ReactNode;
|
|
9
9
|
confirmButtonText?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Color } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { NotificationIcon } from '@pushwoosh/kit-icons';
|
|
4
|
+
import { useLang } from './polyglot';
|
|
4
5
|
import { NotificationBellButton, NotificationBellBadge, NotificationBellBadgeDot } from './styles';
|
|
5
6
|
export function NotificationBell({
|
|
6
7
|
count = 0,
|
|
@@ -8,6 +9,7 @@ export function NotificationBell({
|
|
|
8
9
|
isOpened = false,
|
|
9
10
|
onClick
|
|
10
11
|
}) {
|
|
12
|
+
const lang = useLang();
|
|
11
13
|
const hasNotifications = count > 0;
|
|
12
14
|
const showBadge = hasNotifications || severity;
|
|
13
15
|
const getBadgeColor = () => {
|
|
@@ -20,7 +22,11 @@ export function NotificationBell({
|
|
|
20
22
|
"$isOpened": isOpened,
|
|
21
23
|
onClick: onClick,
|
|
22
24
|
type: "button",
|
|
23
|
-
"aria-label": hasNotifications ?
|
|
25
|
+
"aria-label": hasNotifications ? lang({
|
|
26
|
+
message: 'DUMB.NOTIFICATION_INBOX.BELL_ARIA_UNREAD'
|
|
27
|
+
}) : lang({
|
|
28
|
+
message: 'DUMB.NOTIFICATION_INBOX.TITLE'
|
|
29
|
+
})
|
|
24
30
|
}, React.createElement(NotificationIcon, {
|
|
25
31
|
size: "medium",
|
|
26
32
|
type: "enabled",
|
|
@@ -8,6 +8,7 @@ import { useInfiniteScroll } from './useInfiniteScroll';
|
|
|
8
8
|
import { Badge } from '../Badge';
|
|
9
9
|
import { Spinner } from '../Spinner';
|
|
10
10
|
import emptyNotificationsIcon from './assets/EmptyNotifications.svg?url';
|
|
11
|
+
import { Lang } from './polyglot';
|
|
11
12
|
import { NotificationInboxContainer, NotificationInboxHeader, NotificationInboxTitle, NotificationInboxList, NotificationItem, NotificationIndicator, NotificationHeader, NotificationDescription, NotificationActionLink, NotificationInboxEmptyIcon, NotificationInboxEmptyText } from './styles';
|
|
12
13
|
export function NotificationInbox({
|
|
13
14
|
notifications,
|
|
@@ -51,7 +52,9 @@ export function NotificationInbox({
|
|
|
51
52
|
return React.createElement(NotificationInboxContainer, null, React.createElement(NotificationInboxHeader, null, React.createElement(NotificationInboxTitle, {
|
|
52
53
|
"$variant": "h4",
|
|
53
54
|
"$color": Color.MAIN
|
|
54
|
-
},
|
|
55
|
+
}, React.createElement(Lang, {
|
|
56
|
+
message: "DUMB.NOTIFICATION_INBOX.TITLE"
|
|
57
|
+
}))), React.createElement(Vertical, {
|
|
55
58
|
"$alignItems": "center",
|
|
56
59
|
"$gap": 24,
|
|
57
60
|
"$padding": "24px"
|
|
@@ -76,10 +79,15 @@ export function NotificationInbox({
|
|
|
76
79
|
return React.createElement(NotificationInboxContainer, null, React.createElement(NotificationInboxHeader, null, React.createElement(NotificationInboxTitle, {
|
|
77
80
|
"$variant": "h4",
|
|
78
81
|
"$color": Color.MAIN
|
|
79
|
-
}, React.createElement("span", null,
|
|
82
|
+
}, React.createElement("span", null, React.createElement(Lang, {
|
|
83
|
+
message: "DUMB.NOTIFICATION_INBOX.TITLE"
|
|
84
|
+
})), unreadCount > 0 && React.createElement(React.Fragment, null, ' ', React.createElement(Text, {
|
|
80
85
|
"$variant": "h4",
|
|
81
86
|
"$color": Color.LOCKED
|
|
82
|
-
},
|
|
87
|
+
}, React.createElement(Lang, {
|
|
88
|
+
message: "DUMB.NOTIFICATION_INBOX.UNREAD",
|
|
89
|
+
count: unreadCount
|
|
90
|
+
}))))), React.createElement(NotificationInboxList, {
|
|
83
91
|
"data-notification-list": true
|
|
84
92
|
}, notifications.map(notification => {
|
|
85
93
|
const isRead = notification.isRead ?? false;
|
|
@@ -132,7 +140,11 @@ export function NotificationInbox({
|
|
|
132
140
|
e.stopPropagation();
|
|
133
141
|
setExpandedId(prev => prev === notification.id ? null : notification.id);
|
|
134
142
|
}
|
|
135
|
-
}, expandedId === notification.id ?
|
|
143
|
+
}, expandedId === notification.id ? React.createElement(Lang, {
|
|
144
|
+
message: "DUMB.NOTIFICATION_INBOX.COLLAPSE"
|
|
145
|
+
}) : React.createElement(Lang, {
|
|
146
|
+
message: "DUMB.NOTIFICATION_INBOX.EXPAND"
|
|
147
|
+
})))));
|
|
136
148
|
}), hasMore && isLoading && React.createElement(Horizontal, {
|
|
137
149
|
ref: loadMoreRef,
|
|
138
150
|
"$alignItems": "center",
|
|
@@ -145,7 +157,9 @@ export function NotificationInbox({
|
|
|
145
157
|
}), React.createElement(Text, {
|
|
146
158
|
"$variant": "footnote",
|
|
147
159
|
"$color": Color.LOCKED
|
|
148
|
-
},
|
|
160
|
+
}, React.createElement(Lang, {
|
|
161
|
+
message: "DUMB.NOTIFICATION_INBOX.LOADING_MORE"
|
|
162
|
+
}))), isLoading && notifications.length === 0 && !hasMore && React.createElement(Horizontal, {
|
|
149
163
|
"$justifyContent": "center",
|
|
150
164
|
"$alignItems": "center",
|
|
151
165
|
"$padding": "16px 0"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const messages = {
|
|
2
|
+
'DUMB.NOTIFICATION_INBOX.TITLE': 'Notifications',
|
|
3
|
+
'DUMB.NOTIFICATION_INBOX.UNREAD': '{{count}} unread',
|
|
4
|
+
'DUMB.NOTIFICATION_INBOX.COLLAPSE': 'Collapse',
|
|
5
|
+
'DUMB.NOTIFICATION_INBOX.EXPAND': 'Expand',
|
|
6
|
+
'DUMB.NOTIFICATION_INBOX.LOADING_MORE': 'Loading more…',
|
|
7
|
+
'DUMB.NOTIFICATION_INBOX.BELL_ARIA_UNREAD': 'You have unread notifications'
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const messages = {
|
|
2
|
+
'DUMB.NOTIFICATION_INBOX.TITLE': 'Уведомления',
|
|
3
|
+
'DUMB.NOTIFICATION_INBOX.UNREAD': '{{count}} {{count | pluralize: "непрочитанное", "непрочитанных", "непрочитанных"}}',
|
|
4
|
+
'DUMB.NOTIFICATION_INBOX.COLLAPSE': 'Свернуть',
|
|
5
|
+
'DUMB.NOTIFICATION_INBOX.EXPAND': 'Развернуть',
|
|
6
|
+
'DUMB.NOTIFICATION_INBOX.LOADING_MORE': 'Загрузка…',
|
|
7
|
+
'DUMB.NOTIFICATION_INBOX.BELL_ARIA_UNREAD': 'Есть непрочитанные уведомления'
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NoParams } from '../../polyglot';
|
|
2
|
+
export type NotificationInboxMessages = {
|
|
3
|
+
'DUMB.NOTIFICATION_INBOX.TITLE': NoParams;
|
|
4
|
+
'DUMB.NOTIFICATION_INBOX.UNREAD': {
|
|
5
|
+
count: number;
|
|
6
|
+
};
|
|
7
|
+
'DUMB.NOTIFICATION_INBOX.COLLAPSE': NoParams;
|
|
8
|
+
'DUMB.NOTIFICATION_INBOX.EXPAND': NoParams;
|
|
9
|
+
'DUMB.NOTIFICATION_INBOX.LOADING_MORE': NoParams;
|
|
10
|
+
'DUMB.NOTIFICATION_INBOX.BELL_ARIA_UNREAD': NoParams;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Color } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
4
|
import { CloseIcon } from '@pushwoosh/kit-icons';
|
|
5
|
+
import { Lang } from '../../polyglot';
|
|
5
6
|
import { PushBox, IconContainer, PushTitle, PushDescription } from '../../styles';
|
|
6
7
|
export function MissedContentPreview() {
|
|
7
8
|
return React.createElement(PushBox, {
|
|
@@ -11,7 +12,11 @@ export function MissedContentPreview() {
|
|
|
11
12
|
color: Color.CLEAR
|
|
12
13
|
})), React.createElement(Vertical, null, React.createElement(PushTitle, {
|
|
13
14
|
locked: true
|
|
14
|
-
},
|
|
15
|
+
}, React.createElement(Lang, {
|
|
16
|
+
message: "DUMB.PUSH_PREVIEW.CONTENT_MISSED"
|
|
17
|
+
})), React.createElement(PushDescription, {
|
|
15
18
|
locked: true
|
|
16
|
-
},
|
|
19
|
+
}, React.createElement(Lang, {
|
|
20
|
+
message: "DUMB.PUSH_PREVIEW.HINT"
|
|
21
|
+
}))));
|
|
17
22
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|