@selfcommunity/react-ui 0.8.0-live.80 → 0.8.0-live.85

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.
Files changed (139) hide show
  1. package/lib/cjs/assets/onBoarding/android.d.ts +1 -1
  2. package/lib/cjs/assets/onBoarding/android.js +1 -1
  3. package/lib/cjs/components/CategoryFollowersButton/CategoryFollowersButton.d.ts +2 -2
  4. package/lib/cjs/components/CategoryFollowersButton/CategoryFollowersButton.js +20 -15
  5. package/lib/cjs/components/CommentObject/CommentObject.js +6 -3
  6. package/lib/cjs/components/CommentObjectReply/CommentObjectReply.js +4 -1
  7. package/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +1 -1
  8. package/lib/cjs/components/CreateEventButton/CreateEventButton.js +1 -1
  9. package/lib/cjs/components/EditEventButton/EditEventButton.js +2 -2
  10. package/lib/cjs/components/Editor/plugins/AutoLinkPlugin.js +7 -1
  11. package/lib/cjs/components/Event/Event.js +4 -4
  12. package/lib/cjs/components/EventForm/EventAddress.js +5 -8
  13. package/lib/cjs/components/EventForm/EventForm.js +32 -25
  14. package/lib/cjs/components/EventForm/constants.d.ts +4 -4
  15. package/lib/cjs/components/EventForm/constants.js +4 -4
  16. package/lib/cjs/components/EventForm/utils.d.ts +3 -3
  17. package/lib/cjs/components/EventForm/utils.js +8 -5
  18. package/lib/cjs/components/EventHeader/EventHeader.js +4 -35
  19. package/lib/cjs/components/EventInviteButton/EventInviteButton.js +5 -5
  20. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +3 -7
  21. package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +1 -1
  22. package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +9 -5
  23. package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
  24. package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +14 -16
  25. package/lib/cjs/components/Events/Events.js +12 -35
  26. package/lib/cjs/components/Events/PastEventsFilter.js +2 -12
  27. package/lib/cjs/components/FeedObject/Actions/Share/Share.js +1 -1
  28. package/lib/cjs/components/FeedObject/FeedObject.js +5 -6
  29. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.d.ts +2 -2
  30. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +20 -15
  31. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +6 -1
  32. package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerContent.js +24 -2
  33. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +1 -1
  34. package/lib/cjs/components/Notification/Comment/Comment.js +2 -2
  35. package/lib/cjs/components/Notification/Notification.js +1 -1
  36. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +2 -2
  37. package/lib/cjs/components/OnBoardingWidget/Steps/App/App.js +2 -1
  38. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +65 -104
  39. package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.js +4 -7
  40. package/lib/cjs/components/SearchAutocomplete/SearchAutocomplete.js +3 -2
  41. package/lib/cjs/components/Skeleton/AvatarGroupSkeleton.js +4 -4
  42. package/lib/cjs/components/SuggestedEventsWidget/Arrow.js +2 -1
  43. package/lib/cjs/components/TagAutocomplete/TagAutocomplete.d.ts +44 -0
  44. package/lib/cjs/components/TagAutocomplete/TagAutocomplete.js +92 -0
  45. package/lib/cjs/components/TagAutocomplete/index.d.ts +3 -0
  46. package/lib/cjs/components/TagAutocomplete/index.js +5 -0
  47. package/lib/cjs/components/UserActionIconButton/UserActionIconButton.js +24 -2
  48. package/lib/cjs/components/UserProfileEdit/Section/PublicInfo.js +1 -1
  49. package/lib/cjs/components/UserProfileEdit/UserProfileEdit.d.ts +1 -1
  50. package/lib/cjs/components/UserProfileEdit/UserProfileEdit.js +1 -1
  51. package/lib/cjs/components/UserSocialAssociation/UserSocialAssociation.js +16 -4
  52. package/lib/cjs/constants/SocialShare.d.ts +12 -0
  53. package/lib/cjs/constants/SocialShare.js +15 -2
  54. package/lib/cjs/index.d.ts +3 -2
  55. package/lib/cjs/index.js +6 -2
  56. package/lib/cjs/shared/CopyTextArea/index.d.ts +10 -0
  57. package/lib/cjs/shared/CopyTextArea/index.js +77 -0
  58. package/lib/cjs/utils/buttonCounters.d.ts +1 -0
  59. package/lib/cjs/utils/buttonCounters.js +15 -0
  60. package/lib/cjs/utils/contribution.d.ts +7 -0
  61. package/lib/cjs/utils/contribution.js +13 -1
  62. package/lib/cjs/utils/string.js +1 -1
  63. package/lib/esm/assets/onBoarding/android.d.ts +1 -1
  64. package/lib/esm/assets/onBoarding/android.js +1 -1
  65. package/lib/esm/components/CategoryFollowersButton/CategoryFollowersButton.d.ts +2 -2
  66. package/lib/esm/components/CategoryFollowersButton/CategoryFollowersButton.js +20 -15
  67. package/lib/esm/components/CommentObject/CommentObject.js +8 -5
  68. package/lib/esm/components/CommentObjectReply/CommentObjectReply.js +5 -2
  69. package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +1 -1
  70. package/lib/esm/components/CreateEventButton/CreateEventButton.js +1 -1
  71. package/lib/esm/components/EditEventButton/EditEventButton.js +2 -2
  72. package/lib/esm/components/Editor/plugins/AutoLinkPlugin.js +7 -1
  73. package/lib/esm/components/Event/Event.js +4 -4
  74. package/lib/esm/components/EventForm/EventAddress.js +6 -9
  75. package/lib/esm/components/EventForm/EventForm.js +32 -25
  76. package/lib/esm/components/EventForm/constants.d.ts +4 -4
  77. package/lib/esm/components/EventForm/constants.js +4 -4
  78. package/lib/esm/components/EventForm/utils.d.ts +3 -3
  79. package/lib/esm/components/EventForm/utils.js +8 -5
  80. package/lib/esm/components/EventHeader/EventHeader.js +5 -36
  81. package/lib/esm/components/EventInviteButton/EventInviteButton.js +5 -5
  82. package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +5 -9
  83. package/lib/esm/components/EventMembersWidget/TabContentComponent.js +1 -1
  84. package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +9 -5
  85. package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
  86. package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +16 -18
  87. package/lib/esm/components/Events/Events.js +11 -34
  88. package/lib/esm/components/Events/PastEventsFilter.js +2 -12
  89. package/lib/esm/components/FeedObject/Actions/Share/Share.js +1 -1
  90. package/lib/esm/components/FeedObject/FeedObject.js +5 -6
  91. package/lib/esm/components/GroupMembersButton/GroupMembersButton.d.ts +2 -2
  92. package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +20 -15
  93. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +8 -3
  94. package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerContent.js +27 -5
  95. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +1 -1
  96. package/lib/esm/components/Notification/Comment/Comment.js +2 -2
  97. package/lib/esm/components/Notification/Notification.js +1 -1
  98. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +2 -2
  99. package/lib/esm/components/OnBoardingWidget/Steps/App/App.js +2 -1
  100. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +67 -106
  101. package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.js +4 -7
  102. package/lib/esm/components/SearchAutocomplete/SearchAutocomplete.js +3 -2
  103. package/lib/esm/components/Skeleton/AvatarGroupSkeleton.js +4 -4
  104. package/lib/esm/components/SuggestedEventsWidget/Arrow.js +2 -1
  105. package/lib/esm/components/TagAutocomplete/TagAutocomplete.d.ts +44 -0
  106. package/lib/esm/components/TagAutocomplete/TagAutocomplete.js +90 -0
  107. package/lib/esm/components/TagAutocomplete/index.d.ts +3 -0
  108. package/lib/esm/components/TagAutocomplete/index.js +2 -0
  109. package/lib/esm/components/UserActionIconButton/UserActionIconButton.js +24 -2
  110. package/lib/esm/components/UserProfileEdit/Section/PublicInfo.js +1 -1
  111. package/lib/esm/components/UserProfileEdit/UserProfileEdit.d.ts +1 -1
  112. package/lib/esm/components/UserProfileEdit/UserProfileEdit.js +1 -1
  113. package/lib/esm/components/UserSocialAssociation/UserSocialAssociation.js +18 -6
  114. package/lib/esm/constants/SocialShare.d.ts +12 -0
  115. package/lib/esm/constants/SocialShare.js +13 -0
  116. package/lib/esm/index.d.ts +3 -2
  117. package/lib/esm/index.js +3 -2
  118. package/lib/esm/shared/CopyTextArea/index.d.ts +10 -0
  119. package/lib/esm/shared/CopyTextArea/index.js +74 -0
  120. package/lib/esm/utils/buttonCounters.d.ts +1 -0
  121. package/lib/esm/utils/buttonCounters.js +11 -0
  122. package/lib/esm/utils/contribution.d.ts +7 -0
  123. package/lib/esm/utils/contribution.js +11 -0
  124. package/lib/esm/utils/string.js +1 -1
  125. package/lib/umd/2aa155858f48b8f3911a.eot +0 -0
  126. package/lib/umd/36f3af7f155d916c26ff.woff2 +0 -0
  127. package/lib/umd/749.js +2 -0
  128. package/lib/umd/80884d7cc0fcb1a47982.svg +1 -0
  129. package/lib/umd/a221d3aba0f6753cfbb7.ttf +0 -0
  130. package/lib/umd/assets/icons.svg +251 -0
  131. package/lib/umd/c3528e120c4e831db2ae.woff +0 -0
  132. package/lib/umd/react-ui.js +1 -1
  133. package/package.json +9 -8
  134. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +0 -15
  135. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.js +0 -42
  136. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +0 -15
  137. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.js +0 -37
  138. package/lib/umd/32.js +0 -2
  139. /package/lib/umd/{32.js.LICENSE.txt → 749.js.LICENSE.txt} +0 -0
