@selfcommunity/react-ui 0.11.0-alpha.71 → 0.11.0-alpha.73
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/CategoryFollowButton/CategoryFollowButton.js +1 -1
- package/lib/cjs/components/Course/Course.js +8 -5
- package/lib/cjs/components/Event/Event.js +4 -1
- package/lib/cjs/components/Group/Group.js +6 -4
- package/lib/cjs/components/PaywallsConfigurator/PaywallsConfigurator.js +5 -5
- package/lib/cjs/components/VoteAudienceButton/VoteAudienceButton.js +9 -9
- package/lib/cjs/components/VoteButton/VoteButton.js +6 -6
- package/lib/cjs/shared/EventInfoDetails/index.js +4 -1
- package/lib/esm/components/CategoryFollowButton/CategoryFollowButton.js +1 -1
- package/lib/esm/components/Course/Course.js +10 -7
- package/lib/esm/components/Event/Event.js +6 -3
- package/lib/esm/components/Group/Group.js +7 -5
- package/lib/esm/components/PaywallsConfigurator/PaywallsConfigurator.js +5 -5
- package/lib/esm/components/VoteAudienceButton/VoteAudienceButton.js +9 -9
- package/lib/esm/components/VoteButton/VoteButton.js +6 -6
- package/lib/esm/shared/EventInfoDetails/index.js +5 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +5 -5
|
@@ -104,7 +104,7 @@ function CategoryFollowButton(inProps) {
|
|
|
104
104
|
if (!scCategory || !categoryFollowEnabled || (scCategory && followed && scCategory.auto_follow === types_1.SCCategoryAutoFollowType.FORCED)) {
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
107
|
-
if (scCategoriesManager.isLoading(scCategory) || followed === null) {
|
|
107
|
+
if (scUserContext.user && (scCategoriesManager.isLoading(scCategory) || followed === null)) {
|
|
108
108
|
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ size: "small", variant: "outlined", loading: true, className: (0, classnames_1.default)(classes.root, className) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.categoryFollowButton.follow", id: "ui.categoryFollowButton.follow" }) })));
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
@@ -37,7 +37,8 @@ const classes = {
|
|
|
37
37
|
snippetRoot: `${constants_1.PREFIX}-snippet-root`,
|
|
38
38
|
snippetAvatar: `${constants_1.PREFIX}-snippet-avatar`,
|
|
39
39
|
snippetAvatarUserProfile: `${constants_1.PREFIX}-snippet-avatar-user-profile-view`,
|
|
40
|
-
snippetImage: `${constants_1.PREFIX}-snippet-image
|
|
40
|
+
snippetImage: `${constants_1.PREFIX}-snippet-image`,
|
|
41
|
+
snippetPrivacy: `${constants_1.PREFIX}-snippet-privacy`
|
|
41
42
|
};
|
|
42
43
|
const Root = (0, material_1.styled)(Widget_1.default, {
|
|
43
44
|
name: constants_1.PREFIX,
|
|
@@ -100,7 +101,7 @@ const SnippetRoot = (0, material_1.styled)(BaseItemButton_1.default, {
|
|
|
100
101
|
* @param inProps
|
|
101
102
|
*/
|
|
102
103
|
function Course(inProps) {
|
|
103
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
104
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
104
105
|
// PROPS
|
|
105
106
|
const props = (0, system_1.useThemeProps)({
|
|
106
107
|
props: inProps,
|
|
@@ -115,6 +116,8 @@ function Course(inProps) {
|
|
|
115
116
|
// CONTEXT
|
|
116
117
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
117
118
|
const isCourseAdmin = (0, react_1.useMemo)(() => scCourse && (scCourse.join_status === types_1.SCCourseJoinStatusType.CREATOR || scCourse.join_status === types_1.SCCourseJoinStatusType.MANAGER), [scCourse]);
|
|
119
|
+
// PAYMENTS
|
|
120
|
+
const { isPaymentsEnabled } = (0, react_core_1.useSCPaymentsEnabled)();
|
|
118
121
|
/**
|
|
119
122
|
* Renders course object
|
|
120
123
|
*/
|
|
@@ -162,7 +165,7 @@ function Course(inProps) {
|
|
|
162
165
|
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
163
166
|
}), { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !((_b = scCourse.created_by) === null || _b === void 0 ? void 0 : _b.community_badge), smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scCourse.name, src: (_c = scCourse.created_by) === null || _c === void 0 ? void 0 : _c.avatar, className: classes.previewAvatar }) })) }))] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.previewContent }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ className: classes.previewCreator }, (!((_d = scCourse.created_by) === null || _d === void 0 ? void 0 : _d.deleted) && {
|
|
164
167
|
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
165
|
-
}), { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (_e = scCourse.created_by) === null || _e === void 0 ? void 0 : _e.username })) })), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse), className: classes.previewNameWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", className: classes.previewName }, { children: scCourse.name })) })), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.previewInfo }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.previewCategory }, { children: [scCourse.categories.slice(0, MAX_VISIBLE_CATEGORIES).map((category) => ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: category.name }, category.id))), scCourse.categories.length > MAX_VISIBLE_CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scCourse.categories.slice(MAX_VISIBLE_CATEGORIES).map((cat) => ((0, jsx_runtime_1.jsx)(material_1.Box, { children: cat.name }, cat.id))) }) }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: `+${scCourse.categories.length - MAX_VISIBLE_CATEGORIES}`, sx: { cursor: 'pointer' } }) })))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.previewProgress }, { children: renderProgress() }))] })), actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.previewActions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) })) })))] })));
|
|
168
|
+
}), { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (_e = scCourse.created_by) === null || _e === void 0 ? void 0 : _e.username })) })), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse), className: classes.previewNameWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", className: classes.previewName }, { children: scCourse.name })) })), (0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.previewInfo }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` }), isPaymentsEnabled && ((_f = scCourse.paywalls) === null || _f === void 0 ? void 0 : _f.length) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u00A0", (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "pagamenti" })] }))] })) }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.previewCategory }, { children: [scCourse.categories.slice(0, MAX_VISIBLE_CATEGORIES).map((category) => ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: category.name }, category.id))), scCourse.categories.length > MAX_VISIBLE_CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scCourse.categories.slice(MAX_VISIBLE_CATEGORIES).map((cat) => ((0, jsx_runtime_1.jsx)(material_1.Box, { children: cat.name }, cat.id))) }) }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: `+${scCourse.categories.length - MAX_VISIBLE_CATEGORIES}`, sx: { cursor: 'pointer' } }) })))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.previewProgress }, { children: renderProgress() }))] })), actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.previewActions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) })) })))] })));
|
|
166
169
|
}
|
|
167
170
|
else {
|
|
168
171
|
contentObj = ((0, jsx_runtime_1.jsx)(SnippetRoot, { elevation: 0, className: classes.snippetRoot, image: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.snippetImage }, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { variant: "square", alt: scCourse.name, src: scCourse.image_medium, className: userProfileSnippet ? classes.snippetAvatarUserProfile : classes.snippetAvatar }), !userProfileSnippet &&
|
|
@@ -172,9 +175,9 @@ function Course(inProps) {
|
|
|
172
175
|
? 'default'
|
|
173
176
|
: scCourse.join_status === types_1.SCCourseJoinStatusType.JOINED
|
|
174
177
|
? 'warning'
|
|
175
|
-
: 'secondary', label: chipLabel, className: classes.chip }))] })), primary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!userProfileSnippet && ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!((
|
|
178
|
+
: 'secondary', label: chipLabel, className: classes.chip }))] })), primary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!userProfileSnippet && ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!((_g = scCourse.created_by) === null || _g === void 0 ? void 0 : _g.deleted) && {
|
|
176
179
|
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
177
|
-
}), { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: (
|
|
180
|
+
}), { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: (_h = scCourse.created_by) === null || _h === void 0 ? void 0 : _h.username })) }))), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: scCourse.name })) }))] }), secondary: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: userProfileSnippet ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !scCourse.hide_member_count && ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.userProfileSnippet.students", defaultMessage: "ui.course.userProfileSnippet.students", values: { students: scCourse.member_count } })) })) : ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.snippetPrivacy }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` }), isPaymentsEnabled && ((_j = scCourse.paywalls) === null || _j === void 0 ? void 0 : _j.length) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u00A0", (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "inherit" }, { children: "pagamenti" }))] }))] }))) }), actions: actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) }))) }));
|
|
178
181
|
}
|
|
179
182
|
/**
|
|
180
183
|
* Renders root object
|
|
@@ -102,6 +102,7 @@ const SnippetRoot = (0, material_1.styled)(BaseItem_1.default, {
|
|
|
102
102
|
* @param inProps
|
|
103
103
|
*/
|
|
104
104
|
function Event(inProps) {
|
|
105
|
+
var _a;
|
|
105
106
|
// PROPS
|
|
106
107
|
const props = (0, system_1.useThemeProps)({
|
|
107
108
|
props: inProps,
|
|
@@ -114,6 +115,8 @@ function Event(inProps) {
|
|
|
114
115
|
const isEventFinished = (0, react_1.useMemo)(() => (0, events_1.checkEventFinished)(scEvent), [scEvent]);
|
|
115
116
|
// CONTEXT
|
|
116
117
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
118
|
+
// PAYMENTS
|
|
119
|
+
const { isPaymentsEnabled } = (0, react_core_1.useSCPaymentsEnabled)();
|
|
117
120
|
// HOOKS
|
|
118
121
|
const intl = (0, react_intl_1.useIntl)();
|
|
119
122
|
/**
|
|
@@ -137,7 +140,7 @@ function Event(inProps) {
|
|
|
137
140
|
weekday: 'long',
|
|
138
141
|
month: 'long',
|
|
139
142
|
day: 'numeric'
|
|
140
|
-
})}` })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: scEvent.name }))] })), secondary: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "p", variant: "body2", className: classes.snippetSecondary }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.privacy.${scEvent.privacy}`, defaultMessage: `ui.eventForm.privacy.${scEvent.privacy}` }), " -", ' ', (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.address.live.label`, defaultMessage: `ui.eventForm.address.live.label` })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.address.online.label`, defaultMessage: `ui.eventForm.address.online.label` }))] })), actions: actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.snippetActions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) }))) }));
|
|
143
|
+
})}` })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: scEvent.name }))] })), secondary: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "p", variant: "body2", className: classes.snippetSecondary }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.privacy.${scEvent.privacy}`, defaultMessage: `ui.eventForm.privacy.${scEvent.privacy}` }), " -", ' ', (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.address.live.label`, defaultMessage: `ui.eventForm.address.live.label` })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.address.online.label`, defaultMessage: `ui.eventForm.address.online.label` })), isPaymentsEnabled && ((_a = scEvent.paywalls) === null || _a === void 0 ? void 0 : _a.length) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u00A0", (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "pagamenti" })] }))] })), actions: actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.snippetActions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) }))) }));
|
|
141
144
|
}
|
|
142
145
|
/**
|
|
143
146
|
* Renders root object
|
|
@@ -31,8 +31,8 @@ const classes = {
|
|
|
31
31
|
const Root = (0, material_1.styled)(BaseItemButton_1.default, {
|
|
32
32
|
name: constants_1.PREFIX,
|
|
33
33
|
slot: 'Root',
|
|
34
|
-
overridesResolver: (
|
|
35
|
-
})((
|
|
34
|
+
overridesResolver: (_props, styles) => styles.root
|
|
35
|
+
})(() => ({}));
|
|
36
36
|
/**
|
|
37
37
|
* > API documentation for the Community-JS Group component. Learn about the available props and the CSS API.
|
|
38
38
|
*
|
|
@@ -65,7 +65,7 @@ const Root = (0, material_1.styled)(BaseItemButton_1.default, {
|
|
|
65
65
|
* @param inProps
|
|
66
66
|
*/
|
|
67
67
|
function Group(inProps) {
|
|
68
|
-
var _a;
|
|
68
|
+
var _a, _b;
|
|
69
69
|
// PROPS
|
|
70
70
|
const props = (0, system_1.useThemeProps)({
|
|
71
71
|
props: inProps,
|
|
@@ -84,6 +84,8 @@ function Group(inProps) {
|
|
|
84
84
|
const intl = (0, react_intl_1.useIntl)();
|
|
85
85
|
const theme = (0, material_1.useTheme)();
|
|
86
86
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
87
|
+
// PAYMENTS
|
|
88
|
+
const { isPaymentsEnabled } = (0, react_core_1.useSCPaymentsEnabled)();
|
|
87
89
|
/**
|
|
88
90
|
* Render authenticated actions
|
|
89
91
|
* @return {JSX.Element}
|
|
@@ -102,6 +104,6 @@ function Group(inProps) {
|
|
|
102
104
|
*/
|
|
103
105
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ elevation: elevation }, rest, { className: (0, classnames_1.default)(classes.root, className), ButtonBaseProps: { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isMobile
|
|
104
106
|
? (0, string_1.formatCroppedName)(scGroup.name, Group_1.GROUP_NAME_MAX_LENGTH_MOBILE)
|
|
105
|
-
: (0, string_1.formatCroppedName)(scGroup.name, Group_1.GROUP_NAME_MAX_LENGTH_DESKTOP), ' ', (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.icon }, { children: (group === null || group === void 0 ? void 0 : group.privacy) === types_1.SCGroupPrivacyType.PRIVATE ? 'private' : 'public' }))] }), secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })), openAlert && (0, jsx_runtime_1.jsx)(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
107
|
+
: (0, string_1.formatCroppedName)(scGroup.name, Group_1.GROUP_NAME_MAX_LENGTH_DESKTOP), ' ', (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.icon }, { children: (group === null || group === void 0 ? void 0 : group.privacy) === types_1.SCGroupPrivacyType.PRIVATE ? 'private' : 'public' })), isPaymentsEnabled && ((_b = scGroup.paywalls) === null || _b === void 0 ? void 0 : _b.length) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u00A0", (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "pagamenti" })] }))] }), secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })), openAlert && (0, jsx_runtime_1.jsx)(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
106
108
|
}
|
|
107
109
|
exports.default = Group;
|
|
@@ -86,7 +86,7 @@ function PaywallsConfigurator(inProps) {
|
|
|
86
86
|
* Handle change content type access
|
|
87
87
|
* @param panel
|
|
88
88
|
*/
|
|
89
|
-
const handleChange = (panel) => (
|
|
89
|
+
const handleChange = (panel) => (_event, _isExpanded) => {
|
|
90
90
|
setExpanded(panel);
|
|
91
91
|
onChangeContentAccessType(panel);
|
|
92
92
|
};
|
|
@@ -115,7 +115,7 @@ function PaywallsConfigurator(inProps) {
|
|
|
115
115
|
onChangePaymentProducts === null || onChangePaymentProducts === void 0 ? void 0 : onChangePaymentProducts(products);
|
|
116
116
|
handleToggleCreatePaymentPrice();
|
|
117
117
|
};
|
|
118
|
-
const handleDeleteProduct = (
|
|
118
|
+
const handleDeleteProduct = (_p, i) => {
|
|
119
119
|
const products = [...value.slice(0, i), ...value.slice(i + 1)];
|
|
120
120
|
setValue(products);
|
|
121
121
|
onChangePaymentProducts === null || onChangePaymentProducts === void 0 ? void 0 : onChangePaymentProducts(products);
|
|
@@ -143,7 +143,7 @@ function PaywallsConfigurator(inProps) {
|
|
|
143
143
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
144
144
|
// @ts-ignore
|
|
145
145
|
const { key } = props, optionProps = tslib_1.__rest(props, ["key"]);
|
|
146
|
-
return ((0, jsx_runtime_1.jsxs)("li", Object.assign({}, optionProps, (selected && { style: { backgroundColor: '#f9fafc' } }), { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.productItemCheckIcon, style: { visibility: selected ? 'visible' : 'hidden' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "check" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "span", className: classes.productItemCardIcon }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "
|
|
146
|
+
return ((0, jsx_runtime_1.jsxs)("li", Object.assign({}, optionProps, (selected && { style: { backgroundColor: '#f9fafc' } }), { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.productItemCheckIcon, style: { visibility: selected ? 'visible' : 'hidden' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "check" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "span", className: classes.productItemCardIcon }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "pagamenti" }) })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.productItemContent }, { children: [option.name, (0, jsx_runtime_1.jsx)("br", {}), option.payment_prices && option.payment_prices[0] && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: (0, payment_1.getConvertedAmount)(option.payment_prices[0]) }), ' ', option.payment_prices.length > 1 && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["+", option.payment_prices.length - 1] })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.productItemRemoveIcon, style: { visibility: selected ? 'visible' : 'hidden' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "arrow" }) }))] }), option.id));
|
|
147
147
|
};
|
|
148
148
|
/**
|
|
149
149
|
* Fetch events
|
|
@@ -222,7 +222,7 @@ function PaywallsConfigurator(inProps) {
|
|
|
222
222
|
defaultMessage: 'ui.paywallsConfigurator.connected.noProducts'
|
|
223
223
|
}) }) }), -1)), value.map((p, i) => {
|
|
224
224
|
var _a, _b, _c;
|
|
225
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.ListItem, Object.assign({ secondaryAction: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", color: "secondary", size: "small", onClick: () => handleDeleteProduct(p, i), startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "delete" }) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paywallsConfigurator.connected.products.btnRemove", defaultMessage: "ui.paywallsConfigurator.connected.products.btnRemove" }) })), divider: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "
|
|
225
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.ListItem, Object.assign({ secondaryAction: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", color: "secondary", size: "small", onClick: () => handleDeleteProduct(p, i), startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "delete" }) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paywallsConfigurator.connected.products.btnRemove", defaultMessage: "ui.paywallsConfigurator.connected.products.btnRemove" }) })), divider: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "dredit-card" }) }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: p.name, secondary: `Prices: ${((_a = p.payment_prices) === null || _a === void 0 ? void 0 : _a.length)
|
|
226
226
|
? p.payment_prices
|
|
227
227
|
.slice(0, 3)
|
|
228
228
|
.map((price) => (0, payment_1.getConvertedAmount)(price))
|
|
@@ -233,7 +233,7 @@ function PaywallsConfigurator(inProps) {
|
|
|
233
233
|
defaultMessage: 'ui.paywallsConfigurator.connected.products.others'
|
|
234
234
|
}, { count: ((_c = p.payment_prices) === null || _c === void 0 ? void 0 : _c.length) - 3 })
|
|
235
235
|
: ''}` })] }), i));
|
|
236
|
-
})] })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", fullWidth: true, disableRipple: true, onClick: handleOpenPricesList, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "list" }) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paywallsConfigurator.openPriceslist", defaultMessage: "ui.paywallsConfigurator.openPriceslist" }) }))] })), !loading && ((0, jsx_runtime_1.jsx)(PaymentProductsPopper, Object.assign({ id: open ? 'payment-products' : undefined, open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: (0, jsx_runtime_1.jsx)(ClickAwayListener_1.default, Object.assign({ onClickAway: handleClose }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.paymentProductsPopperTitle }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paywallsConfigurator.connected.products.content", defaultMessage: "ui.paywallsConfigurator.connected.products.content" }) })), (0, jsx_runtime_1.jsx)(material_1.Autocomplete, { loading: loadingProducts, loadingText: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.autoCompleteProductsLoading }, { children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, {}) })), id: "payment-products-autocomplete", className: classes.paymentProductsAutocompletePopperRoot, open: true, multiple: true, onClose: (
|
|
236
|
+
})] })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", fullWidth: true, disableRipple: true, onClick: handleOpenPricesList, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "list" }) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paywallsConfigurator.openPriceslist", defaultMessage: "ui.paywallsConfigurator.openPriceslist" }) }))] })), !loading && ((0, jsx_runtime_1.jsx)(PaymentProductsPopper, Object.assign({ id: open ? 'payment-products' : undefined, open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: (0, jsx_runtime_1.jsx)(ClickAwayListener_1.default, Object.assign({ onClickAway: handleClose }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.paymentProductsPopperTitle }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paywallsConfigurator.connected.products.content", defaultMessage: "ui.paywallsConfigurator.connected.products.content" }) })), (0, jsx_runtime_1.jsx)(material_1.Autocomplete, { loading: loadingProducts, loadingText: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.autoCompleteProductsLoading }, { children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, {}) })), id: "payment-products-autocomplete", className: classes.paymentProductsAutocompletePopperRoot, open: true, multiple: true, onClose: (_event, reason) => {
|
|
237
237
|
if (reason === 'escape') {
|
|
238
238
|
handleClose();
|
|
239
239
|
}
|
|
@@ -24,13 +24,13 @@ const classes = {
|
|
|
24
24
|
const Root = (0, material_1.styled)(lab_1.LoadingButton, {
|
|
25
25
|
name: PREFIX,
|
|
26
26
|
slot: 'Root',
|
|
27
|
-
overridesResolver: (
|
|
28
|
-
})((
|
|
27
|
+
overridesResolver: (_props, styles) => [styles.root, styles.voted]
|
|
28
|
+
})(() => ({}));
|
|
29
29
|
const DialogRoot = (0, material_1.styled)(BaseDialog_1.default, {
|
|
30
30
|
name: PREFIX,
|
|
31
31
|
slot: 'Root',
|
|
32
|
-
overridesResolver: (
|
|
33
|
-
})((
|
|
32
|
+
overridesResolver: (_props, styles) => styles.dialogRoot
|
|
33
|
+
})(() => ({}));
|
|
34
34
|
/**
|
|
35
35
|
* > API documentation for the Community-JS Vote Audience Button component. Learn about the available props and the CSS API.
|
|
36
36
|
|
|
@@ -69,13 +69,13 @@ function VoteAudienceButton(inProps) {
|
|
|
69
69
|
// CONTEXT
|
|
70
70
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
71
71
|
// HANDLERS
|
|
72
|
-
const handleOpen = (
|
|
72
|
+
const handleOpen = (_event) => {
|
|
73
73
|
setOpen(true);
|
|
74
74
|
};
|
|
75
|
-
const handleClose = (
|
|
75
|
+
const handleClose = (_event) => {
|
|
76
76
|
setOpen(false);
|
|
77
77
|
};
|
|
78
|
-
const handleChangeTab = (
|
|
78
|
+
const handleChangeTab = (_event, newValue) => {
|
|
79
79
|
setTab(newValue);
|
|
80
80
|
};
|
|
81
81
|
// HOOKS
|
|
@@ -105,14 +105,14 @@ function VoteAudienceButton(inProps) {
|
|
|
105
105
|
const audienceIcon = (0, react_1.useMemo)(() => {
|
|
106
106
|
if (reactions.default && !isLoading && !error) {
|
|
107
107
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.reactionList }, { children: contributionReactionsCount &&
|
|
108
|
-
contributionReactionsCount.slice(0, 3).map((count,
|
|
108
|
+
contributionReactionsCount.slice(0, 3).map((count, _i) => ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: (0, jsx_runtime_1.jsx)("img", { alt: count.reaction.label, src: count.reaction.image, width: "100%", height: "100%" }) }, count.reaction.id))) })));
|
|
109
109
|
}
|
|
110
110
|
return scUserContext.user && contributionVoted ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "thumb_up" }) : (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "thumb_up_off_alt" });
|
|
111
111
|
}, [reactions.default, isLoading, error, contributionReactionsCount, scUserContext.user, contributionVoted]);
|
|
112
112
|
const dialogTitle = (0, react_1.useMemo)(() => {
|
|
113
113
|
if (reactions.default && !isLoading) {
|
|
114
114
|
return ((0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ className: classes.dialogTabs, value: tab, onChange: handleChangeTab, "aria-label": "reactions" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.voteAudienceButton.dialog.tab.all", id: "ui.voteAudienceButton.dialog.tab.all" }) }), contributionReactionsCount &&
|
|
115
|
-
contributionReactionsCount.map((count) => ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: (0, jsx_runtime_1.jsx)("img", { alt: count.reaction.label, src: count.reaction.image, width: "100%", height: "100%" }) }), count.count] }) }, count.reaction.id)))] })));
|
|
115
|
+
contributionReactionsCount.map((count) => ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: (0, jsx_runtime_1.jsx)("img", { alt: count.reaction.label, src: count.reaction.image, width: "100%", height: "100%" }) })), count.count] }) }, count.reaction.id)))] })));
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
118
|
return (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.voteAudienceButton.dialog.title", id: "ui.voteAudienceButton.dialog.title" });
|
|
@@ -22,12 +22,12 @@ const classes = {
|
|
|
22
22
|
const Root = (0, material_1.styled)(lab_1.LoadingButton, {
|
|
23
23
|
name: PREFIX,
|
|
24
24
|
slot: 'Root',
|
|
25
|
-
overridesResolver: (
|
|
26
|
-
})((
|
|
25
|
+
overridesResolver: (_props, styles) => [styles.root, styles.voted]
|
|
26
|
+
})(() => ({}));
|
|
27
27
|
const PopperRoot = (0, material_1.styled)(material_1.Popper, {
|
|
28
28
|
name: PREFIX,
|
|
29
29
|
slot: 'Root',
|
|
30
|
-
overridesResolver: (
|
|
30
|
+
overridesResolver: (_props, styles) => styles.popperRoot
|
|
31
31
|
})(() => ({}));
|
|
32
32
|
/**
|
|
33
33
|
* > API documentation for the Community-JS Vote Button component. Learn about the available props and the CSS API.
|
|
@@ -72,7 +72,7 @@ function VoteButton(inProps) {
|
|
|
72
72
|
handleClearTimeout();
|
|
73
73
|
timeoutRef.current = setTimeout(() => setAnchorEl(event.target), 1000);
|
|
74
74
|
};
|
|
75
|
-
const handleMouseLeave = (
|
|
75
|
+
const handleMouseLeave = (_event) => {
|
|
76
76
|
handleClearTimeout();
|
|
77
77
|
timeoutRef.current = setTimeout(() => setAnchorEl(null), 500);
|
|
78
78
|
};
|
|
@@ -141,9 +141,9 @@ function VoteButton(inProps) {
|
|
|
141
141
|
? handleMouseEnter
|
|
142
142
|
: () => handleVoteAction(contributionReaction ? contributionReaction : reactions.default ? reactions.default : null), disabled: isLoading || Boolean(error), loading: isVoting, className: (0, classnames_1.default)(classes.root, className, {
|
|
143
143
|
[classes.voted]: scUserContext.user && contributionVoted
|
|
144
|
-
}) }, rest, rootProps, { children: scUserContext.user && contributionVoted ? (contributionReaction ? ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: (0, jsx_runtime_1.jsx)("img", { alt: contributionReaction.label, src: contributionReaction.image, width: "100%", height: "100%" }) })) : ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: "thumb_up" }))) : ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: "thumb_up_off_alt" })) })));
|
|
144
|
+
}) }, rest, rootProps, { children: scUserContext.user && contributionVoted ? (contributionReaction ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: contributionReaction.label }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: (0, jsx_runtime_1.jsx)("img", { alt: contributionReaction.label, src: contributionReaction.image, width: "100%", height: "100%" }) }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: "thumb_up" }))) : ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: "thumb_up_off_alt" })) })));
|
|
145
145
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [reactions.default ? (button) : ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: contributionVoted ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.voteButton.voteDown", defaultMessage: "ui.voteButton.voteDown" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.voteButton.voteUp", defaultMessage: "ui.voteButton.voteUp" })) }, { children: (0, jsx_runtime_1.jsx)("span", { children: button }) }))), reactions.default && Boolean(anchorEl) && !isVoting && !isLoading && ((0, jsx_runtime_1.jsx)(PopperRoot, Object.assign({ id: `vote_${contributionId}_${contributionType}_popper`, className: classes.popperRoot, open: true, anchorEl: anchorEl, placement: "top", keepMounted: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ className: classes.reactionList, onMouseEnter: handleClearTimeout, onMouseLeave: handleMouseLeave }, { children: reactions.reactions
|
|
146
146
|
.filter((reaction) => !contributionVoted || (contributionVoted && contributionReaction.id !== reaction.id) ? reaction.active : reaction)
|
|
147
|
-
.map((reaction) => ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.reaction, onClick: () => handleVoteAction(reaction) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: (0, jsx_runtime_1.jsx)("img", { alt: reaction.label, src: reaction.image, width: "100%", height: "100%" }) }) }), reaction.id))) })) })))] }));
|
|
147
|
+
.map((reaction) => ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: reaction.label }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.reaction, onClick: () => handleVoteAction(reaction) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: (0, jsx_runtime_1.jsx)("img", { alt: reaction.label, src: reaction.image, width: "100%", height: "100%" }) }) })) }), reaction.id))) })) })))] }));
|
|
148
148
|
}
|
|
149
149
|
exports.default = VoteButton;
|
|
@@ -22,6 +22,7 @@ const Root = (0, material_1.styled)(material_1.Stack, {
|
|
|
22
22
|
overridesResolver: (_props, styles) => styles.root
|
|
23
23
|
})(() => ({}));
|
|
24
24
|
function EventInfoDetails(inProps) {
|
|
25
|
+
var _a;
|
|
25
26
|
// PROPS
|
|
26
27
|
const props = (0, material_1.useThemeProps)({
|
|
27
28
|
props: inProps,
|
|
@@ -35,6 +36,8 @@ function EventInfoDetails(inProps) {
|
|
|
35
36
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
36
37
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
37
38
|
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
39
|
+
// PAYMENTS
|
|
40
|
+
const { isPaymentsEnabled } = (0, react_core_1.useSCPaymentsEnabled)();
|
|
38
41
|
const liveStreamEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
39
42
|
features &&
|
|
40
43
|
features.includes(types_1.SCFeatureName.LIVE_STREAM) &&
|
|
@@ -59,7 +62,7 @@ function EventInfoDetails(inProps) {
|
|
|
59
62
|
month: 'long'
|
|
60
63
|
}),
|
|
61
64
|
start: intl.formatDate(scEvent.running ? scEvent.running_start_date : scEvent.next_start_date ? scEvent.next_start_date : scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
62
|
-
} }) })) })), hasInProgress && scEvent.active && scEvent.running && ((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.inProgress }) })))] }))), beforeRecurringInfo, hasRecurringInfo && scEvent.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.${scEvent.recurring}.placeholder`, defaultMessage: `ui.eventInfoDetails.frequency.${scEvent.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: scEvent.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: scEvent.location === types_1.SCEventLocationType.ONLINE ? 'play_circle_outline' : 'add_location_alt' }))), scEvent.location === types_1.SCEventLocationType.ONLINE ? (scEvent.live_stream ? ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "contained", color: "secondary", component: react_core_1.Link, disabled: disableJoinEvent, to: scRoutingContext.url(react_core_1.SCRoutes.LIVESTREAM_ROUTE_NAME, scEvent.live_stream), className: classes.joinLive }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventInfoDetails.live.join", id: "ui.eventInfoDetails.live.join" }) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scEvent.link, target: "_blank", className: classes.link }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.link })) })))) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.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: {
|
|
65
|
+
} }) })) })), hasInProgress && scEvent.active && scEvent.running && ((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.inProgress }) })))] }))), beforeRecurringInfo, hasRecurringInfo && scEvent.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.${scEvent.recurring}.placeholder`, defaultMessage: `ui.eventInfoDetails.frequency.${scEvent.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: scEvent.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 }) })), isPaymentsEnabled && ((_a = scEvent.paywalls) === null || _a === void 0 ? void 0 : _a.length) && (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "pagamenti" })] }))), 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: scEvent.location === types_1.SCEventLocationType.ONLINE ? 'play_circle_outline' : 'add_location_alt' }))), scEvent.location === types_1.SCEventLocationType.ONLINE ? (scEvent.live_stream ? ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "contained", color: "secondary", component: react_core_1.Link, disabled: disableJoinEvent, to: scRoutingContext.url(react_core_1.SCRoutes.LIVESTREAM_ROUTE_NAME, scEvent.live_stream), className: classes.joinLive }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventInfoDetails.live.join", id: "ui.eventInfoDetails.live.join" }) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scEvent.link, target: "_blank", className: classes.link }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.link })) })))) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.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: {
|
|
63
66
|
date: intl.formatDate(scEvent.created_at, {
|
|
64
67
|
weekday: 'long',
|
|
65
68
|
day: 'numeric',
|
|
@@ -102,7 +102,7 @@ export default function CategoryFollowButton(inProps) {
|
|
|
102
102
|
if (!scCategory || !categoryFollowEnabled || (scCategory && followed && scCategory.auto_follow === SCCategoryAutoFollowType.FORCED)) {
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
|
-
if (scCategoriesManager.isLoading(scCategory) || followed === null) {
|
|
105
|
+
if (scUserContext.user && (scCategoriesManager.isLoading(scCategory) || followed === null)) {
|
|
106
106
|
return (_jsx(Root, Object.assign({ size: "small", variant: "outlined", loading: true, className: classNames(classes.root, className) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.categoryFollowButton.follow", id: "ui.categoryFollowButton.follow" }) })));
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Avatar, Box, Button, CardActions, CardContent, CardMedia, Chip, Icon, LinearProgress, Tooltip, Typography, useMediaQuery, useTheme, styled } from '@mui/material';
|
|
3
|
+
import { Avatar, Box, Button, CardActions, CardContent, CardMedia, Chip, Icon, LinearProgress, Tooltip, Typography, useMediaQuery, useTheme, styled, Stack } from '@mui/material';
|
|
4
4
|
import { useThemeProps } from '@mui/system';
|
|
5
|
-
import { Link, SCRoutes, useSCFetchCourse, useSCRouting } from '@selfcommunity/react-core';
|
|
5
|
+
import { Link, SCRoutes, useSCFetchCourse, useSCPaymentsEnabled, useSCRouting } from '@selfcommunity/react-core';
|
|
6
6
|
import { SCCourseJoinStatusType } from '@selfcommunity/types';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { useMemo } from 'react';
|
|
@@ -35,7 +35,8 @@ const classes = {
|
|
|
35
35
|
snippetRoot: `${PREFIX}-snippet-root`,
|
|
36
36
|
snippetAvatar: `${PREFIX}-snippet-avatar`,
|
|
37
37
|
snippetAvatarUserProfile: `${PREFIX}-snippet-avatar-user-profile-view`,
|
|
38
|
-
snippetImage: `${PREFIX}-snippet-image
|
|
38
|
+
snippetImage: `${PREFIX}-snippet-image`,
|
|
39
|
+
snippetPrivacy: `${PREFIX}-snippet-privacy`
|
|
39
40
|
};
|
|
40
41
|
const Root = styled(Widget, {
|
|
41
42
|
name: PREFIX,
|
|
@@ -98,7 +99,7 @@ const SnippetRoot = styled(BaseItemButton, {
|
|
|
98
99
|
* @param inProps
|
|
99
100
|
*/
|
|
100
101
|
export default function Course(inProps) {
|
|
101
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
102
103
|
// PROPS
|
|
103
104
|
const props = useThemeProps({
|
|
104
105
|
props: inProps,
|
|
@@ -113,6 +114,8 @@ export default function Course(inProps) {
|
|
|
113
114
|
// CONTEXT
|
|
114
115
|
const scRoutingContext = useSCRouting();
|
|
115
116
|
const isCourseAdmin = useMemo(() => scCourse && (scCourse.join_status === SCCourseJoinStatusType.CREATOR || scCourse.join_status === SCCourseJoinStatusType.MANAGER), [scCourse]);
|
|
117
|
+
// PAYMENTS
|
|
118
|
+
const { isPaymentsEnabled } = useSCPaymentsEnabled();
|
|
116
119
|
/**
|
|
117
120
|
* Renders course object
|
|
118
121
|
*/
|
|
@@ -160,7 +163,7 @@ export default function Course(inProps) {
|
|
|
160
163
|
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
161
164
|
}), { children: _jsx(UserAvatar, Object.assign({ hide: !((_b = scCourse.created_by) === null || _b === void 0 ? void 0 : _b.community_badge), smaller: true }, { children: _jsx(Avatar, { alt: scCourse.name, src: (_c = scCourse.created_by) === null || _c === void 0 ? void 0 : _c.avatar, className: classes.previewAvatar }) })) }))] })), _jsxs(CardContent, Object.assign({ className: classes.previewContent }, { children: [_jsx(Link, Object.assign({ className: classes.previewCreator }, (!((_d = scCourse.created_by) === null || _d === void 0 ? void 0 : _d.deleted) && {
|
|
162
165
|
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
163
|
-
}), { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: (_e = scCourse.created_by) === null || _e === void 0 ? void 0 : _e.username })) })), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse), className: classes.previewNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h6", className: classes.previewName }, { children: scCourse.name })) })), _jsxs(Typography, Object.assign({ className: classes.previewInfo }, { children: [_jsx(FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', _jsx(FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` })] })), _jsxs(Box, Object.assign({ className: classes.previewCategory }, { children: [scCourse.categories.slice(0, MAX_VISIBLE_CATEGORIES).map((category) => (_jsx(Chip, { size: "small", label: category.name }, category.id))), scCourse.categories.length > MAX_VISIBLE_CATEGORIES && (_jsx(Tooltip, Object.assign({ title: _jsx(_Fragment, { children: scCourse.categories.slice(MAX_VISIBLE_CATEGORIES).map((cat) => (_jsx(Box, { children: cat.name }, cat.id))) }) }, { children: _jsx(Chip, { size: "small", label: `+${scCourse.categories.length - MAX_VISIBLE_CATEGORIES}`, sx: { cursor: 'pointer' } }) })))] })), _jsx(Box, Object.assign({ className: classes.previewProgress }, { children: renderProgress() }))] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.previewActions }, { children: _jsx(Button, Object.assign({ variant: "outlined", size: "small", component: Link, to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) })) })))] })));
|
|
166
|
+
}), { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: (_e = scCourse.created_by) === null || _e === void 0 ? void 0 : _e.username })) })), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse), className: classes.previewNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h6", className: classes.previewName }, { children: scCourse.name })) })), _jsx(Stack, { children: _jsxs(Typography, Object.assign({ className: classes.previewInfo }, { children: [_jsx(FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', _jsx(FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` }), isPaymentsEnabled && ((_f = scCourse.paywalls) === null || _f === void 0 ? void 0 : _f.length) && (_jsxs(_Fragment, { children: ["\u00A0", _jsx(Icon, { children: "pagamenti" })] }))] })) }), _jsxs(Box, Object.assign({ className: classes.previewCategory }, { children: [scCourse.categories.slice(0, MAX_VISIBLE_CATEGORIES).map((category) => (_jsx(Chip, { size: "small", label: category.name }, category.id))), scCourse.categories.length > MAX_VISIBLE_CATEGORIES && (_jsx(Tooltip, Object.assign({ title: _jsx(_Fragment, { children: scCourse.categories.slice(MAX_VISIBLE_CATEGORIES).map((cat) => (_jsx(Box, { children: cat.name }, cat.id))) }) }, { children: _jsx(Chip, { size: "small", label: `+${scCourse.categories.length - MAX_VISIBLE_CATEGORIES}`, sx: { cursor: 'pointer' } }) })))] })), _jsx(Box, Object.assign({ className: classes.previewProgress }, { children: renderProgress() }))] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.previewActions }, { children: _jsx(Button, Object.assign({ variant: "outlined", size: "small", component: Link, to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) })) })))] })));
|
|
164
167
|
}
|
|
165
168
|
else {
|
|
166
169
|
contentObj = (_jsx(SnippetRoot, { elevation: 0, className: classes.snippetRoot, image: _jsxs(Box, Object.assign({ className: classes.snippetImage }, { children: [_jsx(Avatar, { variant: "square", alt: scCourse.name, src: scCourse.image_medium, className: userProfileSnippet ? classes.snippetAvatarUserProfile : classes.snippetAvatar }), !userProfileSnippet &&
|
|
@@ -170,9 +173,9 @@ export default function Course(inProps) {
|
|
|
170
173
|
? 'default'
|
|
171
174
|
: scCourse.join_status === SCCourseJoinStatusType.JOINED
|
|
172
175
|
? 'warning'
|
|
173
|
-
: 'secondary', label: chipLabel, className: classes.chip }))] })), primary: _jsxs(_Fragment, { children: [!userProfileSnippet && (_jsx(Link, Object.assign({}, (!((
|
|
176
|
+
: 'secondary', label: chipLabel, className: classes.chip }))] })), primary: _jsxs(_Fragment, { children: [!userProfileSnippet && (_jsx(Link, Object.assign({}, (!((_g = scCourse.created_by) === null || _g === void 0 ? void 0 : _g.deleted) && {
|
|
174
177
|
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
175
|
-
}), { children: _jsx(Typography, Object.assign({ component: "span" }, { children: (
|
|
178
|
+
}), { children: _jsx(Typography, Object.assign({ component: "span" }, { children: (_h = scCourse.created_by) === null || _h === void 0 ? void 0 : _h.username })) }))), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: scCourse.name })) }))] }), secondary: _jsx(_Fragment, { children: userProfileSnippet ? (_jsx(_Fragment, { children: !scCourse.hide_member_count && (_jsx(FormattedMessage, { id: "ui.course.userProfileSnippet.students", defaultMessage: "ui.course.userProfileSnippet.students", values: { students: scCourse.member_count } })) })) : (_jsxs(Stack, Object.assign({ className: classes.snippetPrivacy }, { children: [_jsx(FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', _jsx(FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` }), isPaymentsEnabled && ((_j = scCourse.paywalls) === null || _j === void 0 ? void 0 : _j.length) && (_jsxs(_Fragment, { children: ["\u00A0", _jsx(Icon, Object.assign({ fontSize: "inherit" }, { children: "pagamenti" }))] }))] }))) }), actions: actions !== null && actions !== void 0 ? actions : (_jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) }))) }));
|
|
176
179
|
}
|
|
177
180
|
/**
|
|
178
181
|
* Renders root object
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Avatar, Box, Button, CardActions, CardContent, CardMedia, Chip, Divider, Typography, styled } from '@mui/material';
|
|
3
|
+
import { Avatar, Box, Button, CardActions, CardContent, CardMedia, Chip, Divider, Icon, Typography, styled } from '@mui/material';
|
|
4
4
|
import { useThemeProps } from '@mui/system';
|
|
5
|
-
import { Link, SCRoutes, useSCFetchEvent, useSCRouting } from '@selfcommunity/react-core';
|
|
5
|
+
import { Link, SCRoutes, useSCFetchEvent, useSCPaymentsEnabled, useSCRouting } from '@selfcommunity/react-core';
|
|
6
6
|
import { SCEventLocationType } from '@selfcommunity/types';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { useMemo } from 'react';
|
|
@@ -100,6 +100,7 @@ const SnippetRoot = styled(BaseItem, {
|
|
|
100
100
|
* @param inProps
|
|
101
101
|
*/
|
|
102
102
|
export default function Event(inProps) {
|
|
103
|
+
var _a;
|
|
103
104
|
// PROPS
|
|
104
105
|
const props = useThemeProps({
|
|
105
106
|
props: inProps,
|
|
@@ -112,6 +113,8 @@ export default function Event(inProps) {
|
|
|
112
113
|
const isEventFinished = useMemo(() => checkEventFinished(scEvent), [scEvent]);
|
|
113
114
|
// CONTEXT
|
|
114
115
|
const scRoutingContext = useSCRouting();
|
|
116
|
+
// PAYMENTS
|
|
117
|
+
const { isPaymentsEnabled } = useSCPaymentsEnabled();
|
|
115
118
|
// HOOKS
|
|
116
119
|
const intl = useIntl();
|
|
117
120
|
/**
|
|
@@ -135,7 +138,7 @@ export default function Event(inProps) {
|
|
|
135
138
|
weekday: 'long',
|
|
136
139
|
month: 'long',
|
|
137
140
|
day: 'numeric'
|
|
138
|
-
})}` })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: scEvent.name }))] })), secondary: _jsxs(Typography, Object.assign({ component: "p", variant: "body2", className: classes.snippetSecondary }, { children: [_jsx(FormattedMessage, { id: `ui.eventForm.privacy.${scEvent.privacy}`, defaultMessage: `ui.eventForm.privacy.${scEvent.privacy}` }), " -", ' ', (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: `ui.eventForm.address.live.label`, defaultMessage: `ui.eventForm.address.live.label` })) : (_jsx(FormattedMessage, { id: `ui.eventForm.address.online.label`, defaultMessage: `ui.eventForm.address.online.label` }))] })), actions: actions !== null && actions !== void 0 ? actions : (_jsx(Box, Object.assign({ className: classes.snippetActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) }))) }));
|
|
141
|
+
})}` })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: scEvent.name }))] })), secondary: _jsxs(Typography, Object.assign({ component: "p", variant: "body2", className: classes.snippetSecondary }, { children: [_jsx(FormattedMessage, { id: `ui.eventForm.privacy.${scEvent.privacy}`, defaultMessage: `ui.eventForm.privacy.${scEvent.privacy}` }), " -", ' ', (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: `ui.eventForm.address.live.label`, defaultMessage: `ui.eventForm.address.live.label` })) : (_jsx(FormattedMessage, { id: `ui.eventForm.address.online.label`, defaultMessage: `ui.eventForm.address.online.label` })), isPaymentsEnabled && ((_a = scEvent.paywalls) === null || _a === void 0 ? void 0 : _a.length) && (_jsxs(_Fragment, { children: ["\u00A0", _jsx(Icon, { children: "pagamenti" })] }))] })), actions: actions !== null && actions !== void 0 ? actions : (_jsx(Box, Object.assign({ className: classes.snippetActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) }))) }));
|
|
139
142
|
}
|
|
140
143
|
/**
|
|
141
144
|
* Renders root object
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
4
|
import { Avatar, Button, Icon, Stack, useMediaQuery, useTheme, styled } from '@mui/material';
|
|
5
5
|
import { SCGroupPrivacyType, SCGroupSubscriptionStatusType } from '@selfcommunity/types';
|
|
6
|
-
import { Link, SCRoutes, useSCFetchGroup, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
6
|
+
import { Link, SCRoutes, useSCFetchGroup, useSCPaymentsEnabled, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
7
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { useThemeProps } from '@mui/system';
|
|
@@ -29,8 +29,8 @@ const classes = {
|
|
|
29
29
|
const Root = styled(BaseItemButton, {
|
|
30
30
|
name: PREFIX,
|
|
31
31
|
slot: 'Root',
|
|
32
|
-
overridesResolver: (
|
|
33
|
-
})((
|
|
32
|
+
overridesResolver: (_props, styles) => styles.root
|
|
33
|
+
})(() => ({}));
|
|
34
34
|
/**
|
|
35
35
|
* > API documentation for the Community-JS Group component. Learn about the available props and the CSS API.
|
|
36
36
|
*
|
|
@@ -63,7 +63,7 @@ const Root = styled(BaseItemButton, {
|
|
|
63
63
|
* @param inProps
|
|
64
64
|
*/
|
|
65
65
|
export default function Group(inProps) {
|
|
66
|
-
var _a;
|
|
66
|
+
var _a, _b;
|
|
67
67
|
// PROPS
|
|
68
68
|
const props = useThemeProps({
|
|
69
69
|
props: inProps,
|
|
@@ -82,6 +82,8 @@ export default function Group(inProps) {
|
|
|
82
82
|
const intl = useIntl();
|
|
83
83
|
const theme = useTheme();
|
|
84
84
|
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
85
|
+
// PAYMENTS
|
|
86
|
+
const { isPaymentsEnabled } = useSCPaymentsEnabled();
|
|
85
87
|
/**
|
|
86
88
|
* Render authenticated actions
|
|
87
89
|
* @return {JSX.Element}
|
|
@@ -100,5 +102,5 @@ export default function Group(inProps) {
|
|
|
100
102
|
*/
|
|
101
103
|
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: _jsx(Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary: _jsxs(_Fragment, { children: [isMobile
|
|
102
104
|
? formatCroppedName(scGroup.name, GROUP_NAME_MAX_LENGTH_MOBILE)
|
|
103
|
-
: formatCroppedName(scGroup.name, GROUP_NAME_MAX_LENGTH_DESKTOP), ' ', _jsx(Icon, Object.assign({ className: classes.icon }, { children: (group === null || group === void 0 ? void 0 : group.privacy) === SCGroupPrivacyType.PRIVATE ? 'private' : 'public' }))] }), secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
105
|
+
: formatCroppedName(scGroup.name, GROUP_NAME_MAX_LENGTH_DESKTOP), ' ', _jsx(Icon, Object.assign({ className: classes.icon }, { children: (group === null || group === void 0 ? void 0 : group.privacy) === SCGroupPrivacyType.PRIVATE ? 'private' : 'public' })), isPaymentsEnabled && ((_b = scGroup.paywalls) === null || _b === void 0 ? void 0 : _b.length) && (_jsxs(_Fragment, { children: ["\u00A0", _jsx(Icon, { children: "pagamenti" })] }))] }), secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
104
106
|
}
|
|
@@ -84,7 +84,7 @@ export default function PaywallsConfigurator(inProps) {
|
|
|
84
84
|
* Handle change content type access
|
|
85
85
|
* @param panel
|
|
86
86
|
*/
|
|
87
|
-
const handleChange = (panel) => (
|
|
87
|
+
const handleChange = (panel) => (_event, _isExpanded) => {
|
|
88
88
|
setExpanded(panel);
|
|
89
89
|
onChangeContentAccessType(panel);
|
|
90
90
|
};
|
|
@@ -113,7 +113,7 @@ export default function PaywallsConfigurator(inProps) {
|
|
|
113
113
|
onChangePaymentProducts === null || onChangePaymentProducts === void 0 ? void 0 : onChangePaymentProducts(products);
|
|
114
114
|
handleToggleCreatePaymentPrice();
|
|
115
115
|
};
|
|
116
|
-
const handleDeleteProduct = (
|
|
116
|
+
const handleDeleteProduct = (_p, i) => {
|
|
117
117
|
const products = [...value.slice(0, i), ...value.slice(i + 1)];
|
|
118
118
|
setValue(products);
|
|
119
119
|
onChangePaymentProducts === null || onChangePaymentProducts === void 0 ? void 0 : onChangePaymentProducts(products);
|
|
@@ -141,7 +141,7 @@ export default function PaywallsConfigurator(inProps) {
|
|
|
141
141
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
142
142
|
// @ts-ignore
|
|
143
143
|
const { key } = props, optionProps = __rest(props, ["key"]);
|
|
144
|
-
return (_jsxs("li", Object.assign({}, optionProps, (selected && { style: { backgroundColor: '#f9fafc' } }), { children: [_jsx(Box, Object.assign({ className: classes.productItemCheckIcon, style: { visibility: selected ? 'visible' : 'hidden' } }, { children: _jsx(Icon, { children: "check" }) })), _jsx(Box, Object.assign({ component: "span", className: classes.productItemCardIcon }, { children: _jsx(Icon, { children: "
|
|
144
|
+
return (_jsxs("li", Object.assign({}, optionProps, (selected && { style: { backgroundColor: '#f9fafc' } }), { children: [_jsx(Box, Object.assign({ className: classes.productItemCheckIcon, style: { visibility: selected ? 'visible' : 'hidden' } }, { children: _jsx(Icon, { children: "check" }) })), _jsx(Box, Object.assign({ component: "span", className: classes.productItemCardIcon }, { children: _jsx(Icon, { children: "pagamenti" }) })), _jsxs(Box, Object.assign({ className: classes.productItemContent }, { children: [option.name, _jsx("br", {}), option.payment_prices && option.payment_prices[0] && (_jsxs(_Fragment, { children: [_jsx("span", { children: getConvertedAmount(option.payment_prices[0]) }), ' ', option.payment_prices.length > 1 && _jsxs(_Fragment, { children: ["+", option.payment_prices.length - 1] })] }))] })), _jsx(Box, Object.assign({ className: classes.productItemRemoveIcon, style: { visibility: selected ? 'visible' : 'hidden' } }, { children: _jsx(Icon, { children: "arrow" }) }))] }), option.id));
|
|
145
145
|
};
|
|
146
146
|
/**
|
|
147
147
|
* Fetch events
|
|
@@ -220,7 +220,7 @@ export default function PaywallsConfigurator(inProps) {
|
|
|
220
220
|
defaultMessage: 'ui.paywallsConfigurator.connected.noProducts'
|
|
221
221
|
}) }) }), -1)), value.map((p, i) => {
|
|
222
222
|
var _a, _b, _c;
|
|
223
|
-
return (_jsxs(ListItem, Object.assign({ secondaryAction: _jsx(Button, Object.assign({ variant: "contained", color: "secondary", size: "small", onClick: () => handleDeleteProduct(p, i), startIcon: _jsx(Icon, { children: "delete" }) }, { children: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.connected.products.btnRemove", defaultMessage: "ui.paywallsConfigurator.connected.products.btnRemove" }) })), divider: true }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, { children: _jsx(Icon, { children: "
|
|
223
|
+
return (_jsxs(ListItem, Object.assign({ secondaryAction: _jsx(Button, Object.assign({ variant: "contained", color: "secondary", size: "small", onClick: () => handleDeleteProduct(p, i), startIcon: _jsx(Icon, { children: "delete" }) }, { children: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.connected.products.btnRemove", defaultMessage: "ui.paywallsConfigurator.connected.products.btnRemove" }) })), divider: true }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, { children: _jsx(Icon, { children: "dredit-card" }) }) }), _jsx(ListItemText, { primary: p.name, secondary: `Prices: ${((_a = p.payment_prices) === null || _a === void 0 ? void 0 : _a.length)
|
|
224
224
|
? p.payment_prices
|
|
225
225
|
.slice(0, 3)
|
|
226
226
|
.map((price) => getConvertedAmount(price))
|
|
@@ -231,7 +231,7 @@ export default function PaywallsConfigurator(inProps) {
|
|
|
231
231
|
defaultMessage: 'ui.paywallsConfigurator.connected.products.others'
|
|
232
232
|
}, { count: ((_c = p.payment_prices) === null || _c === void 0 ? void 0 : _c.length) - 3 })
|
|
233
233
|
: ''}` })] }), i));
|
|
234
|
-
})] })), _jsx(Button, Object.assign({ variant: "outlined", size: "small", fullWidth: true, disableRipple: true, onClick: handleOpenPricesList, startIcon: _jsx(Icon, { children: "list" }) }, { children: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.openPriceslist", defaultMessage: "ui.paywallsConfigurator.openPriceslist" }) }))] })), !loading && (_jsx(PaymentProductsPopper, Object.assign({ id: open ? 'payment-products' : undefined, open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: _jsx(ClickAwayListener, Object.assign({ onClickAway: handleClose }, { children: _jsxs(Box, { children: [_jsx(Box, Object.assign({ className: classes.paymentProductsPopperTitle }, { children: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.connected.products.content", defaultMessage: "ui.paywallsConfigurator.connected.products.content" }) })), _jsx(Autocomplete, { loading: loadingProducts, loadingText: _jsx(Box, Object.assign({ className: classes.autoCompleteProductsLoading }, { children: _jsx(CircularProgress, {}) })), id: "payment-products-autocomplete", className: classes.paymentProductsAutocompletePopperRoot, open: true, multiple: true, onClose: (
|
|
234
|
+
})] })), _jsx(Button, Object.assign({ variant: "outlined", size: "small", fullWidth: true, disableRipple: true, onClick: handleOpenPricesList, startIcon: _jsx(Icon, { children: "list" }) }, { children: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.openPriceslist", defaultMessage: "ui.paywallsConfigurator.openPriceslist" }) }))] })), !loading && (_jsx(PaymentProductsPopper, Object.assign({ id: open ? 'payment-products' : undefined, open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: _jsx(ClickAwayListener, Object.assign({ onClickAway: handleClose }, { children: _jsxs(Box, { children: [_jsx(Box, Object.assign({ className: classes.paymentProductsPopperTitle }, { children: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.connected.products.content", defaultMessage: "ui.paywallsConfigurator.connected.products.content" }) })), _jsx(Autocomplete, { loading: loadingProducts, loadingText: _jsx(Box, Object.assign({ className: classes.autoCompleteProductsLoading }, { children: _jsx(CircularProgress, {}) })), id: "payment-products-autocomplete", className: classes.paymentProductsAutocompletePopperRoot, open: true, multiple: true, onClose: (_event, reason) => {
|
|
235
235
|
if (reason === 'escape') {
|
|
236
236
|
handleClose();
|
|
237
237
|
}
|