@learningpool/ui 1.6.2 → 1.6.3

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.6.3](https://github.com/HT2-Labs/design-system/compare/v1.6.2...v1.6.3) (2023-02-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **AppSwitcher:** Uses 'customName' for applications (if set) [HOME-1121] ([#150](https://github.com/HT2-Labs/design-system/issues/150)) ([5b84774](https://github.com/HT2-Labs/design-system/commit/5b84774f34ffe5bbcc67a9bc92f85419f089340b))
7
+
1
8
  ## [1.6.2](https://github.com/HT2-Labs/design-system/compare/v1.6.1...v1.6.2) (2023-02-07)
2
9
 
3
10
 
@@ -59,8 +59,6 @@ var AppSwitcher = function (props) {
59
59
  var _a;
60
60
  var isAppSwitcherOpen = props.isAppSwitcherOpen, setIsAppSwitcherOpen = props.setIsAppSwitcherOpen, isDrawerOpen = props.isDrawerOpen, localization = props.localization, _b = props.apiKey, apiKey = _b === void 0 ? '' : _b, baseUrl = props.baseUrl;
61
61
  var token = props.token;
62
- // Controls whether the application panel is open or not.
63
- // const [isOpen, setIsOpen] = useState(isAppSwitcherOpen)
64
62
  // Holds the applications which are displayed.
65
63
  var _c = useState([]), applications = _c[0], setApplications = _c[1];
66
64
  // Controls which tab is active.
@@ -73,18 +71,10 @@ var AppSwitcher = function (props) {
73
71
  var _g = useState(''), searchString = _g[0], setSearchString = _g[1];
74
72
  var messages = __assign(__assign({}, localization), defaultMessages);
75
73
  var userId = (_a = props.userId) !== null && _a !== void 0 ? _a : '';
76
- /**
77
- * Toggles display of the Stream suite application dialog.
78
- * @param event {React.MouseEvent} - Click event.
79
- */
80
- // const handleToggleAppsClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
81
- // setIsOpen(!isOpen)
82
- // }
83
74
  /**
84
75
  * Handles closing of the application dialog.
85
76
  */
86
77
  var handleDialogClose = function () {
87
- // setIsOpen(false)
88
78
  setIsAppSwitcherOpen(false);
89
79
  setTimeout(function () {
90
80
  setSearchString('');
@@ -8,6 +8,7 @@ export declare const LogoVariants: {
8
8
  interface IAppSwitcherItemProps {
9
9
  internalName: string;
10
10
  shortName: string;
11
+ customName?: string;
11
12
  handleGoToAppClick: Function;
12
13
  applicationId?: number;
13
14
  url?: string;
@@ -19,20 +19,20 @@ export var LogoVariants = {
19
19
  Outlined: 'icon-outlined',
20
20
  White: 'icon-white'
21
21
  };
22
+ /**
23
+ * Renders an application logo.
24
+ * @param internalName {string | null | undefined } - Internal name of the application.
25
+ * @returns {ReactElement | null } SVG containing the application logo retrieved from the CDN.
26
+ */
27
+ var renderApplicationLogo = function (internalName, logoVariant) {
28
+ if (!internalName) {
29
+ return _jsx(_Fragment, {});
30
+ }
31
+ var urlToIcon = "".concat(Constants.AssetsUrl).concat(internalName, "/logo/latest/").concat(logoVariant !== null && logoVariant !== void 0 ? logoVariant : LogoVariants.Default, ".svg");
32
+ return (_jsx(StyledLogoSVG, { children: _jsx("image", { xlinkHref: urlToIcon, width: "60", height: "60" }) }));
33
+ };
22
34
  var AppSwitcherItem = function (props) {
23
- var applicationId = props.applicationId, internalName = props.internalName, shortName = props.shortName, url = props.url, handleGoToAppClick = props.handleGoToAppClick;
24
- /**
25
- * Renders an application logo.
26
- * @param internalName {string | null | undefined } - Internal name of the application.
27
- * @returns {ReactElement | null } SVG containing the application logo retrieved from the CDN.
28
- */
29
- var renderApplicationLogo = function (internalName, logoVariant) {
30
- if (!internalName) {
31
- return _jsx(_Fragment, {});
32
- }
33
- var urlToIcon = "".concat(Constants.AssetsUrl).concat(internalName, "/logo/latest/").concat(logoVariant !== null && logoVariant !== void 0 ? logoVariant : LogoVariants.Default, ".svg");
34
- return (_jsx(StyledLogoSVG, { children: _jsx("image", { xlinkHref: urlToIcon, width: "60", height: "60" }) }));
35
- };
35
+ var applicationId = props.applicationId, internalName = props.internalName, shortName = props.shortName, customName = props.customName, url = props.url, handleGoToAppClick = props.handleGoToAppClick;
36
36
  var solidLogo = renderApplicationLogo(internalName, LogoVariants.Solid);
37
37
  return (_jsxs(AppLink, __assign({ href: url !== null && url !== void 0 ? url : '#', target: "_blank", onClick: function (event) { return applicationId ? handleGoToAppClick(event, applicationId) : null; } }, { children: [applicationId && (
38
38
  // Create a stack effect to indicate multiple
@@ -46,6 +46,6 @@ var AppSwitcherItem = function (props) {
46
46
  top: '10px',
47
47
  transform: 'scale(0.9)',
48
48
  zIndex: 0
49
- } }, { children: solidLogo }))] })), solidLogo, _jsx(AppName, { children: shortName })] })));
49
+ } }, { children: solidLogo }))] })), solidLogo, _jsx(AppName, { children: customName !== null && customName !== void 0 ? customName : shortName })] })));
50
50
  };
