@selfcommunity/react-ui 0.7.0-alpha.124 → 0.7.0-alpha.126
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/NavigationSettingsIconButton/NavigationSettingsIconButton.d.ts +39 -0
- package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.d.ts.map +1 -0
- package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +235 -0
- package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js.map +1 -0
- package/lib/cjs/components/NavigationSettingsIconButton/index.d.ts +4 -0
- package/lib/cjs/components/NavigationSettingsIconButton/index.d.ts.map +1 -0
- package/lib/cjs/components/NavigationSettingsIconButton/index.js +8 -0
- package/lib/cjs/components/NavigationSettingsIconButton/index.js.map +1 -0
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts.map +1 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +3 -11
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js.map +1 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts.map +1 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -22
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js.map +1 -1
- package/lib/cjs/components/SearchDialog/SearchDialog.d.ts.map +1 -1
- package/lib/cjs/components/SearchDialog/SearchDialog.js.map +1 -1
- package/lib/cjs/components/User/User.js +1 -1
- package/lib/cjs/components/User/User.js.map +1 -1
- package/lib/cjs/components/UserActionIconButton/UserActionIconButton.d.ts +39 -0
- package/lib/cjs/components/UserActionIconButton/UserActionIconButton.d.ts.map +1 -0
- package/lib/cjs/components/UserActionIconButton/UserActionIconButton.js +179 -0
- package/lib/cjs/components/UserActionIconButton/UserActionIconButton.js.map +1 -0
- package/lib/cjs/components/UserActionIconButton/index.d.ts +4 -0
- package/lib/cjs/components/UserActionIconButton/index.d.ts.map +1 -0
- package/lib/cjs/components/UserActionIconButton/index.js +8 -0
- package/lib/cjs/components/UserActionIconButton/index.js.map +1 -0
- package/lib/cjs/components/UserCounters/UserCounters.d.ts +48 -0
- package/lib/cjs/components/UserCounters/UserCounters.d.ts.map +1 -0
- package/lib/cjs/components/UserCounters/UserCounters.js +121 -0
- package/lib/cjs/components/UserCounters/UserCounters.js.map +1 -0
- package/lib/cjs/components/UserCounters/index.d.ts +4 -0
- package/lib/cjs/components/UserCounters/index.d.ts.map +1 -0
- package/lib/cjs/components/UserCounters/index.js +8 -0
- package/lib/cjs/components/UserCounters/index.js.map +1 -0
- package/lib/cjs/components/UserInfo/Skeleton.d.ts.map +1 -0
- package/lib/cjs/components/{UserProfileInfo → UserInfo}/Skeleton.js +8 -7
- package/lib/cjs/components/UserInfo/Skeleton.js.map +1 -0
- package/lib/cjs/components/{UserProfileInfo/UserProfileInfo.d.ts → UserInfo/UserInfo.d.ts} +13 -8
- package/lib/cjs/components/UserInfo/UserInfo.d.ts.map +1 -0
- package/lib/cjs/components/UserInfo/UserInfo.js +190 -0
- package/lib/cjs/components/UserInfo/UserInfo.js.map +1 -0
- package/lib/cjs/components/UserInfo/index.d.ts +5 -0
- package/lib/cjs/components/UserInfo/index.d.ts.map +1 -0
- package/lib/cjs/components/{UserProfileInfo → UserInfo}/index.js +4 -4
- package/lib/cjs/components/UserInfo/index.js.map +1 -0
- package/lib/cjs/components/UserInfoDialog/UserInfoDialog.d.ts +22 -0
- package/lib/cjs/components/UserInfoDialog/UserInfoDialog.d.ts.map +1 -0
- package/lib/cjs/components/UserInfoDialog/UserInfoDialog.js +76 -0
- package/lib/cjs/components/UserInfoDialog/UserInfoDialog.js.map +1 -0
- package/lib/cjs/components/UserInfoDialog/index.d.ts +4 -0
- package/lib/cjs/components/UserInfoDialog/index.d.ts.map +1 -0
- package/lib/cjs/components/UserInfoDialog/index.js +8 -0
- package/lib/cjs/components/UserInfoDialog/index.js.map +1 -0
- package/lib/cjs/components/UserProfileEdit/Section/PublicInfo.js +4 -4
- package/lib/cjs/components/UserProfileEdit/Section/PublicInfo.js.map +1 -1
- package/lib/cjs/components/UserProfileEdit/UserProfileEdit.d.ts.map +1 -1
- package/lib/cjs/components/UserProfileEdit/UserProfileEdit.js +20 -25
- package/lib/cjs/components/UserProfileEdit/UserProfileEdit.js.map +1 -1
- package/lib/cjs/components/UserProfileHeader/Skeleton.d.ts.map +1 -1
- package/lib/cjs/components/UserProfileHeader/Skeleton.js +1 -1
- package/lib/cjs/components/UserProfileHeader/Skeleton.js.map +1 -1
- package/lib/cjs/components/UserProfileHeader/UserProfileHeader.d.ts +1 -1
- package/lib/cjs/components/UserProfileHeader/UserProfileHeader.d.ts.map +1 -1
- package/lib/cjs/components/UserProfileHeader/UserProfileHeader.js +3 -38
- package/lib/cjs/components/UserProfileHeader/UserProfileHeader.js.map +1 -1
- package/lib/cjs/constants/UserProfile.d.ts.map +1 -1
- package/lib/cjs/constants/UserProfile.js +2 -4
- package/lib/cjs/constants/UserProfile.js.map +1 -1
- package/lib/cjs/index.d.ts +7 -2
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +17 -7
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/shared/BaseDialog/BaseDialog.d.ts +5 -0
- package/lib/cjs/shared/BaseDialog/BaseDialog.d.ts.map +1 -1
- package/lib/cjs/shared/BaseDialog/BaseDialog.js +2 -1
- package/lib/cjs/shared/BaseDialog/BaseDialog.js.map +1 -1
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.d.ts +39 -0
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.d.ts.map +1 -0
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +206 -0
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js.map +1 -0
- package/lib/esm/components/NavigationSettingsIconButton/index.d.ts +4 -0
- package/lib/esm/components/NavigationSettingsIconButton/index.d.ts.map +1 -0
- package/lib/esm/components/NavigationSettingsIconButton/index.js +3 -0
- package/lib/esm/components/NavigationSettingsIconButton/index.js.map +1 -0
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts.map +1 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +3 -11
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js.map +1 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts.map +1 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -22
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js.map +1 -1
- package/lib/esm/components/SearchDialog/SearchDialog.d.ts.map +1 -1
- package/lib/esm/components/SearchDialog/SearchDialog.js.map +1 -1
- package/lib/esm/components/User/User.js +2 -2
- package/lib/esm/components/User/User.js.map +1 -1
- package/lib/esm/components/UserActionIconButton/UserActionIconButton.d.ts +39 -0
- package/lib/esm/components/UserActionIconButton/UserActionIconButton.d.ts.map +1 -0
- package/lib/esm/components/UserActionIconButton/UserActionIconButton.js +150 -0
- package/lib/esm/components/UserActionIconButton/UserActionIconButton.js.map +1 -0
- package/lib/esm/components/UserActionIconButton/index.d.ts +4 -0
- package/lib/esm/components/UserActionIconButton/index.d.ts.map +1 -0
- package/lib/esm/components/UserActionIconButton/index.js +3 -0
- package/lib/esm/components/UserActionIconButton/index.js.map +1 -0
- package/lib/esm/components/UserCounters/UserCounters.d.ts +48 -0
- package/lib/esm/components/UserCounters/UserCounters.d.ts.map +1 -0
- package/lib/esm/components/UserCounters/UserCounters.js +92 -0
- package/lib/esm/components/UserCounters/UserCounters.js.map +1 -0
- package/lib/esm/components/UserCounters/index.d.ts +4 -0
- package/lib/esm/components/UserCounters/index.d.ts.map +1 -0
- package/lib/esm/components/UserCounters/index.js +3 -0
- package/lib/esm/components/UserCounters/index.js.map +1 -0
- package/lib/esm/components/UserInfo/Skeleton.d.ts.map +1 -0
- package/lib/esm/components/{UserProfileInfo → UserInfo}/Skeleton.js +9 -8
- package/lib/esm/components/UserInfo/Skeleton.js.map +1 -0
- package/lib/esm/components/{UserProfileInfo/UserProfileInfo.d.ts → UserInfo/UserInfo.d.ts} +13 -8
- package/lib/esm/components/UserInfo/UserInfo.d.ts.map +1 -0
- package/lib/esm/components/UserInfo/UserInfo.js +161 -0
- package/lib/esm/components/UserInfo/UserInfo.js.map +1 -0
- package/lib/esm/components/UserInfo/index.d.ts +5 -0
- package/lib/esm/components/UserInfo/index.d.ts.map +1 -0
- package/lib/esm/components/UserInfo/index.js +5 -0
- package/lib/esm/components/UserInfo/index.js.map +1 -0
- package/lib/esm/components/UserInfoDialog/UserInfoDialog.d.ts +22 -0
- package/lib/esm/components/UserInfoDialog/UserInfoDialog.d.ts.map +1 -0
- package/lib/esm/components/UserInfoDialog/UserInfoDialog.js +47 -0
- package/lib/esm/components/UserInfoDialog/UserInfoDialog.js.map +1 -0
- package/lib/esm/components/UserInfoDialog/index.d.ts +4 -0
- package/lib/esm/components/UserInfoDialog/index.d.ts.map +1 -0
- package/lib/esm/components/UserInfoDialog/index.js +3 -0
- package/lib/esm/components/UserInfoDialog/index.js.map +1 -0
- package/lib/esm/components/UserProfileEdit/Section/PublicInfo.js +4 -4
- package/lib/esm/components/UserProfileEdit/Section/PublicInfo.js.map +1 -1
- package/lib/esm/components/UserProfileEdit/UserProfileEdit.d.ts.map +1 -1
- package/lib/esm/components/UserProfileEdit/UserProfileEdit.js +21 -26
- package/lib/esm/components/UserProfileEdit/UserProfileEdit.js.map +1 -1
- package/lib/esm/components/UserProfileHeader/Skeleton.d.ts.map +1 -1
- package/lib/esm/components/UserProfileHeader/Skeleton.js +1 -1
- package/lib/esm/components/UserProfileHeader/Skeleton.js.map +1 -1
- package/lib/esm/components/UserProfileHeader/UserProfileHeader.d.ts +1 -1
- package/lib/esm/components/UserProfileHeader/UserProfileHeader.d.ts.map +1 -1
- package/lib/esm/components/UserProfileHeader/UserProfileHeader.js +3 -38
- package/lib/esm/components/UserProfileHeader/UserProfileHeader.js.map +1 -1
- package/lib/esm/constants/UserProfile.d.ts.map +1 -1
- package/lib/esm/constants/UserProfile.js +2 -4
- package/lib/esm/constants/UserProfile.js.map +1 -1
- package/lib/esm/index.d.ts +7 -2
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +8 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/shared/BaseDialog/BaseDialog.d.ts +5 -0
- package/lib/esm/shared/BaseDialog/BaseDialog.d.ts.map +1 -1
- package/lib/esm/shared/BaseDialog/BaseDialog.js +2 -1
- package/lib/esm/shared/BaseDialog/BaseDialog.js.map +1 -1
- package/lib/umd/react-ui.js +2 -2
- package/lib/umd/react-ui.js.map +1 -1
- package/package.json +4 -4
- package/lib/cjs/components/NavigationToolbar/SettingsMenu.d.ts +0 -4
- package/lib/cjs/components/NavigationToolbar/SettingsMenu.d.ts.map +0 -1
- package/lib/cjs/components/NavigationToolbar/SettingsMenu.js +0 -133
- package/lib/cjs/components/NavigationToolbar/SettingsMenu.js.map +0 -1
- package/lib/cjs/components/NavigationToolbarMobile/SettingsDrawer.d.ts +0 -4
- package/lib/cjs/components/NavigationToolbarMobile/SettingsDrawer.d.ts.map +0 -1
- package/lib/cjs/components/NavigationToolbarMobile/SettingsDrawer.js +0 -147
- package/lib/cjs/components/NavigationToolbarMobile/SettingsDrawer.js.map +0 -1
- package/lib/cjs/components/UserProfileInfo/Skeleton.d.ts.map +0 -1
- package/lib/cjs/components/UserProfileInfo/Skeleton.js.map +0 -1
- package/lib/cjs/components/UserProfileInfo/UserProfileInfo.d.ts.map +0 -1
- package/lib/cjs/components/UserProfileInfo/UserProfileInfo.js +0 -246
- package/lib/cjs/components/UserProfileInfo/UserProfileInfo.js.map +0 -1
- package/lib/cjs/components/UserProfileInfo/index.d.ts +0 -5
- package/lib/cjs/components/UserProfileInfo/index.d.ts.map +0 -1
- package/lib/cjs/components/UserProfileInfo/index.js.map +0 -1
- package/lib/esm/components/NavigationToolbar/SettingsMenu.d.ts +0 -4
- package/lib/esm/components/NavigationToolbar/SettingsMenu.d.ts.map +0 -1
- package/lib/esm/components/NavigationToolbar/SettingsMenu.js +0 -107
- package/lib/esm/components/NavigationToolbar/SettingsMenu.js.map +0 -1
- package/lib/esm/components/NavigationToolbarMobile/SettingsDrawer.d.ts +0 -4
- package/lib/esm/components/NavigationToolbarMobile/SettingsDrawer.d.ts.map +0 -1
- package/lib/esm/components/NavigationToolbarMobile/SettingsDrawer.js +0 -121
- package/lib/esm/components/NavigationToolbarMobile/SettingsDrawer.js.map +0 -1
- package/lib/esm/components/UserProfileInfo/Skeleton.d.ts.map +0 -1
- package/lib/esm/components/UserProfileInfo/Skeleton.js.map +0 -1
- package/lib/esm/components/UserProfileInfo/UserProfileInfo.d.ts.map +0 -1
- package/lib/esm/components/UserProfileInfo/UserProfileInfo.js +0 -217
- package/lib/esm/components/UserProfileInfo/UserProfileInfo.js.map +0 -1
- package/lib/esm/components/UserProfileInfo/index.d.ts +0 -5
- package/lib/esm/components/UserProfileInfo/index.d.ts.map +0 -1
- package/lib/esm/components/UserProfileInfo/index.js +0 -5
- package/lib/esm/components/UserProfileInfo/index.js.map +0 -1
- /package/lib/cjs/components/{UserProfileInfo → UserInfo}/Skeleton.d.ts +0 -0
- /package/lib/esm/components/{UserProfileInfo → UserInfo}/Skeleton.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selfcommunity/react-ui",
|
|
3
|
-
"version": "0.7.0-alpha.
|
|
3
|
+
"version": "0.7.0-alpha.126",
|
|
4
4
|
"description": "React UI Components to integrate a Community created with SelfCommunity.",
|
|
5
5
|
"author": "SelfCommunity <https://www.selfcommunity.com>",
|
|
6
6
|
"homepage": "https://www.selfcommunity.com",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@rpldy/upload-preview": "^1.3.1",
|
|
69
69
|
"@rpldy/uploady": "^1.3.1",
|
|
70
70
|
"@selfcommunity/api-services": "^0.3.6-alpha.18",
|
|
71
|
-
"@selfcommunity/react-core": "^0.
|
|
72
|
-
"@selfcommunity/react-i18n": "^0.
|
|
71
|
+
"@selfcommunity/react-core": "^0.4.0-alpha.0",
|
|
72
|
+
"@selfcommunity/react-i18n": "^0.5.0-alpha.0",
|
|
73
73
|
"@selfcommunity/types": "^0.4.1-alpha.9",
|
|
74
74
|
"@selfcommunity/utils": "^0.1.44-alpha.1",
|
|
75
75
|
"@types/classnames": "^2.3.1",
|
|
@@ -158,5 +158,5 @@
|
|
|
158
158
|
"bugs": {
|
|
159
159
|
"url": "https://github.com/selfcommunity/community-js/issues"
|
|
160
160
|
},
|
|
161
|
-
"gitHead": "
|
|
161
|
+
"gitHead": "5322b39c7ce0da16615ee93c105eb849e320491f"
|
|
162
162
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/NavigationToolbar/SettingsMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,SAAS,EAAS,MAAM,eAAe,CAAC;AAqCzE,oBAAY,iBAAiB,GAAG,SAAS,CAAC;AAQ1C,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,OAAO,EAAE,iBAAiB,eA+J9D"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
const material_1 = require("@mui/material");
|
|
38
|
-
const react_core_1 = require("@selfcommunity/react-core");
|
|
39
|
-
const react_intl_1 = require("react-intl");
|
|
40
|
-
const react_1 = __importStar(require("react"));
|
|
41
|
-
const system_1 = require("@mui/system");
|
|
42
|
-
const api_services_1 = require("@selfcommunity/api-services");
|
|
43
|
-
const PREFIX = 'SCSettingMenu';
|
|
44
|
-
const classes = {
|
|
45
|
-
root: `${PREFIX}-root`,
|
|
46
|
-
paper: `${PREFIX}-paper`,
|
|
47
|
-
item: `${PREFIX}-item`
|
|
48
|
-
};
|
|
49
|
-
const Root = (0, material_1.styled)(material_1.Menu, {
|
|
50
|
-
name: PREFIX,
|
|
51
|
-
slot: 'Root',
|
|
52
|
-
overridesResolver: (props, styles) => styles.root
|
|
53
|
-
})(({ theme }) => ({
|
|
54
|
-
[`& .${classes.paper}`]: {
|
|
55
|
-
minWidth: 370,
|
|
56
|
-
padding: theme.spacing(2)
|
|
57
|
-
},
|
|
58
|
-
[`& .${classes.item}`]: {}
|
|
59
|
-
}));
|
|
60
|
-
const PREFERENCES = [
|
|
61
|
-
react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED,
|
|
62
|
-
react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED,
|
|
63
|
-
react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED
|
|
64
|
-
];
|
|
65
|
-
function SettingsMenu(inProps) {
|
|
66
|
-
// PROPS
|
|
67
|
-
const props = (0, system_1.useThemeProps)({
|
|
68
|
-
props: inProps,
|
|
69
|
-
name: PREFIX
|
|
70
|
-
});
|
|
71
|
-
const { PaperProps = { className: classes.paper } } = props, rest = __rest(props, ["PaperProps"]);
|
|
72
|
-
// CONTEXT
|
|
73
|
-
const scUserContext = (0, react_core_1.useSCUser)();
|
|
74
|
-
const roles = scUserContext.user && scUserContext.user.role;
|
|
75
|
-
const isAdmin = roles && roles.includes('admin');
|
|
76
|
-
const isModerator = roles && roles.includes('moderator');
|
|
77
|
-
// HOOKS
|
|
78
|
-
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
79
|
-
// PREFERENCES
|
|
80
|
-
const scPreferences = (0, react_core_1.useSCPreferences)();
|
|
81
|
-
const preferences = (0, react_1.useMemo)(() => {
|
|
82
|
-
const _preferences = {};
|
|
83
|
-
PREFERENCES.map((p) => (_preferences[p] = p in scPreferences.preferences ? scPreferences.preferences[p].value : null));
|
|
84
|
-
return _preferences;
|
|
85
|
-
}, [scPreferences.preferences]);
|
|
86
|
-
/**
|
|
87
|
-
* Fetches paltform url
|
|
88
|
-
* @param query
|
|
89
|
-
*/
|
|
90
|
-
const fetchPlatform = (query) => {
|
|
91
|
-
api_services_1.UserService.getCurrentUserPlatform(query).then((res) => {
|
|
92
|
-
const platformUrl = res.platform_url;
|
|
93
|
-
window.open(platformUrl, '_blank').focus();
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
const handleLogout = () => {
|
|
97
|
-
scUserContext.logout();
|
|
98
|
-
};
|
|
99
|
-
return (react_1.default.createElement(Root, Object.assign({ className: classes.root, PaperProps: PaperProps }, rest),
|
|
100
|
-
react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "profile", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) },
|
|
101
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.profile", defaultMessage: "ui.appBar.navigation.settings.menuItem.profile" })),
|
|
102
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && (react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "followings", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWINGS_ROUTE_NAME, scUserContext.user) },
|
|
103
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.followings", defaultMessage: "ui.appBar.navigation.settings.menuItem.followings" }))),
|
|
104
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && (react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "followers", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWERS_ROUTE_NAME, scUserContext.user) },
|
|
105
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.followers", defaultMessage: "ui.appBar.navigation.settings.menuItem.followers" }))),
|
|
106
|
-
!preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && (react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "connections", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_CONNECTIONS_ROUTE_NAME, scUserContext.user) },
|
|
107
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.connections", defaultMessage: "ui.appBar.navigation.settings.menuItem.connections" }))),
|
|
108
|
-
scPreferences.features.includes(react_core_1.SCFeatures.LOYALTY) && (react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "loyaltyProgram", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.LOYALTY_ROUTE_NAME, {}) },
|
|
109
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.loyalty", defaultMessage: "ui.appBar.navigation.settings.menuItem.loyalty" }))),
|
|
110
|
-
react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "suggestedPeople", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.PEOPLE_SUGGESTION_ROUTE_NAME, {}) },
|
|
111
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.interestingPeople", defaultMessage: "ui.appBar.navigation.settings.menuItem.interestingPeople" })),
|
|
112
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] && (react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "followedPosts", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME, scUserContext.user) },
|
|
113
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.postsFollowed", defaultMessage: "ui.appBar.navigation.settings.menuItem.postsFollowed" }))),
|
|
114
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] && (react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "followedDiscussions", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) },
|
|
115
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.discussionsFollowed", defaultMessage: "ui.appBar.navigation.settings.menuItem.discussionsFollowed" }))),
|
|
116
|
-
react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "privateMessages", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}) },
|
|
117
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.privateMessages", defaultMessage: "ui.appBar.navigation.settings.menuItem.privateMessages" })),
|
|
118
|
-
isAdmin && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
119
|
-
react_1.default.createElement(material_1.Divider, null),
|
|
120
|
-
react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "platform", onClick: () => fetchPlatform('') },
|
|
121
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.platform", defaultMessage: "ui.appBar.navigation.settings.menuItem.platform" })))),
|
|
122
|
-
(isModerator || isAdmin) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
123
|
-
react_1.default.createElement(material_1.Divider, null),
|
|
124
|
-
react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "moderation", onClick: () => fetchPlatform('/moderation') },
|
|
125
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.moderation", defaultMessage: "ui.appBar.navigation.settings.menuItem.moderation" })))),
|
|
126
|
-
react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "settings", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_SETTINGS_ROUTE_NAME, scUserContext.user) },
|
|
127
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.settings", defaultMessage: "ui.appBar.navigation.settings.menuItem.settings" })),
|
|
128
|
-
react_1.default.createElement(material_1.Divider, null),
|
|
129
|
-
react_1.default.createElement(material_1.MenuItem, { className: classes.item, key: "logout", onClick: handleLogout },
|
|
130
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.logout", defaultMessage: "ui.appBar.navigation.settings.menuItem.logout" }))));
|
|
131
|
-
}
|
|
132
|
-
exports.default = SettingsMenu;
|
|
133
|
-
//# sourceMappingURL=SettingsMenu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsMenu.js","sourceRoot":"","sources":["../../../../src/components/NavigationToolbar/SettingsMenu.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAyE;AACzE,0DAWmC;AACnC,2CAA4C;AAC5C,+CAAqC;AACrC,wCAA0C;AAC1C,8DAAwD;AAExD,MAAM,MAAM,GAAG,eAAe,CAAC;AAE/B,MAAM,OAAO,GAAG;IACd,IAAI,EAAE,GAAG,MAAM,OAAO;IACtB,KAAK,EAAE,GAAG,MAAM,QAAQ;IACxB,IAAI,EAAE,GAAG,MAAM,OAAO;CACvB,CAAC;AACF,MAAM,IAAI,GAAG,IAAA,iBAAM,EAAC,eAAI,EAAE;IACxB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI;CAClD,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,CAAC;IACf,CAAC,MAAM,OAAO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NavigationToolbarMobile/SettingsDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAqCrH,oBAAY,mBAAmB,GAAG,oBAAoB,CAAC;AAQvD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,OAAO,EAAE,mBAAmB,eAiKlE"}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
const material_1 = require("@mui/material");
|
|
38
|
-
const react_core_1 = require("@selfcommunity/react-core");
|
|
39
|
-
const react_intl_1 = require("react-intl");
|
|
40
|
-
const react_1 = __importStar(require("react"));
|
|
41
|
-
const system_1 = require("@mui/system");
|
|
42
|
-
const api_services_1 = require("@selfcommunity/api-services");
|
|
43
|
-
const PREFIX = 'SCSettingDrawer';
|
|
44
|
-
const classes = {
|
|
45
|
-
root: `${PREFIX}-root`,
|
|
46
|
-
paper: `${PREFIX}-paper`,
|
|
47
|
-
item: `${PREFIX}-item`
|
|
48
|
-
};
|
|
49
|
-
const Root = (0, material_1.styled)(material_1.SwipeableDrawer, {
|
|
50
|
-
name: PREFIX,
|
|
51
|
-
slot: 'Root',
|
|
52
|
-
overridesResolver: (props, styles) => styles.root
|
|
53
|
-
})(({ theme }) => ({
|
|
54
|
-
[`& .${classes.paper}`]: {
|
|
55
|
-
borderTopLeftRadius: theme.shape.borderRadius,
|
|
56
|
-
borderTopRightRadius: theme.shape.borderRadius
|
|
57
|
-
},
|
|
58
|
-
[`& .${classes.item}`]: {}
|
|
59
|
-
}));
|
|
60
|
-
const PREFERENCES = [
|
|
61
|
-
react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED,
|
|
62
|
-
react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED,
|
|
63
|
-
react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED
|
|
64
|
-
];
|
|
65
|
-
function SettingsDrawer(inProps) {
|
|
66
|
-
// PROPS
|
|
67
|
-
const props = (0, system_1.useThemeProps)({
|
|
68
|
-
props: inProps,
|
|
69
|
-
name: PREFIX
|
|
70
|
-
});
|
|
71
|
-
const { PaperProps = { className: classes.paper } } = props, rest = __rest(props, ["PaperProps"]);
|
|
72
|
-
// CONTEXT
|
|
73
|
-
const scUserContext = (0, react_core_1.useSCUser)();
|
|
74
|
-
const roles = scUserContext.user && scUserContext.user.role;
|
|
75
|
-
const isAdmin = roles && roles.includes('admin');
|
|
76
|
-
const isModerator = roles && roles.includes('moderator');
|
|
77
|
-
// HOOKS
|
|
78
|
-
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
79
|
-
// PREFERENCES
|
|
80
|
-
const scPreferences = (0, react_core_1.useSCPreferences)();
|
|
81
|
-
const preferences = (0, react_1.useMemo)(() => {
|
|
82
|
-
const _preferences = {};
|
|
83
|
-
PREFERENCES.map((p) => (_preferences[p] = p in scPreferences.preferences ? scPreferences.preferences[p].value : null));
|
|
84
|
-
return _preferences;
|
|
85
|
-
}, [scPreferences.preferences]);
|
|
86
|
-
/**
|
|
87
|
-
* Fetches paltform url
|
|
88
|
-
* @param query
|
|
89
|
-
*/
|
|
90
|
-
const fetchPlatform = (query) => {
|
|
91
|
-
api_services_1.UserService.getCurrentUserPlatform(query).then((res) => {
|
|
92
|
-
const platformUrl = res.platform_url;
|
|
93
|
-
window.open(platformUrl, '_blank').focus();
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
const handleLogout = () => {
|
|
97
|
-
scUserContext.logout();
|
|
98
|
-
};
|
|
99
|
-
return (react_1.default.createElement(Root, Object.assign({ className: classes.root, PaperProps: PaperProps }, rest),
|
|
100
|
-
react_1.default.createElement(material_1.List, null,
|
|
101
|
-
react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "profile" },
|
|
102
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) },
|
|
103
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.profile", defaultMessage: "ui.appBar.navigation.settings.menuItem.profile" }))),
|
|
104
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && (react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "followings" },
|
|
105
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWINGS_ROUTE_NAME, scUserContext.user) },
|
|
106
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.followings", defaultMessage: "ui.appBar.navigation.settings.menuItem.followings" })))),
|
|
107
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && (react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "followers" },
|
|
108
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWERS_ROUTE_NAME, scUserContext.user) },
|
|
109
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.followers", defaultMessage: "ui.appBar.navigation.settings.menuItem.followers" })))),
|
|
110
|
-
!preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && (react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "connections" },
|
|
111
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_CONNECTIONS_ROUTE_NAME, scUserContext.user) },
|
|
112
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.connections", defaultMessage: "ui.appBar.navigation.settings.menuItem.connections" })))),
|
|
113
|
-
scPreferences.features.includes(react_core_1.SCFeatures.LOYALTY) && (react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "loyaltyProgram" },
|
|
114
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.LOYALTY_ROUTE_NAME, {}) },
|
|
115
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.loyalty", defaultMessage: "ui.appBar.navigation.settings.menuItem.loyalty" })))),
|
|
116
|
-
react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "suggestedPeople" },
|
|
117
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.PEOPLE_SUGGESTION_ROUTE_NAME, {}) },
|
|
118
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.interestingPeople", defaultMessage: "ui.appBar.navigation.settings.menuItem.interestingPeople" }))),
|
|
119
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] && (react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "followedPosts" },
|
|
120
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME, scUserContext.user) },
|
|
121
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.postsFollowed", defaultMessage: "ui.appBar.navigation.settings.menuItem.postsFollowed" })))),
|
|
122
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] && (react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "followedDiscussions" },
|
|
123
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) },
|
|
124
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.discussionsFollowed", defaultMessage: "ui.appBar.navigation.settings.menuItem.discussionsFollowed" })))),
|
|
125
|
-
react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "privateMessages" },
|
|
126
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}) },
|
|
127
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.privateMessages", defaultMessage: "ui.appBar.navigation.settings.menuItem.privateMessages" }))),
|
|
128
|
-
isAdmin && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
129
|
-
react_1.default.createElement(material_1.Divider, null),
|
|
130
|
-
react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "platform" },
|
|
131
|
-
react_1.default.createElement(material_1.ListItemButton, { onClick: () => fetchPlatform('') },
|
|
132
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.platform", defaultMessage: "ui.appBar.navigation.settings.menuItem.platform" }))))),
|
|
133
|
-
(isModerator || isAdmin) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
134
|
-
react_1.default.createElement(material_1.Divider, null),
|
|
135
|
-
react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "moderation" },
|
|
136
|
-
react_1.default.createElement(material_1.ListItemButton, { onClick: () => fetchPlatform('/moderation') },
|
|
137
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.moderation", defaultMessage: "ui.appBar.navigation.settings.menuItem.moderation" }))))),
|
|
138
|
-
react_1.default.createElement(material_1.ListItem, { className: classes.item, key: "settings" },
|
|
139
|
-
react_1.default.createElement(material_1.ListItemButton, { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_SETTINGS_ROUTE_NAME, scUserContext.user) },
|
|
140
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.settings", defaultMessage: "ui.appBar.navigation.settings.menuItem.settings" }))),
|
|
141
|
-
react_1.default.createElement(material_1.Divider, null),
|
|
142
|
-
react_1.default.createElement(material_1.ListItem, { className: classes.item },
|
|
143
|
-
react_1.default.createElement(material_1.ListItemButton, { onClick: handleLogout },
|
|
144
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.settings.menuItem.logout", defaultMessage: "ui.appBar.navigation.settings.menuItem.logout" }))))));
|
|
145
|
-
}
|
|
146
|
-
exports.default = SettingsDrawer;
|
|
147
|
-
//# sourceMappingURL=SettingsDrawer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsDrawer.js","sourceRoot":"","sources":["../../../../src/components/NavigationToolbarMobile/SettingsDrawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAqH;AACrH,0DAWmC;AACnC,2CAA4C;AAC5C,+CAAqC;AACrC,wCAA0C;AAC1C,8DAAwD;AAExD,MAAM,MAAM,GAAG,iBAAiB,CAAC;AAEjC,MAAM,OAAO,GAAG;IACd,IAAI,EAAE,GAAG,MAAM,OAAO;IACtB,KAAK,EAAE,GAAG,MAAM,QAAQ;IACxB,IAAI,EAAE,GAAG,MAAM,OAAO;CACvB,CAAC;AACF,MAAM,IAAI,GAAG,IAAA,iBAAM,EAAC,0BAAe,EAAE;IACnC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI;CAClD,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,CAAC;IACf,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE;QACvB,mBAAmB,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY;QAC7C,o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,SAAS,EAAE,OAAO,CAAC,IAAI;gBAC/B,8BAAC,yBAAc,IAAC,OAAO,EAAE,YAAY;oBACnC,8BAAC,6BAAgB,IAAC,EAAE,EAAC,+CAA+C,EAAC,cAAc,EAAC,+CAA+C,GAAG,CACvH,CACR,CACN,CACF,CACR,CAAC;AACJ,CAAC;AAjKD,iCAiKC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../../src/components/UserProfileInfo/Skeleton.tsx"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iBAAS,uBAAuB,IAAI,GAAG,CAAC,OAAO,CAW9C;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../../../../src/components/UserProfileInfo/Skeleton.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,4CAAwC;AACxC,iDAA4C;AAC5C,sEAA8C;AAE9C,MAAM,MAAM,GAAG,2BAA2B,CAAC;AAE3C,MAAM,OAAO,GAAG;IACd,IAAI,EAAE,GAAG,MAAM,OAAO;CACvB,CAAC;AAEF,MAAM,IAAI,GAAG,IAAA,eAAM,EAAC,cAAG,EAAE;IACvB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI;CAClD,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEf;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,SAAS,uBAAuB;IAC9B,OAAO,CACL,8BAAC,IAAI,IAAC,SAAS,EAAE,OAAO,CAAC,IAAI;QAC3B,8BAAC,eAAI,IAAC,SAAS;YACb,8BAAC,eAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;gBACvB,8BAAC,kBAAQ,IAAC,SAAS,EAAC,MAAM,EAAC,EAAE,EAAE,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAC,GAAI;gBAC9D,8BAAC,kBAAQ,IAAC,SAAS,EAAC,MAAM,EAAC,EAAE,EAAE,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAC,GAAI,CACzD,CACF,CACF,CACR,CAAC;AACJ,CAAC;AAED,kBAAe,uBAAuB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserProfileInfo.d.ts","sourceRoot":"","sources":["../../../../src/components/UserProfileInfo/UserProfileInfo.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAMhD,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AA2EhD,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAE/B;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CAiJlF"}
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
const react_1 = __importStar(require("react"));
|
|
41
|
-
const styles_1 = require("@mui/material/styles");
|
|
42
|
-
const material_1 = require("@mui/material");
|
|
43
|
-
const react_intl_1 = require("react-intl");
|
|
44
|
-
const utils_1 = require("@selfcommunity/utils");
|
|
45
|
-
const react_core_1 = require("@selfcommunity/react-core");
|
|
46
|
-
const UserProfile_1 = require("../../constants/UserProfile");
|
|
47
|
-
const Skeleton_1 = __importDefault(require("./Skeleton"));
|
|
48
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
49
|
-
const system_1 = require("@mui/system");
|
|
50
|
-
const types_1 = require("../../types");
|
|
51
|
-
const Errors_1 = require("../../constants/Errors");
|
|
52
|
-
const Tags_1 = __importStar(require("../../shared/Tags"));
|
|
53
|
-
const PublicInfo_1 = __importDefault(require("../UserProfileEdit/Section/PublicInfo"));
|
|
54
|
-
const BaseDialog_1 = __importDefault(require("../../shared/BaseDialog"));
|
|
55
|
-
const messages = (0, react_intl_1.defineMessages)({
|
|
56
|
-
realName: {
|
|
57
|
-
id: 'ui.userProfileInfo.realName',
|
|
58
|
-
defaultMessage: 'ui.userProfileInfo.realName'
|
|
59
|
-
},
|
|
60
|
-
dateJoined: {
|
|
61
|
-
id: 'ui.userProfileInfo.dateJoined',
|
|
62
|
-
defaultMessage: 'ui.userProfileInfo.dateJoined'
|
|
63
|
-
},
|
|
64
|
-
bio: {
|
|
65
|
-
id: 'ui.userProfileInfo.bio',
|
|
66
|
-
defaultMessage: 'ui.userProfileInfo.bio'
|
|
67
|
-
},
|
|
68
|
-
location: {
|
|
69
|
-
id: 'ui.userProfileInfo.location',
|
|
70
|
-
defaultMessage: 'ui.userProfileInfo.location'
|
|
71
|
-
},
|
|
72
|
-
dateOfBirth: {
|
|
73
|
-
id: 'ui.userProfileInfo.dateOfBirth',
|
|
74
|
-
defaultMessage: 'ui.userProfileInfo.dateOfBirth'
|
|
75
|
-
},
|
|
76
|
-
description: {
|
|
77
|
-
id: 'ui.userProfileInfo.description',
|
|
78
|
-
defaultMessage: 'ui.userProfileInfo.description'
|
|
79
|
-
},
|
|
80
|
-
gender: {
|
|
81
|
-
id: 'ui.userProfileInfo.gender',
|
|
82
|
-
defaultMessage: 'ui.userProfileInfo.gender'
|
|
83
|
-
},
|
|
84
|
-
website: {
|
|
85
|
-
id: 'ui.userProfileInfo.website',
|
|
86
|
-
defaultMessage: 'ui.userProfileInfo.website'
|
|
87
|
-
},
|
|
88
|
-
tags: {
|
|
89
|
-
id: 'ui.userProfileInfo.website',
|
|
90
|
-
defaultMessage: 'ui.userProfileInfo.website'
|
|
91
|
-
},
|
|
92
|
-
fieldLink: {
|
|
93
|
-
id: 'ui.userProfileInfo.fieldLink',
|
|
94
|
-
defaultMessage: 'ui.userProfileInfo.fieldLink'
|
|
95
|
-
},
|
|
96
|
-
fieldLinkFemale: {
|
|
97
|
-
id: 'ui.userProfileInfo.fieldLink.female',
|
|
98
|
-
defaultMessage: 'ui.userProfileInfo.fieldLink.female'
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
const PREFIX = 'SCUserProfileInfo';
|
|
102
|
-
const classes = {
|
|
103
|
-
root: `${PREFIX}-root`,
|
|
104
|
-
field: `${PREFIX}-field`,
|
|
105
|
-
fieldLink: `${PREFIX}-field-link`
|
|
106
|
-
};
|
|
107
|
-
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
108
|
-
name: PREFIX,
|
|
109
|
-
slot: 'Root',
|
|
110
|
-
overridesResolver: (props, styles) => styles.root
|
|
111
|
-
})(({ theme }) => ({
|
|
112
|
-
margin: theme.spacing(2),
|
|
113
|
-
[`& .${classes.field}`]: {
|
|
114
|
-
fontWeight: 'bold'
|
|
115
|
-
},
|
|
116
|
-
[`& .${classes.fieldLink}`]: {
|
|
117
|
-
textDecoration: 'none'
|
|
118
|
-
}
|
|
119
|
-
}));
|
|
120
|
-
/**
|
|
121
|
-
*
|
|
122
|
-
> API documentation for the Community-JS User Profile Info component. Learn about the available props and the CSS API.
|
|
123
|
-
|
|
124
|
-
#### Import
|
|
125
|
-
|
|
126
|
-
```jsx
|
|
127
|
-
import {UserProfileInfo} from '@selfcommunity/react-ui';
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
#### Component Name
|
|
131
|
-
|
|
132
|
-
The name `SCUserProfileInfo` can be used when providing style overrides in the theme.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
#### CSS
|
|
136
|
-
|
|
137
|
-
|Rule Name|Global class|Description|
|
|
138
|
-
|---|---|---|
|
|
139
|
-
|root|.SCUserProfileInfo-root|Styles applied to the root element.|
|
|
140
|
-
|field|.SCUserProfileInfo-field|Styles applied to the field element.|
|
|
141
|
-
|
|
142
|
-
* @param inProps
|
|
143
|
-
*/
|
|
144
|
-
function UserProfileInfo(inProps) {
|
|
145
|
-
// PROPS
|
|
146
|
-
const props = (0, system_1.useThemeProps)({
|
|
147
|
-
props: inProps,
|
|
148
|
-
name: PREFIX
|
|
149
|
-
});
|
|
150
|
-
const { className = null, userId = null, user = null, fields = [...UserProfile_1.DEFAULT_FIELDS] } = props, rest = __rest(props, ["className", "userId", "user", "fields"]);
|
|
151
|
-
// CONTEXT
|
|
152
|
-
const scUserContext = (0, react_core_1.useSCUser)();
|
|
153
|
-
// STATE
|
|
154
|
-
const { scUser, setSCUser } = (0, react_core_1.useSCFetchUser)({ id: userId, user });
|
|
155
|
-
const isMe = scUserContext.user && scUserContext.user.id === (scUser === null || scUser === void 0 ? void 0 : scUser.id);
|
|
156
|
-
const [openDialog, setOpenDialog] = (0, react_1.useState)(false);
|
|
157
|
-
const [editField, setEditField] = (0, react_1.useState)('');
|
|
158
|
-
// INTL
|
|
159
|
-
const intl = (0, react_intl_1.useIntl)();
|
|
160
|
-
const isIt = intl.locale === 'it';
|
|
161
|
-
const renderFieldTranslation = (field) => {
|
|
162
|
-
if (isIt) {
|
|
163
|
-
switch (field) {
|
|
164
|
-
case types_1.SCUserProfileFields.DATE_OF_BIRTH:
|
|
165
|
-
case types_1.SCUserProfileFields.DESCRIPTION:
|
|
166
|
-
case types_1.SCUserProfileFields.BIO:
|
|
167
|
-
return intl.formatMessage(messages.fieldLinkFemale, { field: intl.formatMessage(messages[(0, utils_1.camelCase)(field)]).toLowerCase() });
|
|
168
|
-
default:
|
|
169
|
-
return intl.formatMessage(messages.fieldLink, { field: intl.formatMessage(messages[(0, utils_1.camelCase)(field)]).toLowerCase() });
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return intl.formatMessage(messages.fieldLink, { field: intl.formatMessage(messages[(0, utils_1.camelCase)(field)]).toLowerCase() });
|
|
173
|
-
};
|
|
174
|
-
// PREFERENCES
|
|
175
|
-
const scPreferences = (0, react_core_1.useSCPreferences)();
|
|
176
|
-
const metadataDefinitions = (0, react_1.useMemo)(() => {
|
|
177
|
-
if (scPreferences.preferences && react_core_1.SCPreferences.CONFIGURATIONS_USER_METADATA_DEFINITIONS in scPreferences.preferences) {
|
|
178
|
-
try {
|
|
179
|
-
return JSON.parse(scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_USER_METADATA_DEFINITIONS].value);
|
|
180
|
-
}
|
|
181
|
-
catch (e) {
|
|
182
|
-
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, 'Error on parse user metadata.');
|
|
183
|
-
console.log(scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_USER_METADATA_DEFINITIONS]);
|
|
184
|
-
return {};
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return null;
|
|
188
|
-
}, [scPreferences.preferences]);
|
|
189
|
-
// RENDER
|
|
190
|
-
const renderField = (user, field) => {
|
|
191
|
-
switch (field) {
|
|
192
|
-
case types_1.SCUserProfileFields.DATE_JOINED:
|
|
193
|
-
case types_1.SCUserProfileFields.DATE_OF_BIRTH:
|
|
194
|
-
return `${intl.formatDate(user[field], { year: 'numeric', month: 'numeric', day: 'numeric' })}`;
|
|
195
|
-
case types_1.SCUserProfileFields.TAGS:
|
|
196
|
-
return (react_1.default.createElement(Tags_1.default, { tags: user.tags.filter((t) => t.visible), type: Tags_1.TagsComponentType.LIST, direction: 'row', TagChipProps: { clickable: false, disposable: false } }));
|
|
197
|
-
default:
|
|
198
|
-
return user[field];
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
const handleDialogOpening = (field) => {
|
|
202
|
-
setEditField(field);
|
|
203
|
-
setOpenDialog(true);
|
|
204
|
-
};
|
|
205
|
-
const renderFieldLink = (field) => {
|
|
206
|
-
return (react_1.default.createElement(material_1.Link, { component: "button", variant: "body2", onClick: () => handleDialogOpening(field), className: classes.fieldLink }, renderFieldTranslation(field)));
|
|
207
|
-
};
|
|
208
|
-
const handleFieldUpdate = (f) => {
|
|
209
|
-
setSCUser(Object.assign({}, scUser, f));
|
|
210
|
-
};
|
|
211
|
-
if (!scUser || !metadataDefinitions) {
|
|
212
|
-
return react_1.default.createElement(Skeleton_1.default, null);
|
|
213
|
-
}
|
|
214
|
-
if (fields.length === 0) {
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
217
|
-
return (react_1.default.createElement(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest),
|
|
218
|
-
react_1.default.createElement(material_1.Grid, { container: true, spacing: 2 }, fields.map((field) => {
|
|
219
|
-
if (scUser[field]) {
|
|
220
|
-
if (field === types_1.SCUserProfileFields.TAGS) {
|
|
221
|
-
return (react_1.default.createElement(react_1.default.Fragment, { key: field }, scUser[field].length > 0 && (react_1.default.createElement(material_1.Grid, { item: true, xs: 12 }, renderField(scUser, field)))));
|
|
222
|
-
}
|
|
223
|
-
return (react_1.default.createElement(material_1.Grid, { item: true, xs: 6, key: field },
|
|
224
|
-
react_1.default.createElement(material_1.Typography, { variant: "body2" },
|
|
225
|
-
react_1.default.createElement("span", { className: classes.field },
|
|
226
|
-
metadataDefinitions[field] ? metadataDefinitions[field].label : intl.formatMessage(messages[(0, utils_1.camelCase)(field)]),
|
|
227
|
-
":"),
|
|
228
|
-
' ',
|
|
229
|
-
renderField(scUser, field))));
|
|
230
|
-
}
|
|
231
|
-
else if (isMe) {
|
|
232
|
-
return (react_1.default.createElement(material_1.Grid, { item: true, xs: 6, key: field },
|
|
233
|
-
react_1.default.createElement(material_1.Typography, { variant: "body2" },
|
|
234
|
-
react_1.default.createElement("span", { className: classes.field },
|
|
235
|
-
metadataDefinitions[field] ? metadataDefinitions[field].label : intl.formatMessage(messages[(0, utils_1.camelCase)(field)]),
|
|
236
|
-
":"),
|
|
237
|
-
' ',
|
|
238
|
-
renderFieldLink(field))));
|
|
239
|
-
}
|
|
240
|
-
return null;
|
|
241
|
-
})),
|
|
242
|
-
openDialog && (react_1.default.createElement(BaseDialog_1.default, Object.assign({ title: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.userProfileInfo.dialog.title", defaultMessage: "ui.userProfileInfo.dialog.title" }), open: openDialog, onClose: () => setOpenDialog(false), className: (0, classnames_1.default)(classes.root, className) }, rest),
|
|
243
|
-
react_1.default.createElement(PublicInfo_1.default, { editingField: editField, onEditSuccess: (f) => handleFieldUpdate(f) })))));
|
|
244
|
-
}
|
|
245
|
-
exports.default = UserProfileInfo;
|
|
246
|
-
//# sourceMappingURL=UserProfileInfo.js.map
|