@@ -3,12 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { Alert, AlertTitle, Box, Button, CircularProgress, Stack, Typography } from '@mui/material';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { useThemeProps } from '@mui/system';
6
- import { Link, SCPreferences, useSCFetchLiveStream, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
6
+ import { Link, SCPreferences, SCPreferencesContext, SCRoutes, useSCFetchLiveStream, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
7
7
  import { SCFeatureName, SCLiveStreamConnectionDetailsErrorType } from '@selfcommunity/types';
8
8
  import classNames from 'classnames';
9
9
  import { FormattedMessage, useIntl } from 'react-intl';
10
10
  import { PREFIX } from './constants';
11
- import { useCallback, useMemo, useState } from 'react';
11
+ import { useCallback, useContext, useMemo, useState } from 'react';
12
12
  import LiveStreamVideoConference from './LiveStreamVideoConference';
13
13
  import '@livekit/components-styles';
14
14
  import { LiveStreamService } from '@selfcommunity/api-services';
@@ -19,6 +19,7 @@ import { LiveStreamContext } from './LiveStreamVideoConference/LiveStreamProvide
19
19
  import { useSnackbar } from 'notistack';
20
20
  import DialogContent from '@mui/material/DialogContent';
21
21
  import BaseDialog from '../../shared/BaseDialog';
22
+ import CopyTextField from '../../shared/CopyTextArea';
22
23
  const classes = {
23
24
  root: `${PREFIX}-root`,
24
25
  content: `${PREFIX}-content`,
@@ -30,6 +31,7 @@ const classes = {
30
31
  preJoin: `${PREFIX}-prejoin`,
31
32
  preJoinLoading: `${PREFIX}-prejoin-loading`,
32
33
  prejoinLoader: `${PREFIX}-prejoin-loader`,
34
+ shareLink: `${PREFIX}-share-link`,
33
35
  endPrejoinContent: `${PREFIX}-end-prejoin-content`,
34
36
  conference: `${PREFIX}-conference`,
35
37
  error: `${PREFIX}-error`
@@ -78,6 +80,7 @@ export default function LiveStreamRoom(inProps) {
78
80
  const { id = `live_stream_room_object_${props.liveStreamId ? props.liveStreamId : props.liveStream ? props.liveStream.id : ''}`, liveStreamId = null, liveStream = null, className, showPrejoinTitle = true, showPrejoinDescription = false, startPrejoinContent, endPrejoinContent, presetConnectionDetails, presetPreJoinChoices, LiveStreamVideoConferenceComponentProps = { options: { codec: 'vp8', hq: false } } } = props, rest = __rest(props, ["id", "liveStreamId", "liveStream", "className", "showPrejoinTitle", "showPrejoinDescription", "startPrejoinContent", "endPrejoinContent", "presetConnectionDetails", "presetPreJoinChoices", "LiveStreamVideoConferenceComponentProps"]);
79
81
  // CONTEXT
80
82
  const scUserContext = useSCUser();
83
+ const scRoutingContext = useSCRouting();
81
84
  const { preferences, features } = useSCPreferences();
82
85
  // STATE
83
86
  const { scLiveStream } = useSCFetchLiveStream({ id: liveStreamId, liveStream });
@@ -98,6 +101,8 @@ export default function LiveStreamRoom(inProps) {
98
101
  features.includes(SCFeatureName.LIVE_STREAM) &&
99
102
  SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in preferences &&
100
103
  preferences[SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value, [preferences, features]);
104
+ const scPreferencesContext = useContext(SCPreferencesContext);
105
+ const appUrl = useMemo(() => scPreferencesContext.preferences && scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_APP_URL].value, [scPreferencesContext.preferences]);
101
106
  // INTL
102
107
  const intl = useIntl();
103
108
  // MESSAGES
@@ -182,5 +187,5 @@ export default function LiveStreamRoom(inProps) {
182
187
  }), camLabel: intl.formatMessage({ id: 'ui.liveStreamRoom.preJoin.camera', defaultMessage: 'ui.liveStreamRoom.preJoin.camera' }), userLabel: intl.formatMessage({ id: 'ui.liveStreamRoom.preJoin.username', defaultMessage: 'ui.liveStreamRoom.preJoin.username' }) }) })), loading && (_jsxs(Box, Object.assign({ className: classes.prejoinLoader }, { children: [_jsx(CircularProgress, {}), _jsx(Typography, Object.assign({ component: 'div', variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.connecting", defaultMessage: "ui.liveStreamRoom.connecting" }) }))] })))] })), _jsxs(Box, Object.assign({ className: classes.endPrejoinContent }, { children: [Boolean(scUserContext.user &&
183
188
  scUserContext.user.id !== scLiveStream.host.id &&
184
189
  scLiveStream &&
185
- (((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants) || (scLiveStream && ((_b = scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo)))) && (_jsx(Stack, Object.assign({ sx: { width: '45%' }, spacing: 1 }, { children: scLiveStream && (((_c = scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) || ((_d = scLiveStream.settings) === null || _d === void 0 ? void 0 : _d.disableVideo)) && (_jsxs(Alert, Object.assign({ variant: "filled", severity: "info" }, { children: [_jsx(AlertTitle, { children: _jsx("b", { children: "Info" }) }), ((_e = scLiveStream.settings) === null || _e === void 0 ? void 0 : _e.muteParticipants) && (_jsxs(_Fragment, { children: ["-", ' ', _jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableMicrophone", defaultMessage: "ui.liveStreamRoom.hostDisableMicrophone" }), _jsx("br", {})] })), ((_f = scLiveStream.settings) === null || _f === void 0 ? void 0 : _f.disableVideo) && (_jsxs(_Fragment, { children: ["- ", _jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableVideo", defaultMessage: "ui.liveStreamRoom.hostDisableVideo" })] }))] }))) }))), endPrejoinContent] }))] })) : (_jsx(Box, Object.assign({ className: classes.conference }, { children: _jsx(LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { children: _jsx(LiveStreamVideoConference, Object.assign({ connectionDetails: connectionDetails, userChoices: preJoinChoices }, LiveStreamVideoConferenceComponentProps)) })) }))) }))) })));
190
+ (((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants) || (scLiveStream && ((_b = scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo)))) && (_jsxs(Stack, Object.assign({ sx: { width: '47%' }, spacing: 1 }, { children: [scLiveStream && (((_c = scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) || ((_d = scLiveStream.settings) === null || _d === void 0 ? void 0 : _d.disableVideo)) && (_jsxs(Alert, Object.assign({ variant: "filled", severity: "info" }, { children: [_jsx(AlertTitle, { children: _jsx("b", { children: "Info" }) }), ((_e = scLiveStream.settings) === null || _e === void 0 ? void 0 : _e.muteParticipants) && (_jsxs(_Fragment, { children: ["-", ' ', _jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableMicrophone", defaultMessage: "ui.liveStreamRoom.hostDisableMicrophone" }), _jsx("br", {})] })), ((_f = scLiveStream.settings) === null || _f === void 0 ? void 0 : _f.disableVideo) && (_jsxs(_Fragment, { children: ["- ", _jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableVideo", defaultMessage: "ui.liveStreamRoom.hostDisableVideo" })] }))] }))), _jsx(CopyTextField, { className: classes.shareLink, value: `${appUrl}${scRoutingContext.url(SCRoutes.LIVESTREAM_ROUTE_NAME, scLiveStream)}`, label: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.shareLink", defaultMessage: "ui.liveStreamRoom.shareLink" }) })] }))), endPrejoinContent] }))] })) : (_jsx(Box, Object.assign({ className: classes.conference }, { children: _jsx(LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { children: _jsx(LiveStreamVideoConference, Object.assign({ connectionDetails: connectionDetails, userChoices: preJoinChoices }, LiveStreamVideoConferenceComponentProps)) })) }))) }))) })));
186
191
  }
@@ -1,17 +1,21 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Box, Button, List, ListItem, Typography, Zoom } from '@mui/material';
4
- import { Link, SCRoutes, useSCFetchCategories, useSCRouting } from '@selfcommunity/react-core';
5
- import { useEffect, useState } from 'react';
3
+ import { Box, Divider, Icon, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Typography, Zoom } from '@mui/material';
4
+ import { Link, SCPreferences, SCRoutes, useSCFetchCategories, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
5
+ import { useEffect, useMemo, useState } from 'react';
6
6
  import Category from '../Category';
7
7
  import { FormattedMessage } from 'react-intl';
8
8
  import { sortByAttr } from '@selfcommunity/utils';
9
+ import { SCFeatureName } from '@selfcommunity/types';
9
10
  import { styled } from '@mui/material/styles';
10
11
  import classNames from 'classnames';
11
12
  import { useThemeProps } from '@mui/system';
12
13
  const PREFIX = 'SCDefaultDrawerContent';
13
14
  const classes = {
14
- root: `${PREFIX}-root`
15
+ root: `${PREFIX}-root`,
16
+ navigation: `${PREFIX}-navigation`,
17
+ noResults: `${PREFIX}-no-results`,
18
+ title: `${PREFIX}-title`
15
19
  };
16
20
  const Root = styled(Box, {
17
21
  name: PREFIX,
@@ -29,8 +33,26 @@ export default function DefaultDrawerContent(inProps) {
29
33
  const [categoriesOrdered, setCategoriesOrdered] = useState([]);
30
34
  // ROUTING
31
35
  const scRoutingContext = useSCRouting();
36
+ // CONTEXT
37
+ const scUserContext = useSCUser();
38
+ // PREFERENCES
39
+ const { preferences, features } = useSCPreferences();
32
40
  //STATE
33
41
  const [isHovered, setIsHovered] = useState({});
42
+ // MEMO
43
+ const groupsEnabled = useMemo(() => preferences &&
44
+ features &&
45
+ features.includes(SCFeatureName.TAGGING) &&
46
+ features.includes(SCFeatureName.GROUPING) &&
47
+ SCPreferences.CONFIGURATIONS_GROUPS_ENABLED in preferences &&
48
+ preferences[SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
49
+ const eventsEnabled = useMemo(() => preferences &&
50
+ features &&
51
+ features.includes(SCFeatureName.TAGGING) &&
52
+ SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
53
+ preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
54
+ const exploreStreamEnabled = preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
55
+ const contentAvailable = preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value;
34
56
  // HANDLERS
35
57
  const handleMouseEnter = (index) => {
36
58
  setIsHovered((prevState) => {
@@ -53,5 +75,5 @@ export default function DefaultDrawerContent(inProps) {
53
75
  onTouchMove: mouseLeave
54
76
  });
55
77
  //order
56
- return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsxs(Typography, Object.assign({ variant: "subtitle1" }, { children: [_jsx("span", { children: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.category.title", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.category.title" }) }), ' ', _jsx(Button, Object.assign({ variant: "text", component: Link, color: "secondary", to: scRoutingContext.url(SCRoutes.CATEGORIES_LIST_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.category.seeAll", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.category.seeAll" }) }))] })), _jsx(List, { children: categoriesOrdered.map((c, index) => (_jsx(Zoom, Object.assign({ in: true, style: { transform: isHovered[c.id] && 'scale(1.05)' } }, { children: _jsx(ListItem, { children: _jsx(Category, Object.assign({ ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c) }, elevation: 0, category: c, actions: null }, CategoryItemProps, getMouseEvents(() => handleMouseEnter(c.id), () => handleMouseLeave(c.id)))) }, c.id) }), index))) })] })));
78
+ return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsxs(List, Object.assign({ className: classes.navigation }, { children: [_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "home" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.home", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.home" }) })] })) })), groupsEnabled && scUserContext.user && (_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.GROUPS_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "groups" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.groups", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.groups" }) })] })) }))), eventsEnabled && (scUserContext.user || contentAvailable) && (_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "CalendarIcon" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.events", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.events" }) })] })) }))), exploreStreamEnabled && (contentAvailable || scUserContext.user) && (_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.EXPLORE_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "explore" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.explore", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.explore" }) })] })) })))] })), _jsx(Divider, {}), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.category.title", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.category.title" }) })), !categoriesOrdered.length && (_jsx(Typography, Object.assign({ variant: "body1", className: classes.noResults }, { children: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.category.noResults", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.category.noResults" }) }))), categoriesOrdered.map((c, index) => (_jsx(Zoom, Object.assign({ in: true, style: { transform: isHovered[c.id] && 'scale(1.05)' } }, { children: _jsx(ListItem, { children: _jsx(Category, Object.assign({ ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c) }, elevation: 0, category: c, actions: null }, CategoryItemProps, getMouseEvents(() => handleMouseEnter(c.id), () => handleMouseLeave(c.id)))) }, c.id) }), index)))] })));
57
79
  }
