@selfcommunity/react-ui 0.10.2-courses.207 → 0.10.2-courses.208
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/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
- package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +8 -4
- package/lib/cjs/components/EventFormDialog/EventFormDialog.d.ts +1 -1
- package/lib/cjs/components/EventFormDialog/EventFormDialog.js +3 -3
- package/lib/cjs/components/GroupForm/GroupForm.js +2 -2
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
- package/lib/cjs/components/Notification/Event/Event.js +10 -0
- package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
- package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +8 -4
- package/lib/esm/components/EventFormDialog/EventFormDialog.d.ts +1 -1
- package/lib/esm/components/EventFormDialog/EventFormDialog.js +3 -3
- package/lib/esm/components/GroupForm/GroupForm.js +2 -2
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
- package/lib/esm/components/Notification/Event/Event.js +10 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -8
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ButtonProps } from '@mui/material/Button/Button';
|
|
2
|
-
import { SCEventType, SCLiveStreamType } from '@selfcommunity/types';
|
|
3
2
|
import { CreateLiveStreamDialogProps } from '../CreateLiveStreamDialog';
|
|
4
3
|
export interface CreateLiveStreamButtonProps extends ButtonProps {
|
|
5
4
|
/**
|
|
@@ -12,11 +11,6 @@ export interface CreateLiveStreamButtonProps extends ButtonProps {
|
|
|
12
11
|
* @default empty object
|
|
13
12
|
*/
|
|
14
13
|
CreateLiveStreamDialogComponentProps?: CreateLiveStreamDialogProps;
|
|
15
|
-
/**
|
|
16
|
-
* On success callback function
|
|
17
|
-
* @default null
|
|
18
|
-
*/
|
|
19
|
-
onSuccess?: (data: SCEventType | SCLiveStreamType) => void;
|
|
20
14
|
/**
|
|
21
15
|
* Any other properties
|
|
22
16
|
*/
|
|
@@ -45,7 +45,7 @@ function CreateLiveStreamButton(inProps) {
|
|
|
45
45
|
props: inProps,
|
|
46
46
|
name: PREFIX
|
|
47
47
|
});
|
|
48
|
-
const { className, CreateLiveStreamDialogComponentProps = {},
|
|
48
|
+
const { className, CreateLiveStreamDialogComponentProps = {}, children } = props, rest = tslib_1.__rest(props, ["className", "CreateLiveStreamDialogComponentProps", "children"]);
|
|
49
49
|
// CONTEXT
|
|
50
50
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
51
51
|
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
@@ -71,13 +71,6 @@ function CreateLiveStreamButton(inProps) {
|
|
|
71
71
|
const handleClose = () => {
|
|
72
72
|
setOpen((o) => !o);
|
|
73
73
|
};
|
|
74
|
-
/**
|
|
75
|
-
* Handle close
|
|
76
|
-
*/
|
|
77
|
-
const handleSuccess = (data) => {
|
|
78
|
-
onSuccess && onSuccess(data);
|
|
79
|
-
setOpen((o) => !o);
|
|
80
|
-
};
|
|
81
74
|
/**
|
|
82
75
|
* If there's no authUserId, component is hidden.
|
|
83
76
|
*/
|
|
@@ -87,6 +80,6 @@ function CreateLiveStreamButton(inProps) {
|
|
|
87
80
|
/**
|
|
88
81
|
* Renders root object
|
|
89
82
|
*/
|
|
90
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleClose, variant: "contained", color: "secondary", startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "movie" }) }, rest, { children: children !== null && children !== void 0 ? children : (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createEventButton.goLive", defaultMessage: "ui.createEventButton.goLive" }) })), open && (0, jsx_runtime_1.jsx)(CreateLiveStreamDialog_1.default, Object.assign({ open: true, onClose: handleClose
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleClose, variant: "contained", color: "secondary", startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "movie" }) }, rest, { children: children !== null && children !== void 0 ? children : (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createEventButton.goLive", defaultMessage: "ui.createEventButton.goLive" }) })), open && (0, jsx_runtime_1.jsx)(CreateLiveStreamDialog_1.default, Object.assign({ open: true, onClose: handleClose }, CreateLiveStreamDialogComponentProps))] }));
|
|
91
84
|
}
|
|
92
85
|
exports.default = CreateLiveStreamButton;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { SCEventType, SCLiveStreamType } from '@selfcommunity/types';
|
|
2
1
|
import { BaseDialogProps } from '../../shared/BaseDialog';
|
|
2
|
+
import { EventFormProps } from '../EventForm';
|
|
3
|
+
import { LiveStreamFormProps } from '../LiveStreamForm';
|
|
3
4
|
export interface CreateLiveStreamDialogProps extends BaseDialogProps {
|
|
4
5
|
/**
|
|
5
6
|
* Overrides or extends the styles applied to the component.
|
|
@@ -17,10 +18,15 @@ export interface CreateLiveStreamDialogProps extends BaseDialogProps {
|
|
|
17
18
|
*/
|
|
18
19
|
onClose?: () => void;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @default
|
|
21
|
+
* Props to spread to EventForm component
|
|
22
|
+
* @default {}
|
|
23
|
+
*/
|
|
24
|
+
EventFormComponentProps?: EventFormProps;
|
|
25
|
+
/**
|
|
26
|
+
* Props to spread to LiveStreamForm component
|
|
27
|
+
* @default {}
|
|
22
28
|
*/
|
|
23
|
-
|
|
29
|
+
LiveStreamFormComponentProps?: LiveStreamFormProps;
|
|
24
30
|
/**
|
|
25
31
|
* Any other properties
|
|
26
32
|
*/
|
|
@@ -65,7 +65,7 @@ function CreateLiveStreamDialog(inProps) {
|
|
|
65
65
|
props: inProps,
|
|
66
66
|
name: constants_1.PREFIX
|
|
67
67
|
});
|
|
68
|
-
const { className, open = true, onClose,
|
|
68
|
+
const { className, open = true, onClose, EventFormComponentProps = {}, LiveStreamFormComponentProps = {} } = props, rest = tslib_1.__rest(props, ["className", "open", "onClose", "EventFormComponentProps", "LiveStreamFormComponentProps"]);
|
|
69
69
|
// CONTEXT
|
|
70
70
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
71
71
|
// PERMISSION
|
|
@@ -86,8 +86,12 @@ function CreateLiveStreamDialog(inProps) {
|
|
|
86
86
|
setStep(types_2.CreateLiveStreamStep.SELECT_TYPE);
|
|
87
87
|
}, []);
|
|
88
88
|
const handleSubmit = (0, react_1.useCallback)((e) => {
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
var _a, _b;
|
|
90
|
+
liveType === types_2.LiveStreamType.EVENT_LIVE
|
|
91
|
+
? (_a = EventFormComponentProps.onSuccess) === null || _a === void 0 ? void 0 : _a.call(EventFormComponentProps, e)
|
|
92
|
+
: (_b = LiveStreamFormComponentProps.onSuccess) === null || _b === void 0 ? void 0 : _b.call(LiveStreamFormComponentProps, e);
|
|
93
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
94
|
+
}, [liveType, onClose, EventFormComponentProps, LiveStreamFormComponentProps]);
|
|
91
95
|
(0, react_1.useEffect)(() => {
|
|
92
96
|
if (!canCreateEvent) {
|
|
93
97
|
setLiveType(types_2.LiveStreamType.DIRECT_LIVE);
|
|
@@ -100,6 +104,6 @@ function CreateLiveStreamDialog(inProps) {
|
|
|
100
104
|
/**
|
|
101
105
|
* Renders root object
|
|
102
106
|
*/
|
|
103
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: "md", title: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.title, component: "span" }, { children: [canShowBackButton && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "arrow_back" }) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createLivestreamDialog.button.back", defaultMessage: "ui.createLivestreamDialog.button.back" }) }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "span" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: "body", onClose: !canShowBackButton ? onClose : undefined, className: (0, classnames_1.default)(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [step === types_2.CreateLiveStreamStep.SELECT_TYPE && ((0, jsx_runtime_1.jsx)(LiveStreamSelector_1.default, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === types_2.CreateLiveStreamStep.CREATE_LIVE && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: liveType === types_2.LiveStreamType.EVENT_LIVE ? ((0, jsx_runtime_1.jsx)(EventForm_1.default, { EventAddressComponentProps: { locations: [types_1.SCEventLocationType.LIVESTREAM] }, onSuccess: handleSubmit })) : ((0, jsx_runtime_1.jsx)(LiveStreamForm_1.default, { onSuccess: handleSubmit })) }))] })) })));
|
|
107
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: "md", title: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.title, component: "span" }, { children: [canShowBackButton && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "arrow_back" }) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createLivestreamDialog.button.back", defaultMessage: "ui.createLivestreamDialog.button.back" }) }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "span" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: "body", onClose: !canShowBackButton ? onClose : undefined, className: (0, classnames_1.default)(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [step === types_2.CreateLiveStreamStep.SELECT_TYPE && ((0, jsx_runtime_1.jsx)(LiveStreamSelector_1.default, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === types_2.CreateLiveStreamStep.CREATE_LIVE && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: liveType === types_2.LiveStreamType.EVENT_LIVE ? ((0, jsx_runtime_1.jsx)(EventForm_1.default, Object.assign({}, EventFormComponentProps, { EventAddressComponentProps: { locations: [types_1.SCEventLocationType.LIVESTREAM] }, onSuccess: handleSubmit }))) : ((0, jsx_runtime_1.jsx)(LiveStreamForm_1.default, Object.assign({}, LiveStreamFormComponentProps, { onSuccess: handleSubmit }))) }))] })) })));
|
|
104
108
|
}
|
|
105
109
|
exports.default = CreateLiveStreamDialog;
|
|
@@ -42,15 +42,15 @@ function EventFormDialog(inProps) {
|
|
|
42
42
|
props: inProps,
|
|
43
43
|
name: constants_1.PREFIX
|
|
44
44
|
});
|
|
45
|
-
const { className, open = true, onClose, EventFormComponentProps } = props, rest = tslib_1.__rest(props, ["className", "open", "onClose", "EventFormComponentProps"]);
|
|
45
|
+
const { className, open = true, onClose, EventFormComponentProps = {} } = props, rest = tslib_1.__rest(props, ["className", "open", "onClose", "EventFormComponentProps"]);
|
|
46
46
|
const handleSuccess = (0, react_1.useCallback)((event) => {
|
|
47
47
|
var _a;
|
|
48
|
-
(_a = EventFormComponentProps
|
|
48
|
+
(_a = EventFormComponentProps.onSuccess) === null || _a === void 0 ? void 0 : _a.call(EventFormComponentProps, event);
|
|
49
49
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
50
50
|
}, [onClose, EventFormComponentProps]);
|
|
51
51
|
/**
|
|
52
52
|
* Renders root object
|
|
53
53
|
*/
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: onClose, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(EventForm_1.default, Object.assign({},
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: onClose, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(EventForm_1.default, Object.assign({}, EventFormComponentProps, { onSuccess: handleSuccess })) })));
|
|
55
55
|
}
|
|
56
56
|
exports.default = EventFormDialog;
|
|
@@ -195,10 +195,10 @@ function GroupForm(inProps) {
|
|
|
195
195
|
}
|
|
196
196
|
groupService
|
|
197
197
|
.then((data) => {
|
|
198
|
-
onSuccess
|
|
198
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
|
|
199
199
|
notifyChanges(data);
|
|
200
|
-
onClose && onClose();
|
|
201
200
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
201
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
202
202
|
})
|
|
203
203
|
.catch((e) => {
|
|
204
204
|
setError(Object.assign(Object.assign({}, error), (0, api_services_1.formatHttpErrorCode)(e)));
|
|
@@ -26,7 +26,9 @@ export interface NavigationMenuDrawerProps extends DrawerProps {
|
|
|
26
26
|
* Custom Drawer footer content
|
|
27
27
|
* @default null
|
|
28
28
|
*/
|
|
29
|
-
drawerFooterContent?: React.ReactNode
|
|
29
|
+
drawerFooterContent?: React.ReactNode | ((props: {
|
|
30
|
+
handleCloseMenuDrawer: (event: any, reason: 'backdropClick' | 'escapeKeyDown') => void;
|
|
31
|
+
}) => React.ReactNode);
|
|
30
32
|
/**
|
|
31
33
|
* Props to spread to ScrollContainer component
|
|
32
34
|
* This lib use 'react-custom-scrollbars' component to perform scrollbars
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const styles_1 = require("@mui/material/styles");
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
8
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
@@ -11,7 +11,6 @@ const ScrollContainer_1 = tslib_1.__importDefault(require("../../shared/ScrollCo
|
|
|
11
11
|
const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
|
|
12
12
|
const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
|
|
13
13
|
const CreateLiveStreamButton_1 = tslib_1.__importDefault(require("../CreateLiveStreamButton"));
|
|
14
|
-
const react_core_1 = require("@selfcommunity/react-core");
|
|
15
14
|
const PREFIX = 'SCNavigationMenuDrawer';
|
|
16
15
|
const classes = {
|
|
17
16
|
root: `${PREFIX}-root`,
|
|
@@ -30,15 +29,23 @@ const Root = (0, styles_1.styled)(material_1.Drawer, {
|
|
|
30
29
|
overridesResolver: (props, styles) => styles.root
|
|
31
30
|
})(({ theme }) => ({}));
|
|
32
31
|
function NavigationMenuDrawer(inProps) {
|
|
33
|
-
var _a;
|
|
34
32
|
// PROPS
|
|
35
33
|
const props = (0, system_1.useThemeProps)({
|
|
36
34
|
props: inProps,
|
|
37
35
|
name: PREFIX
|
|
38
36
|
});
|
|
39
37
|
const { className = null, showDrawerHeader = true, drawerHeaderContent = (0, jsx_runtime_1.jsx)(DefaultHeaderContent_1.default, {}), drawerContent = (0, jsx_runtime_1.jsx)(DefaultDrawerContent_1.default, {}), showDrawerFooterContent = true, drawerFooterContent = null, ScrollContainerProps = { hideTracksWhenNotNeeded: true }, CreateLiveStreamButtonComponentProps = {}, open, onClose } = props, rest = tslib_1.__rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "showDrawerFooterContent", "drawerFooterContent", "ScrollContainerProps", "CreateLiveStreamButtonComponentProps", "open", "onClose"]);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const footerContent = (() => {
|
|
39
|
+
if (typeof drawerFooterContent === 'function') {
|
|
40
|
+
return drawerFooterContent({ handleCloseMenuDrawer: onClose });
|
|
41
|
+
}
|
|
42
|
+
if (react_1.default.isValidElement(drawerFooterContent)) {
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
return react_1.default.cloneElement(drawerFooterContent, { handleCloseMenuDrawer: onClose });
|
|
46
|
+
}
|
|
47
|
+
return drawerFooterContent;
|
|
48
|
+
})();
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ anchor: "left", className: (0, classnames_1.default)(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, Object.assign({}, ScrollContainerProps, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "div", className: classes.drawerFooter }, { children: footerContent || ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: (0, jsx_runtime_1.jsx)(CreateLiveStreamButton_1.default, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))) })) }))] })));
|
|
43
50
|
}
|
|
44
51
|
exports.default = NavigationMenuDrawer;
|
|
@@ -42,10 +42,20 @@ function EventNotification(props) {
|
|
|
42
42
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
43
43
|
// STATE
|
|
44
44
|
const [openAlert, setOpenAlert] = (0, react_1.useState)(false);
|
|
45
|
+
// const [loading, setLoading] = useState<boolean>(false);
|
|
46
|
+
// const [disabled, setDisabled] = useState<boolean>(!notificationObject.is_new);
|
|
45
47
|
// CONST
|
|
46
48
|
const isSnippetTemplate = template === types_2.SCNotificationObjectTemplateType.SNIPPET;
|
|
47
49
|
const isToastTemplate = template === types_2.SCNotificationObjectTemplateType.TOAST;
|
|
48
50
|
const intl = (0, react_intl_1.useIntl)();
|
|
51
|
+
//HANDLERS
|
|
52
|
+
// const acceptRequest = (event) => {
|
|
53
|
+
// setLoading(true);
|
|
54
|
+
// EventService.inviteOrAcceptEventRequest(event.id, {users: [notificationObject.user.id]}).then(() => {
|
|
55
|
+
// setLoading(false);
|
|
56
|
+
// setDisabled(true);
|
|
57
|
+
// });
|
|
58
|
+
// };
|
|
49
59
|
// RENDER
|
|
50
60
|
if (isSnippetTemplate || isToastTemplate) {
|
|
51
61
|
return ((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 && {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ButtonProps } from '@mui/material/Button/Button';
|
|
2
|
-
import { SCEventType, SCLiveStreamType } from '@selfcommunity/types';
|
|
3
2
|
import { CreateLiveStreamDialogProps } from '../CreateLiveStreamDialog';
|
|
4
3
|
export interface CreateLiveStreamButtonProps extends ButtonProps {
|
|
5
4
|
/**
|
|
@@ -12,11 +11,6 @@ export interface CreateLiveStreamButtonProps extends ButtonProps {
|
|
|
12
11
|
* @default empty object
|
|
13
12
|
*/
|
|
14
13
|
CreateLiveStreamDialogComponentProps?: CreateLiveStreamDialogProps;
|
|
15
|
-
/**
|
|
16
|
-
* On success callback function
|
|
17
|
-
* @default null
|
|
18
|
-
*/
|
|
19
|
-
onSuccess?: (data: SCEventType | SCLiveStreamType) => void;
|
|
20
14
|
/**
|
|
21
15
|
* Any other properties
|
|
22
16
|
*/
|
|
@@ -43,7 +43,7 @@ export default function CreateLiveStreamButton(inProps) {
|
|
|
43
43
|
props: inProps,
|
|
44
44
|
name: PREFIX
|
|
45
45
|
});
|
|
46
|
-
const { className, CreateLiveStreamDialogComponentProps = {},
|
|
46
|
+
const { className, CreateLiveStreamDialogComponentProps = {}, children } = props, rest = __rest(props, ["className", "CreateLiveStreamDialogComponentProps", "children"]);
|
|
47
47
|
// CONTEXT
|
|
48
48
|
const scUserContext = useContext(SCUserContext);
|
|
49
49
|
const { preferences, features } = useSCPreferences();
|
|
@@ -69,13 +69,6 @@ export default function CreateLiveStreamButton(inProps) {
|
|
|
69
69
|
const handleClose = () => {
|
|
70
70
|
setOpen((o) => !o);
|
|
71
71
|
};
|
|
72
|
-
/**
|
|
73
|
-
* Handle close
|
|
74
|
-
*/
|
|
75
|
-
const handleSuccess = (data) => {
|
|
76
|
-
onSuccess && onSuccess(data);
|
|
77
|
-
setOpen((o) => !o);
|
|
78
|
-
};
|
|
79
72
|
/**
|
|
80
73
|
* If there's no authUserId, component is hidden.
|
|
81
74
|
*/
|
|
@@ -85,5 +78,5 @@ export default function CreateLiveStreamButton(inProps) {
|
|
|
85
78
|
/**
|
|
86
79
|
* Renders root object
|
|
87
80
|
*/
|
|
88
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleClose, variant: "contained", color: "secondary", startIcon: _jsx(Icon, { children: "movie" }) }, rest, { children: children !== null && children !== void 0 ? children : _jsx(FormattedMessage, { id: "ui.createEventButton.goLive", defaultMessage: "ui.createEventButton.goLive" }) })), open && _jsx(CreateLivestreamDialog, Object.assign({ open: true, onClose: handleClose
|
|
81
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleClose, variant: "contained", color: "secondary", startIcon: _jsx(Icon, { children: "movie" }) }, rest, { children: children !== null && children !== void 0 ? children : _jsx(FormattedMessage, { id: "ui.createEventButton.goLive", defaultMessage: "ui.createEventButton.goLive" }) })), open && _jsx(CreateLivestreamDialog, Object.assign({ open: true, onClose: handleClose }, CreateLiveStreamDialogComponentProps))] }));
|
|
89
82
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { SCEventType, SCLiveStreamType } from '@selfcommunity/types';
|
|
2
1
|
import { BaseDialogProps } from '../../shared/BaseDialog';
|
|
2
|
+
import { EventFormProps } from '../EventForm';
|
|
3
|
+
import { LiveStreamFormProps } from '../LiveStreamForm';
|
|
3
4
|
export interface CreateLiveStreamDialogProps extends BaseDialogProps {
|
|
4
5
|
/**
|
|
5
6
|
* Overrides or extends the styles applied to the component.
|
|
@@ -17,10 +18,15 @@ export interface CreateLiveStreamDialogProps extends BaseDialogProps {
|
|
|
17
18
|
*/
|
|
18
19
|
onClose?: () => void;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @default
|
|
21
|
+
* Props to spread to EventForm component
|
|
22
|
+
* @default {}
|
|
23
|
+
*/
|
|
24
|
+
EventFormComponentProps?: EventFormProps;
|
|
25
|
+
/**
|
|
26
|
+
* Props to spread to LiveStreamForm component
|
|
27
|
+
* @default {}
|
|
22
28
|
*/
|
|
23
|
-
|
|
29
|
+
LiveStreamFormComponentProps?: LiveStreamFormProps;
|
|
24
30
|
/**
|
|
25
31
|
* Any other properties
|
|
26
32
|
*/
|
|
@@ -63,7 +63,7 @@ export default function CreateLiveStreamDialog(inProps) {
|
|
|
63
63
|
props: inProps,
|
|
64
64
|
name: PREFIX
|
|
65
65
|
});
|
|
66
|
-
const { className, open = true, onClose,
|
|
66
|
+
const { className, open = true, onClose, EventFormComponentProps = {}, LiveStreamFormComponentProps = {} } = props, rest = __rest(props, ["className", "open", "onClose", "EventFormComponentProps", "LiveStreamFormComponentProps"]);
|
|
67
67
|
// CONTEXT
|
|
68
68
|
const scUserContext = useSCUser();
|
|
69
69
|
// PERMISSION
|
|
@@ -84,8 +84,12 @@ export default function CreateLiveStreamDialog(inProps) {
|
|
|
84
84
|
setStep(CreateLiveStreamStep.SELECT_TYPE);
|
|
85
85
|
}, []);
|
|
86
86
|
const handleSubmit = useCallback((e) => {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
var _a, _b;
|
|
88
|
+
liveType === LiveStreamType.EVENT_LIVE
|
|
89
|
+
? (_a = EventFormComponentProps.onSuccess) === null || _a === void 0 ? void 0 : _a.call(EventFormComponentProps, e)
|
|
90
|
+
: (_b = LiveStreamFormComponentProps.onSuccess) === null || _b === void 0 ? void 0 : _b.call(LiveStreamFormComponentProps, e);
|
|
91
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
92
|
+
}, [liveType, onClose, EventFormComponentProps, LiveStreamFormComponentProps]);
|
|
89
93
|
useEffect(() => {
|
|
90
94
|
if (!canCreateEvent) {
|
|
91
95
|
setLiveType(LiveStreamType.DIRECT_LIVE);
|
|
@@ -98,5 +102,5 @@ export default function CreateLiveStreamDialog(inProps) {
|
|
|
98
102
|
/**
|
|
99
103
|
* Renders root object
|
|
100
104
|
*/
|
|
101
|
-
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: "md", title: _jsxs(Box, Object.assign({ className: classes.title, component: "span" }, { children: [canShowBackButton && (_jsx(Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: _jsx(Icon, { children: "arrow_back" }) }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.button.back", defaultMessage: "ui.createLivestreamDialog.button.back" }) }))), _jsx(Box, Object.assign({ component: "span" }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: "body", onClose: !canShowBackButton ? onClose : undefined, className: classNames(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: _jsxs(Box, Object.assign({ className: classes.content }, { children: [step === CreateLiveStreamStep.SELECT_TYPE && (_jsx(LiveStreamSelector, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === CreateLiveStreamStep.CREATE_LIVE && (_jsx(_Fragment, { children: liveType === LiveStreamType.EVENT_LIVE ? (_jsx(EventForm, { EventAddressComponentProps: { locations: [SCEventLocationType.LIVESTREAM] }, onSuccess: handleSubmit })) : (_jsx(LiveStreamForm, { onSuccess: handleSubmit })) }))] })) })));
|
|
105
|
+
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: "md", title: _jsxs(Box, Object.assign({ className: classes.title, component: "span" }, { children: [canShowBackButton && (_jsx(Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: _jsx(Icon, { children: "arrow_back" }) }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.button.back", defaultMessage: "ui.createLivestreamDialog.button.back" }) }))), _jsx(Box, Object.assign({ component: "span" }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: "body", onClose: !canShowBackButton ? onClose : undefined, className: classNames(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: _jsxs(Box, Object.assign({ className: classes.content }, { children: [step === CreateLiveStreamStep.SELECT_TYPE && (_jsx(LiveStreamSelector, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === CreateLiveStreamStep.CREATE_LIVE && (_jsx(_Fragment, { children: liveType === LiveStreamType.EVENT_LIVE ? (_jsx(EventForm, Object.assign({}, EventFormComponentProps, { EventAddressComponentProps: { locations: [SCEventLocationType.LIVESTREAM] }, onSuccess: handleSubmit }))) : (_jsx(LiveStreamForm, Object.assign({}, LiveStreamFormComponentProps, { onSuccess: handleSubmit }))) }))] })) })));
|
|
102
106
|
}
|
|
@@ -40,14 +40,14 @@ export default function EventFormDialog(inProps) {
|
|
|
40
40
|
props: inProps,
|
|
41
41
|
name: PREFIX
|
|
42
42
|
});
|
|
43
|
-
const { className, open = true, onClose, EventFormComponentProps } = props, rest = __rest(props, ["className", "open", "onClose", "EventFormComponentProps"]);
|
|
43
|
+
const { className, open = true, onClose, EventFormComponentProps = {} } = props, rest = __rest(props, ["className", "open", "onClose", "EventFormComponentProps"]);
|
|
44
44
|
const handleSuccess = useCallback((event) => {
|
|
45
45
|
var _a;
|
|
46
|
-
(_a = EventFormComponentProps
|
|
46
|
+
(_a = EventFormComponentProps.onSuccess) === null || _a === void 0 ? void 0 : _a.call(EventFormComponentProps, event);
|
|
47
47
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
48
48
|
}, [onClose, EventFormComponentProps]);
|
|
49
49
|
/**
|
|
50
50
|
* Renders root object
|
|
51
51
|
*/
|
|
52
|
-
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? (_jsx(FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : (_jsx(FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: onClose, className: classNames(classes.root, className) }, rest, { children: _jsx(EventForm, Object.assign({},
|
|
52
|
+
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? (_jsx(FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : (_jsx(FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: onClose, className: classNames(classes.root, className) }, rest, { children: _jsx(EventForm, Object.assign({}, EventFormComponentProps, { onSuccess: handleSuccess })) })));
|
|
53
53
|
}
|
|
@@ -193,10 +193,10 @@ export default function GroupForm(inProps) {
|
|
|
193
193
|
}
|
|
194
194
|
groupService
|
|
195
195
|
.then((data) => {
|
|
196
|
-
onSuccess
|
|
196
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
|
|
197
197
|
notifyChanges(data);
|
|
198
|
-
onClose && onClose();
|
|
199
198
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
199
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
200
200
|
})
|
|
201
201
|
.catch((e) => {
|
|
202
202
|
setError(Object.assign(Object.assign({}, error), formatHttpErrorCode(e)));
|
|
@@ -26,7 +26,9 @@ export interface NavigationMenuDrawerProps extends DrawerProps {
|
|
|
26
26
|
* Custom Drawer footer content
|
|
27
27
|
* @default null
|
|
28
28
|
*/
|
|
29
|
-
drawerFooterContent?: React.ReactNode
|
|
29
|
+
drawerFooterContent?: React.ReactNode | ((props: {
|
|
30
|
+
handleCloseMenuDrawer: (event: any, reason: 'backdropClick' | 'escapeKeyDown') => void;
|
|
31
|
+
}) => React.ReactNode);
|
|
30
32
|
/**
|
|
31
33
|
* Props to spread to ScrollContainer component
|
|
32
34
|
* This lib use 'react-custom-scrollbars' component to perform scrollbars
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { Box, Divider, Drawer, Icon, IconButton, List } from '@mui/material';
|
|
6
6
|
import classNames from 'classnames';
|
|
@@ -9,7 +9,6 @@ import ScrollContainer from '../../shared/ScrollContainer';
|
|
|
9
9
|
import DefaultDrawerContent from './DefaultDrawerContent';
|
|
10
10
|
import DefaultHeaderContent from './DefaultHeaderContent';
|
|
11
11
|
import CreateLiveStreamButton from '../CreateLiveStreamButton';
|
|
12
|
-
import { useSCUser } from '@selfcommunity/react-core';
|
|
13
12
|
const PREFIX = 'SCNavigationMenuDrawer';
|
|
14
13
|
const classes = {
|
|
15
14
|
root: `${PREFIX}-root`,
|
|
@@ -28,14 +27,22 @@ const Root = styled(Drawer, {
|
|
|
28
27
|
overridesResolver: (props, styles) => styles.root
|
|
29
28
|
})(({ theme }) => ({}));
|
|
30
29
|
export default function NavigationMenuDrawer(inProps) {
|
|
31
|
-
var _a;
|
|
32
30
|
// PROPS
|
|
33
31
|
const props = useThemeProps({
|
|
34
32
|
props: inProps,
|
|
35
33
|
name: PREFIX
|
|
36
34
|
});
|
|
37
35
|
const { className = null, showDrawerHeader = true, drawerHeaderContent = _jsx(DefaultHeaderContent, {}), drawerContent = _jsx(DefaultDrawerContent, {}), showDrawerFooterContent = true, drawerFooterContent = null, ScrollContainerProps = { hideTracksWhenNotNeeded: true }, CreateLiveStreamButtonComponentProps = {}, open, onClose } = props, rest = __rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "showDrawerFooterContent", "drawerFooterContent", "ScrollContainerProps", "CreateLiveStreamButtonComponentProps", "open", "onClose"]);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const footerContent = (() => {
|
|
37
|
+
if (typeof drawerFooterContent === 'function') {
|
|
38
|
+
return drawerFooterContent({ handleCloseMenuDrawer: onClose });
|
|
39
|
+
}
|
|
40
|
+
if (React.isValidElement(drawerFooterContent)) {
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
return React.cloneElement(drawerFooterContent, { handleCloseMenuDrawer: onClose });
|
|
44
|
+
}
|
|
45
|
+
return drawerFooterContent;
|
|
46
|
+
})();
|
|
47
|
+
return (_jsxs(Root, Object.assign({ anchor: "left", className: classNames(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsx(Divider, {})] })), _jsx(ScrollContainer, Object.assign({}, ScrollContainerProps, { children: _jsx(List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && (_jsx(_Fragment, { children: _jsx(Box, Object.assign({ component: "div", className: classes.drawerFooter }, { children: footerContent || (_jsx(Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: _jsx(CreateLiveStreamButton, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))) })) }))] })));
|
|
41
48
|
}
|
|
@@ -40,10 +40,20 @@ export default function EventNotification(props) {
|
|
|
40
40
|
const scRoutingContext = useSCRouting();
|
|
41
41
|
// STATE
|
|
42
42
|
const [openAlert, setOpenAlert] = useState(false);
|
|
43
|
+
// const [loading, setLoading] = useState<boolean>(false);
|
|
44
|
+
// const [disabled, setDisabled] = useState<boolean>(!notificationObject.is_new);
|
|
43
45
|
// CONST
|
|
44
46
|
const isSnippetTemplate = template === SCNotificationObjectTemplateType.SNIPPET;
|
|
45
47
|
const isToastTemplate = template === SCNotificationObjectTemplateType.TOAST;
|
|
46
48
|
const intl = useIntl();
|
|
49
|
+
//HANDLERS
|
|
50
|
+
// const acceptRequest = (event) => {
|
|
51
|
+
// setLoading(true);
|
|
52
|
+
// EventService.inviteOrAcceptEventRequest(event.id, {users: [notificationObject.user.id]}).then(() => {
|
|
53
|
+
// setLoading(false);
|
|
54
|
+
// setDisabled(true);
|
|
55
|
+
// });
|
|
56
|
+
// };
|
|
47
57
|
// RENDER
|
|
48
58
|
if (isSnippetTemplate || isToastTemplate) {
|
|
49
59
|
return (_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 && {
|