51
51
  export default AppSwitcherItem;
package/dist/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "components",
10
10
  "ui"
11
11
  ],
12
- "version": "1.6.1",
12
+ "version": "1.6.2",
13
13
  "private": false,
14
14
  "main": "index.js",
15
15
  "module": "index.js",
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "components",
10
10
  "ui"
11
11
  ],
12
- "version": "1.6.2",
12
+ "version": "1.6.3",
13
13
  "private": false,
14
14
  "main": "dist/index.js",
15
15
  "module": "dist/index.js",
@@ -35,8 +35,6 @@ const AppSwitcher = (props: IProps): ReactElement | null => {
35
35
  } = props
36
36
  let { token } = props
37
37
 
38
- // Controls whether the application panel is open or not.
39
- // const [isOpen, setIsOpen] = useState(isAppSwitcherOpen)
40
38
  // Holds the applications which are displayed.
41
39
  const [applications, setApplications] = useState<IApplication[]>([])
42
40
  // Controls which tab is active.
@@ -52,19 +50,10 @@ const AppSwitcher = (props: IProps): ReactElement | null => {
52
50
 
53
51
  let userId = props.userId ?? ''
54
52
 
55
- /**
56
- * Toggles display of the Stream suite application dialog.
57
- * @param event {React.MouseEvent} - Click event.
58
- */
59
- // const handleToggleAppsClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
60
- // setIsOpen(!isOpen)
61
- // }
62
-
63
53
  /**
64
54
  * Handles closing of the application dialog.
65
55
  */
66
56
  const handleDialogClose = (): void => {
67
- // setIsOpen(false)
68
57
  setIsAppSwitcherOpen(false)
69
58
 
70
59
  setTimeout(() => {
@@ -13,36 +13,37 @@ export const LogoVariants = {
13
13
  interface IAppSwitcherItemProps {
14
14
  internalName: string
15
15
  shortName: string
16
+ customName?: string
16
17
  handleGoToAppClick: Function
17
18
  applicationId?: number
18
19
  url?: string
19
20
  }
20
21
 
22
+ /**
23
+ * Renders an application logo.
24
+ * @param internalName {string | null | undefined } - Internal name of the application.
25
+ * @returns {ReactElement | null } SVG containing the application logo retrieved from the CDN.
26
+ */
27
+ const renderApplicationLogo = (internalName: string | null | undefined, logoVariant: string): ReactElement | null => {
28
+ if (!internalName) {
29
+ return <></>
30
+ }
31
+
32
+ const urlToIcon = `${Constants.AssetsUrl}${internalName}/logo/latest/${logoVariant ?? LogoVariants.Default}.svg`
33
+
34
+ return (
35
+ <StyledLogoSVG>
36
+ <image xlinkHref={urlToIcon} width="60" height="60" />
37
+ </StyledLogoSVG>
38
+ )
39
+ }
40
+
21
41
  const AppSwitcherItem = (props: IAppSwitcherItemProps): ReactElement => {
22
42
  const {
23
- applicationId, internalName, shortName,
43
+ applicationId, internalName, shortName, customName,
24
44
  url, handleGoToAppClick
25
45
  } = props
26
46
 
27
- /**
28
- * Renders an application logo.
29
- * @param internalName {string | null | undefined } - Internal name of the application.
30
- * @returns {ReactElement | null } SVG containing the application logo retrieved from the CDN.
31
- */
32
- const renderApplicationLogo = (internalName: string | null | undefined, logoVariant: string): ReactElement | null => {
33
- if (!internalName) {
34
- return <></>
35
- }
36
-
37
- const urlToIcon = `${Constants.AssetsUrl}${internalName}/logo/latest/${logoVariant ?? LogoVariants.Default}.svg`
38
-
39
- return (
40
- <StyledLogoSVG>
41
- <image xlinkHref={urlToIcon} width="60" height="60" />
42
- </StyledLogoSVG>
43
- )
44
- }
45
-
46
47
  const solidLogo = renderApplicationLogo(internalName, LogoVariants.Solid)
47
48
 
48
49
  return (
@@ -74,7 +75,7 @@ const AppSwitcherItem = (props: IAppSwitcherItemProps): ReactElement => {
74
75
  )}
75
76
  {solidLogo}
76
77
  <AppName>
77
- {shortName}
78
+ {customName ?? shortName}
78
79
  </AppName>
79
80
  </AppLink>
80
81
  )