@selfcommunity/react-ui 0.7.50-events.106 → 0.7.50-events.108
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/EventInfoWidget/EventInfoWidget.js +1 -1
- package/lib/cjs/components/Events/Events.js +28 -9
- package/lib/cjs/components/MyEventsWidget/MyEventsWidget.d.ts +1 -1
- package/lib/cjs/components/MyEventsWidget/MyEventsWidget.js +7 -3
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +0 -4
- package/lib/cjs/components/OnBoardingWidget/Steps/Category/Category.js +20 -1
- package/lib/cjs/components/OnBoardingWidget/Steps/Content/Content.js +20 -1
- package/lib/cjs/constants/ContributionsActionsMenu.d.ts +1 -0
- package/lib/cjs/constants/ContributionsActionsMenu.js +2 -1
- package/lib/cjs/shared/ContributionActionsMenu/index.d.ts +4 -0
- package/lib/cjs/shared/ContributionActionsMenu/index.js +66 -13
- package/lib/cjs/shared/EventInfoDetails/index.d.ts +1 -0
- package/lib/cjs/shared/EventInfoDetails/index.js +3 -2
- package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +1 -1
- package/lib/esm/components/Events/Events.js +30 -11
- package/lib/esm/components/MyEventsWidget/MyEventsWidget.d.ts +1 -1
- package/lib/esm/components/MyEventsWidget/MyEventsWidget.js +8 -4
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +0 -4
- package/lib/esm/components/OnBoardingWidget/Steps/Category/Category.js +21 -2
- package/lib/esm/components/OnBoardingWidget/Steps/Content/Content.js +21 -2
- package/lib/esm/constants/ContributionsActionsMenu.d.ts +1 -0
- package/lib/esm/constants/ContributionsActionsMenu.js +1 -0
- package/lib/esm/shared/ContributionActionsMenu/index.d.ts +4 -0
- package/lib/esm/shared/ContributionActionsMenu/index.js +67 -14
- package/lib/esm/shared/EventInfoDetails/index.d.ts +1 -0
- package/lib/esm/shared/EventInfoDetails/index.js +4 -3
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -74,6 +74,6 @@ function EventInfoWidget(inProps) {
|
|
|
74
74
|
if (!scEvent) {
|
|
75
75
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
76
76
|
}
|
|
77
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.titleWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "info" })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.infoEventWidget.title", defaultMessage: "ui.infoEventWidget.title" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.textWrapper }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "span", variant: "body1" }, { children: [description, showButton && !expanded && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "text", className: classes.showMore, onClick: handleToggleSummary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.infoEventWidget.showMore", defaultMessage: "ui.infoEventWidget.showMore" }) })))] })) })), (0, jsx_runtime_1.jsx)(EventInfoDetails_1.default, { event: scEvent, hasRecurringInfo: true, hasCreatedInfo: true, hasLocationInfo: showInfo })] })) })));
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.titleWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "info" })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.infoEventWidget.title", defaultMessage: "ui.infoEventWidget.title" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.textWrapper }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "span", variant: "body1" }, { children: [description, showButton && !expanded && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "text", className: classes.showMore, onClick: handleToggleSummary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.infoEventWidget.showMore", defaultMessage: "ui.infoEventWidget.showMore" }) })))] })) })), (0, jsx_runtime_1.jsx)(EventInfoDetails_1.default, { event: scEvent, hasRecurringInfo: true, hasCreatedInfo: true, hasLocationInfo: showInfo, hasInProgress: false })] })) })));
|
|
78
78
|
}
|
|
79
79
|
exports.default = EventInfoWidget;
|
|
@@ -27,7 +27,8 @@ const classes = {
|
|
|
27
27
|
item: `${constants_1.PREFIX}-item`,
|
|
28
28
|
itemSkeleton: `${constants_1.PREFIX}-item-skeleton`,
|
|
29
29
|
noResults: `${constants_1.PREFIX}-no-results`,
|
|
30
|
-
showMore: `${constants_1.PREFIX}-show-more
|
|
30
|
+
showMore: `${constants_1.PREFIX}-show-more`,
|
|
31
|
+
search: `${constants_1.PREFIX}-search`
|
|
31
32
|
};
|
|
32
33
|
const options = [
|
|
33
34
|
{ value: types_1.SCEventDateFilterType.ANY, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.select.any", defaultMessage: "ui.events.select.any" }) },
|
|
@@ -85,10 +86,10 @@ function Events(inProps) {
|
|
|
85
86
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
86
87
|
const [next, setNext] = (0, react_1.useState)(null);
|
|
87
88
|
const [query, setQuery] = (0, react_1.useState)('');
|
|
88
|
-
const [search, setSearch] = (0, react_1.useState)(false);
|
|
89
89
|
const [dateSearch, setDateSearch] = (0, react_1.useState)(options[0].value);
|
|
90
90
|
const [showFollowed, setShowFollowed] = (0, react_1.useState)(false);
|
|
91
91
|
const [showPastEvents, setShowPastEvents] = (0, react_1.useState)(false);
|
|
92
|
+
const [showMyEvents, setShowMyEvents] = (0, react_1.useState)(false);
|
|
92
93
|
// CONTEXT
|
|
93
94
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
94
95
|
const scPreferencesContext = (0, react_1.useContext)(react_core_1.SCPreferencesContext);
|
|
@@ -98,6 +99,8 @@ function Events(inProps) {
|
|
|
98
99
|
scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value;
|
|
99
100
|
// CONST
|
|
100
101
|
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
102
|
+
const theme = (0, material_1.useTheme)();
|
|
103
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
101
104
|
// HANDLERS
|
|
102
105
|
const handleChipClick = () => {
|
|
103
106
|
setShowFollowed(!showFollowed);
|
|
@@ -114,14 +117,14 @@ function Events(inProps) {
|
|
|
114
117
|
/**
|
|
115
118
|
* Fetches events list
|
|
116
119
|
*/
|
|
117
|
-
const fetchEvents = () => {
|
|
120
|
+
const fetchEvents = (search) => {
|
|
118
121
|
setLoading(true);
|
|
119
122
|
return api_services_1.http
|
|
120
123
|
.request({
|
|
121
124
|
url: endpoint.url({}),
|
|
122
125
|
method: endpoint.method,
|
|
123
126
|
params: Object.assign(Object.assign({}, endpointQueryParams), (general
|
|
124
|
-
? Object.assign(Object.assign(Object.assign(Object.assign({}, (search && { search: query })), (dateSearch !== types_1.SCEventDateFilterType.ANY && { date_filter: dateSearch })), (showFollowed && { follows: showFollowed })), (showPastEvents && { date_filter: types_1.SCEventDateFilterType.PAST })) : Object.assign({ subscription_status: types_1.SCEventSubscriptionStatusType.GOING }, (showPastEvents && { past: showPastEvents }))))
|
|
127
|
+
? Object.assign(Object.assign(Object.assign(Object.assign({}, (search && { search: query })), (dateSearch !== types_1.SCEventDateFilterType.ANY && { date_filter: dateSearch })), (showFollowed && { follows: showFollowed })), (showPastEvents && { date_filter: types_1.SCEventDateFilterType.PAST })) : Object.assign(Object.assign({ subscription_status: types_1.SCEventSubscriptionStatusType.GOING }, (showPastEvents && { past: showPastEvents })), (showMyEvents && { created_by: authUserId }))))
|
|
125
128
|
})
|
|
126
129
|
.then((res) => {
|
|
127
130
|
setEvents(res.data.results);
|
|
@@ -140,9 +143,9 @@ function Events(inProps) {
|
|
|
140
143
|
return;
|
|
141
144
|
}
|
|
142
145
|
else {
|
|
143
|
-
fetchEvents();
|
|
146
|
+
query === '' && fetchEvents();
|
|
144
147
|
}
|
|
145
|
-
}, [contentAvailability,
|
|
148
|
+
}, [contentAvailability, dateSearch, showFollowed, showPastEvents, showMyEvents, query]);
|
|
146
149
|
const handleNext = (0, react_1.useMemo)(() => () => {
|
|
147
150
|
if (!next) {
|
|
148
151
|
return;
|
|
@@ -165,7 +168,6 @@ function Events(inProps) {
|
|
|
165
168
|
*/
|
|
166
169
|
const handleOnChangeFilterName = (event) => {
|
|
167
170
|
setQuery(event.target.value);
|
|
168
|
-
setSearch(false);
|
|
169
171
|
};
|
|
170
172
|
/**
|
|
171
173
|
* Handle change time frame
|
|
@@ -177,8 +179,25 @@ function Events(inProps) {
|
|
|
177
179
|
/**
|
|
178
180
|
* Renders events list
|
|
179
181
|
*/
|
|
180
|
-
const c = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showFilters && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, autoHide: !events.length && !showPastEvents }) }))
|
|
181
|
-
|
|
182
|
+
const c = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showFilters && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, autoHide: !events.length && !showPastEvents }) })), (events.length !== 0 || (events.length === 0 && showMyEvents)) && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot
|
|
183
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
184
|
+
// @ts-ignore
|
|
185
|
+
, {
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
color: showMyEvents ? 'secondary' : 'default',
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
190
|
+
// @ts-ignore
|
|
191
|
+
variant: showMyEvents ? 'filled' : 'outlined', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByCreatedByMe", defaultMessage: "ui.events.filterByCreatedByMe" }), onClick: () => setShowMyEvents(!showMyEvents),
|
|
192
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
193
|
+
// @ts-ignore
|
|
194
|
+
showFollowed: showMyEvents, deleteIcon: showMyEvents ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showMyEvents ? handleDeleteClick : null }) })))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 4 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { className: classes.search, size: 'small', fullWidth: true, value: query, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading, onKeyUp: (e) => {
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
if (e.key === 'Enter') {
|
|
197
|
+
fetchEvents(true);
|
|
198
|
+
}
|
|
199
|
+
}, InputProps: {
|
|
200
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "end" }, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => fetchEvents(true) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchEvents(true), endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }) })) })))
|
|
182
201
|
} }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ disabled: showPastEvents, size: 'small', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: option.value }, { children: [(0, jsx_runtime_1.jsx)(material_1.Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), authUserId && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot
|
|
183
202
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
184
203
|
// @ts-ignore
|
|
@@ -3,7 +3,7 @@ import { WidgetProps } from '../Widget';
|
|
|
3
3
|
export interface MyEventsWidgetProps extends WidgetProps {
|
|
4
4
|
/**
|
|
5
5
|
* Feed API Query Params
|
|
6
|
-
* @default [{'limit': 20, 'offset': 0}]
|
|
6
|
+
* @default [{'limit': 20, 'offset': 0, subscription_status: 'going'}]
|
|
7
7
|
*/
|
|
8
8
|
endpointQueryParams?: Record<string, string | number>;
|
|
9
9
|
/**
|
|
@@ -14,12 +14,12 @@ const react_intl_1 = require("react-intl");
|
|
|
14
14
|
const Errors_1 = require("../../constants/Errors");
|
|
15
15
|
const Pagination_1 = require("../../constants/Pagination");
|
|
16
16
|
const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
|
|
17
|
+
const event_1 = require("../../types/event");
|
|
17
18
|
const widget_1 = require("../../utils/widget");
|
|
19
|
+
const Event_1 = tslib_1.__importDefault(require("../Event"));
|
|
18
20
|
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
19
21
|
const constants_1 = require("./constants");
|
|
20
22
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
21
|
-
const event_1 = require("../../types/event");
|
|
22
|
-
const Event_1 = tslib_1.__importDefault(require("../Event"));
|
|
23
23
|
const classes = {
|
|
24
24
|
root: `${constants_1.PREFIX}-root`,
|
|
25
25
|
titleWrapper: `${constants_1.PREFIX}-title-wrapper`,
|
|
@@ -47,7 +47,11 @@ function MyEventsWidget(inProps) {
|
|
|
47
47
|
name: constants_1.PREFIX
|
|
48
48
|
});
|
|
49
49
|
// CONST
|
|
50
|
-
const { endpointQueryParams = {
|
|
50
|
+
const { endpointQueryParams = {
|
|
51
|
+
limit: Pagination_1.DEFAULT_PAGINATION_LIMIT,
|
|
52
|
+
offset: Pagination_1.DEFAULT_PAGINATION_OFFSET,
|
|
53
|
+
subscription_status: types_1.SCEventSubscriptionStatusType.GOING
|
|
54
|
+
}, cacheStrategy } = props, rest = tslib_1.__rest(props, ["endpointQueryParams", "cacheStrategy"]);
|
|
51
55
|
// STATE
|
|
52
56
|
const [state, dispatch] = (0, react_1.useReducer)(widget_1.dataWidgetReducer, {
|
|
53
57
|
isLoadingNext: false,
|
|
@@ -93,7 +93,6 @@ const OnBoardingWidget = (inProps) => {
|
|
|
93
93
|
}
|
|
94
94
|
return item;
|
|
95
95
|
}));
|
|
96
|
-
setStep(nextStep);
|
|
97
96
|
})
|
|
98
97
|
.catch((error) => {
|
|
99
98
|
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
@@ -108,9 +107,6 @@ const OnBoardingWidget = (inProps) => {
|
|
|
108
107
|
variant: 'success',
|
|
109
108
|
autoHideDuration: 7000
|
|
110
109
|
});
|
|
111
|
-
if (_step.step === step.step) {
|
|
112
|
-
setStep(nextStep);
|
|
113
|
-
}
|
|
114
110
|
};
|
|
115
111
|
const getSteps = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
116
112
|
yield api_services_1.OnBoardingService.getAllSteps()
|
|
@@ -72,6 +72,25 @@ function Category(inProps) {
|
|
|
72
72
|
return () => clearInterval(intervalId);
|
|
73
73
|
}
|
|
74
74
|
}, [step.status, step.completion_percentage]);
|
|
75
|
+
const getLoadingMessage = (0, react_1.useMemo)(() => {
|
|
76
|
+
let message;
|
|
77
|
+
if (progress <= 10) {
|
|
78
|
+
message = ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.loading.a", defaultMessage: "ui.onBoardingWidget.step.categories.loading.a" }));
|
|
79
|
+
}
|
|
80
|
+
else if (progress <= 20) {
|
|
81
|
+
message = ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.loading.b", defaultMessage: "ui.onBoardingWidget.step.categories.loading.b" }));
|
|
82
|
+
}
|
|
83
|
+
else if (progress <= 40) {
|
|
84
|
+
message = ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.loading.c", defaultMessage: "ui.onBoardingWidget.step.categories.loading.c" }));
|
|
85
|
+
}
|
|
86
|
+
else if (progress <= 60) {
|
|
87
|
+
message = ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.loading.d", defaultMessage: "ui.onBoardingWidget.step.categories.loading.d" }));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
message = ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.loading.e", defaultMessage: "ui.onBoardingWidget.step.categories.loading.e" }));
|
|
91
|
+
}
|
|
92
|
+
return message;
|
|
93
|
+
}, [progress]);
|
|
75
94
|
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.categories", defaultMessage: "ui.onBoardingWidget.categories" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.category.summary", defaultMessage: "ui.onBoardingWidget.step.category.summary" }) })), (step === null || step === void 0 ? void 0 : step.status) !== types_1.SCOnBoardingStepStatusType.IN_PROGRESS && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.category.generation.steps", defaultMessage: "ui.onBoardingWidget.step.category.generation.steps", values: {
|
|
76
95
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
77
96
|
// @ts-ignore
|
|
@@ -82,6 +101,6 @@ function Category(inProps) {
|
|
|
82
101
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
83
102
|
// @ts-ignore
|
|
84
103
|
iconC: (...chunks) => (0, jsx_runtime_1.jsx)(CircledLetter, { letter: "c", statement: chunks })
|
|
85
|
-
} }) }), (0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.image, component: "img", src: categoryA_1.default }), (0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.image, component: "img", src: categoryB_1.default })] })), (0, jsx_runtime_1.jsx)(Box_1.default, Object.assign({ component: "span", className: classes.action }, { children: (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.COMPLETED ? ((0, jsx_runtime_1.jsx)(material_1.Alert, Object.assign({ severity: "success" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.success", defaultMessage: "ui.onBoardingWidget.step.categories.success" }) }))) : (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.IN_PROGRESS ? ((0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.progress }, { children: [(0, jsx_runtime_1.jsx)(react_lottie_player_1.Player, { autoplay: true, loop: true, src: category_progress_json_1.default, className: classes.animationProgress, controls: false }), (0, jsx_runtime_1.jsx)(ProgressBar_1.default, { value: progress, hideBar: true, loadingMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4" }, { children:
|
|
104
|
+
} }) }), (0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.image, component: "img", src: categoryA_1.default }), (0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.image, component: "img", src: categoryB_1.default })] })), (0, jsx_runtime_1.jsx)(Box_1.default, Object.assign({ component: "span", className: classes.action }, { children: (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.COMPLETED ? ((0, jsx_runtime_1.jsx)(material_1.Alert, Object.assign({ severity: "success" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.success", defaultMessage: "ui.onBoardingWidget.step.categories.success" }) }))) : (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.IN_PROGRESS ? ((0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.progress }, { children: [(0, jsx_runtime_1.jsx)(react_lottie_player_1.Player, { autoplay: true, loop: true, src: category_progress_json_1.default, className: classes.animationProgress, controls: false }), (0, jsx_runtime_1.jsx)(ProgressBar_1.default, { value: progress, hideBar: true, loadingMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4" }, { children: getLoadingMessage })) })] }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "contained", color: "secondary", onClick: handleCategoriesCreation, endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: hover ? 'ai_stars' : 'magic_wand' }), onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.onBoardingWidget.step.category.button", id: "ui.onBoardingWidget.step.category.button" }) }))) }))] })));
|
|
86
105
|
}
|
|
87
106
|
exports.default = Category;
|
|
@@ -52,6 +52,25 @@ function Content(inProps) {
|
|
|
52
52
|
return () => clearInterval(intervalId);
|
|
53
53
|
}
|
|
54
54
|
}, [step.status, step.completion_percentage]);
|
|
55
|
-
|
|
55
|
+
const getLoadingMessage = (0, react_1.useMemo)(() => {
|
|
56
|
+
let message;
|
|
57
|
+
if (progress <= 10) {
|
|
58
|
+
message = (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.contents.loading.a", defaultMessage: "ui.onBoardingWidget.step.contents.loading.a" });
|
|
59
|
+
}
|
|
60
|
+
else if (progress <= 20) {
|
|
61
|
+
message = (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.contents.loading.b", defaultMessage: "ui.onBoardingWidget.step.contents.loading.b" });
|
|
62
|
+
}
|
|
63
|
+
else if (progress <= 40) {
|
|
64
|
+
message = (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.contents.loading.c", defaultMessage: "ui.onBoardingWidget.step.contents.loading.c" });
|
|
65
|
+
}
|
|
66
|
+
else if (progress <= 60) {
|
|
67
|
+
message = (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.contents.loading.d", defaultMessage: "ui.onBoardingWidget.step.contents.loading.d" });
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
message = (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.contents.loading.e", defaultMessage: "ui.onBoardingWidget.step.contents.loading.e" });
|
|
71
|
+
}
|
|
72
|
+
return message;
|
|
73
|
+
}, [progress]);
|
|
74
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.contents", defaultMessage: "ui.onBoardingWidget.contents" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.content.summary", defaultMessage: "ui.onBoardingWidget.step.content.summary" }) })), (0, jsx_runtime_1.jsx)(Box_1.default, Object.assign({ component: "span", className: classes.action }, { children: (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.COMPLETED ? ((0, jsx_runtime_1.jsx)(material_1.Alert, Object.assign({ severity: "success" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.contents.success", defaultMessage: "ui.onBoardingWidget.step.contents.success" }) }))) : (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.IN_PROGRESS ? ((0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.progress }, { children: [(0, jsx_runtime_1.jsx)(react_lottie_player_1.Player, { autoplay: true, loop: true, src: content_progress_json_1.default, className: classes.animationProgress, controls: false }), (0, jsx_runtime_1.jsx)(ProgressBar_1.default, { value: progress, hideBar: true, loadingMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4" }, { children: getLoadingMessage })) })] }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "contained", color: "secondary", onClick: handleContentCreation, endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: hover ? 'ai_stars' : 'magic_wand' }), onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.onBoardingWidget.step.content.button", id: "ui.onBoardingWidget.step.content.button" }) }))) }))] })));
|
|
56
75
|
}
|
|
57
76
|
exports.default = Content;
|
|
@@ -14,5 +14,6 @@ export declare const EDIT_CONTRIBUTION = "_edit_contribution";
|
|
|
14
14
|
export declare const DELETE_CONTRIBUTION = "_delete_contribution";
|
|
15
15
|
export declare const RESTORE_CONTRIBUTION = "_restore_contribution";
|
|
16
16
|
export declare const SUSPEND_NOTIFICATION_CONTRIBUTION = "_suspend_notification_contribution";
|
|
17
|
+
export declare const SUSPEND_NOTIFICATION_EVENT = "_suspend_notification_event";
|
|
17
18
|
export declare const MODERATE_CONTRIBUTION_HIDDEN = "_moderate_contribution_hidden";
|
|
18
19
|
export declare const MODERATE_CONTRIBUTION_DELETED = "_moderate_contribution_deleted";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MODERATE_CONTRIBUTION_DELETED = exports.MODERATE_CONTRIBUTION_HIDDEN = exports.SUSPEND_NOTIFICATION_CONTRIBUTION = exports.RESTORE_CONTRIBUTION = exports.DELETE_CONTRIBUTION = exports.EDIT_CONTRIBUTION = exports.GET_CONTRIBUTION_PERMALINK = exports.DELETE_CONTRIBUTION_SECTION = exports.HIDE_CONTRIBUTION_SECTION = exports.FLAG_CONTRIBUTION_SECTION = exports.GENERAL_SECTION = void 0;
|
|
3
|
+
exports.MODERATE_CONTRIBUTION_DELETED = exports.MODERATE_CONTRIBUTION_HIDDEN = exports.SUSPEND_NOTIFICATION_EVENT = exports.SUSPEND_NOTIFICATION_CONTRIBUTION = exports.RESTORE_CONTRIBUTION = exports.DELETE_CONTRIBUTION = exports.EDIT_CONTRIBUTION = exports.GET_CONTRIBUTION_PERMALINK = exports.DELETE_CONTRIBUTION_SECTION = exports.HIDE_CONTRIBUTION_SECTION = exports.FLAG_CONTRIBUTION_SECTION = exports.GENERAL_SECTION = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Sections
|
|
6
6
|
* @type {string}
|
|
@@ -17,5 +17,6 @@ exports.EDIT_CONTRIBUTION = '_edit_contribution';
|
|
|
17
17
|
exports.DELETE_CONTRIBUTION = '_delete_contribution';
|
|
18
18
|
exports.RESTORE_CONTRIBUTION = '_restore_contribution';
|
|
19
19
|
exports.SUSPEND_NOTIFICATION_CONTRIBUTION = '_suspend_notification_contribution';
|
|
20
|
+
exports.SUSPEND_NOTIFICATION_EVENT = '_suspend_notification_event';
|
|
20
21
|
exports.MODERATE_CONTRIBUTION_HIDDEN = '_moderate_contribution_hidden';
|
|
21
22
|
exports.MODERATE_CONTRIBUTION_DELETED = '_moderate_contribution_deleted';
|
|
@@ -54,6 +54,10 @@ export interface ContributionActionsMenuProps {
|
|
|
54
54
|
* Handle suspend notification obj
|
|
55
55
|
*/
|
|
56
56
|
onSuspendNotificationContribution?: (obj: SCCommentType | SCFeedObjectType) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Handle suspend notification event embedded in obj
|
|
59
|
+
*/
|
|
60
|
+
onSuspendNotificationEvent?: (obj: SCCommentType | SCFeedObjectType) => void;
|
|
57
61
|
/**
|
|
58
62
|
* Props to spread to popper
|
|
59
63
|
* @default empty object
|
|
@@ -78,7 +78,7 @@ const messages = (0, react_intl_1.defineMessages)({
|
|
|
78
78
|
});
|
|
79
79
|
function ContributionActionsMenu(props) {
|
|
80
80
|
// PROPS
|
|
81
|
-
const { className, feedObjectId, feedObject, feedObjectType = types_1.SCContributionType.POST, commentObjectId, commentObject, onFlagContribution, onEditContribution, onHideContribution, onDeleteContribution, onRestoreContribution, onSuspendNotificationContribution, PopperProps = {} } = props, rest = tslib_1.__rest(props, ["className", "feedObjectId", "feedObject", "feedObjectType", "commentObjectId", "commentObject", "onFlagContribution", "onEditContribution", "onHideContribution", "onDeleteContribution", "onRestoreContribution", "onSuspendNotificationContribution", "PopperProps"]);
|
|
81
|
+
const { className, feedObjectId, feedObject, feedObjectType = types_1.SCContributionType.POST, commentObjectId, commentObject, onFlagContribution, onEditContribution, onHideContribution, onDeleteContribution, onRestoreContribution, onSuspendNotificationContribution, onSuspendNotificationEvent, PopperProps = {} } = props, rest = tslib_1.__rest(props, ["className", "feedObjectId", "feedObject", "feedObjectType", "commentObjectId", "commentObject", "onFlagContribution", "onEditContribution", "onHideContribution", "onDeleteContribution", "onRestoreContribution", "onSuspendNotificationContribution", "onSuspendNotificationEvent", "PopperProps"]);
|
|
82
82
|
// INTL
|
|
83
83
|
const intl = (0, react_intl_1.useIntl)();
|
|
84
84
|
// CONTEXT
|
|
@@ -173,7 +173,7 @@ function ContributionActionsMenu(props) {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
|
-
* Performs
|
|
176
|
+
* Performs notification suspension
|
|
177
177
|
*/
|
|
178
178
|
const performSuspendNotification = (0, react_1.useMemo)(() => () => {
|
|
179
179
|
return api_services_1.http
|
|
@@ -188,14 +188,30 @@ function ContributionActionsMenu(props) {
|
|
|
188
188
|
return Promise.resolve(res.data);
|
|
189
189
|
});
|
|
190
190
|
}, [contributionObj]);
|
|
191
|
+
/**
|
|
192
|
+
* Performs notification suspension of event embedded
|
|
193
|
+
*/
|
|
194
|
+
const performSuspendNotificationEvent = (0, react_1.useMemo)(() => () => {
|
|
195
|
+
const _endpoint = contributionObj.event.show_on_feed ? api_services_1.Endpoints.HideEvent : api_services_1.Endpoints.ShowEvent;
|
|
196
|
+
return api_services_1.http
|
|
197
|
+
.request({
|
|
198
|
+
url: _endpoint.url({ id: contributionObj.event.id }),
|
|
199
|
+
method: _endpoint.method
|
|
200
|
+
})
|
|
201
|
+
.then((res) => {
|
|
202
|
+
if (res.status >= 300) {
|
|
203
|
+
return Promise.reject(res);
|
|
204
|
+
}
|
|
205
|
+
return Promise.resolve(res.data);
|
|
206
|
+
});
|
|
207
|
+
}, [contributionObj]);
|
|
191
208
|
/**
|
|
192
209
|
* Handles stop notification for contributionObj
|
|
193
|
-
* @param contribution
|
|
194
210
|
*/
|
|
195
211
|
function handleSuspendContentNotification() {
|
|
196
212
|
setCurrentActionLoading(ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_CONTRIBUTION);
|
|
197
213
|
performSuspendNotification()
|
|
198
|
-
.then((
|
|
214
|
+
.then(() => {
|
|
199
215
|
const _feedObj = Object.assign({}, feedObj, { suspended: !feedObj.suspended });
|
|
200
216
|
setFeedObj(_feedObj);
|
|
201
217
|
onSuspendNotificationContribution && onSuspendNotificationContribution(_feedObj);
|
|
@@ -211,6 +227,29 @@ function ContributionActionsMenu(props) {
|
|
|
211
227
|
});
|
|
212
228
|
});
|
|
213
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Handles stop notification for event embedded in contributionObj
|
|
232
|
+
*/
|
|
233
|
+
function handleSuspendEventNotification() {
|
|
234
|
+
setCurrentActionLoading(ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_EVENT);
|
|
235
|
+
performSuspendNotificationEvent()
|
|
236
|
+
.then(() => {
|
|
237
|
+
const _eventObj = Object.assign({}, feedObj.event, { show_on_feed: !feedObj.event.show_on_feed });
|
|
238
|
+
const _feedObj = Object.assign({}, feedObj, { event: _eventObj });
|
|
239
|
+
setFeedObj(_feedObj);
|
|
240
|
+
onSuspendNotificationEvent && onSuspendNotificationEvent(_feedObj);
|
|
241
|
+
setCurrentActionLoading(null);
|
|
242
|
+
})
|
|
243
|
+
.catch((error) => {
|
|
244
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
245
|
+
setCurrentAction(null);
|
|
246
|
+
setCurrentActionLoading(null);
|
|
247
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.actionError", defaultMessage: "ui.contributionActionMenu.actionError" }), {
|
|
248
|
+
variant: 'error',
|
|
249
|
+
autoHideDuration: 3000
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
}
|
|
214
253
|
/**
|
|
215
254
|
* Get Status Flag
|
|
216
255
|
*/
|
|
@@ -355,7 +394,7 @@ function ContributionActionsMenu(props) {
|
|
|
355
394
|
else if (contributionObj && !isLoading && !isFlagging && type !== 'undefined') {
|
|
356
395
|
setIsFlagging(true);
|
|
357
396
|
performFlag(type)
|
|
358
|
-
.then((
|
|
397
|
+
.then(() => {
|
|
359
398
|
setFlagType(flagType === type ? null : type);
|
|
360
399
|
setIsFlagging(false);
|
|
361
400
|
onFlagContribution && onFlagContribution(contributionObj, type, flagType !== type);
|
|
@@ -443,6 +482,10 @@ function ContributionActionsMenu(props) {
|
|
|
443
482
|
setCurrentAction(ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_CONTRIBUTION);
|
|
444
483
|
handleSuspendContentNotification();
|
|
445
484
|
}
|
|
485
|
+
else if (action === ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_EVENT) {
|
|
486
|
+
setCurrentAction(ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_EVENT);
|
|
487
|
+
handleSuspendEventNotification();
|
|
488
|
+
}
|
|
446
489
|
else if (action === ContributionsActionsMenu_1.MODERATE_CONTRIBUTION_HIDDEN) {
|
|
447
490
|
setCurrentAction(ContributionsActionsMenu_1.MODERATE_CONTRIBUTION_HIDDEN);
|
|
448
491
|
setOpenConfirmDialog(true);
|
|
@@ -496,7 +539,7 @@ function ContributionActionsMenu(props) {
|
|
|
496
539
|
if (currentAction === ContributionsActionsMenu_1.DELETE_CONTRIBUTION) {
|
|
497
540
|
setCurrentActionLoading(ContributionsActionsMenu_1.DELETE_CONTRIBUTION);
|
|
498
541
|
performDeleteContribution()
|
|
499
|
-
.then((
|
|
542
|
+
.then(() => {
|
|
500
543
|
const _contributionObj = Object.assign({}, contributionObj, { deleted: true });
|
|
501
544
|
onDeleteContribution && onDeleteContribution(_contributionObj);
|
|
502
545
|
performPostConfirmAction(true);
|
|
@@ -509,7 +552,7 @@ function ContributionActionsMenu(props) {
|
|
|
509
552
|
else if (currentAction === ContributionsActionsMenu_1.RESTORE_CONTRIBUTION) {
|
|
510
553
|
setCurrentActionLoading(ContributionsActionsMenu_1.RESTORE_CONTRIBUTION);
|
|
511
554
|
performRestoreContribution()
|
|
512
|
-
.then((
|
|
555
|
+
.then(() => {
|
|
513
556
|
const _contributionObj = Object.assign({}, contributionObj, { deleted: false });
|
|
514
557
|
onRestoreContribution && onRestoreContribution(_contributionObj);
|
|
515
558
|
performPostConfirmAction(true);
|
|
@@ -522,7 +565,7 @@ function ContributionActionsMenu(props) {
|
|
|
522
565
|
else if (currentAction === ContributionsActionsMenu_1.MODERATE_CONTRIBUTION_HIDDEN) {
|
|
523
566
|
setCurrentActionLoading(ContributionsActionsMenu_1.MODERATE_CONTRIBUTION_HIDDEN);
|
|
524
567
|
performModerationContribution(Flagging_1.MODERATION_TYPE_ACTION_HIDE, hideFlagType)
|
|
525
|
-
.then((
|
|
568
|
+
.then(() => {
|
|
526
569
|
const _contributionObj = Object.assign({}, contributionObj, { collapsed: !contributionObj.collapsed });
|
|
527
570
|
setHideType(hideType === hideFlagType ? null : hideFlagType);
|
|
528
571
|
setHideFlagType(null);
|
|
@@ -537,7 +580,7 @@ function ContributionActionsMenu(props) {
|
|
|
537
580
|
else if (currentAction === ContributionsActionsMenu_1.MODERATE_CONTRIBUTION_DELETED) {
|
|
538
581
|
setCurrentActionLoading(ContributionsActionsMenu_1.MODERATE_CONTRIBUTION_DELETED);
|
|
539
582
|
performModerationContribution(Flagging_1.MODERATION_TYPE_ACTION_DELETE, deleteFlagType)
|
|
540
|
-
.then((
|
|
583
|
+
.then(() => {
|
|
541
584
|
const _contributionObj = Object.assign({}, contributionObj, { deleted: !contributionObj.deleted });
|
|
542
585
|
setDeleteType(deleteType === deleteFlagType ? null : deleteFlagType);
|
|
543
586
|
setDeleteFlagType(null);
|
|
@@ -580,9 +623,9 @@ function ContributionActionsMenu(props) {
|
|
|
580
623
|
return name;
|
|
581
624
|
}
|
|
582
625
|
/**
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
626
|
+
* action
|
|
627
|
+
* @param sectionId
|
|
628
|
+
*/
|
|
586
629
|
function handleOpenSection(sectionId) {
|
|
587
630
|
if (sectionId) {
|
|
588
631
|
if (sectionId === openSection) {
|
|
@@ -653,11 +696,21 @@ function ContributionActionsMenu(props) {
|
|
|
653
696
|
contributionObj &&
|
|
654
697
|
contributionObj.type !== types_1.SCContributionType.COMMENT);
|
|
655
698
|
}
|
|
699
|
+
/**
|
|
700
|
+
* Can authenticated user suspend notification for the event related to the contribution
|
|
701
|
+
*/
|
|
702
|
+
function canSuspendNotificationEvent() {
|
|
703
|
+
return (scUserContext.user &&
|
|
704
|
+
scUserContext.user.id !== contributionObj.author.id &&
|
|
705
|
+
contributionObj &&
|
|
706
|
+
contributionObj.type !== types_1.SCContributionType.COMMENT &&
|
|
707
|
+
Boolean(contributionObj.event));
|
|
708
|
+
}
|
|
656
709
|
/**
|
|
657
710
|
* Renders section general
|
|
658
711
|
*/
|
|
659
712
|
function renderGeneralSection() {
|
|
660
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.subItem, disabled: isFlagging }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "link" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.permanentLink", defaultMessage: "ui.contributionActionMenu.permanentLink" }), onClick: () => handleAction(ContributionsActionsMenu_1.GET_CONTRIBUTION_PERMALINK), classes: { root: classes.itemText } })] })), canModifyContribution() && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.subItem, disabled: isFlagging }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "edit" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.editContribution", defaultMessage: "ui.contributionActionMenu.editContribution" }), onClick: () => handleAction(ContributionsActionsMenu_1.EDIT_CONTRIBUTION), classes: { root: classes.itemText } })] }))), canDeleteContribution() && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.subItem, disabled: isFlagging }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: currentActionLoading === ContributionsActionsMenu_1.DELETE_CONTRIBUTION || currentActionLoading === ContributionsActionsMenu_1.RESTORE_CONTRIBUTION ? ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 20 })) : ((0, jsx_runtime_1.jsx)(Icon_1.default, { children: "delete" })) }), contributionObj.deleted ? ((0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.restoreContribution", defaultMessage: "ui.contributionActionMenu.restoreContribution" }), onClick: () => handleAction(ContributionsActionsMenu_1.RESTORE_CONTRIBUTION), classes: { root: classes.itemText } })) : ((0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.deleteContribution", defaultMessage: "ui.contributionActionMenu.deleteContribution" }), onClick: () => handleAction(ContributionsActionsMenu_1.DELETE_CONTRIBUTION), classes: { root: classes.itemText } }))] }))), canSuspendNotificationContribution() && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.subItem, disabled: isFlagging }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: currentActionLoading === ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_CONTRIBUTION ? ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 20 })) : contributionObj['suspended'] ? ((0, jsx_runtime_1.jsx)(Icon_1.default, { children: "notifications_active" })) : ((0, jsx_runtime_1.jsx)(Icon_1.default, { children: "notifications_off" })) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: contributionObj['suspended'] ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.enableNotificationContribution", defaultMessage: "ui.contributionActionMenu.enableNotificationContribution" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.suspendNotificationContribution", defaultMessage: "ui.contributionActionMenu.suspendNotificationContribution" })), onClick: () => handleAction(ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_CONTRIBUTION), classes: { root: classes.itemText } })] })))] }, ContributionsActionsMenu_1.GENERAL_SECTION));
|
|
713
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.subItem, disabled: isFlagging }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "link" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.permanentLink", defaultMessage: "ui.contributionActionMenu.permanentLink" }), onClick: () => handleAction(ContributionsActionsMenu_1.GET_CONTRIBUTION_PERMALINK), classes: { root: classes.itemText } })] })), canModifyContribution() && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.subItem, disabled: isFlagging }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "edit" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.editContribution", defaultMessage: "ui.contributionActionMenu.editContribution" }), onClick: () => handleAction(ContributionsActionsMenu_1.EDIT_CONTRIBUTION), classes: { root: classes.itemText } })] }))), canDeleteContribution() && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.subItem, disabled: isFlagging }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: currentActionLoading === ContributionsActionsMenu_1.DELETE_CONTRIBUTION || currentActionLoading === ContributionsActionsMenu_1.RESTORE_CONTRIBUTION ? ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 20 })) : ((0, jsx_runtime_1.jsx)(Icon_1.default, { children: "delete" })) }), contributionObj.deleted ? ((0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.restoreContribution", defaultMessage: "ui.contributionActionMenu.restoreContribution" }), onClick: () => handleAction(ContributionsActionsMenu_1.RESTORE_CONTRIBUTION), classes: { root: classes.itemText } })) : ((0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.deleteContribution", defaultMessage: "ui.contributionActionMenu.deleteContribution" }), onClick: () => handleAction(ContributionsActionsMenu_1.DELETE_CONTRIBUTION), classes: { root: classes.itemText } }))] }))), canSuspendNotificationContribution() && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.subItem, disabled: isFlagging }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: currentActionLoading === ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_CONTRIBUTION ? ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 20 })) : contributionObj['suspended'] ? ((0, jsx_runtime_1.jsx)(Icon_1.default, { children: "notifications_active" })) : ((0, jsx_runtime_1.jsx)(Icon_1.default, { children: "notifications_off" })) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: contributionObj['suspended'] ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.enableNotificationContribution", defaultMessage: "ui.contributionActionMenu.enableNotificationContribution" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.suspendNotificationContribution", defaultMessage: "ui.contributionActionMenu.suspendNotificationContribution" })), onClick: () => handleAction(ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_CONTRIBUTION), classes: { root: classes.itemText } })] }))), canSuspendNotificationEvent() && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.subItem, disabled: isFlagging }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: currentActionLoading === ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_EVENT ? ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 20 })) : contributionObj.event['show_on_feed'] ? ((0, jsx_runtime_1.jsx)(Icon_1.default, { children: "notifications_active" })) : ((0, jsx_runtime_1.jsx)(Icon_1.default, { children: "notifications_off" })) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: !contributionObj.event['show_on_feed'] ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.enableNotificationContribution", defaultMessage: "ui.contributionActionMenu.enableNotificationContribution" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.contributionActionMenu.suspendNotificationContribution", defaultMessage: "ui.contributionActionMenu.suspendNotificationContribution" })), onClick: () => handleAction(ContributionsActionsMenu_1.SUSPEND_NOTIFICATION_EVENT), classes: { root: classes.itemText } })] })))] }, ContributionsActionsMenu_1.GENERAL_SECTION));
|
|
661
714
|
}
|
|
662
715
|
/**
|
|
663
716
|
* Renders contribution menu content
|
|
@@ -12,6 +12,7 @@ export interface EventInfoDetailsProps {
|
|
|
12
12
|
hasPrivacyInfo?: boolean;
|
|
13
13
|
hasLocationInfo?: boolean;
|
|
14
14
|
hasCreatedInfo?: boolean;
|
|
15
|
+
hasInProgress?: boolean;
|
|
15
16
|
beforeDateInfo?: ReactNode | null;
|
|
16
17
|
beforeRecurringInfo?: ReactNode | null;
|
|
17
18
|
beforePrivacyInfo?: ReactNode | null;
|
|
@@ -10,6 +10,7 @@ const PREFIX = 'SCEventInfoDetails';
|
|
|
10
10
|
const classes = {
|
|
11
11
|
root: `${PREFIX}-root`,
|
|
12
12
|
iconTextWrapper: `${PREFIX}-icon-text-wrapper`,
|
|
13
|
+
live: `${PREFIX}-live`,
|
|
13
14
|
link: `${PREFIX}-link`,
|
|
14
15
|
url: `${PREFIX}-url`,
|
|
15
16
|
creationWrapper: `${PREFIX}-creation-wrapper`
|
|
@@ -25,7 +26,7 @@ function EventInfoDetails(inProps) {
|
|
|
25
26
|
props: inProps,
|
|
26
27
|
name: PREFIX
|
|
27
28
|
});
|
|
28
|
-
const { event, hideDateIcon = false, hideRecurringIcon = false, hidePrivacyIcon = false, hideLocationIcon = false, hideCreatedIcon = false, hasDateInfo = true, hasRecurringInfo = false, hasPrivacyInfo = true, hasLocationInfo = true, hasCreatedInfo = false, beforeDateInfo, beforeRecurringInfo, beforePrivacyInfo, beforeLocationInfo, beforeCreatedInfo } = props;
|
|
29
|
+
const { event, hideDateIcon = false, hideRecurringIcon = false, hidePrivacyIcon = false, hideLocationIcon = false, hideCreatedIcon = false, hasDateInfo = true, hasRecurringInfo = false, hasPrivacyInfo = true, hasLocationInfo = true, hasCreatedInfo = false, hasInProgress = true, beforeDateInfo, beforeRecurringInfo, beforePrivacyInfo, beforeLocationInfo, beforeCreatedInfo } = props;
|
|
29
30
|
// HOOKS
|
|
30
31
|
const intl = (0, react_intl_1.useIntl)();
|
|
31
32
|
const privacy = (0, react_1.useMemo)(() => (event.privacy === types_1.SCEventPrivacyType.PUBLIC ? 'ui.eventInfoDetails.privacy.public' : 'ui.eventInfoDetails.privacy.private'), [event]);
|
|
@@ -38,7 +39,7 @@ function EventInfoDetails(inProps) {
|
|
|
38
39
|
month: 'long'
|
|
39
40
|
}),
|
|
40
41
|
start: intl.formatDate(event.running ? event.running_start_date : event.next_start_date, { hour: 'numeric', minute: 'numeric' })
|
|
41
|
-
} }) }))] }))), beforeRecurringInfo, hasRecurringInfo && event.recurring !== types_1.SCEventRecurrenceType.NEVER && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideRecurringIcon && (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "frequency" })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventInfoDetails.frequency.${event.recurring}.placeholder`, defaultMessage: `ui.eventInfoDetails.frequency.${event.recurring}.placeholder` }) }))] }))), beforePrivacyInfo, hasPrivacyInfo && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hidePrivacyIcon && (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: event.privacy === types_1.SCEventPrivacyType.PUBLIC ? 'public' : 'private' })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: privacy, defaultMessage: privacy }) })), "-", (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: location, defaultMessage: location }) }))] }))), beforeLocationInfo, hasLocationInfo && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideLocationIcon && ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: event.location === types_1.SCEventLocationType.ONLINE ? 'play_circle_outline' : 'add_location_alt' }))), event.location === types_1.SCEventLocationType.ONLINE ? ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: event.link, target: "_blank", className: classes.link }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.url }, { children: event.link })) }))) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.url }, { children: event.geolocation })))] }))), beforeCreatedInfo, hasCreatedInfo && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.creationWrapper }, { children: [!hideCreatedIcon && (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "create" })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventInfoDetails.date.create", defaultMessage: "ui.eventInfoDetails.date.create", values: {
|
|
42
|
+
} }) })), hasInProgress && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventInfoDetails.inProgress", defaultMessage: "ui.eventInfoDetails.inProgress" }) }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.live }) })))] }))), beforeRecurringInfo, hasRecurringInfo && event.recurring !== types_1.SCEventRecurrenceType.NEVER && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideRecurringIcon && (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "frequency" })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventInfoDetails.frequency.${event.recurring}.placeholder`, defaultMessage: `ui.eventInfoDetails.frequency.${event.recurring}.placeholder` }) }))] }))), beforePrivacyInfo, hasPrivacyInfo && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hidePrivacyIcon && (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: event.privacy === types_1.SCEventPrivacyType.PUBLIC ? 'public' : 'private' })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: privacy, defaultMessage: privacy }) })), "-", (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: location, defaultMessage: location }) }))] }))), beforeLocationInfo, hasLocationInfo && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideLocationIcon && ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: event.location === types_1.SCEventLocationType.ONLINE ? 'play_circle_outline' : 'add_location_alt' }))), event.location === types_1.SCEventLocationType.ONLINE ? ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: event.link, target: "_blank", className: classes.link }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.url }, { children: event.link })) }))) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.url }, { children: event.geolocation })))] }))), beforeCreatedInfo, hasCreatedInfo && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.creationWrapper }, { children: [!hideCreatedIcon && (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "create" })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventInfoDetails.date.create", defaultMessage: "ui.eventInfoDetails.date.create", values: {
|
|
42
43
|
date: intl.formatDate(event.created_at, {
|
|
43
44
|
weekday: 'long',
|
|
44
45
|
day: 'numeric',
|
|
@@ -72,5 +72,5 @@ export default function EventInfoWidget(inProps) {
|
|
|
72
72
|
if (!scEvent) {
|
|
73
73
|
return _jsx(HiddenPlaceholder, {});
|
|
74
74
|
}
|
|
75
|
-
return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsxs(Stack, Object.assign({ className: classes.titleWrapper }, { children: [_jsx(Icon, Object.assign({ fontSize: "small" }, { children: "info" })), _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.infoEventWidget.title", defaultMessage: "ui.infoEventWidget.title" }) }))] })), _jsx(Box, Object.assign({ className: classes.textWrapper }, { children: _jsxs(Typography, Object.assign({ component: "span", variant: "body1" }, { children: [description, showButton && !expanded && (_jsx(Button, Object.assign({ size: "small", variant: "text", className: classes.showMore, onClick: handleToggleSummary }, { children: _jsx(FormattedMessage, { id: "ui.infoEventWidget.showMore", defaultMessage: "ui.infoEventWidget.showMore" }) })))] })) })), _jsx(EventInfoDetails, { event: scEvent, hasRecurringInfo: true, hasCreatedInfo: true, hasLocationInfo: showInfo })] })) })));
|
|
75
|
+
return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsxs(Stack, Object.assign({ className: classes.titleWrapper }, { children: [_jsx(Icon, Object.assign({ fontSize: "small" }, { children: "info" })), _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.infoEventWidget.title", defaultMessage: "ui.infoEventWidget.title" }) }))] })), _jsx(Box, Object.assign({ className: classes.textWrapper }, { children: _jsxs(Typography, Object.assign({ component: "span", variant: "body1" }, { children: [description, showButton && !expanded && (_jsx(Button, Object.assign({ size: "small", variant: "text", className: classes.showMore, onClick: handleToggleSummary }, { children: _jsx(FormattedMessage, { id: "ui.infoEventWidget.showMore", defaultMessage: "ui.infoEventWidget.showMore" }) })))] })) })), _jsx(EventInfoDetails, { event: scEvent, hasRecurringInfo: true, hasCreatedInfo: true, hasLocationInfo: showInfo, hasInProgress: false })] })) })));
|
|
76
76
|
}
|