@selfcommunity/react-ui 0.10.2-courses.206 → 0.10.2-courses.207
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/lib/cjs/components/Notification/Course/Course.js +7 -22
- package/lib/cjs/components/Notification/Course/utils.d.ts +5 -0
- package/lib/cjs/components/Notification/Course/utils.js +44 -0
- package/lib/esm/components/Notification/Course/Course.js +5 -20
- package/lib/esm/components/Notification/Course/utils.d.ts +5 -0
- package/lib/esm/components/Notification/Course/utils.js +39 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -8
|
@@ -18,6 +18,7 @@ const UserAvatar_1 = tslib_1.__importDefault(require("../../../shared/UserAvatar
|
|
|
18
18
|
const constants_1 = require("../constants");
|
|
19
19
|
const Course_1 = tslib_1.__importDefault(require("../../Course"));
|
|
20
20
|
const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../../shared/HiddenPlaceholder"));
|
|
21
|
+
const utils_1 = require("./utils");
|
|
21
22
|
const classes = {
|
|
22
23
|
root: `${constants_1.PREFIX}-course-root`,
|
|
23
24
|
avatar: `${constants_1.PREFIX}-avatar`,
|
|
@@ -31,14 +32,6 @@ const Root = (0, styles_1.styled)(NotificationItem_1.default, {
|
|
|
31
32
|
name: constants_1.PREFIX,
|
|
32
33
|
slot: 'CourseRoot'
|
|
33
34
|
})(() => ({}));
|
|
34
|
-
function formatLessonUrl(notificationObject) {
|
|
35
|
-
return {
|
|
36
|
-
id: notificationObject.course.id,
|
|
37
|
-
slug: notificationObject.course.slug,
|
|
38
|
-
section_id: notificationObject.comment.section_id,
|
|
39
|
-
lesson_id: notificationObject.comment.lesson_id
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
35
|
/**
|
|
43
36
|
* This component render the content of the notification of type course
|
|
44
37
|
* @constructor
|
|
@@ -70,15 +63,11 @@ function CourseNotification(props) {
|
|
|
70
63
|
? notificationObject.comment.lesson_name
|
|
71
64
|
: notificationObject.course.name,
|
|
72
65
|
link: (...chunks) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
73
|
-
? react_core_1.SCRoutes.
|
|
66
|
+
? react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME
|
|
74
67
|
: react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
75
|
-
? formatLessonUrl(notificationObject)
|
|
68
|
+
? (0, utils_1.formatLessonUrl)(notificationObject)
|
|
76
69
|
: notificationObject.course) }, { children: chunks })))
|
|
77
|
-
} })] }), footer: isToastTemplate ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(notificationObject.
|
|
78
|
-
? react_core_1.SCRoutes.COURSE_LESSON_COMMENTS_ROUTE_NAME
|
|
79
|
-
: react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
80
|
-
? formatLessonUrl(notificationObject)
|
|
81
|
-
: notificationObject.course) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) })) }))] }))) : ((0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
|
|
70
|
+
} })] }), footer: isToastTemplate ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url((0, utils_1.getRouteName)(notificationObject), (0, utils_1.getRouteParams)(notificationObject)) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) })) }))] }))) : ((0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
|
|
82
71
|
}
|
|
83
72
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, `${constants_1.PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
|
|
84
73
|
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
|
|
@@ -91,14 +80,10 @@ function CourseNotification(props) {
|
|
|
91
80
|
? notificationObject.comment.lesson_name
|
|
92
81
|
: notificationObject.course.name,
|
|
93
82
|
link: (...chunks) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
94
|
-
? react_core_1.SCRoutes.
|
|
83
|
+
? react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME
|
|
95
84
|
: react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
96
|
-
? formatLessonUrl(notificationObject)
|
|
85
|
+
? (0, utils_1.formatLessonUrl)(notificationObject)
|
|
97
86
|
: notificationObject.course) }, { children: chunks })))
|
|
98
|
-
} }), notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", dangerouslySetInnerHTML: { __html: notificationObject.comment.html } })) : ((0, jsx_runtime_1.jsx)(Course_1.default, { course: notificationObject.course, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), template: types_2.SCCourseTemplateType.SNIPPET, elevation: 0 }))] }), actions: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.activeAt }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: react_core_1.Link, to: scRoutingContext.url(notificationObject.
|
|
99
|
-
? react_core_1.SCRoutes.COURSE_LESSON_COMMENTS_ROUTE_NAME
|
|
100
|
-
: react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
101
|
-
? formatLessonUrl(notificationObject)
|
|
102
|
-
: notificationObject.course) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) }))] })) }, rest)), openAlert && (0, jsx_runtime_1.jsx)(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
87
|
+
} }), notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", dangerouslySetInnerHTML: { __html: notificationObject.comment.html } })) : ((0, jsx_runtime_1.jsx)(Course_1.default, { course: notificationObject.course, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), template: types_2.SCCourseTemplateType.SNIPPET, elevation: 0 }))] }), actions: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.activeAt }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: react_core_1.Link, to: scRoutingContext.url((0, utils_1.getRouteName)(notificationObject), (0, utils_1.getRouteParams)(notificationObject)) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) }))] })) }, rest)), openAlert && (0, jsx_runtime_1.jsx)(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
103
88
|
}
|
|
104
89
|
exports.default = CourseNotification;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SCNotificationCourseActivityType } from '@selfcommunity/types';
|
|
2
|
+
declare function formatLessonUrl(notificationObject: SCNotificationCourseActivityType): any;
|
|
3
|
+
declare const getRouteName: (notificationObject: SCNotificationCourseActivityType) => "course_edit" | "course_lesson_comments" | "course";
|
|
4
|
+
declare const getRouteParams: (notificationObject: SCNotificationCourseActivityType) => any;
|
|
5
|
+
export { getRouteName, getRouteParams, formatLessonUrl };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatLessonUrl = exports.getRouteParams = exports.getRouteName = void 0;
|
|
4
|
+
const course_1 = require("../../../types/course");
|
|
5
|
+
const types_1 = require("@selfcommunity/types");
|
|
6
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
7
|
+
function formatLessonUrl(notificationObject) {
|
|
8
|
+
return {
|
|
9
|
+
id: notificationObject.course.id,
|
|
10
|
+
slug: notificationObject.course.slug,
|
|
11
|
+
section_id: notificationObject.comment.section_id,
|
|
12
|
+
lesson_id: notificationObject.comment.lesson_id
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.formatLessonUrl = formatLessonUrl;
|
|
16
|
+
function formatCourseRequestsUrl(notificationObject) {
|
|
17
|
+
return {
|
|
18
|
+
id: notificationObject.course.id,
|
|
19
|
+
slug: notificationObject.course.slug,
|
|
20
|
+
tab: course_1.SCCourseEditTabType.REQUESTS
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const getRouteName = (notificationObject) => {
|
|
24
|
+
switch (notificationObject.type) {
|
|
25
|
+
case types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON:
|
|
26
|
+
return react_core_1.SCRoutes.COURSE_LESSON_COMMENTS_ROUTE_NAME;
|
|
27
|
+
case types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE:
|
|
28
|
+
return react_core_1.SCRoutes.COURSE_EDIT_ROUTE_NAME;
|
|
29
|
+
default:
|
|
30
|
+
return react_core_1.SCRoutes.COURSE_ROUTE_NAME;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.getRouteName = getRouteName;
|
|
34
|
+
const getRouteParams = (notificationObject) => {
|
|
35
|
+
switch (notificationObject.type) {
|
|
36
|
+
case types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON:
|
|
37
|
+
return formatLessonUrl(notificationObject);
|
|
38
|
+
case types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE:
|
|
39
|
+
return formatCourseRequestsUrl(notificationObject);
|
|
40
|
+
default:
|
|
41
|
+
return notificationObject.course;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.getRouteParams = getRouteParams;
|
|
@@ -16,6 +16,7 @@ import UserAvatar from '../../../shared/UserAvatar';
|
|
|
16
16
|
import { PREFIX } from '../constants';
|
|
17
17
|
import { default as CourseItem } from '../../Course';
|
|
18
18
|
import HiddenPlaceholder from '../../../shared/HiddenPlaceholder';
|
|
19
|
+
import { formatLessonUrl, getRouteName, getRouteParams } from './utils';
|
|
19
20
|
const classes = {
|
|
20
21
|
root: `${PREFIX}-course-root`,
|
|
21
22
|
avatar: `${PREFIX}-avatar`,
|
|
@@ -29,14 +30,6 @@ const Root = styled(NotificationItem, {
|
|
|
29
30
|
name: PREFIX,
|
|
30
31
|
slot: 'CourseRoot'
|
|
31
32
|
})(() => ({}));
|
|
32
|
-
function formatLessonUrl(notificationObject) {
|
|
33
|
-
return {
|
|
34
|
-
id: notificationObject.course.id,
|
|
35
|
-
slug: notificationObject.course.slug,
|
|
36
|
-
section_id: notificationObject.comment.section_id,
|
|
37
|
-
lesson_id: notificationObject.comment.lesson_id
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
33
|
/**
|
|
41
34
|
* This component render the content of the notification of type course
|
|
42
35
|
* @constructor
|
|
@@ -68,15 +61,11 @@ export default function CourseNotification(props) {
|
|
|
68
61
|
? notificationObject.comment.lesson_name
|
|
69
62
|
: notificationObject.course.name,
|
|
70
63
|
link: (...chunks) => (_jsx(Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
71
|
-
? SCRoutes.
|
|
64
|
+
? SCRoutes.COURSE_LESSON_ROUTE_NAME
|
|
72
65
|
: SCRoutes.COURSE_ROUTE_NAME, notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
73
66
|
? formatLessonUrl(notificationObject)
|
|
74
67
|
: notificationObject.course) }, { children: chunks })))
|
|
75
|
-
} })] }), footer: isToastTemplate ? (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at }), _jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(Link, Object.assign({ to: scRoutingContext.url(notificationObject.
|
|
76
|
-
? SCRoutes.COURSE_LESSON_COMMENTS_ROUTE_NAME
|
|
77
|
-
: SCRoutes.COURSE_ROUTE_NAME, notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
78
|
-
? formatLessonUrl(notificationObject)
|
|
79
|
-
: notificationObject.course) }, { children: _jsx(FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) })) }))] }))) : (_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
|
|
68
|
+
} })] }), footer: isToastTemplate ? (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at }), _jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(Link, Object.assign({ to: scRoutingContext.url(getRouteName(notificationObject), getRouteParams(notificationObject)) }, { children: _jsx(FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) })) }))] }))) : (_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
|
|
80
69
|
}
|
|
81
70
|
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, `${PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: _jsx(Link, Object.assign({}, (!notificationObject.user.deleted && {
|
|
82
71
|
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
|
|
@@ -89,13 +78,9 @@ export default function CourseNotification(props) {
|
|
|
89
78
|
? notificationObject.comment.lesson_name
|
|
90
79
|
: notificationObject.course.name,
|
|
91
80
|
link: (...chunks) => (_jsx(Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
92
|
-
? SCRoutes.
|
|
81
|
+
? SCRoutes.COURSE_LESSON_ROUTE_NAME
|
|
93
82
|
: SCRoutes.COURSE_ROUTE_NAME, notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
94
83
|
? formatLessonUrl(notificationObject)
|
|
95
84
|
: notificationObject.course) }, { children: chunks })))
|
|
96
|
-
} }), notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ? (_jsx(Typography, { variant: "body2", dangerouslySetInnerHTML: { __html: notificationObject.comment.html } })) : (_jsx(CourseItem, { course: notificationObject.course, actions: _jsx(_Fragment, {}), template: SCCourseTemplateType.SNIPPET, elevation: 0 }))] }), actions: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }), _jsx(LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: Link, to: scRoutingContext.url(notificationObject.
|
|
97
|
-
? SCRoutes.COURSE_LESSON_COMMENTS_ROUTE_NAME
|
|
98
|
-
: SCRoutes.COURSE_ROUTE_NAME, notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
|
|
99
|
-
? formatLessonUrl(notificationObject)
|
|
100
|
-
: notificationObject.course) }, { children: _jsx(FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) }))] })) }, rest)), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
85
|
+
} }), notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ? (_jsx(Typography, { variant: "body2", dangerouslySetInnerHTML: { __html: notificationObject.comment.html } })) : (_jsx(CourseItem, { course: notificationObject.course, actions: _jsx(_Fragment, {}), template: SCCourseTemplateType.SNIPPET, elevation: 0 }))] }), actions: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }), _jsx(LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: Link, to: scRoutingContext.url(getRouteName(notificationObject), getRouteParams(notificationObject)) }, { children: _jsx(FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) }))] })) }, rest)), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
101
86
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SCNotificationCourseActivityType } from '@selfcommunity/types';
|
|
2
|
+
declare function formatLessonUrl(notificationObject: SCNotificationCourseActivityType): any;
|
|
3
|
+
declare const getRouteName: (notificationObject: SCNotificationCourseActivityType) => "course_edit" | "course_lesson_comments" | "course";
|
|
4
|
+
declare const getRouteParams: (notificationObject: SCNotificationCourseActivityType) => any;
|
|
5
|
+
export { getRouteName, getRouteParams, formatLessonUrl };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SCCourseEditTabType } from '../../../types/course';
|
|
2
|
+
import { SCNotificationTypologyType } from '@selfcommunity/types';
|
|
3
|
+
import { SCRoutes } from '@selfcommunity/react-core';
|
|
4
|
+
function formatLessonUrl(notificationObject) {
|
|
5
|
+
return {
|
|
6
|
+
id: notificationObject.course.id,
|
|
7
|
+
slug: notificationObject.course.slug,
|
|
8
|
+
section_id: notificationObject.comment.section_id,
|
|
9
|
+
lesson_id: notificationObject.comment.lesson_id
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function formatCourseRequestsUrl(notificationObject) {
|
|
13
|
+
return {
|
|
14
|
+
id: notificationObject.course.id,
|
|
15
|
+
slug: notificationObject.course.slug,
|
|
16
|
+
tab: SCCourseEditTabType.REQUESTS
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const getRouteName = (notificationObject) => {
|
|
20
|
+
switch (notificationObject.type) {
|
|
21
|
+
case SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON:
|
|
22
|
+
return SCRoutes.COURSE_LESSON_COMMENTS_ROUTE_NAME;
|
|
23
|
+
case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE:
|
|
24
|
+
return SCRoutes.COURSE_EDIT_ROUTE_NAME;
|
|
25
|
+
default:
|
|
26
|
+
return SCRoutes.COURSE_ROUTE_NAME;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const getRouteParams = (notificationObject) => {
|
|
30
|
+
switch (notificationObject.type) {
|
|
31
|
+
case SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON:
|
|
32
|
+
return formatLessonUrl(notificationObject);
|
|
33
|
+
case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE:
|
|
34
|
+
return formatCourseRequestsUrl(notificationObject);
|
|
35
|
+
default:
|
|
36
|
+
return notificationObject.course;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export { getRouteName, getRouteParams, formatLessonUrl };
|