@selfcommunity/react-ui 0.8.0-embeds.17 → 0.8.0
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/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +1 -1
- package/lib/cjs/components/Events/Events.js +15 -5
- package/lib/cjs/components/Events/LocationEventsFilter.d.ts +14 -0
- package/lib/cjs/components/Events/LocationEventsFilter.js +45 -0
- package/lib/cjs/components/Events/PastEventsFilter.js +1 -2
- package/lib/cjs/components/Feed/Feed.js +3 -2
- package/lib/cjs/components/GroupActionsMenu/index.d.ts +57 -0
- package/lib/cjs/components/GroupActionsMenu/index.js +157 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.js +8 -4
- package/lib/cjs/components/Groups/Groups.js +26 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +31 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +35 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +4 -20
- package/lib/cjs/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/cjs/components/NavigationMenuIconButton/index.js +3 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +2 -2
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +5 -1
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +30 -7
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +8 -4
- package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.js +56 -12
- package/lib/cjs/components/PlatformWidget/constants.d.ts +0 -4
- package/lib/cjs/components/PlatformWidget/constants.js +1 -5
- package/lib/cjs/constants/GroupActionsMenu.d.ts +5 -0
- package/lib/cjs/constants/GroupActionsMenu.js +8 -0
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +11 -5
- package/lib/cjs/shared/EventInfoDetails/index.js +3 -3
- package/lib/cjs/shared/InfiniteScroll/index.js +4 -4
- package/lib/cjs/shared/Media/Link/DisplayComponent.js +5 -5
- package/lib/esm/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +2 -2
- package/lib/esm/components/Events/Events.js +16 -6
- package/lib/esm/components/Events/LocationEventsFilter.d.ts +14 -0
- package/lib/esm/components/Events/LocationEventsFilter.js +41 -0
- package/lib/esm/components/Events/PastEventsFilter.js +1 -2
- package/lib/esm/components/Feed/Feed.js +4 -3
- package/lib/esm/components/GroupActionsMenu/index.d.ts +57 -0
- package/lib/esm/components/GroupActionsMenu/index.js +154 -0
- package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -0
- package/lib/esm/components/GroupHeader/GroupHeader.js +9 -5
- package/lib/esm/components/Groups/Groups.js +27 -1
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +31 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +32 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +6 -22
- package/lib/esm/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/esm/components/NavigationMenuIconButton/index.js +2 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +2 -2
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +5 -1
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +31 -8
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +9 -5
- package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.js +59 -14
- package/lib/esm/components/PlatformWidget/constants.d.ts +0 -4
- package/lib/esm/components/PlatformWidget/constants.js +0 -4
- package/lib/esm/constants/GroupActionsMenu.d.ts +5 -0
- package/lib/esm/constants/GroupActionsMenu.js +5 -0
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +5 -3
- package/lib/esm/shared/EventInfoDetails/index.js +3 -3
- package/lib/esm/shared/InfiniteScroll/index.js +4 -4
- package/lib/esm/shared/Media/Link/DisplayComponent.js +5 -5
- package/lib/umd/148.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +9 -9
- package/lib/umd/99.js +0 -2
- /package/lib/umd/{99.js.LICENSE.txt → 148.js.LICENSE.txt} +0 -0
|
@@ -37,6 +37,6 @@ function ComposerTypeButtonGroup(props) {
|
|
|
37
37
|
const handleChange = (0, react_1.useCallback)((event, value) => {
|
|
38
38
|
onChange && onChange(value);
|
|
39
39
|
}, [onChange]);
|
|
40
|
-
return (0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onChange: handleChange, exclusive: true, value: value }, rest, { children: [hasPostType && (0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_POST }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.post", defaultMessage: "ui.composer.typeSwitch.post" }) })), hasDiscussionType && (0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_DISCUSSION }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.discussion", defaultMessage: "ui.composer.typeSwitch.discussion" }) })), hasPollType && (0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_POLL }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.poll", defaultMessage: "ui.composer.typeSwitch.poll" }) }))] }));
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onChange: handleChange, exclusive: true, value: value }, rest, { children: [hasPostType && ((0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_POST }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.post", defaultMessage: "ui.composer.typeSwitch.post" }) }))), hasDiscussionType && ((0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_DISCUSSION }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.discussion", defaultMessage: "ui.composer.typeSwitch.discussion" }) }))), hasPostType && hasPollType && ((0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_POLL }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.poll", defaultMessage: "ui.composer.typeSwitch.poll" }) })))] })));
|
|
41
41
|
}
|
|
42
42
|
exports.default = ComposerTypeButtonGroup;
|
|
@@ -22,6 +22,7 @@ const constants_1 = require("./constants");
|
|
|
22
22
|
const PastEventsFilter_1 = tslib_1.__importDefault(require("./PastEventsFilter"));
|
|
23
23
|
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
24
24
|
const PubSub_1 = require("../../constants/PubSub");
|
|
25
|
+
const LocationEventsFilter_1 = tslib_1.__importDefault(require("./LocationEventsFilter"));
|
|
25
26
|
const classes = {
|
|
26
27
|
root: `${constants_1.PREFIX}-root`,
|
|
27
28
|
filters: `${constants_1.PREFIX}-filters`,
|
|
@@ -89,6 +90,7 @@ function Events(inProps) {
|
|
|
89
90
|
const [next, setNext] = (0, react_1.useState)(null);
|
|
90
91
|
const [query, setQuery] = (0, react_1.useState)('');
|
|
91
92
|
const [dateSearch, setDateSearch] = (0, react_1.useState)(options[0].value);
|
|
93
|
+
const [location, setLocation] = (0, react_1.useState)(types_1.SCEventLocationFilterType.ANY);
|
|
92
94
|
const [showFollowed, setShowFollowed] = (0, react_1.useState)(false);
|
|
93
95
|
const [showPastEvents, setShowPastEvents] = (0, react_1.useState)(false);
|
|
94
96
|
const [showMyEvents, setShowMyEvents] = (0, react_1.useState)(false);
|
|
@@ -128,7 +130,7 @@ function Events(inProps) {
|
|
|
128
130
|
url: endpoint.url({}),
|
|
129
131
|
method: endpoint.method,
|
|
130
132
|
params: Object.assign(Object.assign({}, endpointQueryParams), (general
|
|
131
|
-
? Object.assign(Object.assign(Object.assign(Object.assign({}, (search && { search: query })), (dateSearch !== types_1.SCEventDateFilterType.ANY && { date_filter: dateSearch })), (showFollowed && { follows: showFollowed })), (showPastEvents && { date_filter: types_1.SCEventDateFilterType.PAST })) : Object.assign(Object.assign({ subscription_status: types_1.SCEventSubscriptionStatusType.GOING }, (showPastEvents && { past: showPastEvents })), (showMyEvents && { created_by: authUserId }))))
|
|
133
|
+
? Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (search && { search: query })), (dateSearch !== types_1.SCEventDateFilterType.ANY && { date_filter: dateSearch })), (location !== types_1.SCEventLocationFilterType.ANY && { location })), (showFollowed && { follows: showFollowed })), (showPastEvents && { date_filter: types_1.SCEventDateFilterType.PAST })) : Object.assign(Object.assign(Object.assign({ subscription_status: types_1.SCEventSubscriptionStatusType.GOING }, (location !== types_1.SCEventLocationFilterType.ANY && { location })), (showPastEvents && { past: showPastEvents })), (showMyEvents && { created_by: authUserId }))))
|
|
132
134
|
})
|
|
133
135
|
.then((res) => {
|
|
134
136
|
setEvents(res.data.results);
|
|
@@ -149,7 +151,7 @@ function Events(inProps) {
|
|
|
149
151
|
else {
|
|
150
152
|
query === '' && fetchEvents();
|
|
151
153
|
}
|
|
152
|
-
}, [contentAvailability, dateSearch, showFollowed, showPastEvents, showMyEvents, query]);
|
|
154
|
+
}, [contentAvailability, dateSearch, location, showFollowed, showPastEvents, showMyEvents, query]);
|
|
153
155
|
/**
|
|
154
156
|
* Subscriber for pubsub callback
|
|
155
157
|
*/
|
|
@@ -202,10 +204,18 @@ function Events(inProps) {
|
|
|
202
204
|
const handleOnChangeTimeFrame = (event) => {
|
|
203
205
|
setDateSearch(event.target.value);
|
|
204
206
|
};
|
|
207
|
+
/**
|
|
208
|
+
* Handle change location
|
|
209
|
+
* @param event
|
|
210
|
+
*/
|
|
211
|
+
const handleOnChangeLocation = (event) => {
|
|
212
|
+
setLocation(event.target.value);
|
|
213
|
+
};
|
|
205
214
|
/**
|
|
206
215
|
* Renders events list
|
|
207
216
|
*/
|
|
208
|
-
|
|
217
|
+
console.log(location);
|
|
218
|
+
const c = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showFilters && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(events.length !== 0 || (events.length === 0 && showMyEvents)) && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot
|
|
209
219
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
210
220
|
// @ts-ignore
|
|
211
221
|
, {
|
|
@@ -217,14 +227,14 @@ function Events(inProps) {
|
|
|
217
227
|
variant: showMyEvents ? 'filled' : 'outlined', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByCreatedByMe", defaultMessage: "ui.events.filterByCreatedByMe" }), onClick: () => setShowMyEvents(!showMyEvents),
|
|
218
228
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
219
229
|
// @ts-ignore
|
|
220
|
-
showFollowed: showMyEvents, deleteIcon: showMyEvents ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showMyEvents ? handleDeleteClick : null, disabled: loading }) })))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md:
|
|
230
|
+
showFollowed: showMyEvents, deleteIcon: showMyEvents ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showMyEvents ? handleDeleteClick : null, autoHide: !loading && !events.length, disabled: loading }) }))), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, autoHide: !loading && !events.length && !showPastEvents, disabled: loading }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsx)(LocationEventsFilter_1.default, { value: location, autoHide: !loading && !events.length, disabled: loading || (!events.length && !location), handleOnChange: handleOnChangeLocation }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 3 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { className: classes.search, size: 'small', fullWidth: true, value: query, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading || (!events.length && !query), onKeyUp: (e) => {
|
|
221
231
|
e.preventDefault();
|
|
222
232
|
if (e.key === 'Enter') {
|
|
223
233
|
fetchEvents(true);
|
|
224
234
|
}
|
|
225
235
|
}, InputProps: {
|
|
226
236
|
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "end" }, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => fetchEvents(true), disabled: loading || (!events.length && !query) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchEvents(true), endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }), disabled: loading || (!events.length && !query) })) })))
|
|
227
|
-
} }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ disabled: showPastEvents || loading || (!events.length && dateSearch === types_1.SCEventDateFilterType.ANY), size: 'small', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: option.value }, { children: [(0, jsx_runtime_1.jsx)(material_1.Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), authUserId && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot
|
|
237
|
+
} }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ disabled: showPastEvents || loading || (!events.length && dateSearch === types_1.SCEventDateFilterType.ANY), size: 'small', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: option.value }, { children: [(0, jsx_runtime_1.jsx)(material_1.Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsx)(LocationEventsFilter_1.default, { value: location, disabled: loading || (!events.length && !location), handleOnChange: handleOnChangeLocation }) })), authUserId && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot
|
|
228
238
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
229
239
|
// @ts-ignore
|
|
230
240
|
, {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChipProps } from '@mui/material';
|
|
2
|
+
import { SCEventLocationFilterType } from '@selfcommunity/types';
|
|
3
|
+
export interface LocationEventsFilterProps extends ChipProps {
|
|
4
|
+
/**
|
|
5
|
+
* Overrides or extends the styles applied to the component.
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
value: SCEventLocationFilterType;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
autoHide?: boolean;
|
|
12
|
+
handleOnChange: (event: any) => void;
|
|
13
|
+
}
|
|
14
|
+
export default function LocationEventsFilter(inProps: LocationEventsFilterProps): JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_intl_1 = require("react-intl");
|
|
7
|
+
const system_1 = require("@mui/system");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const styles_1 = require("@mui/material/styles");
|
|
10
|
+
const types_1 = require("@selfcommunity/types");
|
|
11
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
12
|
+
const classes = {
|
|
13
|
+
root: `${constants_1.PREFIX}-root`
|
|
14
|
+
};
|
|
15
|
+
const Root = (0, styles_1.styled)(material_1.FormControl, {
|
|
16
|
+
name: constants_1.PREFIX,
|
|
17
|
+
slot: 'Root'
|
|
18
|
+
})(() => ({}));
|
|
19
|
+
const locationOptions = [
|
|
20
|
+
{
|
|
21
|
+
value: types_1.SCEventLocationFilterType.ANY,
|
|
22
|
+
label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.location.select.any", defaultMessage: "ui.events.location.select.any" })
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: types_1.SCEventLocationFilterType.PERSON,
|
|
26
|
+
label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventInfoDetails.location.inPerson", defaultMessage: "ui.eventInfoDetails.location.inPerson" })
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: types_1.SCEventLocationFilterType.ONLINE,
|
|
30
|
+
label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventInfoDetails.location.virtual", defaultMessage: "ui.eventInfoDetails.location.virtual" })
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
function LocationEventsFilter(inProps) {
|
|
34
|
+
// PROPS
|
|
35
|
+
const props = (0, system_1.useThemeProps)({
|
|
36
|
+
props: inProps,
|
|
37
|
+
name: constants_1.PREFIX
|
|
38
|
+
});
|
|
39
|
+
const { className, value, disabled = false, autoHide = false, handleOnChange } = props;
|
|
40
|
+
if (autoHide) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByLocation", defaultMessage: "ui.events.filterByLocation" }) }), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ disabled: disabled, size: 'small', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.location", defaultMessage: "ui.events.location" }), value: value, onChange: handleOnChange, renderValue: (selected) => locationOptions.find((option) => option.value === selected).label }, { children: locationOptions.map((option) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: option.value }, { children: [(0, jsx_runtime_1.jsx)(material_1.Radio, { checked: value === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })));
|
|
44
|
+
}
|
|
45
|
+
exports.default = LocationEventsFilter;
|
|
@@ -7,7 +7,6 @@ const react_intl_1 = require("react-intl");
|
|
|
7
7
|
const system_1 = require("@mui/system");
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const Events_1 = require("./Events");
|
|
10
|
-
const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
|
|
11
10
|
function PastEventsFilter(inProps) {
|
|
12
11
|
// PROPS
|
|
13
12
|
const props = (0, system_1.useThemeProps)({
|
|
@@ -16,7 +15,7 @@ function PastEventsFilter(inProps) {
|
|
|
16
15
|
});
|
|
17
16
|
const { autoHide = false, showPastEvents, handleClick, handleDeleteClick } = props, rest = tslib_1.__rest(props, ["autoHide", "showPastEvents", "handleClick", "handleDeleteClick"]);
|
|
18
17
|
if (autoHide) {
|
|
19
|
-
return
|
|
18
|
+
return null;
|
|
20
19
|
}
|
|
21
20
|
return ((0, jsx_runtime_1.jsx)(Events_1.EventsChipRoot
|
|
22
21
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
@@ -37,6 +37,7 @@ const classes = {
|
|
|
37
37
|
left: `${constants_1.PREFIX}-left`,
|
|
38
38
|
leftItems: `${constants_1.PREFIX}-left-items`,
|
|
39
39
|
start: `${constants_1.PREFIX}-start`,
|
|
40
|
+
headerItem: `${constants_1.PREFIX}-header-item`,
|
|
40
41
|
end: `${constants_1.PREFIX}-end`,
|
|
41
42
|
endMessage: `${constants_1.PREFIX}-end-message`,
|
|
42
43
|
right: `${constants_1.PREFIX}-right`,
|
|
@@ -293,7 +294,7 @@ const Feed = (inProps, ref) => {
|
|
|
293
294
|
const renderHeaderComponent = () => {
|
|
294
295
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.start }, { children: !feedDataObject.previous && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [virtualScrollerMountState.current && HeaderComponent, headData.map((item) => {
|
|
295
296
|
const _itemId = `item_${itemIdGenerator(item)}`;
|
|
296
|
-
return ((0, jsx_runtime_1.jsx)(ItemComponent, Object.assign({ id: _itemId }, itemPropsGenerator(scUserContext.user, item), ItemProps, { sx: { width: '100%' } }), _itemId));
|
|
297
|
+
return ((0, jsx_runtime_1.jsx)(ItemComponent, Object.assign({ className: classes.headerItem, id: _itemId }, itemPropsGenerator(scUserContext.user, item), ItemProps, { sx: { width: '100%' } }), _itemId));
|
|
297
298
|
})] })) })));
|
|
298
299
|
};
|
|
299
300
|
/**
|
|
@@ -419,6 +420,6 @@ const Feed = (inProps, ref) => {
|
|
|
419
420
|
if (feedDataObject.isLoadingNext && !feedDataLeft.length) {
|
|
420
421
|
return ((0, jsx_runtime_1.jsx)(Skeleton_2.default, { children: [...Array(3)].map((v, i) => ((0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps), i))) }));
|
|
421
422
|
}
|
|
422
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ container: true, spacing: 2, id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: [advEnabled && !hideAdvs && enabledCustomAdvPositions.includes(types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR) ? ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(CustomAdv_1.default, Object.assign({ position: types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR }, CustomAdvProps)) }))) : null, (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 7 }, { children: (0, jsx_runtime_1.jsxs)(InfiniteScroll_1.default, Object.assign({ ref: containerRef, className: classes.left, dataLength: feedDataLeft.length, next: getNextPage, previous: getPreviousPage, hasMoreNext: Boolean(feedDataObject.next), hasMorePrevious: Boolean(feedDataObject.previous), header: PreviousPageLink, footer: NextPageLink, loaderNext: (0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps)), loaderPrevious: (0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps)), scrollThreshold: '90%', endMessage: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.end }, { children: [(0, jsx_runtime_1.jsx)(Widget_1.default, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(material_1.CardContent, { children: endMessage }) })), FooterComponent ? (0, jsx_runtime_1.jsx)(FooterComponent, Object.assign({}, FooterComponentProps)) : null] })), refreshFunction: refresh, pullDownToRefresh: true, pullDownToRefreshThreshold: 1000, pullDownToRefreshContent: null, releaseToRefreshContent: (0, jsx_runtime_1.jsx)(
|
|
423
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ container: true, spacing: 2, id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: [advEnabled && !hideAdvs && enabledCustomAdvPositions.includes(types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR) ? ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(CustomAdv_1.default, Object.assign({ position: types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR }, CustomAdvProps)) }))) : null, (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 7 }, { children: (0, jsx_runtime_1.jsxs)(InfiniteScroll_1.default, Object.assign({ ref: containerRef, className: classes.left, dataLength: feedDataLeft.length, next: getNextPage, previous: getPreviousPage, hasMoreNext: Boolean(feedDataObject.next), hasMorePrevious: Boolean(feedDataObject.previous), header: PreviousPageLink, footer: NextPageLink, loaderNext: (0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps)), loaderPrevious: (0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps)), scrollThreshold: '90%', endMessage: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.end }, { children: [(0, jsx_runtime_1.jsx)(Widget_1.default, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(material_1.CardContent, { children: endMessage }) })), FooterComponent ? (0, jsx_runtime_1.jsx)(FooterComponent, Object.assign({}, FooterComponentProps)) : null] })), refreshFunction: refresh, pullDownToRefresh: true, pullDownToRefreshThreshold: 1000, pullDownToRefreshContent: null, releaseToRefreshContent: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", variant: "contained", className: classes.refresh }, { children: refreshMessage })), style: { overflow: 'visible' } }, (scrollableTargetId && { scrollableTarget: scrollableTargetId }), { children: [renderHeaderComponent(), feedDataObject.count === 0 && emptyFeedPlaceholder && emptyFeedPlaceholder, (0, jsx_runtime_1.jsx)(VirtualizedScroller_1.default, Object.assign({ className: classes.leftItems, items: feedDataLeft, itemComponent: InnerItem, onMount: onScrollerMount, onScrollerStateChange: onScrollerStateChange, getItemId: getScrollItemId, preserveScrollPosition: true, preserveScrollPositionOnPrependItems: true, cacheScrollStateKey: react_core_1.SCCache.getVirtualizedScrollStateCacheKey(id), cacheScrollerPositionKey: react_core_1.SCCache.getFeedSPCacheKey(id), cacheStrategy: cacheStrategy }, (scrollableTargetId && { getScrollableContainer: () => document.getElementById(scrollableTargetId) }), VirtualizedScrollerProps))] })) })), feedDataRight.length > 0 && !hideAdvs && ((0, jsx_runtime_1.jsx)(material_1.Hidden, Object.assign({ smDown: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 5 }, { children: (0, jsx_runtime_1.jsx)(StickyBox_1.default, Object.assign({ className: classes.right }, FeedSidebarProps, { children: (0, jsx_runtime_1.jsx)(react_1.default.Suspense, Object.assign({ fallback: (0, jsx_runtime_1.jsx)(Skeleton_1.GenericSkeleton, {}) }, { children: feedDataRight.map((d, i) => ((0, jsx_runtime_1.jsx)(d.component, Object.assign({}, d.componentProps), i))) })) })) })) })))] })));
|
|
423
424
|
};
|
|
424
425
|
exports.default = (0, react_1.forwardRef)(Feed);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { IconButtonProps } from '@mui/material';
|
|
2
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
3
|
+
export interface GroupActionsMenuProps extends IconButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Overrides or extends the styles applied to the component.
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The group
|
|
11
|
+
*/
|
|
12
|
+
group: SCGroupType;
|
|
13
|
+
/**
|
|
14
|
+
* The group id
|
|
15
|
+
*/
|
|
16
|
+
groupId?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Handles callback on delete confirm
|
|
19
|
+
*/
|
|
20
|
+
onDeleteConfirm?: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Handles on edit success
|
|
23
|
+
*/
|
|
24
|
+
onEditSuccess?: (data: SCGroupType) => any;
|
|
25
|
+
/**
|
|
26
|
+
* Any other properties
|
|
27
|
+
*/
|
|
28
|
+
[p: string]: any;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* > API documentation for the Community-JS GroupActionsMenu component. Learn about the available props and the CSS API.
|
|
32
|
+
|
|
33
|
+
#### Import
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
import {GroupActionsMenu} from '@selfcommunity/react-ui';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Component Name
|
|
40
|
+
|
|
41
|
+
The name `SCGroupActionsMenu` can be used when providing style overrides in the theme.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
#### CSS
|
|
45
|
+
|
|
46
|
+
|Rule Name|Global class|Description|
|
|
47
|
+
|---|---|---|
|
|
48
|
+
|root|.SCGroupActionsMenu-root|Styles applied to the root element.|
|
|
49
|
+
|drawerRoot|.SCGroupActionsMenu-drawer-root|Styles applied to the drawer root element.|
|
|
50
|
+
|menuRoot|.SCGroupActionsMenu-menu-root|Styles applied to the menu root element.|
|
|
51
|
+
|paper|.SCGroupActionsMenu-paper|Styles applied to the paper element.|
|
|
52
|
+
|item|.SCGroupActionsMenu-item|Styles applied to the item element.|
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
* @param inProps
|
|
56
|
+
*/
|
|
57
|
+
export default function GroupActionsMenu(inProps: GroupActionsMenuProps): JSX.Element;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
10
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
11
|
+
const system_1 = require("@mui/system");
|
|
12
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
13
|
+
const ConfirmDialog_1 = tslib_1.__importDefault(require("../../shared/ConfirmDialog/ConfirmDialog"));
|
|
14
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
15
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
16
|
+
const notistack_1 = require("notistack");
|
|
17
|
+
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
18
|
+
const PubSub_1 = require("../../constants/PubSub");
|
|
19
|
+
const GroupForm_1 = tslib_1.__importDefault(require("../../components/GroupForm"));
|
|
20
|
+
const GroupActionsMenu_1 = require("../../constants/GroupActionsMenu");
|
|
21
|
+
const PREFIX = 'SCGroupActionsMenu';
|
|
22
|
+
const classes = {
|
|
23
|
+
root: `${PREFIX}-root`,
|
|
24
|
+
drawerRoot: `${PREFIX}-drawer-root`,
|
|
25
|
+
menuRoot: `${PREFIX}-menu-root`,
|
|
26
|
+
paper: `${PREFIX}-paper`,
|
|
27
|
+
item: `${PREFIX}-item`
|
|
28
|
+
};
|
|
29
|
+
const Root = (0, styles_1.styled)(material_1.IconButton, {
|
|
30
|
+
name: PREFIX,
|
|
31
|
+
slot: 'Root'
|
|
32
|
+
})(() => ({}));
|
|
33
|
+
const SwipeableDrawerRoot = (0, styles_1.styled)(material_1.SwipeableDrawer, {
|
|
34
|
+
name: PREFIX,
|
|
35
|
+
slot: 'DrawerRoot'
|
|
36
|
+
})(() => ({}));
|
|
37
|
+
const MenuRoot = (0, styles_1.styled)(material_1.Menu, {
|
|
38
|
+
name: PREFIX,
|
|
39
|
+
slot: 'MenuRoot'
|
|
40
|
+
})(() => ({}));
|
|
41
|
+
/**
|
|
42
|
+
* > API documentation for the Community-JS GroupActionsMenu component. Learn about the available props and the CSS API.
|
|
43
|
+
|
|
44
|
+
#### Import
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
import {GroupActionsMenu} from '@selfcommunity/react-ui';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Component Name
|
|
51
|
+
|
|
52
|
+
The name `SCGroupActionsMenu` can be used when providing style overrides in the theme.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
#### CSS
|
|
56
|
+
|
|
57
|
+
|Rule Name|Global class|Description|
|
|
58
|
+
|---|---|---|
|
|
59
|
+
|root|.SCGroupActionsMenu-root|Styles applied to the root element.|
|
|
60
|
+
|drawerRoot|.SCGroupActionsMenu-drawer-root|Styles applied to the drawer root element.|
|
|
61
|
+
|menuRoot|.SCGroupActionsMenu-menu-root|Styles applied to the menu root element.|
|
|
62
|
+
|paper|.SCGroupActionsMenu-paper|Styles applied to the paper element.|
|
|
63
|
+
|item|.SCGroupActionsMenu-item|Styles applied to the item element.|
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
* @param inProps
|
|
67
|
+
*/
|
|
68
|
+
function GroupActionsMenu(inProps) {
|
|
69
|
+
var _a;
|
|
70
|
+
// PROPS
|
|
71
|
+
const props = (0, system_1.useThemeProps)({
|
|
72
|
+
props: inProps,
|
|
73
|
+
name: PREFIX
|
|
74
|
+
});
|
|
75
|
+
const { className, group, groupId, onDeleteConfirm, onEditSuccess } = props, rest = tslib_1.__rest(props, ["className", "group", "groupId", "onDeleteConfirm", "onEditSuccess"]);
|
|
76
|
+
// STATE
|
|
77
|
+
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
78
|
+
const [openConfirmDialog, setOpenConfirmDialog] = (0, react_1.useState)(false);
|
|
79
|
+
const [openEdit, setOpenEdit] = (0, react_1.useState)(false);
|
|
80
|
+
// HOOKS
|
|
81
|
+
const theme = (0, material_1.useTheme)();
|
|
82
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
83
|
+
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
84
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
85
|
+
const { scGroup, setSCGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
|
|
86
|
+
const isGroupAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
87
|
+
// HANDLERS
|
|
88
|
+
const handleOpen = (group) => {
|
|
89
|
+
setAnchorEl(group.currentTarget);
|
|
90
|
+
};
|
|
91
|
+
const handleClose = () => {
|
|
92
|
+
setAnchorEl(null);
|
|
93
|
+
};
|
|
94
|
+
const handleEditClick = () => {
|
|
95
|
+
setOpenEdit((o) => !o);
|
|
96
|
+
};
|
|
97
|
+
const handleCloseDialog = () => {
|
|
98
|
+
setOpenConfirmDialog(false);
|
|
99
|
+
setAnchorEl(null);
|
|
100
|
+
};
|
|
101
|
+
const handleEditSuccess = (data) => {
|
|
102
|
+
setSCGroup(data);
|
|
103
|
+
onEditSuccess && onEditSuccess(data);
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Handles thread deletion
|
|
107
|
+
*/
|
|
108
|
+
function handleDeleteThread() {
|
|
109
|
+
api_services_1.GroupService.deleteGroup(scGroup.id)
|
|
110
|
+
.then(() => {
|
|
111
|
+
onDeleteConfirm();
|
|
112
|
+
handleCloseDialog();
|
|
113
|
+
pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.GROUP}.${PubSub_1.SCGroupEventType.DELETE}`, scGroup.id);
|
|
114
|
+
})
|
|
115
|
+
.catch((error) => {
|
|
116
|
+
setOpenConfirmDialog(false);
|
|
117
|
+
console.log(error);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Handles actions
|
|
122
|
+
*/
|
|
123
|
+
function handleAction(action) {
|
|
124
|
+
if (action === GroupActionsMenu_1.GET_GROUP_LINK) {
|
|
125
|
+
(0, utils_1.copyTextToClipboard)(`${location.protocol}//${location.host}${scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, scGroup)}`).then(() => {
|
|
126
|
+
(0, notistack_1.enqueueSnackbar)((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.permanentLinkCopied", defaultMessage: "ui.common.permanentLinkCopied" }), {
|
|
127
|
+
variant: 'success',
|
|
128
|
+
autoHideDuration: 3000
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
handleClose();
|
|
132
|
+
}
|
|
133
|
+
else if (action === GroupActionsMenu_1.DELETE_GROUP) {
|
|
134
|
+
setOpenConfirmDialog(true);
|
|
135
|
+
handleClose();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
*/
|
|
141
|
+
const renderList = () => {
|
|
142
|
+
return [
|
|
143
|
+
(0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(GroupActionsMenu_1.GET_GROUP_LINK) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "link" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.item.link", defaultMessage: "ui.groupActionsMenu.item.link" })] }), "link"),
|
|
144
|
+
isGroupAdmin &&
|
|
145
|
+
scGroup.active && [
|
|
146
|
+
(0, jsx_runtime_1.jsx)(material_1.Divider, {}, "divider"),
|
|
147
|
+
isMobile && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: handleEditClick }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "edit" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.item.edit", defaultMessage: "ui.groupActionsMenu.item.edit" })] }), "edit")),
|
|
148
|
+
(0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(GroupActionsMenu_1.DELETE_GROUP) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "delete" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.item.delete", defaultMessage: "ui.groupActionsMenu.item.delete" })] }), "delete")
|
|
149
|
+
]
|
|
150
|
+
];
|
|
151
|
+
};
|
|
152
|
+
if (!scGroup) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "more_vert" }) })), isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "bottom", open: Boolean(anchorEl), onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: renderList() }) }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ className: classes.menuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() }))), openConfirmDialog && ((0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: openConfirmDialog, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.dialog.msg", defaultMessage: "ui.groupActionsMenu.dialog.msg" }), btnConfirm: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.dialog.confirm", defaultMessage: "ui.groupActionsMenu.dialog.confirm" }), onConfirm: handleDeleteThread, onClose: handleCloseDialog })), openEdit && (0, jsx_runtime_1.jsx)(GroupForm_1.default, { onClose: handleEditClick, group: scGroup, onSuccess: handleEditSuccess })] }));
|
|
156
|
+
}
|
|
157
|
+
exports.default = GroupActionsMenu;
|
|
@@ -3,6 +3,7 @@ import { ChangeGroupCoverProps } from '../ChangeGroupCover';
|
|
|
3
3
|
import { ChangeGroupPictureProps } from '../ChangeGroupPicture';
|
|
4
4
|
import { GroupMembersButtonProps } from '../GroupMembersButton';
|
|
5
5
|
import { GroupSubscribeButtonProps } from '../GroupSubscribeButton';
|
|
6
|
+
import { GroupActionsMenuProps } from '../GroupActionsMenu';
|
|
6
7
|
export interface GroupHeaderProps {
|
|
7
8
|
/**
|
|
8
9
|
* Id of group object
|
|
@@ -44,6 +45,11 @@ export interface GroupHeaderProps {
|
|
|
44
45
|
* @default {}
|
|
45
46
|
*/
|
|
46
47
|
GroupMembersButtonProps?: GroupMembersButtonProps;
|
|
48
|
+
/**
|
|
49
|
+
* Props to spread event actions menu
|
|
50
|
+
* @default {}
|
|
51
|
+
*/
|
|
52
|
+
GroupActionsProps?: Omit<GroupActionsMenuProps, 'group'>;
|
|
47
53
|
/**
|
|
48
54
|
* Any other properties
|
|
49
55
|
*/
|
|
@@ -21,6 +21,7 @@ const GroupSubscribeButton_1 = tslib_1.__importDefault(require("../GroupSubscrib
|
|
|
21
21
|
const GroupInviteButton_1 = tslib_1.__importDefault(require("../GroupInviteButton"));
|
|
22
22
|
const PubSub_1 = require("../../constants/PubSub");
|
|
23
23
|
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
24
|
+
const GroupActionsMenu_1 = tslib_1.__importDefault(require("../GroupActionsMenu"));
|
|
24
25
|
const classes = {
|
|
25
26
|
root: `${constants_1.PREFIX}-root`,
|
|
26
27
|
cover: `${constants_1.PREFIX}-cover`,
|
|
@@ -32,7 +33,8 @@ const classes = {
|
|
|
32
33
|
visibility: `${constants_1.PREFIX}-visibility`,
|
|
33
34
|
visibilityItem: `${constants_1.PREFIX}-visibility-item`,
|
|
34
35
|
members: `${constants_1.PREFIX}-members`,
|
|
35
|
-
membersCounter: `${constants_1.PREFIX}-members-counter
|
|
36
|
+
membersCounter: `${constants_1.PREFIX}-members-counter`,
|
|
37
|
+
multiActions: `${constants_1.PREFIX}-multi-actions`
|
|
36
38
|
};
|
|
37
39
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
38
40
|
name: constants_1.PREFIX,
|
|
@@ -76,7 +78,7 @@ function GroupHeader(inProps) {
|
|
|
76
78
|
props: inProps,
|
|
77
79
|
name: constants_1.PREFIX
|
|
78
80
|
});
|
|
79
|
-
const { id = null, className = null, group, groupId = null, ChangePictureProps = {}, ChangeCoverProps = {}, GroupSubscribeButtonProps = {}, GroupMembersButtonProps = {} } = props, rest = tslib_1.__rest(props, ["id", "className", "group", "groupId", "ChangePictureProps", "ChangeCoverProps", "GroupSubscribeButtonProps", "GroupMembersButtonProps"]);
|
|
81
|
+
const { id = null, className = null, group, groupId = null, ChangePictureProps = {}, ChangeCoverProps = {}, GroupSubscribeButtonProps = {}, GroupMembersButtonProps = {}, GroupActionsProps } = props, rest = tslib_1.__rest(props, ["id", "className", "group", "groupId", "ChangePictureProps", "ChangeCoverProps", "GroupSubscribeButtonProps", "GroupMembersButtonProps", "GroupActionsProps"]);
|
|
80
82
|
// PREFERENCES
|
|
81
83
|
const scPreferences = (0, react_core_1.useSCPreferences)();
|
|
82
84
|
const visibilityEnabled = (0, react_1.useMemo)(() => scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_GROUPS_VISIBILITY_ENABLED].value, [scPreferences.preferences]);
|
|
@@ -85,6 +87,8 @@ function GroupHeader(inProps) {
|
|
|
85
87
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
86
88
|
// HOOKS
|
|
87
89
|
const { scGroup, setSCGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
|
|
90
|
+
const theme = (0, material_1.useTheme)();
|
|
91
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
88
92
|
// REFS
|
|
89
93
|
const updatesSubscription = (0, react_1.useRef)(null);
|
|
90
94
|
// CONST
|
|
@@ -147,8 +151,8 @@ function GroupHeader(inProps) {
|
|
|
147
151
|
const _backgroundCover = Object.assign({}, (scGroup.emotional_image
|
|
148
152
|
? { background: `url('${scGroup.emotional_image}') center / cover` }
|
|
149
153
|
: { background: `url('${scPreferences.preferences[react_core_1.SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
|
|
150
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { children: (0, jsx_runtime_1.jsx)("img", { alt: "group", src: scGroup.image_big ? scGroup.image_big : '' }) }) })), isGroupAdmin && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ChangeGroupPicture_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeAvatar, className: classes.changePicture }, ChangePictureProps)), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.changeCover }, { children: (0, jsx_runtime_1.jsx)(ChangeGroupCover_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeCover }, ChangeCoverProps)) }))] }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.info }, { children: [isGroupAdmin && (0, jsx_runtime_1.jsx)(EditGroupButton_1.default, { group: scGroup, groupId: scGroup.id, onEditSuccess: (data) => setSCGroup(data) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scGroup.name })), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [privateEnabled && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.public", defaultMessage: "ui.groupHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.private", defaultMessage: "ui.groupHeader.visibility.private" })] }))) })), visibilityEnabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [privateEnabled && (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), scGroup.visible ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.visible", defaultMessage: "ui.groupHeader.visibility.visible" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility_off" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.hidden", defaultMessage: "ui.groupHeader.visibility.hidden" })] })))] }))] }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: ((scGroup && scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC) ||
|
|
154
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { children: (0, jsx_runtime_1.jsx)("img", { alt: "group", src: scGroup.image_big ? scGroup.image_big : '' }) }) })), isGroupAdmin && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ChangeGroupPicture_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeAvatar, className: classes.changePicture }, ChangePictureProps)), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.changeCover }, { children: (0, jsx_runtime_1.jsx)(ChangeGroupCover_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeCover }, ChangeCoverProps)) }))] }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.info }, { children: [isGroupAdmin && !isMobile && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EditGroupButton_1.default, { group: scGroup, groupId: scGroup.id, onEditSuccess: (data) => setSCGroup(data) }), (0, jsx_runtime_1.jsx)(GroupActionsMenu_1.default, Object.assign({ group: scGroup, onEditSuccess: (data) => setSCGroup(data) }, GroupActionsProps))] }))), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scGroup.name })), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [privateEnabled && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.public", defaultMessage: "ui.groupHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.private", defaultMessage: "ui.groupHeader.visibility.private" })] }))) })), visibilityEnabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [privateEnabled && (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), scGroup.visible ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.visible", defaultMessage: "ui.groupHeader.visibility.visible" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility_off" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.hidden", defaultMessage: "ui.groupHeader.visibility.hidden" })] })))] }))] }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: ((scGroup && scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC) ||
|
|
151
155
|
scGroup.subscription_status === types_1.SCGroupSubscriptionStatusType.SUBSCRIBED ||
|
|
152
|
-
isGroupAdmin) && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.members }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.membersCounter, component: "div" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.members", defaultMessage: "ui.groupHeader.members", values: { total: scGroup.subscribers_counter } }) })), (0, jsx_runtime_1.jsx)(GroupMembersButton_1.default, Object.assign({ groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, group: scGroup, autoHide: !isGroupAdmin }, GroupMembersButtonProps), scGroup.subscribers_counter)] }))) }), isGroupAdmin ? ((0, jsx_runtime_1.jsx)(GroupInviteButton_1.default, { group: scGroup, groupId: scGroup.id })) : ((0, jsx_runtime_1.jsx)(GroupSubscribeButton_1.default, Object.assign({ group: scGroup, onSubscribe: handleSubscribe }, GroupSubscribeButtonProps)))] }))] })));
|
|
156
|
+
isGroupAdmin) && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.members }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.membersCounter, component: "div" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.members", defaultMessage: "ui.groupHeader.members", values: { total: scGroup.subscribers_counter } }) })), (0, jsx_runtime_1.jsx)(GroupMembersButton_1.default, Object.assign({ groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, group: scGroup, autoHide: !isGroupAdmin }, GroupMembersButtonProps), scGroup.subscribers_counter)] }))) }), isGroupAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(GroupInviteButton_1.default, { group: scGroup, groupId: scGroup.id }), isMobile && (0, jsx_runtime_1.jsx)(GroupActionsMenu_1.default, Object.assign({ group: scGroup, onEditSuccess: (data) => setSCGroup(data) }, GroupActionsProps))] })) : ((0, jsx_runtime_1.jsx)(GroupSubscribeButton_1.default, Object.assign({ group: scGroup, onSubscribe: handleSubscribe }, GroupSubscribeButtonProps)))] }))] })));
|
|
153
157
|
}
|
|
154
158
|
exports.default = GroupHeader;
|
|
@@ -18,6 +18,8 @@ const constants_1 = require("./constants");
|
|
|
18
18
|
const Group_1 = tslib_1.__importStar(require("../Group"));
|
|
19
19
|
const Pagination_1 = require("../../constants/Pagination");
|
|
20
20
|
const InfiniteScroll_1 = tslib_1.__importDefault(require("../../shared/InfiniteScroll"));
|
|
21
|
+
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
22
|
+
const PubSub_1 = require("../../constants/PubSub");
|
|
21
23
|
const classes = {
|
|
22
24
|
root: `${constants_1.PREFIX}-root`,
|
|
23
25
|
filters: `${constants_1.PREFIX}-filter`,
|
|
@@ -85,6 +87,8 @@ function Groups(inProps) {
|
|
|
85
87
|
scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value, [scPreferencesContext.preferences]);
|
|
86
88
|
// CONST
|
|
87
89
|
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
90
|
+
// REFS
|
|
91
|
+
const updatesSubscription = (0, react_1.useRef)(null);
|
|
88
92
|
// HANDLERS
|
|
89
93
|
const handleScrollUp = () => {
|
|
90
94
|
window.scrollTo({ left: 0, top: 0, behavior: 'smooth' });
|
|
@@ -121,6 +125,28 @@ function Groups(inProps) {
|
|
|
121
125
|
fetchGroups();
|
|
122
126
|
}
|
|
123
127
|
}, [contentAvailability, authUserId, search]);
|
|
128
|
+
/**
|
|
129
|
+
* Subscriber for pubsub callback
|
|
130
|
+
*/
|
|
131
|
+
const onDeleteGroupHandler = (0, react_1.useCallback)((_msg, deleted) => {
|
|
132
|
+
setGroups((prev) => {
|
|
133
|
+
if (prev.some((e) => e.id === deleted)) {
|
|
134
|
+
return prev.filter((e) => e.id !== deleted);
|
|
135
|
+
}
|
|
136
|
+
return prev;
|
|
137
|
+
});
|
|
138
|
+
}, [groups]);
|
|
139
|
+
/**
|
|
140
|
+
* On mount, subscribe to receive event updates (only delete)
|
|
141
|
+
*/
|
|
142
|
+
(0, react_1.useEffect)(() => {
|
|
143
|
+
if (groups) {
|
|
144
|
+
updatesSubscription.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.GROUP}.${PubSub_1.SCGroupEventType.DELETE}`, onDeleteGroupHandler);
|
|
145
|
+
}
|
|
146
|
+
return () => {
|
|
147
|
+
updatesSubscription.current && pubsub_js_1.default.unsubscribe(updatesSubscription.current);
|
|
148
|
+
};
|
|
149
|
+
}, [groups]);
|
|
124
150
|
const handleNext = (0, react_1.useMemo)(() => () => {
|
|
125
151
|
if (!next) {
|
|
126
152
|
return;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawerProps } from '@mui/material';
|
|
3
|
+
export interface NavigationMenuDrawerProps extends DrawerProps {
|
|
4
|
+
/**
|
|
5
|
+
* Hide drawer header
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
showDrawerHeader?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Custom Drawer header content
|
|
11
|
+
* @default null
|
|
12
|
+
*/
|
|
13
|
+
drawerHeaderContent?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Custom Drawer content
|
|
16
|
+
* @default null
|
|
17
|
+
*/
|
|
18
|
+
drawerContent?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Props to spread to ScrollContainer component
|
|
21
|
+
* This lib use 'react-custom-scrollbars' component to perform scrollbars
|
|
22
|
+
* For more info: https://github.com/malte-wessel/react-custom-scrollbars/blob/master/docs/API.md
|
|
23
|
+
* @default {}
|
|
24
|
+
*/
|
|
25
|
+
ScrollContainerProps?: Record<string, any>;
|
|
26
|
+
/**
|
|
27
|
+
* Any other properties
|
|
28
|
+
*/
|
|
29
|
+
[p: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export default function NavigationMenuDrawer(inProps: NavigationMenuDrawerProps): JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
8
|
+
const system_1 = require("@mui/system");
|
|
9
|
+
const ScrollContainer_1 = tslib_1.__importDefault(require("../../shared/ScrollContainer"));
|
|
10
|
+
const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
|
|
11
|
+
const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
|
|
12
|
+
const PREFIX = 'SCNavigationMenuDrawer';
|
|
13
|
+
const classes = {
|
|
14
|
+
root: `${PREFIX}-root`,
|
|
15
|
+
logo: `${PREFIX}-logo`,
|
|
16
|
+
drawerRoot: `${PREFIX}-drawer-root`,
|
|
17
|
+
drawerHeader: `${PREFIX}-drawer-header`,
|
|
18
|
+
drawerHeaderAction: `${PREFIX}-drawer-header-action`,
|
|
19
|
+
drawerContent: `${PREFIX}-drawer-content`
|
|
20
|
+
};
|
|
21
|
+
const Root = (0, styles_1.styled)(material_1.Drawer, {
|
|
22
|
+
name: PREFIX,
|
|
23
|
+
slot: 'Root',
|
|
24
|
+
overridesResolver: (props, styles) => styles.root
|
|
25
|
+
})(({ theme }) => ({}));
|
|
26
|
+
function NavigationMenuDrawer(inProps) {
|
|
27
|
+
// PROPS
|
|
28
|
+
const props = (0, system_1.useThemeProps)({
|
|
29
|
+
props: inProps,
|
|
30
|
+
name: PREFIX
|
|
31
|
+
});
|
|
32
|
+
const { className = null, showDrawerHeader = true, drawerHeaderContent = (0, jsx_runtime_1.jsx)(DefaultHeaderContent_1.default, {}), drawerContent = (0, jsx_runtime_1.jsx)(DefaultDrawerContent_1.default, {}), ScrollContainerProps = {}, open, onClose } = props, rest = tslib_1.__rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "ScrollContainerProps", "open", "onClose"]);
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ anchor: "left", className: (0, classnames_1.default)(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, Object.assign({}, ScrollContainerProps, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) }))] })));
|
|
34
|
+
}
|
|
35
|
+
exports.default = NavigationMenuDrawer;
|