@@ -144,7 +144,7 @@ export default function NavigationToolbar(inProps) {
144
144
  value.startsWith(scRoutingContext.url(SCRoutes.GROUPS_ROUTE_NAME, {}))
145
145
  }), "aria-label": "Groups", to: scRoutingContext.url(SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "groups" }) }))), eventsEnabled && (scUserContext.user || preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY]) && (_jsx(IconButton, Object.assign({ className: classNames(classes.events, {
146
146
  [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}))
147
- }), "aria-label": "Groups", to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "CalendarIcon" }) })))] })));
147
+ }), "aria-label": "Events", to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "CalendarIcon" }) })))] })));
148
148
  return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsx(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: _jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[SCPreferences.ADDONS_CLOSED_COMMUNITY] && (_jsx(Button, Object.assign({ color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && (_jsx(_Fragment, { children: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? (_jsx(Tooltip, Object.assign({ title: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: _jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? (_jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteProps))) : (_jsx(Box, { className: classes.search })), startActions, scUserContext.user ? (_jsxs(_Fragment, { children: [showComposer && _jsx(ComposerIconButton, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), _jsx(Tooltip, Object.assign({ title: scUserContext.user.username }, { children: _jsx(IconButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: _jsx(Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), _jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classNames(classes.notification, {
149
149
  [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}))
150
150
  }), "aria-label": "Notification", onClick: handleOpenNotificationMenu }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) })), _jsx(NotificationMenu, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open: Boolean(anchorNotification), onClose: handleCloseNotificationMenu, onClick: handleCloseNotificationMenu, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, NotificationMenuProps))] }), privateMessagingEnabled && (_jsx(IconButton, Object.assign({ className: classNames(classes.messages, {
@@ -65,10 +65,10 @@ export default function CommentNotification(props) {
65
65
  }), { onClick: notificationObject.comment.author.deleted ? () => setOpenAlert(true) : null }, { children: _jsx(UserAvatar, Object.assign({ hide: !notificationObject.comment.author.community_badge, smaller: true }, { children: _jsx(Avatar, { alt: notificationObject.comment.author.username, variant: "circular", src: notificationObject.comment.author.avatar, classes: { root: classes.avatar } }) })) })), primary: _jsxs(_Fragment, { children: [_jsx(Link, Object.assign({}, (!notificationObject.comment.author.deleted && {
66
66
  to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.comment.author)
67
67
  }), { onClick: notificationObject.comment.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.comment.author.username })), ' ', notificationObject.type === SCNotificationTypologyType.NESTED_COMMENT
68
- ? intl.formatMessage(messages.comment, {
68
+ ? intl.formatMessage(messages.nestedComment, {
69
69
  b: (...chunks) => _jsx("strong", { children: chunks })
70
70
  })
71
- : intl.formatMessage(messages.nestedComment, {
71
+ : intl.formatMessage(messages.comment, {
72
72
  b: (...chunks) => _jsx("strong", { children: chunks })
73
73
  })] }), secondary: _jsxs(React.Fragment, { children: [_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COMMENT_ROUTE_NAME, getRouteData(notificationObject.comment)) }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contributionText }, { children: getContributionSnippet(notificationObject.comment) })) })), (template === SCNotificationObjectTemplateType.DETAIL || template === SCNotificationObjectTemplateType.SNIPPET) && (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "flex-start", alignItems: "center", spacing: 1 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }), _jsx(Bullet, { className: classes.bullet }), _jsx(VoteButton, { className: classes.voteButton, variant: "text", size: "small", contributionId: notificationObject.comment.id, contributionType: SCContributionType.COMMENT, contribution: notificationObject.comment, onVote: handleVote })] })))] }), footer: template === SCNotificationObjectTemplateType.TOAST && (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at }), _jsx(Typography, Object.assign({ color: "primary", component: 'div' }, { children: _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COMMENT_ROUTE_NAME, getRouteData(notificationObject.comment)) }, { children: _jsx(FormattedMessage, { id: "ui.userToastNotifications.viewContribution", defaultMessage: 'ui.userToastNotifications.viewContribution' }) })) }))] }))) }, rest)), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
