@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
|
@@ -22,13 +22,13 @@ const classes = {
|
|
|
22
22
|
const Root = styled(LoadingButton, {
|
|
23
23
|
name: PREFIX,
|
|
24
24
|
slot: 'Root',
|
|
25
|
-
overridesResolver: (
|
|
26
|
-
})((
|
|
25
|
+
overridesResolver: (_props, styles) => [styles.root, styles.voted]
|
|
26
|
+
})(() => ({}));
|
|
27
27
|
const DialogRoot = styled(BaseDialog, {
|
|
28
28
|
name: PREFIX,
|
|
29
29
|
slot: 'Root',
|
|
30
|
-
overridesResolver: (
|
|
31
|
-
})((
|
|
30
|
+
overridesResolver: (_props, styles) => styles.dialogRoot
|
|
31
|
+
})(() => ({}));
|
|
32
32
|
/**
|
|
33
33
|
* > API documentation for the Community-JS Vote Audience Button component. Learn about the available props and the CSS API.
|
|
34
34
|
|
|
@@ -67,13 +67,13 @@ export default function VoteAudienceButton(inProps) {
|
|
|
67
67
|
// CONTEXT
|
|
68
68
|
const scUserContext = useSCUser();
|
|
69
69
|
// HANDLERS
|
|
70
|
-
const handleOpen = (
|
|
70
|
+
const handleOpen = (_event) => {
|
|
71
71
|
setOpen(true);
|
|
72
72
|
};
|
|
73
|
-
const handleClose = (
|
|
73
|
+
const handleClose = (_event) => {
|
|
74
74
|
setOpen(false);
|
|
75
75
|
};
|
|
76
|
-
const handleChangeTab = (
|
|
76
|
+
const handleChangeTab = (_event, newValue) => {
|
|
77
77
|
setTab(newValue);
|
|
78
78
|
};
|
|
79
79
|
// HOOKS
|
|
@@ -103,14 +103,14 @@ export default function VoteAudienceButton(inProps) {
|
|
|
103
103
|
const audienceIcon = useMemo(() => {
|
|
104
104
|
if (reactions.default && !isLoading && !error) {
|
|
105
105
|
return (_jsx(Box, Object.assign({ className: classes.reactionList }, { children: contributionReactionsCount &&
|
|
106
|
-
contributionReactionsCount.slice(0, 3).map((count,
|
|
106
|
+
contributionReactionsCount.slice(0, 3).map((count, _i) => (_jsx(Icon, { children: _jsx("img", { alt: count.reaction.label, src: count.reaction.image, width: "100%", height: "100%" }) }, count.reaction.id))) })));
|
|
107
107
|
}
|
|
108
108
|
return scUserContext.user && contributionVoted ? _jsx(Icon, { children: "thumb_up" }) : _jsx(Icon, { children: "thumb_up_off_alt" });
|
|
109
109
|
}, [reactions.default, isLoading, error, contributionReactionsCount, scUserContext.user, contributionVoted]);
|
|
110
110
|
const dialogTitle = useMemo(() => {
|
|
111
111
|
if (reactions.default && !isLoading) {
|
|
112
112
|
return (_jsxs(Tabs, Object.assign({ className: classes.dialogTabs, value: tab, onChange: handleChangeTab, "aria-label": "reactions" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { defaultMessage: "ui.voteAudienceButton.dialog.tab.all", id: "ui.voteAudienceButton.dialog.tab.all" }) }), contributionReactionsCount &&
|
|
113
|
-
contributionReactionsCount.map((count) => (_jsx(Tab, { label: _jsxs(_Fragment, { children: [_jsx(Icon, { children: _jsx("img", { alt: count.reaction.label, src: count.reaction.image, width: "100%", height: "100%" }) }), count.count] }) }, count.reaction.id)))] })));
|
|
113
|
+
contributionReactionsCount.map((count) => (_jsx(Tab, { label: _jsxs(_Fragment, { children: [_jsx(Icon, Object.assign({ fontSize: "medium" }, { children: _jsx("img", { alt: count.reaction.label, src: count.reaction.image, width: "100%", height: "100%" }) })), count.count] }) }, count.reaction.id)))] })));
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
116
|
return _jsx(FormattedMessage, { defaultMessage: "ui.voteAudienceButton.dialog.title", id: "ui.voteAudienceButton.dialog.title" });
|
|
@@ -20,12 +20,12 @@ const classes = {
|
|
|
20
20
|
const Root = styled(LoadingButton, {
|
|
21
21
|
name: PREFIX,
|
|
22
22
|
slot: 'Root',
|
|
23
|
-
overridesResolver: (
|
|
24
|
-
})((
|
|
23
|
+
overridesResolver: (_props, styles) => [styles.root, styles.voted]
|
|
24
|
+
})(() => ({}));
|
|
25
25
|
const PopperRoot = styled(Popper, {
|
|
26
26
|
name: PREFIX,
|
|
27
27
|
slot: 'Root',
|
|
28
|
-
overridesResolver: (
|
|
28
|
+
overridesResolver: (_props, styles) => styles.popperRoot
|
|
29
29
|
})(() => ({}));
|
|
30
30
|
/**
|
|
31
31
|
* > API documentation for the Community-JS Vote Button component. Learn about the available props and the CSS API.
|
|
@@ -70,7 +70,7 @@ export default function VoteButton(inProps) {
|
|
|
70
70
|
handleClearTimeout();
|
|
71
71
|
timeoutRef.current = setTimeout(() => setAnchorEl(event.target), 1000);
|
|
72
72
|
};
|
|
73
|
-
const handleMouseLeave = (
|
|
73
|
+
const handleMouseLeave = (_event) => {
|
|
74
74
|
handleClearTimeout();
|
|
75
75
|
timeoutRef.current = setTimeout(() => setAnchorEl(null), 500);
|
|
76
76
|
};
|
|
@@ -139,8 +139,8 @@ export default function VoteButton(inProps) {
|
|
|
139
139
|
? handleMouseEnter
|
|
140
140
|
: () => handleVoteAction(contributionReaction ? contributionReaction : reactions.default ? reactions.default : null), disabled: isLoading || Boolean(error), loading: isVoting, className: classNames(classes.root, className, {
|
|
141
141
|
[classes.voted]: scUserContext.user && contributionVoted
|
|
142
|
-
}) }, rest, rootProps, { children: scUserContext.user && contributionVoted ? (contributionReaction ? (_jsx(Icon, { children: _jsx("img", { alt: contributionReaction.label, src: contributionReaction.image, width: "100%", height: "100%" }) })) : (_jsx(Icon, { children: "thumb_up" }))) : (_jsx(Icon, { children: "thumb_up_off_alt" })) })));
|
|
142
|
+
}) }, rest, rootProps, { children: scUserContext.user && contributionVoted ? (contributionReaction ? (_jsx(Tooltip, Object.assign({ title: contributionReaction.label }, { children: _jsx(Icon, { children: _jsx("img", { alt: contributionReaction.label, src: contributionReaction.image, width: "100%", height: "100%" }) }) }))) : (_jsx(Icon, { children: "thumb_up" }))) : (_jsx(Icon, { children: "thumb_up_off_alt" })) })));
|
|
143
143
|
return (_jsxs(_Fragment, { children: [reactions.default ? (button) : (_jsx(Tooltip, Object.assign({ title: contributionVoted ? (_jsx(FormattedMessage, { id: "ui.voteButton.voteDown", defaultMessage: "ui.voteButton.voteDown" })) : (_jsx(FormattedMessage, { id: "ui.voteButton.voteUp", defaultMessage: "ui.voteButton.voteUp" })) }, { children: _jsx("span", { children: button }) }))), reactions.default && Boolean(anchorEl) && !isVoting && !isLoading && (_jsx(PopperRoot, Object.assign({ id: `vote_${contributionId}_${contributionType}_popper`, className: classes.popperRoot, open: true, anchorEl: anchorEl, placement: "top", keepMounted: true }, { children: _jsx(Paper, Object.assign({ className: classes.reactionList, onMouseEnter: handleClearTimeout, onMouseLeave: handleMouseLeave }, { children: reactions.reactions
|
|
144
144
|
.filter((reaction) => !contributionVoted || (contributionVoted && contributionReaction.id !== reaction.id) ? reaction.active : reaction)
|
|
145
|
-
.map((reaction) => (_jsx(IconButton, Object.assign({ className: classes.reaction, onClick: () => handleVoteAction(reaction) }, { children: _jsx(Icon, { children: _jsx("img", { alt: reaction.label, src: reaction.image, width: "100%", height: "100%" }) }) }), reaction.id))) })) })))] }));
|
|
145
|
+
.map((reaction) => (_jsx(Tooltip, Object.assign({ title: reaction.label }, { children: _jsx(IconButton, Object.assign({ className: classes.reaction, onClick: () => handleVoteAction(reaction) }, { children: _jsx(Icon, { children: _jsx("img", { alt: reaction.label, src: reaction.image, width: "100%", height: "100%" }) }) })) }), reaction.id))) })) })))] }));
|
|
146
146
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Button, Icon, Stack, styled, Tooltip, Typography, useThemeProps } from '@mui/material';
|
|
3
|
-
import { Link, SCPreferences, SCRoutes, SCUserContext, useSCFetchEvent, useSCPreferences, useSCRouting } from '@selfcommunity/react-core';
|
|
3
|
+
import { Link, SCPreferences, SCRoutes, SCUserContext, useSCFetchEvent, useSCPaymentsEnabled, useSCPreferences, useSCRouting } from '@selfcommunity/react-core';
|
|
4
4
|
import { SCEventLocationType, SCEventPrivacyType, SCEventRecurrenceType, SCFeatureName } from '@selfcommunity/types';
|
|
5
5
|
import { useContext, useMemo } from 'react';
|
|
6
6
|
import { FormattedMessage, useIntl } from 'react-intl';
|
|
@@ -20,6 +20,7 @@ const Root = styled(Stack, {
|
|
|
20
20
|
overridesResolver: (_props, styles) => styles.root
|
|
21
21
|
})(() => ({}));
|
|
22
22
|
export default function EventInfoDetails(inProps) {
|
|
23
|
+
var _a;
|
|
23
24
|
// PROPS
|
|
24
25
|
const props = useThemeProps({
|
|
25
26
|
props: inProps,
|
|
@@ -33,6 +34,8 @@ export default function EventInfoDetails(inProps) {
|
|
|
33
34
|
const scRoutingContext = useSCRouting();
|
|
34
35
|
const scUserContext = useContext(SCUserContext);
|
|
35
36
|
const { preferences, features } = useSCPreferences();
|
|
37
|
+
// PAYMENTS
|
|
38
|
+
const { isPaymentsEnabled } = useSCPaymentsEnabled();
|
|
36
39
|
const liveStreamEnabled = useMemo(() => preferences &&
|
|
37
40
|
features &&
|
|
38
41
|
features.includes(SCFeatureName.LIVE_STREAM) &&
|
|
@@ -57,7 +60,7 @@ export default function EventInfoDetails(inProps) {
|
|
|
57
60
|
month: 'long'
|
|
58
61
|
}),
|
|
59
62
|
start: intl.formatDate(scEvent.running ? scEvent.running_start_date : scEvent.next_start_date ? scEvent.next_start_date : scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
60
|
-
} }) })) })), hasInProgress && scEvent.active && scEvent.running && (_jsx(Tooltip, Object.assign({ title: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.inProgress", defaultMessage: "ui.eventInfoDetails.inProgress" }) }, { children: _jsx(Box, { className: classes.inProgress }) })))] }))), beforeRecurringInfo, hasRecurringInfo && scEvent.recurring !== SCEventRecurrenceType.NEVER && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideRecurringIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: "frequency" })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: `ui.eventInfoDetails.frequency.${scEvent.recurring}.placeholder`, defaultMessage: `ui.eventInfoDetails.frequency.${scEvent.recurring}.placeholder` }) }))] }))), beforePrivacyInfo, hasPrivacyInfo && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hidePrivacyIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: scEvent.privacy === SCEventPrivacyType.PUBLIC ? 'public' : 'private' })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: privacy, defaultMessage: privacy }) })), "-", _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: location, defaultMessage: location }) }))] }))), beforeLocationInfo, hasLocationInfo && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideLocationIcon && (_jsx(Icon, Object.assign({ fontSize: "small" }, { children: scEvent.location === SCEventLocationType.ONLINE ? 'play_circle_outline' : 'add_location_alt' }))), scEvent.location === SCEventLocationType.ONLINE ? (scEvent.live_stream ? (_jsx(Button, Object.assign({ size: "small", variant: "contained", color: "secondary", component: Link, disabled: disableJoinEvent, to: scRoutingContext.url(SCRoutes.LIVESTREAM_ROUTE_NAME, scEvent.live_stream), className: classes.joinLive }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.eventInfoDetails.live.join", id: "ui.eventInfoDetails.live.join" }) }))) : (_jsx(Link, Object.assign({ to: scEvent.link, target: "_blank", className: classes.link }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.link })) })))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.geolocation })))] }))), beforeCreatedInfo, hasCreatedInfo && (_jsxs(Stack, Object.assign({ className: classes.creationWrapper }, { children: [!hideCreatedIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: "create" })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.date.create", defaultMessage: "ui.eventInfoDetails.date.create", values: {
|
|
63
|
+
} }) })) })), hasInProgress && scEvent.active && scEvent.running && (_jsx(Tooltip, Object.assign({ title: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.inProgress", defaultMessage: "ui.eventInfoDetails.inProgress" }) }, { children: _jsx(Box, { className: classes.inProgress }) })))] }))), beforeRecurringInfo, hasRecurringInfo && scEvent.recurring !== SCEventRecurrenceType.NEVER && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideRecurringIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: "frequency" })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: `ui.eventInfoDetails.frequency.${scEvent.recurring}.placeholder`, defaultMessage: `ui.eventInfoDetails.frequency.${scEvent.recurring}.placeholder` }) }))] }))), beforePrivacyInfo, hasPrivacyInfo && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hidePrivacyIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: scEvent.privacy === SCEventPrivacyType.PUBLIC ? 'public' : 'private' })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: privacy, defaultMessage: privacy }) })), "-", _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: location, defaultMessage: location }) })), isPaymentsEnabled && ((_a = scEvent.paywalls) === null || _a === void 0 ? void 0 : _a.length) && _jsx(Icon, { children: "pagamenti" })] }))), beforeLocationInfo, hasLocationInfo && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideLocationIcon && (_jsx(Icon, Object.assign({ fontSize: "small" }, { children: scEvent.location === SCEventLocationType.ONLINE ? 'play_circle_outline' : 'add_location_alt' }))), scEvent.location === SCEventLocationType.ONLINE ? (scEvent.live_stream ? (_jsx(Button, Object.assign({ size: "small", variant: "contained", color: "secondary", component: Link, disabled: disableJoinEvent, to: scRoutingContext.url(SCRoutes.LIVESTREAM_ROUTE_NAME, scEvent.live_stream), className: classes.joinLive }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.eventInfoDetails.live.join", id: "ui.eventInfoDetails.live.join" }) }))) : (_jsx(Link, Object.assign({ to: scEvent.link, target: "_blank", className: classes.link }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.link })) })))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.geolocation })))] }))), beforeCreatedInfo, hasCreatedInfo && (_jsxs(Stack, Object.assign({ className: classes.creationWrapper }, { children: [!hideCreatedIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: "create" })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.date.create", defaultMessage: "ui.eventInfoDetails.date.create", values: {
|
|
61
64
|
date: intl.formatDate(scEvent.created_at, {
|
|
62
65
|
weekday: 'long',
|
|
63
66
|
day: 'numeric',
|