@learningpool/ui 1.6.0-beta.5 → 1.6.0-beta.7

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.
@@ -1,97 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
- import React, { useEffect } from 'react';
25
- import { Avatar, Box, Typography, IconButton, Button, Link, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Tooltip } from '../../../index';
26
- import { useTheme } from '@mui/material/styles';
27
- import EditIcon from '@mui/icons-material/Edit';
28
- import GroupIcon from '@mui/icons-material/Group';
29
- import BarChartIcon from '@mui/icons-material/BarChart';
30
- import ArchiveIcon from '@mui/icons-material/Archive';
31
- import LogoutIcon from '@mui/icons-material/Logout';
32
- import { tooltipDelay } from '../../../utils/theme';
33
- var AvatarPanel = function (props) {
34
- var _a;
35
- var theme = useTheme();
36
- var avatarName = props.avatarName, editProfileText = props.editProfileText, logoutText = props.logoutText, rest = __rest(props, ["avatarName", "editProfileText", "logoutText"]);
37
- useEffect(function () { return setAvatarInitials(handleAvatarInitials(avatarName)); }, [
38
- avatarName
39
- ]);
40
- var handleAvatarInitials = function (avatar) {
41
- var _a, _b;
42
- var firstInitial = avatar.split('')[0] || '';
43
- var secondInitial = '';
44
- if (((_a = avatarName.split(' ')) === null || _a === void 0 ? void 0 : _a.length) > 1) {
45
- firstInitial = avatarName.split(' ')[0][0];
46
- if (((_b = avatar.split(' ')[1]) === null || _b === void 0 ? void 0 : _b.length) > 0) {
47
- secondInitial = avatar === null || avatar === void 0 ? void 0 : avatar.split(' ')[1][0];
48
- }
49
- }
50
- return "".concat(firstInitial).concat(secondInitial);
51
- };
52
- var _b = React.useState((_a = handleAvatarInitials(avatarName)) !== null && _a !== void 0 ? _a : 'AN'), avatarInitials = _b[0], setAvatarInitials = _b[1];
53
- return (_jsxs(Box, __assign({ style: {
54
- alignItems: 'center',
55
- backgroundColor: theme.palette.mode === 'dark'
56
- ? theme.palette.primary.dark
57
- : '#E6EAF0',
58
- boxSizing: 'border-box',
59
- display: 'flex',
60
- flexDirection: 'column',
61
- height: '100%',
62
- justifyContent: 'space-between',
63
- overflow: 'hidden',
64
- padding: theme.spacing(2),
65
- width: '100%',
66
- zIndex: '1'
67
- } }, rest, { children: [_jsx(Tooltip, __assign({ title: logoutText !== null && logoutText !== void 0 ? logoutText : 'Log out', placement: 'bottom', enterDelay: tooltipDelay.start, leaveDelay: tooltipDelay.end }, { children: _jsx(IconButton, __assign({ style: {
68
- left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto',
69
- position: 'absolute',
70
- right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1),
71
- top: theme.spacing(1)
72
- } }, { children: _jsx(LogoutIcon, {}) })) })), _jsxs(Box, __assign({ style: {
73
- alignItems: 'center',
74
- display: 'flex',
75
- flexDirection: 'column'
76
- } }, { children: [_jsx(Avatar, __assign({ style: {
77
- fontSize: '3.75rem',
78
- height: 150,
79
- marginBottom: theme.spacing(2),
80
- width: 150
81
- } }, { children: avatarInitials })), _jsxs(Typography, __assign({ component: "h3", variant: "h4", style: {
82
- marginBottom: theme.spacing(2)
83
- } }, { children: [_jsx("span", __assign({ style: { fontWeight: 300 } }, { children: "Hi," })), " ", _jsx("strong", { children: avatarName.split(' ')[0] })] })), _jsxs(Box, __assign({ style: {
84
- marginBottom: theme.spacing(1)
85
- } }, { children: [_jsx(Button, __assign({ variant: 'contained', color: 'primary', size: 'medium', style: { marginRight: '0.5rem' } }, { children: "View Profile" })), _jsx(Tooltip, __assign({ title: editProfileText !== null && editProfileText !== void 0 ? editProfileText : 'Edit profile', placement: 'bottom', enterDelay: tooltipDelay.start, leaveDelay: tooltipDelay.end }, { children: _jsx(IconButton, { children: _jsx(EditIcon, {}) }) }))] }))] })), _jsxs(Box, __assign({ style: {
86
- alignItems: 'center',
87
- display: 'flex',
88
- flexDirection: 'column'
89
- } }, { children: [_jsxs(List, __assign({ style: { marginBottom: theme.spacing(2) } }, { children: [_jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton, __assign({ component: Link, role: 'link' }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
90
- minWidth: theme.spacing(5)
91
- } }, { children: _jsx(GroupIcon, {}) })), _jsx(ListItemText, { children: "My Team" })] })) })), _jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton, __assign({ component: Link, role: 'link' }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
92
- minWidth: theme.spacing(5)
93
- } }, { children: _jsx(BarChartIcon, {}) })), _jsx(ListItemText, { children: "My Reports" })] })) })), _jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton, __assign({ component: Link, role: 'link' }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
94
- minWidth: theme.spacing(5)
95
- } }, { children: _jsx(ArchiveIcon, {}) })), _jsx(ListItemText, { children: "Archived Playlists" })] })) }))] })), _jsx(Button, __assign({ variant: 'outlined', color: 'primary', size: 'medium' }, { children: "Admin Portal" }))] }))] })));
96
- };
97
- export default AvatarPanel;