@selfcommunity/react-ui 0.7.50-events.39 → 0.7.50-events.41
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/BottomNavigation/BottomNavigation.js +14 -5
- package/lib/cjs/components/CreateEventButton/CreateEventButton.js +5 -6
- package/lib/cjs/components/EventInfoWidget/EventInfoWidget.d.ts +24 -0
- package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +74 -0
- package/lib/cjs/components/EventInfoWidget/constants.d.ts +1 -0
- package/lib/cjs/components/EventInfoWidget/constants.js +4 -0
- package/lib/cjs/components/EventInfoWidget/index.d.ts +3 -0
- package/lib/cjs/components/EventInfoWidget/index.js +6 -0
- package/lib/cjs/components/EventInviteButton/EventInviteButton.js +11 -11
- package/lib/cjs/components/Events/Events.d.ts +1 -1
- package/lib/cjs/components/Events/Events.js +10 -10
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +2 -0
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +9 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +12 -2
- package/lib/cjs/components/User/User.d.ts +2 -1
- package/lib/cjs/components/User/User.js +9 -9
- package/lib/cjs/index.d.ts +104 -103
- package/lib/cjs/index.js +270 -267
- package/lib/cjs/shared/Bullet/index.js +1 -2
- package/lib/cjs/shared/Calendar/index.d.ts +1 -2
- package/lib/cjs/shared/Calendar/index.js +3 -5
- package/lib/cjs/shared/EventInfoDetails/index.d.ts +6 -0
- package/lib/cjs/shared/EventInfoDetails/index.js +67 -0
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +14 -5
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +5 -6
- package/lib/esm/components/EventInfoWidget/EventInfoWidget.d.ts +24 -0
- package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +71 -0
- package/lib/esm/components/EventInfoWidget/constants.d.ts +1 -0
- package/lib/esm/components/EventInfoWidget/constants.js +1 -0
- package/lib/esm/components/EventInfoWidget/index.d.ts +3 -0
- package/lib/esm/components/EventInfoWidget/index.js +3 -0
- package/lib/esm/components/EventInviteButton/EventInviteButton.js +11 -11
- package/lib/esm/components/Events/Events.d.ts +1 -1
- package/lib/esm/components/Events/Events.js +10 -10
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +2 -0
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +9 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +13 -3
- package/lib/esm/components/User/User.d.ts +2 -1
- package/lib/esm/components/User/User.js +9 -9
- package/lib/esm/index.d.ts +104 -103
- package/lib/esm/index.js +109 -108
- package/lib/esm/shared/Bullet/index.js +0 -1
- package/lib/esm/shared/Calendar/index.d.ts +1 -2
- package/lib/esm/shared/Calendar/index.js +0 -1
- package/lib/esm/shared/EventInfoDetails/index.d.ts +6 -0
- package/lib/esm/shared/EventInfoDetails/index.js +64 -0
- package/lib/umd/84.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -7
- package/lib/umd/204.js +0 -2
- /package/lib/umd/{204.js.LICENSE.txt → 84.js.LICENSE.txt} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
4
|
const styles_1 = require("@mui/material/styles");
|
|
6
5
|
const system_1 = require("@mui/system");
|
|
7
6
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
@@ -20,6 +19,6 @@ function Bullet(inProps) {
|
|
|
20
19
|
props: inProps,
|
|
21
20
|
name: PREFIX
|
|
22
21
|
}), { className } = _a, props = tslib_1.__rest(_a, ["className"]);
|
|
23
|
-
return (
|
|
22
|
+
return (React.createElement(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, props), "\u2022"));
|
|
24
23
|
}
|
|
25
24
|
exports.default = Bullet;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
3
|
const material_1 = require("@mui/material");
|
|
6
4
|
const PREFIX = 'SCCalendar';
|
|
7
5
|
const Root = (0, material_1.styled)(material_1.Stack, {
|
|
@@ -11,8 +9,8 @@ const Root = (0, material_1.styled)(material_1.Stack, {
|
|
|
11
9
|
})();
|
|
12
10
|
function Calendar(props) {
|
|
13
11
|
const day = props.day;
|
|
14
|
-
return (
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
return (React.createElement(Root, { gap: "7px", position: "absolute", bottom: "-36px", left: "24px", width: "60px", height: "60px", borderRadius: "5px", boxShadow: "0px 3px 8px #00000040", bgcolor: "#fff", overflow: "hidden" },
|
|
13
|
+
React.createElement(material_1.Box, { width: "100%", height: "16px", bgcolor: "#b20404" }),
|
|
14
|
+
React.createElement(material_1.Typography, { variant: "h2", textAlign: "center" }, day)));
|
|
17
15
|
}
|
|
18
16
|
exports.default = Calendar;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const material_1 = require("@mui/material");
|
|
4
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
5
|
+
const date_fns_1 = require("date-fns");
|
|
6
|
+
const locale_1 = require("date-fns/locale");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const LOCALE_MAP = {
|
|
10
|
+
en: locale_1.enUS,
|
|
11
|
+
it: locale_1.it
|
|
12
|
+
};
|
|
13
|
+
const PREFIX = 'SCEventInfoDetails';
|
|
14
|
+
const classes = {
|
|
15
|
+
root: `${PREFIX}-root`,
|
|
16
|
+
iconTextWrapper: `${PREFIX}-icon-text-wrapper`,
|
|
17
|
+
link: `${PREFIX}-link`,
|
|
18
|
+
url: `${PREFIX}-url`,
|
|
19
|
+
creationWrapper: `${PREFIX}-creation-wrapper`
|
|
20
|
+
};
|
|
21
|
+
const Root = (0, material_1.styled)(material_1.Stack, {
|
|
22
|
+
name: PREFIX,
|
|
23
|
+
slot: 'Root',
|
|
24
|
+
overridesResolver: (_props, styles) => styles.root
|
|
25
|
+
})();
|
|
26
|
+
function EventInfoDetails(inProps) {
|
|
27
|
+
// PROPS
|
|
28
|
+
const props = (0, material_1.useThemeProps)({
|
|
29
|
+
props: inProps,
|
|
30
|
+
name: PREFIX
|
|
31
|
+
});
|
|
32
|
+
const { event, hasCreatedInfo } = props;
|
|
33
|
+
// HOOKS
|
|
34
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
35
|
+
const privacy = event.privacy === 'public' ? 'ui.eventInfoDetails.privacy.public' : 'ui.eventInfoDetails.privacy.private';
|
|
36
|
+
const location = event.location === 'virtual' ? 'ui.eventInfoDetails.location.virtual' : 'ui.eventInfoDetails.location.inPerson';
|
|
37
|
+
const LocationComponent = event.location === 'virtual' ? react_core_1.Link : react_1.Fragment;
|
|
38
|
+
const formatDateEventDate = (date) => {
|
|
39
|
+
return (0, date_fns_1.format)(new Date(date), "EEEE d MMMM' - Ore 'H:mm", {
|
|
40
|
+
locale: LOCALE_MAP[intl.locale]
|
|
41
|
+
}).replace(/([a-z/ì]+) (\d{2}) ([a-z]+) - Ore (\d{2}):(\d{2})/, (_, weekDay, day, month, hour, minute) => `${weekDay.charAt(0).toUpperCase() + weekDay.slice(1)} ${day} ${month.charAt(0).toUpperCase() + month.slice(1)} - Ore ${hour}:${minute}`);
|
|
42
|
+
};
|
|
43
|
+
const formatDateCreateDate = (date) => {
|
|
44
|
+
return (0, date_fns_1.format)(new Date(date), "'Creato il 'd MMMM y", {
|
|
45
|
+
locale: LOCALE_MAP[intl.locale]
|
|
46
|
+
}).replace(/Creato il (\d{1})+ ([a-z]+) (\d{4})/, (_, day, month, year) => `Creato il ${day} ${month.charAt(0).toUpperCase() + month.slice(1)} ${year}`);
|
|
47
|
+
};
|
|
48
|
+
return (React.createElement(Root, { className: classes.root },
|
|
49
|
+
React.createElement(material_1.Stack, { className: classes.iconTextWrapper },
|
|
50
|
+
React.createElement(material_1.Icon, { fontSize: "small" }, "CalendarIcon"),
|
|
51
|
+
React.createElement(material_1.Typography, { variant: "body1" }, formatDateEventDate(event.start_date))),
|
|
52
|
+
React.createElement(material_1.Stack, { className: classes.iconTextWrapper },
|
|
53
|
+
React.createElement(material_1.Icon, { fontSize: "small" }, event.privacy === 'public' ? 'public' : 'private'),
|
|
54
|
+
React.createElement(material_1.Typography, { variant: "body1" },
|
|
55
|
+
React.createElement(react_intl_1.FormattedMessage, { id: privacy, defaultMessage: privacy })),
|
|
56
|
+
"-",
|
|
57
|
+
React.createElement(material_1.Typography, { variant: "body1" },
|
|
58
|
+
React.createElement(react_intl_1.FormattedMessage, { id: location, defaultMessage: location }))),
|
|
59
|
+
React.createElement(material_1.Stack, { className: classes.iconTextWrapper },
|
|
60
|
+
React.createElement(material_1.Icon, { fontSize: "small" }, event.location === 'virtual' ? 'play_circle_outline' : 'add_location_alt'),
|
|
61
|
+
React.createElement(LocationComponent, { to: event.link, target: "_blank", className: classes.link },
|
|
62
|
+
React.createElement(material_1.Typography, { variant: "body1", className: classes.url }, event.location === 'virtual' ? event.link : event.geolocation))),
|
|
63
|
+
hasCreatedInfo && (React.createElement(material_1.Stack, { className: classes.creationWrapper },
|
|
64
|
+
React.createElement(material_1.Icon, { fontSize: "small" }, "create"),
|
|
65
|
+
React.createElement(material_1.Typography, { variant: "body1" }, formatDateCreateDate(event.created_at))))));
|
|
66
|
+
}
|
|
67
|
+
exports.default = EventInfoDetails;
|
|
@@ -61,18 +61,27 @@ export default function BottomNavigation(inProps) {
|
|
|
61
61
|
// MEMO
|
|
62
62
|
const privateMessagingEnabled = useMemo(() => features.includes(SCFeatureName.PRIVATE_MESSAGING), [features]);
|
|
63
63
|
const groupsEnabled = useMemo(() => features.includes(SCFeatureName.GROUPING) && features.includes(SCFeatureName.TAGGING), [features]);
|
|
64
|
+
const eventsEnabled = useMemo(() => features && features.includes(SCFeatureName.EVENT) && features.includes(SCFeatureName.TAGGING), [features]);
|
|
65
|
+
const exploreStreamEnabled = preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
66
|
+
const postOnlyStaffEnabled = preferences[SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value;
|
|
67
|
+
const contentAvailable = preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value;
|
|
64
68
|
const isIOS = useMemo(() => iOS(), []);
|
|
65
69
|
// RENDER
|
|
66
70
|
return (React.createElement(Root, Object.assign({ className: classNames(className, classes.root, { [classes.ios]: isIOS }) }, rest), children
|
|
67
71
|
? children
|
|
68
72
|
: [
|
|
69
73
|
React.createElement(BottomNavigationAction, { key: "home", className: classes.action, component: Link, to: scUserContext.user ? scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) : '/', value: scUserContext.user ? scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) : '/', icon: React.createElement(Icon, null, "home") }),
|
|
70
|
-
(scUserContext.user ||
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
(scUserContext.user || contentAvailable) && exploreStreamEnabled ? (React.createElement(BottomNavigationAction, { key: "explore", className: classes.action, component: Link, to: scRoutingContext.url(SCRoutes.EXPLORE_ROUTE_NAME, {}), value: scRoutingContext.url(SCRoutes.EXPLORE_ROUTE_NAME, {}), icon: React.createElement(Icon, null, "explore") })) : null,
|
|
75
|
+
(!postOnlyStaffEnabled || (UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
|
|
76
|
+
((groupsEnabled && !eventsEnabled) || (!groupsEnabled && eventsEnabled)) &&
|
|
77
|
+
!exploreStreamEnabled ? (React.createElement(BottomNavigationAction, { key: "composer", className: classNames(classes.composer, classes.action), component: ComposerIconButton, disableRipple: true })) : null,
|
|
74
78
|
groupsEnabled && scUserContext.user ? (React.createElement(BottomNavigationAction, { key: "groups", className: classes.action, component: Link, to: scRoutingContext.url(SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), value: scRoutingContext.url(SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), icon: React.createElement(Icon, null, "groups") })) : null,
|
|
75
|
-
|
|
79
|
+
(!postOnlyStaffEnabled || (UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
|
|
80
|
+
groupsEnabled &&
|
|
81
|
+
eventsEnabled &&
|
|
82
|
+
!exploreStreamEnabled ? (React.createElement(BottomNavigationAction, { key: "composer", className: classNames(classes.composer, classes.action), component: ComposerIconButton, disableRipple: true })) : null,
|
|
83
|
+
eventsEnabled && scUserContext.user ? (React.createElement(BottomNavigationAction, { key: "events", className: classes.action, component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, {}), value: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}), icon: React.createElement(Icon, null, "CalendarIcon") })) : null,
|
|
84
|
+
scUserContext.user && !groupsEnabled && !eventsEnabled ? (React.createElement(BottomNavigationAction, { key: "notifications", className: classes.action, component: Link, to: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}), value: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}), icon: React.createElement(Badge, { badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" },
|
|
76
85
|
React.createElement(Icon, null, "notifications_active")) })) : null,
|
|
77
86
|
privateMessagingEnabled && scUserContext.user ? (React.createElement(BottomNavigationAction, { key: "messages", className: classes.action, component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}), value: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}), icon: React.createElement(Badge, { badgeContent: 0, color: "secondary" },
|
|
78
87
|
React.createElement(Icon, null, "email")) })) : null
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React, { useContext, useMemo } from 'react';
|
|
3
|
-
import { useThemeProps } from '@mui/system';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
5
2
|
import { Button, Icon } from '@mui/material';
|
|
6
|
-
import {
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { useThemeProps } from '@mui/system';
|
|
7
5
|
import { SCPreferences, SCUserContext, useSCPreferences } from '@selfcommunity/react-core';
|
|
8
6
|
import classNames from 'classnames';
|
|
7
|
+
import React, { useContext, useMemo } from 'react';
|
|
8
|
+
import { FormattedMessage } from 'react-intl';
|
|
9
9
|
import EventForm from '../EventForm';
|
|
10
|
-
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
11
10
|
const PREFIX = 'SCCreateEventButton';
|
|
12
11
|
const classes = {
|
|
13
12
|
root: `${PREFIX}-root`
|
|
@@ -65,7 +64,7 @@ export default function CreateEventButton(inProps) {
|
|
|
65
64
|
* If there's no authUserId, component is hidden.
|
|
66
65
|
*/
|
|
67
66
|
if ((!canCreateEvent && onlyStaffEnabled) || !authUserId) {
|
|
68
|
-
return
|
|
67
|
+
return null;
|
|
69
68
|
}
|
|
70
69
|
/**
|
|
71
70
|
* Renders root object
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SCEventType } from '@selfcommunity/types';
|
|
2
|
+
import { WidgetProps } from '../Widget';
|
|
3
|
+
export interface EventInfoWidgetProps extends WidgetProps {
|
|
4
|
+
/**
|
|
5
|
+
* Event Object
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
event?: SCEventType;
|
|
9
|
+
/**
|
|
10
|
+
* Id of event object
|
|
11
|
+
* @default null
|
|
12
|
+
*/
|
|
13
|
+
eventId?: number;
|
|
14
|
+
/**
|
|
15
|
+
* True if summary must be already expanded
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
summaryExpanded?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Other props
|
|
21
|
+
*/
|
|
22
|
+
[p: string]: any;
|
|
23
|
+
}
|
|
24
|
+
export default function EventInfoWidget(inProps: EventInfoWidgetProps): JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { Box, Button, CardContent, Icon, Stack, styled, Typography, useThemeProps } from '@mui/material';
|
|
3
|
+
import { useSCFetchEvent } from '@selfcommunity/react-core';
|
|
4
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
+
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import EventInfoDetails from '../../shared/EventInfoDetails';
|
|
7
|
+
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
8
|
+
import Widget from '../Widget';
|
|
9
|
+
import { PREFIX } from './constants';
|
|
10
|
+
const classes = {
|
|
11
|
+
root: `${PREFIX}-root`,
|
|
12
|
+
content: `${PREFIX}-content`,
|
|
13
|
+
titleWrapper: `${PREFIX}-title-wrapper`,
|
|
14
|
+
textWrapper: `${PREFIX}-text-wrapper`,
|
|
15
|
+
showMore: `${PREFIX}-show-more`
|
|
16
|
+
};
|
|
17
|
+
const Root = styled(Widget, {
|
|
18
|
+
name: PREFIX,
|
|
19
|
+
slot: 'Root',
|
|
20
|
+
overridesResolver: (_props, styles) => styles.root
|
|
21
|
+
})();
|
|
22
|
+
function isTextLongerThanLimit(text, limit = 125) {
|
|
23
|
+
return text.length > limit;
|
|
24
|
+
}
|
|
25
|
+
function getTruncatedText(text, limit = 125) {
|
|
26
|
+
return isTextLongerThanLimit(text, limit) ? text.substring(0, limit).concat('...') : text;
|
|
27
|
+
}
|
|
28
|
+
export default function EventInfoWidget(inProps) {
|
|
29
|
+
// PROPS
|
|
30
|
+
const props = useThemeProps({
|
|
31
|
+
props: inProps,
|
|
32
|
+
name: PREFIX
|
|
33
|
+
});
|
|
34
|
+
const { event, eventId, summaryExpanded = false } = props, rest = __rest(props, ["event", "eventId", "summaryExpanded"]);
|
|
35
|
+
// STATE
|
|
36
|
+
const [expanded, setExpanded] = useState(summaryExpanded);
|
|
37
|
+
const [showButton, setShowButton] = useState(!summaryExpanded);
|
|
38
|
+
// HOOKS
|
|
39
|
+
const { scEvent } = useSCFetchEvent({ id: eventId, event });
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!scEvent) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const _showButton = isTextLongerThanLimit(scEvent.description, 220);
|
|
45
|
+
if (_showButton !== !summaryExpanded) {
|
|
46
|
+
setShowButton(_showButton);
|
|
47
|
+
}
|
|
48
|
+
}, [scEvent]);
|
|
49
|
+
/**
|
|
50
|
+
* Handle toggle summary
|
|
51
|
+
*/
|
|
52
|
+
const handleToggleSummary = useCallback(() => {
|
|
53
|
+
setExpanded(!expanded);
|
|
54
|
+
}, [expanded]);
|
|
55
|
+
if (!scEvent) {
|
|
56
|
+
return React.createElement(HiddenPlaceholder, null);
|
|
57
|
+
}
|
|
58
|
+
const description = expanded ? scEvent.description : getTruncatedText(scEvent.description, 220);
|
|
59
|
+
return (React.createElement(Root, Object.assign({ className: classes.root }, rest, { expanded: expanded }),
|
|
60
|
+
React.createElement(CardContent, { className: classes.content },
|
|
61
|
+
React.createElement(Stack, { className: classes.titleWrapper },
|
|
62
|
+
React.createElement(Icon, { fontSize: "small" }, "info"),
|
|
63
|
+
React.createElement(Typography, { variant: "h5" },
|
|
64
|
+
React.createElement(FormattedMessage, { id: "ui.infoEventWidget.title", defaultMessage: "ui.infoEventWidget.title" }))),
|
|
65
|
+
React.createElement(Box, { className: classes.textWrapper },
|
|
66
|
+
React.createElement(Typography, { component: "span", variant: "body1" },
|
|
67
|
+
description,
|
|
68
|
+
showButton && !expanded && (React.createElement(Button, { size: "small", variant: "text", className: classes.showMore, onClick: handleToggleSummary },
|
|
69
|
+
React.createElement(FormattedMessage, { id: "ui.infoEventWidget.showMore", defaultMessage: "ui.infoEventWidget.showMore" }))))),
|
|
70
|
+
React.createElement(EventInfoDetails, { event: scEvent }))));
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCEventInfoWidget";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PREFIX = 'SCEventInfoWidget';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import
|
|
3
|
-
import { useThemeProps } from '@mui/system';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
2
|
+
import { LoadingButton } from '@mui/lab';
|
|
5
3
|
import { Avatar, Box, Button, Chip, Icon, IconButton, InputAdornment, TextField, Typography } from '@mui/material';
|
|
6
|
-
import
|
|
4
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { useThemeProps } from '@mui/system';
|
|
7
|
+
import { EventService } from '@selfcommunity/api-services';
|
|
7
8
|
import { SCUserContext, useSCFetchEvent } from '@selfcommunity/react-core';
|
|
9
|
+
import { Logger } from '@selfcommunity/utils';
|
|
8
10
|
import classNames from 'classnames';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import Autocomplete from '@mui/material/Autocomplete';
|
|
13
|
-
import User from '../User';
|
|
11
|
+
import PubSub from 'pubsub-js';
|
|
12
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
14
14
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
15
|
-
import { Logger } from '@selfcommunity/utils';
|
|
16
15
|
import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
|
|
17
|
-
import
|
|
16
|
+
import BaseDialog from '../../shared/BaseDialog';
|
|
17
|
+
import User from '../User';
|
|
18
18
|
const messages = defineMessages({
|
|
19
19
|
placeholder: {
|
|
20
20
|
id: 'ui.eventInviteButton.searchBar.placeholder',
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
4
2
|
import { Box, Button, Chip, FormControl, Grid, Icon, InputLabel, MenuItem, Radio, Select, TextField, Typography } from '@mui/material';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { useThemeProps } from '@mui/system';
|
|
5
5
|
import { Endpoints, EventService, http } from '@selfcommunity/api-services';
|
|
6
6
|
import { SCPreferences, SCPreferencesContext, SCUserContext, UserUtils } from '@selfcommunity/react-core';
|
|
7
7
|
import { SCEventDateFilterType } from '@selfcommunity/types';
|
|
8
|
-
import
|
|
9
|
-
import { FormattedMessage } from 'react-intl';
|
|
8
|
+
import { Logger, sortByAttr } from '@selfcommunity/utils';
|
|
10
9
|
import classNames from 'classnames';
|
|
11
|
-
import {
|
|
10
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
11
|
+
import { FormattedMessage } from 'react-intl';
|
|
12
12
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
13
|
-
import { Logger, sortByAttr } from '@selfcommunity/utils';
|
|
14
|
-
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
15
|
-
import { PREFIX } from './constants';
|
|
16
|
-
import Skeleton from '../Events/Skeleton';
|
|
17
13
|
import { DEFAULT_PAGINATION_OFFSET } from '../../constants/Pagination';
|
|
14
|
+
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
18
15
|
import CreateEventButton from '../CreateEventButton';
|
|
16
|
+
import Event, { EventSkeleton } from '../Event';
|
|
17
|
+
import Skeleton from '../Events/Skeleton';
|
|
18
|
+
import { PREFIX } from './constants';
|
|
19
19
|
const classes = {
|
|
20
20
|
root: `${PREFIX}-root`,
|
|
21
21
|
filters: `${PREFIX}-filters`,
|
|
@@ -74,7 +74,7 @@ export default function Events(inProps) {
|
|
|
74
74
|
props: inProps,
|
|
75
75
|
name: PREFIX
|
|
76
76
|
});
|
|
77
|
-
const { endpointQueryParams = { limit:
|
|
77
|
+
const { endpointQueryParams = { limit: 8, offset: DEFAULT_PAGINATION_OFFSET }, className, EventComponentProps = {}, showFilters = false, filters, general = false } = props, rest = __rest(props, ["endpointQueryParams", "className", "EventComponentProps", "showFilters", "filters", "general"]);
|
|
78
78
|
// STATE
|
|
79
79
|
const [events, setEvents] = useState([]);
|
|
80
80
|
const [loading, setLoading] = useState(true);
|
|
@@ -85,6 +85,8 @@ export interface NavigationToolbarProps extends ToolbarProps {
|
|
|
85
85
|
|navigation|.SCNavigationToolbar-navigation|Styles applied to the navigation container element|
|
|
86
86
|
|home|.SCNavigationToolbar-home|Styles applied to the home button|
|
|
87
87
|
|explore|.SCNavigationToolbar-explore|Styles applied to the explore button|
|
|
88
|
+
|groups|.SCNavigationToolbar-groups|Styles applied to the group button|
|
|
89
|
+
|events|.SCNavigationToolbar-events|Styles applied to the event button|
|
|
88
90
|
|search|.SCNavigationToolbar-search|Styles applied to the search component|
|
|
89
91
|
|composer|.SCNavigationToolbar-composer|Styles applied to the composer component|
|
|
90
92
|
|profile|.SCNavigationToolbar-profile|Styles applied to the profile button|
|
|
@@ -22,6 +22,7 @@ const classes = {
|
|
|
22
22
|
navigation: `${PREFIX}-navigation`,
|
|
23
23
|
home: `${PREFIX}-home`,
|
|
24
24
|
explore: `${PREFIX}-explore`,
|
|
25
|
+
events: `${PREFIX}-events`,
|
|
25
26
|
groups: `${PREFIX}-groups`,
|
|
26
27
|
search: `${PREFIX}-search`,
|
|
27
28
|
composer: `${PREFIX}-composer`,
|
|
@@ -74,6 +75,8 @@ const PREFERENCES = [
|
|
|
74
75
|
|navigation|.SCNavigationToolbar-navigation|Styles applied to the navigation container element|
|
|
75
76
|
|home|.SCNavigationToolbar-home|Styles applied to the home button|
|
|
76
77
|
|explore|.SCNavigationToolbar-explore|Styles applied to the explore button|
|
|
78
|
+
|groups|.SCNavigationToolbar-groups|Styles applied to the group button|
|
|
79
|
+
|events|.SCNavigationToolbar-events|Styles applied to the event button|
|
|
77
80
|
|search|.SCNavigationToolbar-search|Styles applied to the search component|
|
|
78
81
|
|composer|.SCNavigationToolbar-composer|Styles applied to the composer component|
|
|
79
82
|
|profile|.SCNavigationToolbar-profile|Styles applied to the profile button|
|
|
@@ -105,6 +108,7 @@ export default function NavigationToolbar(inProps) {
|
|
|
105
108
|
}, [scPreferences.preferences]);
|
|
106
109
|
const privateMessagingEnabled = useMemo(() => scPreferences.features.includes(SCFeatureName.PRIVATE_MESSAGING), [scPreferences.features]);
|
|
107
110
|
const groupsEnabled = useMemo(() => scPreferences.features && scPreferences.features.includes(SCFeatureName.GROUPING) && scPreferences.features.includes(SCFeatureName.TAGGING), [scPreferences.features]);
|
|
111
|
+
const eventsEnabled = useMemo(() => scPreferences.features && scPreferences.features.includes(SCFeatureName.EVENT) && scPreferences.features.includes(SCFeatureName.TAGGING), [scPreferences.features]);
|
|
108
112
|
const showComposer = useMemo(() => {
|
|
109
113
|
return (!disableComposer &&
|
|
110
114
|
(!scPreferences.preferences[SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value || UserUtils.isStaff(scUserContext.user)));
|
|
@@ -134,7 +138,11 @@ export default function NavigationToolbar(inProps) {
|
|
|
134
138
|
[classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {})) ||
|
|
135
139
|
value.startsWith(scRoutingContext.url(SCRoutes.GROUPS_ROUTE_NAME, {}))
|
|
136
140
|
}), "aria-label": "Groups", to: scRoutingContext.url(SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), component: Link },
|
|
137
|
-
React.createElement(Icon, null, "groups")))
|
|
141
|
+
React.createElement(Icon, null, "groups"))),
|
|
142
|
+
eventsEnabled && scUserContext.user && (React.createElement(IconButton, { className: classNames(classes.events, {
|
|
143
|
+
[classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, {}))
|
|
144
|
+
}), "aria-label": "Groups", to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}), component: Link },
|
|
145
|
+
React.createElement(Icon, null, "CalendarIcon")))));
|
|
138
146
|
return (React.createElement(Root, Object.assign({ className: classNames(className, classes.root) }, rest),
|
|
139
147
|
React.createElement(NavigationMenuIconButtonComponent, null),
|
|
140
148
|
React.createElement(Link, { to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { Badge, Button, IconButton, styled, Toolbar } from '@mui/material';
|
|
3
3
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
4
|
-
import { Link, SCPreferences, SCRoutes, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
4
|
+
import { Link, SCPreferences, SCRoutes, UserUtils, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
5
5
|
import Icon from '@mui/material/Icon';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
7
7
|
import classNames from 'classnames';
|
|
@@ -12,6 +12,7 @@ import NavigationSettingsIconButton from '../NavigationSettingsIconButton';
|
|
|
12
12
|
import NavigationMenuIconButton from '../NavigationMenuIconButton';
|
|
13
13
|
import { PREFIX } from './constants';
|
|
14
14
|
import { SCFeatureName } from '@selfcommunity/types';
|
|
15
|
+
import ComposerIconButton from '../ComposerIconButton';
|
|
15
16
|
const classes = {
|
|
16
17
|
root: `${PREFIX}-root`,
|
|
17
18
|
logo: `${PREFIX}-logo`,
|
|
@@ -77,6 +78,10 @@ export default function NavigationToolbarMobile(inProps) {
|
|
|
77
78
|
const [searchOpen, setSearchOpen] = useState(false);
|
|
78
79
|
// MEMO
|
|
79
80
|
const groupsEnabled = useMemo(() => features && features.includes(SCFeatureName.GROUPING) && features.includes(SCFeatureName.TAGGING), [features]);
|
|
81
|
+
const eventsEnabled = useMemo(() => features && features.includes(SCFeatureName.EVENT) && features.includes(SCFeatureName.TAGGING), [features]);
|
|
82
|
+
const exploreStreamEnabled = preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
83
|
+
const postOnlyStaffEnabled = preferences[SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value;
|
|
84
|
+
const contentAvailable = preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value;
|
|
80
85
|
// HANDLERS
|
|
81
86
|
const handleOpenSearch = useCallback(() => {
|
|
82
87
|
setSearchOpen(true);
|
|
@@ -98,12 +103,17 @@ export default function NavigationToolbarMobile(inProps) {
|
|
|
98
103
|
return (React.createElement(Root, Object.assign({ className: classNames(className, classes.root) }, rest),
|
|
99
104
|
_children,
|
|
100
105
|
startActions,
|
|
101
|
-
(
|
|
106
|
+
(contentAvailable || scUserContext.user) && !disableSearch && (React.createElement(React.Fragment, null,
|
|
102
107
|
React.createElement(IconButton, { className: classes.search, onClick: handleOpenSearch },
|
|
103
108
|
React.createElement(Icon, null, "search")),
|
|
104
109
|
React.createElement(SearchDialog, { className: classes.searchDialog, fullScreen: true, open: searchOpen, SearchAutocompleteProps: Object.assign(Object.assign({}, SearchAutocompleteProps), { onClear: handleCloseSearch }) }))),
|
|
105
110
|
endActions,
|
|
106
|
-
|
|
111
|
+
(!postOnlyStaffEnabled || (UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
|
|
112
|
+
groupsEnabled &&
|
|
113
|
+
eventsEnabled &&
|
|
114
|
+
(scUserContext.user || contentAvailable) &&
|
|
115
|
+
exploreStreamEnabled && React.createElement(ComposerIconButton, null),
|
|
116
|
+
scUserContext.user && (groupsEnabled || eventsEnabled) && (React.createElement(IconButton, { className: classes.notifications, component: Link, to: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}) },
|
|
107
117
|
React.createElement(Badge, { badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" },
|
|
108
118
|
React.createElement(Icon, null, "notifications_active")))),
|
|
109
119
|
scUserContext.user ? (React.createElement(NavigationSettingsIconButtonComponent, { className: classes.settings })) : (React.createElement(Button, { className: classes.login, color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNIN_ROUTE_NAME, {}) },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ButtonBaseProps } from '@mui/material';
|
|
3
2
|
import { SCUserType } from '@selfcommunity/types';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
4
|
import { FollowUserButtonProps } from '../FollowUserButton/FollowUserButton';
|
|
5
5
|
import { FriendshipButtonProps } from '../FriendshipUserButton/FriendshipUserButton';
|
|
6
6
|
import { WidgetProps } from '../Widget';
|
|
@@ -49,6 +49,7 @@ export interface UserProps extends WidgetProps {
|
|
|
49
49
|
* @default {}
|
|
50
50
|
*/
|
|
51
51
|
buttonProps?: ButtonBaseProps | null;
|
|
52
|
+
secondary?: ReactNode | null;
|
|
52
53
|
/**
|
|
53
54
|
* Any other properties
|
|
54
55
|
*/
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React, { useMemo, useState } from 'react';
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
4
|
-
import UserSkeleton from './Skeleton';
|
|
5
2
|
import { Avatar, Badge, Button, Chip } from '@mui/material';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { useThemeProps } from '@mui/system';
|
|
6
5
|
import { Link, SCPreferences, SCRoutes, useSCFetchUser, useSCPreferences, useSCRouting } from '@selfcommunity/react-core';
|
|
7
|
-
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
8
6
|
import classNames from 'classnames';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
7
|
+
import React, { useMemo, useState } from 'react';
|
|
8
|
+
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
11
9
|
import BaseItemButton from '../../shared/BaseItemButton';
|
|
12
|
-
import UserDeletedSnackBar from '../../shared/UserDeletedSnackBar';
|
|
13
10
|
import UserAvatar from '../../shared/UserAvatar';
|
|
11
|
+
import UserDeletedSnackBar from '../../shared/UserDeletedSnackBar';
|
|
12
|
+
import ConnectionUserButton from '../ConnectionUserButton';
|
|
14
13
|
import { PREFIX } from './constants';
|
|
14
|
+
import UserSkeleton from './Skeleton';
|
|
15
15
|
const messages = defineMessages({
|
|
16
16
|
userFollowers: {
|
|
17
17
|
id: 'ui.user.userFollowers',
|
|
@@ -65,7 +65,7 @@ export default function User(inProps) {
|
|
|
65
65
|
props: inProps,
|
|
66
66
|
name: PREFIX
|
|
67
67
|
});
|
|
68
|
-
const { userId = null, user = null, handleIgnoreAction, className = null, followConnectUserButtonProps = {}, showFollowers = false, elevation, badgeContent = null, actions = null, isGroupAdmin = false, buttonProps = null } = props, rest = __rest(props, ["userId", "user", "handleIgnoreAction", "className", "followConnectUserButtonProps", "showFollowers", "elevation", "badgeContent", "actions", "isGroupAdmin", "buttonProps"]);
|
|
68
|
+
const { userId = null, user = null, handleIgnoreAction, className = null, followConnectUserButtonProps = {}, showFollowers = false, elevation, badgeContent = null, actions = null, isGroupAdmin = false, buttonProps = null, secondary = null } = props, rest = __rest(props, ["userId", "user", "handleIgnoreAction", "className", "followConnectUserButtonProps", "showFollowers", "elevation", "badgeContent", "actions", "isGroupAdmin", "buttonProps", "secondary"]);
|
|
69
69
|
// STATE
|
|
70
70
|
const { scUser, setSCUser } = useSCFetchUser({ id: userId, user });
|
|
71
71
|
// CONTEXT
|
|
@@ -107,6 +107,6 @@ export default function User(inProps) {
|
|
|
107
107
|
React.createElement(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }))) : (React.createElement(UserAvatar, { hide: !hasBadge },
|
|
108
108
|
React.createElement(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }))), primary: (hasBadge && preferences) || isGroupAdmin ? (React.createElement(React.Fragment, null,
|
|
109
109
|
scUser.username,
|
|
110
|
-
React.createElement(Chip, { component: "span", className: isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel, size: "small", label: isGroupAdmin ? (React.createElement(FormattedMessage, { defaultMessage: "ui.user.group.admin", id: "ui.user.group.admin" })) : (preferences[SCPreferences.STAFF_STAFF_BADGE_LABEL]) }))) : (scUser.username), secondary: showFollowers ? `${intl.formatMessage(messages.userFollowers, { total: scUser.followers_counter })}` : scUser.description, actions: actions !== null && actions !== void 0 ? actions : renderAuthenticatedActions() })),
|
|
110
|
+
React.createElement(Chip, { component: "span", className: isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel, size: "small", label: isGroupAdmin ? (React.createElement(FormattedMessage, { defaultMessage: "ui.user.group.admin", id: "ui.user.group.admin" })) : (preferences[SCPreferences.STAFF_STAFF_BADGE_LABEL]) }))) : (scUser.username), secondary: secondary || (showFollowers ? `${intl.formatMessage(messages.userFollowers, { total: scUser.followers_counter })}` : scUser.description), actions: actions !== null && actions !== void 0 ? actions : renderAuthenticatedActions() })),
|
|
111
111
|
openAlert && React.createElement(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })));
|
|
112
112
|
}
|