74
74
  }
@@ -225,7 +225,7 @@ export default function UserNotification(inProps) {
225
225
  notificationObject.aggregated[0].type === SCNotificationTypologyType.VOTE_UP ||
226
226
  notificationObject.aggregated[0].type === SCNotificationTypologyType.CONTRIBUTION)) {
227
227
  const contribution = getContribution(notificationObject);
228
- return (_jsx(CardHeader, { className: classes.header, titleTypographyProps: { className: classes.title, variant: 'subtitle1' }, title: _jsx(Link, Object.assign({ to: scRoutingContext.url(getContributionRouteName(contribution), getRouteData(notificationObject[contribution.type])) }, { children: getContributionSnippet(contribution) })), action: contribution && (_jsx(Tooltip, Object.assign({ title: contribution.suspended ? (_jsx(FormattedMessage, { id: 'ui.notification.notificationSuspended', defaultMessage: 'ui.notification.notificationSuspended' })) : (_jsx(FormattedMessage, { id: 'ui.notification.notificationSuspend', defaultMessage: 'ui.notification.notificationSuspend' })) }, { children: _jsx(LoadingButton, Object.assign({ variant: "text", size: "small", loading: loadingSuspendNotification, color: 'inherit', classes: { root: classes.stopButton }, onClick: () => handleStopContentNotification(contribution) }, { children: contribution.suspended ? _jsx(Icon, Object.assign({ color: 'primary' }, { children: "notifications_off" })) : _jsx(Icon, Object.assign({ color: 'inherit' }, { children: "notifications" })) })) }))) }));
228
+ return (_jsx(CardHeader, { className: classes.header, titleTypographyProps: { className: classes.title, variant: 'subtitle1' }, title: _jsx(Link, Object.assign({ to: scRoutingContext.url(getContributionRouteName(contribution), getRouteData(notificationObject[contribution.type])) }, { children: getContributionSnippet(contribution) })), action: contribution && (_jsx(Tooltip, Object.assign({ title: contribution.suspended ? (_jsx(FormattedMessage, { id: 'ui.notification.notificationSuspended', defaultMessage: 'ui.notification.notificationSuspended' })) : (_jsx(FormattedMessage, { id: 'ui.notification.notificationSuspend', defaultMessage: 'ui.notification.notificationSuspend' })) }, { children: _jsx(LoadingButton, Object.assign({ variant: "text", size: "small", loading: loadingSuspendNotification, color: 'inherit', classes: { root: classes.stopButton }, onClick: () => handleStopContentNotification(contribution) }, { children: contribution.suspended ? _jsx(Icon, Object.assign({ color: 'primary' }, { children: "notifications_off" })) : _jsx(Icon, Object.assign({ color: 'inherit' }, { children: "notifications_active" })) })) }))) }));
229
229
  }
