@stack-spot/portal-layout 2.23.2 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/Header.d.ts +5 -1
- package/dist/components/Header.d.ts.map +1 -1
- package/dist/components/Header.js +2 -2
- package/dist/components/Header.js.map +1 -1
- package/dist/components/TypeForm/index.js +1 -1
- package/dist/components/TypeForm/index.js.map +1 -1
- package/dist/components/UserMenu.d.ts +5 -1
- package/dist/components/UserMenu.d.ts.map +1 -1
- package/dist/components/UserMenu.js +4 -4
- package/dist/components/UserMenu.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Header.tsx +16 -2
- package/src/components/TypeForm/index.tsx +1 -1
- package/src/components/UserMenu.tsx +14 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.24.0](https://github.com/stack-spot/portal-commons/compare/portal-layout@v2.23.3...portal-layout@v2.24.0) (2025-02-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* conditional render using the userImage parameter ([#682](https://github.com/stack-spot/portal-commons/issues/682)) ([420ef30](https://github.com/stack-spot/portal-commons/commit/420ef30665f80ddb191266eac90ca918a6948a2d))
|
|
9
|
+
|
|
10
|
+
## [2.23.3](https://github.com/stack-spot/portal-commons/compare/portal-layout@v2.23.2...portal-layout@v2.23.3) (2025-02-03)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* CSAT ([#683](https://github.com/stack-spot/portal-commons/issues/683)) ([5efa303](https://github.com/stack-spot/portal-commons/commit/5efa303e84305ab8f7c8d45d8a9b4feac27c3e79))
|
|
16
|
+
|
|
3
17
|
## [2.23.2](https://github.com/stack-spot/portal-commons/compare/portal-layout@v2.23.1...portal-layout@v2.23.2) (2025-01-28)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -14,6 +14,10 @@ export interface HeaderProps {
|
|
|
14
14
|
* The username to show in the user menu.
|
|
15
15
|
*/
|
|
16
16
|
userName?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The user image to show in the user menu.
|
|
19
|
+
*/
|
|
20
|
+
userImage?: string;
|
|
17
21
|
/**
|
|
18
22
|
* The email to show in the user menu.
|
|
19
23
|
*/
|
|
@@ -43,5 +47,5 @@ export interface HeaderProps {
|
|
|
43
47
|
* The page header.
|
|
44
48
|
* @param props the React props for the header {@link HeaderProps}.
|
|
45
49
|
*/
|
|
46
|
-
export declare const Header: ({ logo, logoHref, center, right, userName, email, options, portalSwitch, showNotificationCenter }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export declare const Header: ({ logo, logoHref, center, right, userName, email, options, portalSwitch, showNotificationCenter, userImage }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
47
51
|
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAGtE,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC9C;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAGtE,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC9C;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,iHAUJ,WAAW,4CAezB,CAAA"}
|
|
@@ -9,10 +9,10 @@ import { UserMenu } from './UserMenu.js';
|
|
|
9
9
|
* The page header.
|
|
10
10
|
* @param props the React props for the header {@link HeaderProps}.
|
|
11
11
|
*/
|
|
12
|
-
export const Header = ({ logo, logoHref, center, right, userName, email, options, portalSwitch, showNotificationCenter }) => {
|
|
12
|
+
export const Header = ({ logo, logoHref, center, right, userName, email, options, portalSwitch, showNotificationCenter, userImage }) => {
|
|
13
13
|
const Link = useAnchorTag();
|
|
14
14
|
return (_jsxs(_Fragment, { children: [portalSwitch ?
|
|
15
15
|
_jsx(PortalSwitcher, { portals: portalSwitch }) :
|
|
16
|
-
_jsx(Link, { href: logoHref, title: "Home", children: logo ?? _jsx(Logo, { style: { width: 130 } }) }), _jsx(Flex, { flex: 1, children: center }), right, showNotificationCenter && _jsx(NotificationCenter, {}), userName && _jsx(UserMenu, { userName: userName, email: email, options: options })] }));
|
|
16
|
+
_jsx(Link, { href: logoHref, title: "Home", children: logo ?? _jsx(Logo, { style: { width: 130 } }) }), _jsx(Flex, { flex: 1, children: center }), right, showNotificationCenter && _jsx(NotificationCenter, {}), userName && _jsx(UserMenu, { userName: userName, email: email, options: options, userImage: userImage })] }));
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=Header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AA6CrC;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACL,OAAO,EACP,YAAY,EACZ,sBAAsB,EACtB,SAAS,EAAe,EAAE,EAAE;IAC5B,MAAM,IAAI,GAAG,YAAY,EAAE,CAAA;IAE3B,OAAO,CACL,8BACG,YAAY,CAAC,CAAC;gBACb,KAAC,cAAc,IAAC,OAAO,EAAE,YAAY,GAAI,CAAC,CAAC;gBAC3C,KAAC,IAAI,IAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,YAAE,IAAI,IAAI,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,GAAI,GAAQ,EAErF,KAAC,IAAI,IAAC,IAAI,EAAE,CAAC,YAAG,MAAM,GAAQ,EAC7B,KAAK,EACL,sBAAsB,IAAI,KAAC,kBAAkB,KAAG,EAChD,QAAQ,IAAI,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAI,IAClG,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -10,7 +10,7 @@ export const TypeForm = ({ dataTfLive, orgId, userId, appId, infraId, }) => {
|
|
|
10
10
|
setIsLoading(false);
|
|
11
11
|
}, 2000);
|
|
12
12
|
}, []);
|
|
13
|
-
const typeform = useMemo(() => _jsx(Box, { children: appId ? _jsx("div", { "data-tf-live": dataTfLive, "data-tf-hidden": `org_id=${orgId},user_id=${userId},app_id=${appId}` }) : _jsx("div", { "data-tf-live": dataTfLive, "data-tf-hidden": `org_id=${orgId},user_id=${userId}infra_id=${infraId}` }) }), []);
|
|
13
|
+
const typeform = useMemo(() => _jsx(Box, { children: appId ? _jsx("div", { "data-tf-live": dataTfLive, "data-tf-hidden": `org_id=${orgId},user_id=${userId},app_id=${appId}` }) : _jsx("div", { "data-tf-live": dataTfLive, "data-tf-hidden": `org_id=${orgId},user_id=${userId},infra_id=${infraId}` }) }), []);
|
|
14
14
|
return (_jsxs(Box, { sx: { minWidth: '650px', minHeight: '500px' }, children: [isLoading && _jsx(Flex, { alignItems: "center", justifyContent: "center", w: "12", sx: { height: '100%' }, children: _jsx(LoadingCircular, {}) }), _jsx(Box, { sx: { opacity: isLoading ? '0' : 1 }, children: typeform })] }));
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/TypeForm/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAUpD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,UAAU,EACV,KAAK,EACL,MAAM,EACN,KAAK,EACL,OAAO,GACO,EAAE,EAAE;IAGlB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAEhD,SAAS,CAAC,GAAG,EAAE;QACZ,MAAc,CAAC,EAAE,EAAE,IAAI,EAAE,CAAA;QAC1B,UAAU,CAAC,GAAG,EAAE;YACd,YAAY,CAAC,KAAK,CAAC,CAAA;QACrB,CAAC,EAAE,IAAI,CAAC,CAAA;IACV,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,QAAQ,GAAG,OAAO,CAA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AE,OAAO,EAAE,aAC/C,SAAS,IAAI,KAAC,IAAI,IAAC,UAAU,EAAC,QAAQ,EAAC,cAAc,EAAC,QAAQ,EAAC,CAAC,EAAC,IAAI,EAAC,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAC3F,KAAC,eAAe,KAAG,GACd,EACP,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,YACtC,QAAQ,GACL,IACF,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -4,6 +4,10 @@ interface Props {
|
|
|
4
4
|
* The user name.
|
|
5
5
|
*/
|
|
6
6
|
userName: string;
|
|
7
|
+
/**
|
|
8
|
+
* The user image to show in the user menu.
|
|
9
|
+
*/
|
|
10
|
+
userImage?: string;
|
|
7
11
|
/**
|
|
8
12
|
* The user email.
|
|
9
13
|
*/
|
|
@@ -17,6 +21,6 @@ interface Props {
|
|
|
17
21
|
* Renders the user menu.
|
|
18
22
|
* @param props the component's props {@link Props}.
|
|
19
23
|
*/
|
|
20
|
-
export declare const UserMenu: ({ userName, email, options }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare const UserMenu: ({ userName, email, options, userImage }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
25
|
export {};
|
|
22
26
|
//# sourceMappingURL=UserMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserMenu.d.ts","sourceRoot":"","sources":["../../src/components/UserMenu.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAO/F,UAAU,KAAK;IACb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CACvC;AAsDD;;;GAGG;AACH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"UserMenu.d.ts","sourceRoot":"","sources":["../../src/components/UserMenu.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAO/F,UAAU,KAAK;IACb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CACvC;AAsDD;;;GAGG;AACH,eAAO,MAAM,QAAQ,4CAA6C,KAAK,4CAwCtE,CAAA"}
|
|
@@ -50,17 +50,17 @@ const UserMenuBox = styled.div `
|
|
|
50
50
|
transition: transform ease-out 0.3s;
|
|
51
51
|
}
|
|
52
52
|
`;
|
|
53
|
-
const UserMenuHeader = ({ userName, email }) => (_jsxs("div", { className: "user-menu-header", children: [_jsx(Avatar, { size: "xs", children: userName }), _jsx(Text, { appearance: "body1", className: "username", children: userName }), email && _jsx(Text, { appearance: "microtext1", className: "email", colorScheme: "light.700", children: email })] }));
|
|
53
|
+
const UserMenuHeader = ({ userName, email, userImage }) => (_jsxs("div", { className: "user-menu-header", children: [_jsx(Avatar, { size: "xs", children: userImage ? (_jsx("img", { src: userImage })) : userName }), _jsx(Text, { appearance: "body1", className: "username", children: userName }), email && _jsx(Text, { appearance: "microtext1", className: "email", colorScheme: "light.700", children: email })] }));
|
|
54
54
|
/**
|
|
55
55
|
* Renders the user menu.
|
|
56
56
|
* @param props the component's props {@link Props}.
|
|
57
57
|
*/
|
|
58
|
-
export const UserMenu = ({ userName, email, options }) => {
|
|
58
|
+
export const UserMenu = ({ userName, email, options, userImage }) => {
|
|
59
59
|
const t = useTranslate(dictionary);
|
|
60
60
|
const [visible, setVisible] = useState(false);
|
|
61
61
|
useEffect(() => userMenuManager.subscribe(setVisible), []);
|
|
62
|
-
return (_jsxs(UserMenuBox, { children: [_jsx(LinkBox, { as: "button", onClick: () => setVisible(v => !v), "aria-controls": USER_MENU_ID, "aria-expanded": visible, "aria-label": interpolate(t.accountMenu, [userName]), children: _jsxs(Flex, { alignItems: "center", children: [_jsx(Avatar, { size: "xs", "aria-label": interpolate(t.accountMenu, [userName]), children: userName }), _jsx(IconBox, { colorIcon: "inverse.500", className: "chevron", style: visible ? { transform: 'rotate(180deg)' } : undefined, children: _jsx(ChevronDown, {}) })] }) }), options?.length
|
|
63
|
-
? _jsx(SelectionList, { id: USER_MENU_ID, visible: visible, before: _jsx(UserMenuHeader, { userName: userName, email: email }), items: options, onHide: () => setVisible(false), maxHeight: "600px" })
|
|
62
|
+
return (_jsxs(UserMenuBox, { children: [_jsx(LinkBox, { as: "button", onClick: () => setVisible(v => !v), "aria-controls": USER_MENU_ID, "aria-expanded": visible, "aria-label": interpolate(t.accountMenu, [userName]), children: _jsxs(Flex, { alignItems: "center", children: [_jsx(Avatar, { size: "xs", "aria-label": interpolate(t.accountMenu, [userName]), children: userImage ? (_jsx("img", { src: userImage })) : userName }), _jsx(IconBox, { colorIcon: "inverse.500", className: "chevron", style: visible ? { transform: 'rotate(180deg)' } : undefined, children: _jsx(ChevronDown, {}) })] }) }), options?.length
|
|
63
|
+
? _jsx(SelectionList, { id: USER_MENU_ID, visible: visible, before: _jsx(UserMenuHeader, { userName: userName, email: email, userImage: userImage }), items: options, onHide: () => setVisible(false), maxHeight: "600px" })
|
|
64
64
|
: null] }));
|
|
65
65
|
};
|
|
66
66
|
const dictionary = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserMenu.js","sourceRoot":"","sources":["../../src/components/UserMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eA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MAAM,IAAC,IAAI,EAAC,IAAI,gBAEb,WAAW,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,YACvC,SAAS,CAAC,CAAC,CAAC,CACX,cAAK,GAAG,EAAE,SAAS,GAAI,CACxB,CAAC,CAAC,CAAC,QAAQ,GAAU,EACxB,KAAC,OAAO,IAAC,SAAS,EAAC,aAAa,EAAC,SAAS,EAAC,SAAS,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,SAAS,YAC/G,KAAC,WAAW,KAAG,GACP,IACL,GACC,EAET,OAAO,EAAE,MAAM;gBACd,CAAC,CAAC,KAAC,aAAa,IACd,EAAE,EAAE,YAAY,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,KAAC,cAAc,IAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAI,EAClF,KAAK,EAAE,OAAQ,EACf,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAC/B,SAAS,EAAC,OAAO,GACjB;gBACF,CAAC,CAAC,IAAI,IAEI,CACf,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,WAAW,EAAE,oBAAoB;KAClC;IACD,EAAE,EAAE;QACF,WAAW,EAAE,mBAAmB;KACjC;CACmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -20,6 +20,10 @@ export interface HeaderProps {
|
|
|
20
20
|
* The username to show in the user menu.
|
|
21
21
|
*/
|
|
22
22
|
userName?: string,
|
|
23
|
+
/**
|
|
24
|
+
* The user image to show in the user menu.
|
|
25
|
+
*/
|
|
26
|
+
userImage?: string,
|
|
23
27
|
/**
|
|
24
28
|
* The email to show in the user menu.
|
|
25
29
|
*/
|
|
@@ -50,7 +54,17 @@ export interface HeaderProps {
|
|
|
50
54
|
* The page header.
|
|
51
55
|
* @param props the React props for the header {@link HeaderProps}.
|
|
52
56
|
*/
|
|
53
|
-
export const Header = ({
|
|
57
|
+
export const Header = ({
|
|
58
|
+
logo,
|
|
59
|
+
logoHref,
|
|
60
|
+
center,
|
|
61
|
+
right,
|
|
62
|
+
userName,
|
|
63
|
+
email,
|
|
64
|
+
options,
|
|
65
|
+
portalSwitch,
|
|
66
|
+
showNotificationCenter,
|
|
67
|
+
userImage }: HeaderProps) => {
|
|
54
68
|
const Link = useAnchorTag()
|
|
55
69
|
|
|
56
70
|
return (
|
|
@@ -62,7 +76,7 @@ export const Header = ({ logo, logoHref, center, right, userName, email, options
|
|
|
62
76
|
<Flex flex={1}>{center}</Flex>
|
|
63
77
|
{right}
|
|
64
78
|
{showNotificationCenter && <NotificationCenter />}
|
|
65
|
-
{userName && <UserMenu userName={userName} email={email} options={options} />}
|
|
79
|
+
{userName && <UserMenu userName={userName} email={email} options={options} userImage={userImage} />}
|
|
66
80
|
</>
|
|
67
81
|
)
|
|
68
82
|
}
|
|
@@ -34,7 +34,7 @@ export const TypeForm = ({
|
|
|
34
34
|
data-tf-hidden={`org_id=${orgId},user_id=${userId},app_id=${appId}`}
|
|
35
35
|
/> : <div
|
|
36
36
|
data-tf-live={dataTfLive}
|
|
37
|
-
data-tf-hidden={`org_id=${orgId},user_id=${userId}infra_id=${infraId}`}
|
|
37
|
+
data-tf-hidden={`org_id=${orgId},user_id=${userId},infra_id=${infraId}`}
|
|
38
38
|
/>}
|
|
39
39
|
</Box>, [])
|
|
40
40
|
|
|
@@ -13,6 +13,10 @@ interface Props {
|
|
|
13
13
|
* The user name.
|
|
14
14
|
*/
|
|
15
15
|
userName: string,
|
|
16
|
+
/**
|
|
17
|
+
* The user image to show in the user menu.
|
|
18
|
+
*/
|
|
19
|
+
userImage?: string,
|
|
16
20
|
/**
|
|
17
21
|
* The user email.
|
|
18
22
|
*/
|
|
@@ -67,9 +71,9 @@ const UserMenuBox = styled.div`
|
|
|
67
71
|
}
|
|
68
72
|
`
|
|
69
73
|
|
|
70
|
-
const UserMenuHeader = ({ userName, email }: Omit<Props, 'options'>) => (
|
|
74
|
+
const UserMenuHeader = ({ userName, email, userImage }: Omit<Props, 'options'>) => (
|
|
71
75
|
<div className="user-menu-header">
|
|
72
|
-
<Avatar size="xs">{userName}</Avatar>
|
|
76
|
+
<Avatar size="xs">{userImage ? (<img src={userImage} />) : userName}</Avatar>
|
|
73
77
|
<Text appearance="body1" className="username">{userName}</Text>
|
|
74
78
|
{email && <Text appearance="microtext1" className="email" colorScheme="light.700">{email}</Text>}
|
|
75
79
|
</div>
|
|
@@ -79,12 +83,11 @@ const UserMenuHeader = ({ userName, email }: Omit<Props, 'options'>) => (
|
|
|
79
83
|
* Renders the user menu.
|
|
80
84
|
* @param props the component's props {@link Props}.
|
|
81
85
|
*/
|
|
82
|
-
export const UserMenu = ({ userName, email, options }: Props) => {
|
|
86
|
+
export const UserMenu = ({ userName, email, options, userImage }: Props) => {
|
|
83
87
|
const t = useTranslate(dictionary)
|
|
84
88
|
const [visible, setVisible] = useState(false)
|
|
85
89
|
|
|
86
90
|
useEffect(() => userMenuManager.subscribe(setVisible), [])
|
|
87
|
-
|
|
88
91
|
return (
|
|
89
92
|
<UserMenuBox>
|
|
90
93
|
<LinkBox
|
|
@@ -95,7 +98,12 @@ export const UserMenu = ({ userName, email, options }: Props) => {
|
|
|
95
98
|
aria-label={interpolate(t.accountMenu, [userName])}
|
|
96
99
|
>
|
|
97
100
|
<Flex alignItems="center">
|
|
98
|
-
<Avatar size="xs"
|
|
101
|
+
<Avatar size="xs"
|
|
102
|
+
aria-label={
|
|
103
|
+
interpolate(t.accountMenu, [userName])}>
|
|
104
|
+
{userImage ? (
|
|
105
|
+
<img src={userImage} />
|
|
106
|
+
) : userName}</Avatar>
|
|
99
107
|
<IconBox colorIcon="inverse.500" className="chevron" style={visible ? { transform: 'rotate(180deg)' } : undefined}>
|
|
100
108
|
<ChevronDown />
|
|
101
109
|
</IconBox>
|
|
@@ -106,7 +114,7 @@ export const UserMenu = ({ userName, email, options }: Props) => {
|
|
|
106
114
|
? <SelectionList
|
|
107
115
|
id={USER_MENU_ID}
|
|
108
116
|
visible={visible}
|
|
109
|
-
before={<UserMenuHeader userName={userName} email={email} />}
|
|
117
|
+
before={<UserMenuHeader userName={userName} email={email} userImage={userImage} />}
|
|
110
118
|
items={options!}
|
|
111
119
|
onHide={() => setVisible(false)}
|
|
112
120
|
maxHeight="600px"
|