230
230
  return null;
231
231
  }
@@ -247,13 +247,13 @@ const OnBoardingWidget = (inProps) => {
247
247
  notifyLayoutChanges({ forceExpanded: _expanded });
248
248
  }, [allStepsDone]);
249
249
  useEffect(() => {
250
- if (isAdmin) {
250
+ if (isAdmin && showOnBoarding) {
251
251
  getSteps();
252
252
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
253
253
  const intervalId = setInterval(getSteps, isGenerating ? 6000 : 3 * 60 * 1000);
254
254
  return () => clearInterval(intervalId);
255
255
  }
256
- }, [scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user, isGenerating, isAdmin]);
256
+ }, [scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user, isGenerating, isAdmin, showOnBoarding]);
257
257
  /**
258
258
  * updates categories info when generating category content
259
259
  */
@@ -18,6 +18,7 @@ const classes = {
18
18
  summary: `${PREFIX}-app-summary`,
19
19
  step: `${PREFIX}-app-step`,
20
20
  image: `${PREFIX}-app-image`,
21
+ imageAndroid: `${PREFIX}-app-image-android`,
21
22
  action: `${PREFIX}-app-action`,
22
23
  button: `${PREFIX}-app-button`
23
24
  };
@@ -53,7 +54,7 @@ export default function App(inProps) {
53
54
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
54
55
  // @ts-ignore
55
56
  b: (...chunks) => _jsx("strong", { children: chunks })
56
- } }) })), _jsx(CardMedia, { className: classes.image, component: "img", src: AndroidPlaceholder })] })), tab === 1 && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), _jsx(Typography, Object.assign({ className: classes.step }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.a", defaultMessage: "ui.onBoardingWidget.step.app.ios.a", values: {
57
+ } }) })), _jsx(CardMedia, { className: classes.imageAndroid, component: "img", src: AndroidPlaceholder })] })), tab === 1 && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), _jsx(Typography, Object.assign({ className: classes.step }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.a", defaultMessage: "ui.onBoardingWidget.step.app.ios.a", values: {
57
58
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
58
59
  // @ts-ignore
59
60
  icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
@@ -1,17 +1,16 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import React, { useCallback, useEffect, useReducer, useRef, useState } from 'react';
3
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import Box from '@mui/material/Box';
6
6
  import { useThemeProps } from '@mui/system';
7
7
  import classNames from 'classnames';
8
8
  import { Preferences } from '@selfcommunity/react-core';
9
9
  import { PREFIX } from '../../constants';
10
- import { Button, CircularProgress, Drawer, IconButton, Tab, Tabs, TextField, Typography } from '@mui/material';
10
+ import { Button, Drawer, IconButton, Tab, Tabs, TextField, Typography } from '@mui/material';
11
11
  import { MuiColorInput } from 'mui-color-input';
12
- import { actionTypes } from './reducer';
13
- import { getInitialState, reducer } from './reducer';
14
12
  import { PreferenceService } from '@selfcommunity/api-services';
13
+ import { SCPreferenceSection } from '@selfcommunity/types';
15
14
  import { formatColorLabel, formatLogoLabel } from '../../../../utils/onBoarding';
16
15
  import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
17
16
  import Icon from '@mui/material/Icon';
@@ -44,6 +43,12 @@ const classes = {
44
43
  drawerHeaderAction: `${PREFIX}-appearance-drawer-header-action`,
45
44
  drawerContent: `${PREFIX}-appearance-drawer-content`
46
45
  };
46
+ var AppearanceTabType;
47
+ (function (AppearanceTabType) {
48
+ AppearanceTabType["COLOR"] = "color";
49
+ AppearanceTabType["LOGO"] = "logo";
50
+ AppearanceTabType["SLOGAN"] = "slogan";
51
+ })(AppearanceTabType || (AppearanceTabType = {}));
47
52
  const Root = styled(Box, {
48
53
  name: PREFIX,
49
54
  slot: 'AppearanceRoot'
@@ -54,7 +59,7 @@ const DrawerRoot = styled(Drawer, {
54
59
  overridesResolver: (props, styles) => styles.appearanceDrawerRoot
55
60
  })(({ theme }) => ({}));
56
61
  export default function Appearance(inProps) {
57
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
62
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
58
63
  // PROPS
59
64
  const props = useThemeProps({
60
65
  props: inProps,
@@ -62,18 +67,20 @@ export default function Appearance(inProps) {
62
67
  });
63
68
  const { className, onCompleteAction } = props;
64
69
  // STATE
65
- const [state, dispatch] = useReducer(reducer, getInitialState(null));
70
+ const [preferences, setPreferences] = useState([]);
71
+ const [data, setData] = useState({});
72
+ const [loading, setLoading] = useState(true);
66
73
  const [loadingLogo, setLoadingLogo] = useState('');
67
74
  const [anchorEl, setAnchorEl] = useState(null);
68
- const [tab, setTab] = useState(0);
75
+ const [tab, setTab] = useState(AppearanceTabType.COLOR);
69
76
  const [updating, setUpdating] = useState(false);
70
- const [updatingColor, setUpdatingColor] = useState('');
71
77
  const colorRef = useRef(null);
72
78
  // INTL
73
79
  const intl = useIntl();
74
80
  // HANDLERS
75
81
  const handleTabChange = (event, newValue) => {
76
82
  setTab(newValue);
83
+ setData({});
77
84
  };
78
85
  const handleOpen = useCallback((event) => {
79
86
  setAnchorEl(event.currentTarget);
@@ -81,82 +88,58 @@ export default function Appearance(inProps) {
81
88
  const handleClose = useCallback(() => {
82
89
  setAnchorEl(null);
83
90
  }, []);
84
- const fetchColors = () => {
85
- dispatch({ type: actionTypes.LOADING, payload: { loading: true } });
86
- PreferenceService.searchPreferences('', '', `${Preferences.COLORS_COLORBACK},${Preferences.COLORS_COLORPRIMARY},${Preferences.COLORS_COLORSECONDARY},${Preferences.COLORS_NAVBARBACK},${Preferences.COLORS_COLORFONT},${Preferences.COLORS_COLORFONTSECONDARY}`)
87
- .then((res) => {
88
- dispatch({
89
- type: actionTypes.SET_COLORS,
90
- payload: {
91
- loading: false,
92
- colors: res.results
93
- }
94
- });
95
- })
96
- .catch((e) => {
97
- Logger.error(SCOPE_SC_UI, e);
98
- dispatch({ type: actionTypes.SET_COLORS, payload: { loading: false, colors: [] } });
91
+ const handleClosePopover = () => {
92
+ if (colorRef.current) {
93
+ colorRef.current.blur();
94
+ }
95
+ };
96
+ const handleChange = (event) => {
97
+ const { name, value } = event.target;
98
+ setPreferences((prev) => {
99
+ return prev.map((p) => Object.assign({}, p, { value: p.name === name ? value : p.value }));
99
100
  });
101
+ handleDataUpdate(name, value);
100
102
  };
101
- const fetchLogos = () => {
102
- dispatch({ type: actionTypes.LOADING, payload: { loading: true } });
103
- PreferenceService.searchPreferences('', '', `${Preferences.LOGO_NAVBAR_LOGO},${Preferences.LOGO_NAVBAR_LOGO_MOBILE}`)
104
- .then((res) => {
105
- dispatch({
106
- type: actionTypes.SET_LOGOS,
107
- payload: {
108
- loading: false,
109
- logos: res.results
110
- }
111
- });
112
- })
113
- .catch((e) => {
114
- Logger.error(SCOPE_SC_UI, e);
115
- dispatch({ type: actionTypes.SET_LOGOS, payload: { loading: false, logos: [] } });
103
+ const handleColorChange = (newColor, name) => {
104
+ setPreferences((prev) => {
105
+ return prev.map((p) => Object.assign({}, p, { value: p.name === name ? newColor : p.value }));
116
106
  });
107
+ handleDataUpdate(name, newColor);
117
108
  };
118
- const fetchSlogans = () => {
119
- dispatch({ type: actionTypes.LOADING, payload: { loading: true } });
120
- PreferenceService.searchPreferences('', '', `${Preferences.TEXT_APPLICATION_SLOGAN1},${Preferences.TEXT_APPLICATION_SLOGAN2}`)
109
+ const handleDataUpdate = (key, value) => {
110
+ const elementInDict = preferences.filter((p) => p.name === key && p.value === value);
111
+ if (elementInDict.length) {
112
+ const newData = Object.assign({}, data);
113
+ delete newData[key];
114
+ setData(newData);
115
+ }
116
+ else {
117
+ setData((prevData) => (Object.assign(Object.assign({}, prevData), { [key]: value })));
118
+ }
119
+ };
120
+ const fetchPreferences = () => {
121
+ PreferenceService.searchPreferences('', '', `${Preferences.COLORS_COLORBACK},${Preferences.COLORS_COLORPRIMARY},${Preferences.COLORS_COLORSECONDARY},${Preferences.COLORS_NAVBARBACK},${Preferences.COLORS_COLORFONT},${Preferences.COLORS_COLORFONTSECONDARY}, ${Preferences.LOGO_NAVBAR_LOGO},${Preferences.LOGO_NAVBAR_LOGO_MOBILE}, ${Preferences.TEXT_APPLICATION_SLOGAN1},${Preferences.TEXT_APPLICATION_SLOGAN2}`)
121
122
  .then((res) => {
122
- dispatch({
123
- type: actionTypes.SET_SLOGANS,
124
- payload: {
125
- loading: false,
126
- slogans: res.results
127
- }
128
- });
123
+ setPreferences(res.results);
124
+ setLoading(false);
129
125
  })
130
126
  .catch((e) => {
131
127
  Logger.error(SCOPE_SC_UI, e);
132
- dispatch({ type: actionTypes.SET_SLOGANS, payload: { loading: false, slogans: [] } });
128
+ setLoading(false);
133
129
  });
134
130
  };
135
- const updatePreference = (preference) => __awaiter(this, void 0, void 0, function* () {
136
- try {
137
- yield PreferenceService.updatePreferences(preference);
138
- }
139
- catch (e) {
140
- Logger.error(SCOPE_SC_UI, e);
141
- }
142
- finally {
143
- setUpdating(false);
144
- setUpdatingColor('');
145
- onCompleteAction();
146
- }
147
- });
148
- const updateSlogans = () => __awaiter(this, void 0, void 0, function* () {
131
+ const updatePreference = () => __awaiter(this, void 0, void 0, function* () {
149
132
  setUpdating(true);
150
133
  try {
151
- yield Promise.all(state.slogans.map(({ name, value }) => {
152
- return updatePreference({ [name]: value });
153
- }));
134
+ yield PreferenceService.updatePreferences(data);
154
135
  }
155
136
  catch (e) {
156
137
  Logger.error(SCOPE_SC_UI, e);
157
138
  }
158
139
  finally {
159
140
  setUpdating(false);
141
+ setData({});
142
+ onCompleteAction();
160
143
  }
161
144
  });
162
145
  const updateLogoPreference = (name, file) => __awaiter(this, void 0, void 0, function* () {
@@ -166,14 +149,15 @@ export default function Appearance(inProps) {
166
149
  yield PreferenceService.updatePreferences(formData)
167
150
  .then((preference) => {
168
151
  setLoadingLogo('');
169
- dispatch({
170
- type: actionTypes.SET_LOGOS,
171
- payload: { logos: state.logos.map((l) => (l.name === name ? Object.assign(Object.assign({}, l), { value: preference[name].value }) : l)) }
152
+ setData({});
153
+ setPreferences((prev) => {
154
+ return prev.map((p) => Object.assign({}, p, { value: p.name === name ? preference[name].value : p.value }));
172
155
  });
173
156
  onCompleteAction();
174
157
  })
175
158
  .catch((e) => {
176
159
  setLoadingLogo('');
160
+ setData({});
177
161
  Logger.error(SCOPE_SC_UI, e);
178
162
  });
179
163
  });
@@ -189,42 +173,19 @@ export default function Appearance(inProps) {
189
173
  }
190
174
  };
191
175
  useEffect(() => {
192
- fetchColors();
193
- fetchLogos();
194
- fetchSlogans();
176
+ fetchPreferences();
195
177
  }, []);
196
- // HANDLERS
197
- const handleColorChange = (color, name) => {
198
- setUpdatingColor(name);
199
- const currentColor = state.colors.find((col) => col.name === name);
200
- if (currentColor && currentColor.value !== color) {
201
- setUpdating(true);
202
- dispatch({
203
- type: actionTypes.SET_COLORS,
204
- payload: { colors: state.colors.map((col) => (col.name === name ? Object.assign(Object.assign({}, col), { value: color }) : col)) }
205
- });
206
- updatePreference({ [`${name}`]: color });
207
- }
208
- };
209
- const handleChange = (event) => {
210
- const { name, value } = event.target;
211
- dispatch({
212
- type: actionTypes.SET_SLOGANS,
213
- payload: { slogans: state.slogans.map((s) => (s.name === name ? Object.assign(Object.assign({}, s), { value: value }) : s)) }
214
- });
215
- };
216
- const handleClosePopover = () => {
217
- if (colorRef.current) {
218
- colorRef.current.blur();
219
- }
220
- };
221
- return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), _jsx(Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), _jsxs(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [_jsx(Typography, Object.assign({ variant: "h4", color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsxs(Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), _jsx(ScrollContainer, { children: _jsxs(Box, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && (_jsx(_Fragment, { children: state.colors.map((color) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatColorLabel(color) })), _jsxs(Box, Object.assign({ className: classes.colorContainer }, { children: [_jsx(MuiColorInput, { inputRef: colorRef, className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name), isAlphaHidden: true, PopoverProps: { onClose: handleClosePopover } }), updatingColor && updatingColor === color.name && (_jsx(CircularProgress, { className: classes.colorProgress, color: "secondary", size: 24 }))] }))] }, color.id))) })), tab === 1 && (_jsx(_Fragment, { children: state.logos.map((logo) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatLogoLabel(logo.name) })), _jsxs(Box, Object.assign({ className: classes.logoContainer }, { children: [_jsx("img", { src: logo.value, className: classes.logo }), _jsx("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), hidden: true, accept: ".gif,.png,.jpg,.jpeg", id: logo.name }), _jsx(LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => document.getElementById(`${logo.name}`).click(), loading: Boolean(loadingLogo) && Boolean(logo.name === loadingLogo), disabled: Boolean(loadingLogo) && Boolean(logo.name !== loadingLogo) }, { children: _jsx(Icon, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && (_jsxs(Box, { children: [_jsx(TextField, { multiline: true, fullWidth: true,
222
- //className={classes.field}
223
- label: `${intl.formatMessage(messages.titleField)}`, margin: "normal", value: (_a = state === null || state === void 0 ? void 0 : state.slogans[0]) === null || _a === void 0 ? void 0 : _a.value, name: "application_slogan1", onChange: handleChange, InputProps: {
224
- endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_b = state.slogans[0].value) === null || _b === void 0 ? void 0 : _b.length) ? 50 - ((_c = state.slogans[0].value) === null || _c === void 0 ? void 0 : _c.length) : 50 }))
225
- }, error: Boolean(((_e = (_d = state === null || state === void 0 ? void 0 : state.slogans[0]) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.length) > 50) }), _jsx(TextField, { multiline: true, fullWidth: true,
226
- //className={classes.field}
227
- label: `${intl.formatMessage(messages.sloganField)}`, margin: "normal", value: (_f = state === null || state === void 0 ? void 0 : state.slogans[1]) === null || _f === void 0 ? void 0 : _f.value, name: "application_slogan2", onChange: handleChange, InputProps: {
228
- endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_g = state.slogans[1].value) === null || _g === void 0 ? void 0 : _g.length) ? 150 - ((_h = state.slogans[1].value) === null || _h === void 0 ? void 0 : _h.length) : 150 })))
229
- }, error: Boolean(((_k = (_j = state === null || state === void 0 ? void 0 : state.slogans[1]) === null || _j === void 0 ? void 0 : _j.value) === null || _k === void 0 ? void 0 : _k.length) > 150) }), _jsx(LoadingButton, Object.assign({ loading: updating, disabled: updating, variant: "outlined", size: "small", color: "primary", onClick: updateSlogans }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.button", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.button" }) }))] }))] })) })] }))] })));
178
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), _jsx(Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), _jsxs(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [_jsx(Typography, Object.assign({ variant: "h4", color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsxs(Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [_jsx(Tab, { value: AppearanceTabType.COLOR, label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), _jsx(Tab, { value: AppearanceTabType.LOGO, label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), _jsx(Tab, { value: AppearanceTabType.SLOGAN, label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), _jsx(ScrollContainer, { children: _jsxs(Box, Object.assign({ className: classes.drawerContent }, { children: [tab === AppearanceTabType.COLOR && (_jsxs(Box, Object.assign({ className: classes.colorContainer }, { children: [preferences
179
+ .filter((item) => item.section === SCPreferenceSection.COLORS)
180
+ .map((color) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatColorLabel(color) })), _jsx(Box, { children: _jsx(MuiColorInput, { inputRef: colorRef, className: classes.color, format: "hex", value: color.value, onChange: (value) => handleColorChange(value, color.name), isAlphaHidden: true, PopoverProps: { onClose: handleClosePopover } }) })] }, color.id))), _jsx(LoadingButton, Object.assign({ loading: loading || updating, disabled: loading || updating || Object.keys(data).length === 0, variant: "outlined", size: "small", color: "primary", onClick: updatePreference }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.button", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.button" }) }))] }))), tab === AppearanceTabType.LOGO && (_jsx(_Fragment, { children: preferences
181
+ .filter((item) => item.section === SCPreferenceSection.LOGO)
182
+ .map((logo) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatLogoLabel(logo.name) })), _jsxs(Box, Object.assign({ className: classes.logoContainer }, { children: [_jsx("img", { src: logo.value, className: classes.logo }), _jsx("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), hidden: true, accept: ".gif,.png,.jpg,.jpeg", id: logo.name }), _jsx(LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => document.getElementById(`${logo.name}`).click(), loading: Boolean(loadingLogo) && Boolean(logo.name === loadingLogo), disabled: Boolean(loadingLogo) && Boolean(logo.name !== loadingLogo) }, { children: _jsx(Icon, { children: "upload" }) }))] }))] }, logo.id))) })), tab === AppearanceTabType.SLOGAN && (_jsxs(Box, { children: [_jsx(TextField, { multiline: true, fullWidth: true, label: `${intl.formatMessage(messages.titleField)}`, margin: "normal", value: ((_a = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan1')) === null || _a === void 0 ? void 0 : _a.value) || '', name: "application_slogan1", onChange: handleChange, InputProps: {
183
+ endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_c = (_b = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan1')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.length)
184
+ ? 50 - ((_d = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan1')) === null || _d === void 0 ? void 0 : _d.value.length)
185
+ : 50 })))
186
+ }, error: Boolean(((_f = (_e = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan1')) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.length) > 50) }), _jsx(TextField, { multiline: true, fullWidth: true, label: `${intl.formatMessage(messages.sloganField)}`, margin: "normal", value: ((_g = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan2')) === null || _g === void 0 ? void 0 : _g.value) || '', name: "application_slogan2", onChange: handleChange, InputProps: {
187
+ endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_j = (_h = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan2')) === null || _h === void 0 ? void 0 : _h.value) === null || _j === void 0 ? void 0 : _j.length)
188
+ ? 150 - ((_k = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan2')) === null || _k === void 0 ? void 0 : _k.value.length)
189
+ : 150 })))
190
+ }, error: Boolean(((_m = (_l = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan2')) === null || _l === void 0 ? void 0 : _l.value) === null || _m === void 0 ? void 0 : _m.length) > 150) }), _jsx(LoadingButton, Object.assign({ loading: updating, disabled: updating || Object.keys(data).length === 0, variant: "outlined", size: "small", color: "primary", onClick: updatePreference }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.button", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.button" }) }))] }))] })) })] }))] })));
230
191
  }
@@ -175,13 +175,10 @@ export default function PrivateMessageThread(inProps) {
175
175
  * Memoized message recipients ids
176
176
  */
177
177
  const ids = useMemo(() => {
178
- if (recipients && openNewMessage) {
179
- return recipients.map((u) => {
180
- return parseInt(u.id, 10);
181
- });
182
- }
183
- return [recipients];
184
- }, [recipients]);
178
+ if (!recipients)
179
+ return [];
180
+ return Array.isArray(recipients) ? recipients.map((u) => parseInt(u.id, 10)) : [parseInt(recipients.id || recipients, 10)];
181
+ }, [recipients, openNewMessage]);
185
182
  function fetchResults() {
186
183
  setLoading(true);
187
184
  PrivateMessageService.searchUser(value)
@@ -106,11 +106,12 @@ export default function SearchAutocomplete(inProps) {
106
106
  });
107
107
  }
108
108
  const optionLabel = (option) => {
109
+ var _a, _b, _c, _d;
109
110
  switch (option.type) {
110
111
  case SuggestionType.CATEGORY:
111
- return option[option.type]['name_synonyms'] || option[option.type]['name'];
112
+ return `${((_a = option[option.type]) === null || _a === void 0 ? void 0 : _a.name_synonyms) || ''} ${((_b = option[option.type]) === null || _b === void 0 ? void 0 : _b.name) || ''}`.trim();
112
113
  case SuggestionType.USER:
113
- return option[option.type]['username'] && option[option.type]['real_name'];
114
+ return `${((_c = option[option.type]) === null || _c === void 0 ? void 0 : _c.username) || ''} ${((_d = option[option.type]) === null || _d === void 0 ? void 0 : _d.real_name) || ''}`.trim();
114
115
  default:
115
116
  return option[option.type]['name'];
116
117
  }
@@ -10,8 +10,8 @@ const classes = {
10
10
  const Root = styled(AvatarGroup, {
11
11
  name: PREFIX,
12
12
  slot: 'Root',
13
- overridesResolver: (props, styles) => styles.root
14
- })(({ theme }) => ({}));
13
+ overridesResolver: (_props, styles) => styles.root
14
+ })(() => ({}));
15
15
  /**
16
16
  * > API documentation for the Community-JS Avatar Group Skeleton component. Learn about the available props and the CSS API.
17
17
 
@@ -38,7 +38,7 @@ export default function AvatarGroupSkeleton(inProps) {
38
38
  props: inProps,
39
39
  name: PREFIX
40
40
  });
41
- const { className, skeletonsAnimation = 'wave', count = 2 } = props, rest = __rest(props, ["className", "skeletonsAnimation", "count"]);
41
+ const { skeletonsAnimation = 'wave', count = 3 } = props, rest = __rest(props, ["skeletonsAnimation", "count"]);
42
42
  const theme = useTheme();
43
- return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: [...Array(count + 1)].map((x, i) => (_jsx(Avatar, { children: _jsx(Skeleton, { variant: "circular", width: theme.selfcommunity.user.avatar.sizeSmall, height: theme.selfcommunity.user.avatar.sizeSmall, animation: skeletonsAnimation }) }, i))) })));
43
+ return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: [...Array(count)].map((_x, i) => (_jsx(Avatar, { children: _jsx(Skeleton, { variant: "circular", width: theme.selfcommunity.user.avatar.sizeSmall, height: theme.selfcommunity.user.avatar.sizeSmall, animation: skeletonsAnimation }) }, i))) })));
44
44
  }
@@ -23,5 +23,6 @@ export default function Arrow(props) {
23
23
  if (type === 'prev') {
24
24
  return (currentItem > 0 && (_jsx(Button, Object.assign({ variant: "contained", className: className, size: "medium", onClick: () => handleChange('prev') }, { children: _jsx(Icon, { children: "chevron_left" }) }))));
25
25
  }
26
- return (currentItem < itemsLength - 1 && (_jsx(Button, Object.assign({ variant: "contained", className: className, size: "medium", onClick: () => handleChange('next') }, { children: _jsx(Icon, { children: "chevron_right" }) }))));
26
+ return (itemsLength > 2 &&
27
+ currentItem < itemsLength - 1 && (_jsx(Button, Object.assign({ variant: "contained", className: className, size: "medium", onClick: () => handleChange('next') }, { children: _jsx(Icon, { children: "chevron_right" }) }))));
27
28
  }
@@ -0,0 +1,44 @@
1
+ import { TextFieldProps } from '@mui/material/TextField';
2
+ import { AutocompleteProps } from '@mui/material';
3
+ import { SCTagType } from '@selfcommunity/types/src/index';
4
+ import { TagChipProps } from '../../shared/TagChip';
5
+ export interface TagAutocompleteProps extends Pick<AutocompleteProps<SCTagType | null, any, any, any>, Exclude<keyof AutocompleteProps<SCTagType | null, any, any, any>, 'open' | 'onOpen' | 'onClose' | 'onChange' | 'filterSelectedOptions' | 'disableCloseOnSelect' | 'options' | 'getOptionLabel' | 'value' | 'selectOnFocus' | 'clearOnBlur' | 'blurOnSelect' | 'handleHomeEndKeys' | 'noOptionsText' | 'isOptionEqualToValue' | 'renderTags' | 'renderOption' | 'renderInput'>> {
6
+ defaultValue: SCTagType[] | any;
7
+ /**
8
+ * The props applied to text field
9
+ * @default {variant: 'outlined, label: tags_label}
10
+ */
11
+ TextFieldProps?: TextFieldProps;
12
+ /**
13
+ * The props to spread to TagChip component
14
+ */
15
+ TagChipProps?: Pick<TagChipProps, Exclude<keyof TagChipProps, 'tag'>>;
16
+ /**
17
+ * Callback for change event on poll object
18
+ * @param value
19
+ */
20
+ onChange?: (value: any) => void;
21
+ }
22
+ /**
23
+ * > API documentation for the Community-JS Tag Autocomplete component. Learn about the available props and the CSS API.
24
+ *
25
+ *
26
+ * This component renders a bar that allows users to search (with autocomplete) for all the tags available in the application.
27
+ *
28
+ * #### Import
29
+ * ```jsx
30
+ * import {TagAutocomplete} from '@selfcommunity/react-ui';
31
+ * ```
32
+ * #### Component Name
33
+ * The name `SCTagAutocomplete` can be used when providing style overrides in the theme.
34
+ *
35
+ * #### CSS
36
+ *
37
+ * |Rule Name|Global class|Description|
38
+ * |---|---|---|
39
+ * |root|.SCTagAutocomplete-root|Styles applied to the root element.|
40
+ *
41
+ * @param inProps
42
+ */
43
+ declare const TagAutocomplete: (inProps: TagAutocompleteProps) => JSX.Element;
44
+ export default TagAutocomplete;