l-min-components 1.0.171 → 1.0.181
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/package.json +3 -2
- package/src/assets/svg/award.jsx +32 -0
- package/src/assets/svg/dashboard.jsx +42 -0
- package/src/assets/svg/document.jsx +18 -0
- package/src/assets/svg/teams.jsx +17 -0
- package/src/assets/svg/volume.jsx +29 -0
- package/src/components/AppMainLayout/index.jsx +36 -29
- package/src/components/header/account-dropdown.jsx +203 -39
- package/src/components/header/getHeaderDetails.js +31 -0
- package/src/components/header/index.jsx +13 -5
- package/src/components/header/index.styled.js +8 -2
- package/src/components/index.js +2 -0
- package/src/components/sideBar/userCard/index.jsx +22 -6
- package/src/hooks/leftNavMenu.jsx +112 -0
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const AwardIcon = ({ width, height, fill, onClick }) => (
|
|
2
|
+
<svg
|
|
3
|
+
onClick={onClick}
|
|
4
|
+
width={width || "24"}
|
|
5
|
+
height={height || "25"}
|
|
6
|
+
viewBox="0 0 24 25"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
d="M4.25781 11.2011V16.1711C4.25781 17.9911 4.25781 17.9911 5.97781 19.1511L10.7078 21.8811C11.4178 22.2911 12.5778 22.2911 13.2878 21.8811L18.0178 19.1511C19.7378 17.9911 19.7378 17.9911 19.7378 16.1711V11.2011C19.7378 9.38109 19.7378 9.38109 18.0178 8.22109L13.2878 5.49109C12.5778 5.08109 11.4178 5.08109 10.7078 5.49109L5.97781 8.22109C4.25781 9.38109 4.25781 9.38109 4.25781 11.2011Z"
|
|
12
|
+
stroke="white"
|
|
13
|
+
stroke-width="1.5"
|
|
14
|
+
stroke-linecap="round"
|
|
15
|
+
stroke-linejoin="round"
|
|
16
|
+
/>
|
|
17
|
+
<path
|
|
18
|
+
d="M17.5 7.80969V5.17969C17.5 3.17969 16.5 2.17969 14.5 2.17969H9.5C7.5 2.17969 6.5 3.17969 6.5 5.17969V7.73969"
|
|
19
|
+
stroke="white"
|
|
20
|
+
stroke-width="1.5"
|
|
21
|
+
stroke-linecap="round"
|
|
22
|
+
stroke-linejoin="round"
|
|
23
|
+
/>
|
|
24
|
+
<path
|
|
25
|
+
d="M12.6317 11.1706L13.2017 12.0606C13.2917 12.2006 13.4917 12.3406 13.6417 12.3806L14.6617 12.6406C15.2917 12.8006 15.4617 13.3406 15.0517 13.8406L14.3817 14.6506C14.2817 14.7806 14.2017 15.0106 14.2117 15.1706L14.2717 16.2206C14.3117 16.8706 13.8517 17.2006 13.2517 16.9606L12.2717 16.5706C12.1217 16.5106 11.8717 16.5106 11.7217 16.5706L10.7417 16.9606C10.1417 17.2006 9.68173 16.8606 9.72173 16.2206L9.78173 15.1706C9.79173 15.0106 9.71173 14.7706 9.61173 14.6506L8.94173 13.8406C8.53173 13.3406 8.70173 12.8006 9.33173 12.6406L10.3517 12.3806C10.5117 12.3406 10.7117 12.1906 10.7917 12.0606L11.3617 11.1706C11.7217 10.6306 12.2817 10.6306 12.6317 11.1706Z"
|
|
26
|
+
stroke="white"
|
|
27
|
+
stroke-width="1.5"
|
|
28
|
+
stroke-linecap="round"
|
|
29
|
+
stroke-linejoin="round"
|
|
30
|
+
/>
|
|
31
|
+
</svg>
|
|
32
|
+
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const DashboardIcon = ({ width, height, stroke }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "24"}
|
|
4
|
+
height={height || "25"}
|
|
5
|
+
viewBox="0 0 24 25"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M5 10.1797H7C9 10.1797 10 9.17969 10 7.17969V5.17969C10 3.17969 9 2.17969 7 2.17969H5C3 2.17969 2 3.17969 2 5.17969V7.17969C2 9.17969 3 10.1797 5 10.1797Z"
|
|
11
|
+
stroke="white"
|
|
12
|
+
stroke-width="1.5"
|
|
13
|
+
stroke-miterlimit="10"
|
|
14
|
+
stroke-linecap="round"
|
|
15
|
+
stroke-linejoin="round"
|
|
16
|
+
/>
|
|
17
|
+
<path
|
|
18
|
+
d="M17 10.1797H19C21 10.1797 22 9.17969 22 7.17969V5.17969C22 3.17969 21 2.17969 19 2.17969H17C15 2.17969 14 3.17969 14 5.17969V7.17969C14 9.17969 15 10.1797 17 10.1797Z"
|
|
19
|
+
stroke="white"
|
|
20
|
+
stroke-width="1.5"
|
|
21
|
+
stroke-miterlimit="10"
|
|
22
|
+
stroke-linecap="round"
|
|
23
|
+
stroke-linejoin="round"
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
d="M17 22.1797H19C21 22.1797 22 21.1797 22 19.1797V17.1797C22 15.1797 21 14.1797 19 14.1797H17C15 14.1797 14 15.1797 14 17.1797V19.1797C14 21.1797 15 22.1797 17 22.1797Z"
|
|
27
|
+
stroke="white"
|
|
28
|
+
stroke-width="1.5"
|
|
29
|
+
stroke-miterlimit="10"
|
|
30
|
+
stroke-linecap="round"
|
|
31
|
+
stroke-linejoin="round"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M5 22.1797H7C9 22.1797 10 21.1797 10 19.1797V17.1797C10 15.1797 9 14.1797 7 14.1797H5C3 14.1797 2 15.1797 2 17.1797V19.1797C2 21.1797 3 22.1797 5 22.1797Z"
|
|
35
|
+
stroke="white"
|
|
36
|
+
stroke-width="1.5"
|
|
37
|
+
stroke-miterlimit="10"
|
|
38
|
+
stroke-linecap="round"
|
|
39
|
+
stroke-linejoin="round"
|
|
40
|
+
/>
|
|
41
|
+
</svg>
|
|
42
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const DocumentIcon = ({ width, height, fill, onClick }) => (
|
|
2
|
+
<svg
|
|
3
|
+
onClick={onClick}
|
|
4
|
+
width={width || "24"}
|
|
5
|
+
height={height || "25"}
|
|
6
|
+
viewBox="0 0 24 25"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
d="M9 12.1797H15M9 16.1797H15M17 21.1797H7C5.89543 21.1797 5 20.2843 5 19.1797V5.17969C5 4.07512 5.89543 3.17969 7 3.17969H12.5858C12.851 3.17969 13.1054 3.28504 13.2929 3.47258L18.7071 8.88679C18.8946 9.07433 19 9.32868 19 9.5939V19.1797C19 20.2843 18.1046 21.1797 17 21.1797Z"
|
|
12
|
+
stroke="white"
|
|
13
|
+
stroke-width="2"
|
|
14
|
+
stroke-linecap="round"
|
|
15
|
+
stroke-linejoin="round"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const TeamsIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "24"}
|
|
4
|
+
height={height || "25"}
|
|
5
|
+
viewBox="0 0 24 25"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M17 20.1797H22V18.1797C22 16.5228 20.6569 15.1797 19 15.1797C18.0444 15.1797 17.1931 15.6265 16.6438 16.3226M17 20.1797H7M17 20.1797V18.1797C17 17.5234 16.8736 16.8967 16.6438 16.3226M7 20.1797H2V18.1797C2 16.5228 3.34315 15.1797 5 15.1797C5.95561 15.1797 6.80686 15.6265 7.35625 16.3226M7 20.1797V18.1797C7 17.5234 7.12642 16.8967 7.35625 16.3226M7.35625 16.3226C8.0935 14.4807 9.89482 13.1797 12 13.1797C14.1052 13.1797 15.9065 14.4807 16.6438 16.3226M15 7.17969C15 8.83654 13.6569 10.1797 12 10.1797C10.3431 10.1797 9 8.83654 9 7.17969C9 5.52283 10.3431 4.17969 12 4.17969C13.6569 4.17969 15 5.52283 15 7.17969ZM21 10.1797C21 11.2843 20.1046 12.1797 19 12.1797C17.8954 12.1797 17 11.2843 17 10.1797C17 9.07512 17.8954 8.17969 19 8.17969C20.1046 8.17969 21 9.07512 21 10.1797ZM7 10.1797C7 11.2843 6.10457 12.1797 5 12.1797C3.89543 12.1797 3 11.2843 3 10.1797C3 9.07512 3.89543 8.17969 5 8.17969C6.10457 8.17969 7 9.07512 7 10.1797Z"
|
|
11
|
+
stroke="white"
|
|
12
|
+
stroke-width="1.5"
|
|
13
|
+
stroke-linecap="round"
|
|
14
|
+
stroke-linejoin="round"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const VolumeIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "24"}
|
|
4
|
+
height={height || "25"}
|
|
5
|
+
viewBox="0 0 24 25"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M2 10.1814V14.1814C2 16.1814 3 17.1814 5 17.1814H6.43C6.8 17.1814 7.17 17.2914 7.49 17.4814L10.41 19.3114C12.93 20.8914 15 19.7414 15 16.7714V7.59143C15 4.61143 12.93 3.47143 10.41 5.05143L7.49 6.88143C7.17 7.07143 6.8 7.18143 6.43 7.18143H5C3 7.18143 2 8.18143 2 10.1814Z"
|
|
11
|
+
stroke="white"
|
|
12
|
+
stroke-width="1.5"
|
|
13
|
+
/>
|
|
14
|
+
<path
|
|
15
|
+
d="M18 8.17969C19.78 10.5497 19.78 13.8097 18 16.1797"
|
|
16
|
+
stroke="white"
|
|
17
|
+
stroke-width="1.5"
|
|
18
|
+
stroke-linecap="round"
|
|
19
|
+
stroke-linejoin="round"
|
|
20
|
+
/>
|
|
21
|
+
<path
|
|
22
|
+
d="M19.8281 5.67969C22.7181 9.52969 22.7181 14.8297 19.8281 18.6797"
|
|
23
|
+
stroke="white"
|
|
24
|
+
stroke-width="1.5"
|
|
25
|
+
stroke-linecap="round"
|
|
26
|
+
stroke-linejoin="round"
|
|
27
|
+
/>
|
|
28
|
+
</svg>
|
|
29
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useLocation } from "react-router-dom";
|
|
1
|
+
import { useState, useEffect, createContext } from "react";
|
|
2
|
+
import { Outlet, useLocation } from "react-router-dom";
|
|
3
3
|
import {
|
|
4
4
|
Layout,
|
|
5
5
|
CenterLayout,
|
|
@@ -7,44 +7,51 @@ import {
|
|
|
7
7
|
RightLayout,
|
|
8
8
|
MainLayout,
|
|
9
9
|
} from "./index.styled";
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import {
|
|
11
|
+
Header as HeaderComponent,
|
|
12
|
+
Banner,
|
|
13
|
+
SideNav as SideBar,
|
|
14
|
+
SideMenu,
|
|
15
|
+
} from "../";
|
|
13
16
|
import { leftNavMenu, user, sideMenuOptions } from "../../hooks/leftNavMenu";
|
|
14
|
-
import SideMenu from "../sideBar/sideMenu";
|
|
17
|
+
// import SideMenu from "../sideBar/sideMenu";
|
|
15
18
|
|
|
16
|
-
const AppMainLayout = (
|
|
19
|
+
const AppMainLayout = () => {
|
|
17
20
|
const [isOpen, setIsOpen] = useState(true);
|
|
18
21
|
const location = useLocation();
|
|
19
22
|
|
|
20
|
-
console.log(location);
|
|
21
|
-
|
|
22
23
|
useEffect(() => {
|
|
23
24
|
if (location.pathname === "/documentation") setIsOpen(false);
|
|
24
25
|
}, [isOpen]);
|
|
25
|
-
|
|
26
|
+
const [rightLayout, setRightLayout] = useState(true);
|
|
27
|
+
const [rightComponent, setRightComponent] = useState();
|
|
26
28
|
return (
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
<OutletContext.Provider value={{ setRightComponent, setRightLayout }}>
|
|
30
|
+
<Layout>
|
|
31
|
+
<HeaderComponent />
|
|
32
|
+
<MainLayout>
|
|
33
|
+
<LeftLayout>
|
|
34
|
+
<SideBar routes={leftNavMenu} />
|
|
35
|
+
<SideMenu
|
|
36
|
+
user={user}
|
|
37
|
+
routes={sideMenuOptions}
|
|
38
|
+
userType={"developer"}
|
|
39
|
+
isOpen={isOpen}
|
|
40
|
+
setIsOpen={setIsOpen}
|
|
41
|
+
/>
|
|
42
|
+
</LeftLayout>
|
|
43
|
+
<CenterLayout>
|
|
44
|
+
<Outlet />
|
|
45
|
+
</CenterLayout>
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
{rightLayout && (
|
|
48
|
+
<RightLayout>{rightComponent ?? <Banner />}</RightLayout>
|
|
49
|
+
)}
|
|
50
|
+
</MainLayout>
|
|
51
|
+
</Layout>
|
|
52
|
+
</OutletContext.Provider>
|
|
47
53
|
);
|
|
48
54
|
};
|
|
49
55
|
|
|
56
|
+
export const OutletContext = createContext({});
|
|
50
57
|
export default AppMainLayout;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { CloseIcon } from "./assets/svg/close";
|
|
3
3
|
import { AddIcon } from "./assets/svg/add";
|
|
4
4
|
import {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
AccountDropdownBody,
|
|
8
8
|
AccountDropdownFooter,
|
|
9
9
|
} from "./index.styled";
|
|
10
|
+
import { useLocation, useNavigate } from "react-router-dom";
|
|
10
11
|
/**
|
|
11
12
|
* @param {{
|
|
12
13
|
* type: string,
|
|
@@ -17,59 +18,222 @@ import {
|
|
|
17
18
|
*
|
|
18
19
|
*/
|
|
19
20
|
const AccountDropdown = (props) => {
|
|
21
|
+
const [personalAccountData, setPersonalAccountData] = useState([]);
|
|
22
|
+
const [developerAccountData, setDeveloperAccountData] = useState([]);
|
|
23
|
+
const [instructorAccountData, setInstructorAccountData] = useState([]);
|
|
24
|
+
const [enterpriseAccountData, setEnterpriseAccountData] = useState([]);
|
|
25
|
+
const [selectedAccount, setSelectedAccount] = useState();
|
|
26
|
+
const navigate = useNavigate();
|
|
27
|
+
const { pathname } = useLocation();
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (pathname?.includes("personal")) {
|
|
30
|
+
setSelectedAccount(personalAccountData[0]);
|
|
31
|
+
}
|
|
32
|
+
if (pathname?.includes("developer")) {
|
|
33
|
+
setSelectedAccount(developerAccountData[0]);
|
|
34
|
+
}
|
|
35
|
+
if (pathname?.includes("instructor")) {
|
|
36
|
+
setSelectedAccount(instructorAccountData[0]);
|
|
37
|
+
}
|
|
38
|
+
if (pathname?.includes("enterprise")) {
|
|
39
|
+
setSelectedAccount(enterpriseAccountData[0]);
|
|
40
|
+
}
|
|
41
|
+
}, [pathname]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (props?.data?.data) {
|
|
44
|
+
let personalArray = [];
|
|
45
|
+
let developerArray = [];
|
|
46
|
+
let instructorArray = [];
|
|
47
|
+
let enterpriseArray = [];
|
|
48
|
+
props?.data?.data?.results?.map((accountItem, idx) => {
|
|
49
|
+
if (
|
|
50
|
+
accountItem?.type === "PERSONAL" &&
|
|
51
|
+
!personalAccountData?.includes(accountItem)
|
|
52
|
+
) {
|
|
53
|
+
personalArray.push(accountItem);
|
|
54
|
+
setPersonalAccountData(personalArray);
|
|
55
|
+
}
|
|
56
|
+
if (
|
|
57
|
+
accountItem?.type === "DEVELOPER" &&
|
|
58
|
+
!developerAccountData?.includes(accountItem)
|
|
59
|
+
) {
|
|
60
|
+
developerArray.push(accountItem);
|
|
61
|
+
setDeveloperAccountData(developerArray);
|
|
62
|
+
}
|
|
63
|
+
if (
|
|
64
|
+
accountItem?.type === "INSTRUCTOR" &&
|
|
65
|
+
!instructorAccountData?.includes(accountItem)
|
|
66
|
+
) {
|
|
67
|
+
instructorArray.push(accountItem);
|
|
68
|
+
setInstructorAccountData(instructorArray);
|
|
69
|
+
}
|
|
70
|
+
if (
|
|
71
|
+
accountItem?.type === "ENTERPRISE" &&
|
|
72
|
+
!enterpriseAccountData?.includes(accountItem)
|
|
73
|
+
) {
|
|
74
|
+
enterpriseArray.push(accountItem);
|
|
75
|
+
setEnterpriseAccountData(enterpriseArray);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, [props?.data?.data]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (selectedAccount) {
|
|
82
|
+
window.localStorage.setItem("current-account", selectedAccount);
|
|
83
|
+
}
|
|
84
|
+
}, [selectedAccount]);
|
|
20
85
|
return (
|
|
21
86
|
<>
|
|
22
87
|
<AccountDropdownLayout>
|
|
23
88
|
<AccountDropdownHeader>
|
|
24
89
|
<div>
|
|
25
|
-
<img
|
|
90
|
+
<img
|
|
91
|
+
src={selectedAccount?.profile_photo || props?.avatar}
|
|
92
|
+
alt="account photo"
|
|
93
|
+
/>
|
|
26
94
|
</div>
|
|
27
95
|
<div>
|
|
28
|
-
<h1>
|
|
29
|
-
|
|
96
|
+
<h1>
|
|
97
|
+
{" "}
|
|
98
|
+
{selectedAccount?.display_name ||
|
|
99
|
+
selectedAccount?.metadata?.organization_name ||
|
|
100
|
+
props.activeAccountName}
|
|
101
|
+
</h1>
|
|
102
|
+
<h2 style={{ textTransform: "capitalize" }}>
|
|
103
|
+
{selectedAccount?.type || props.activeAccountType}{" "}
|
|
104
|
+
</h2>
|
|
30
105
|
</div>
|
|
31
106
|
<CloseIcon onClick={(e) => props.setIsOpen(!props.isOpen)} />
|
|
32
107
|
</AccountDropdownHeader>
|
|
33
108
|
<AccountDropdownBody>
|
|
34
109
|
{/* {props.apiAccountType === `${props.accountType}` && ( */}
|
|
35
|
-
<div>
|
|
36
|
-
<h3>{props.accountType} </h3>
|
|
37
|
-
<div className="account-info">
|
|
38
|
-
<div className="avatar-container">
|
|
39
|
-
<img src={props.avatar} alt="account photo" />
|
|
40
|
-
</div>
|
|
41
|
-
<div className="account-details">
|
|
42
|
-
<h1> {props.accountName}</h1>
|
|
43
|
-
<span>{props.notificationCount} </span>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
110
|
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
111
|
+
{personalAccountData?.length > 0 && (
|
|
112
|
+
<div>
|
|
113
|
+
<h3>Personal account</h3>
|
|
114
|
+
{personalAccountData?.map((personalItem, idx) => (
|
|
115
|
+
<div
|
|
116
|
+
className="account-info"
|
|
117
|
+
onClick={() => {
|
|
118
|
+
setSelectedAccount(personalItem);
|
|
119
|
+
if (window.location.port) {
|
|
120
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/personal`;
|
|
121
|
+
} else {
|
|
122
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/personal`;
|
|
123
|
+
}
|
|
124
|
+
}}
|
|
125
|
+
key={idx}
|
|
126
|
+
>
|
|
127
|
+
<div className="avatar-container">
|
|
128
|
+
<img
|
|
129
|
+
src={personalItem?.profile_photo || props?.avatar}
|
|
130
|
+
alt="account photo"
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
<div className="account-details">
|
|
134
|
+
<h1> {personalItem?.display_name || props.accountName}</h1>
|
|
135
|
+
<span>{props.notificationCount} </span>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
))}
|
|
58
139
|
</div>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
140
|
+
)}
|
|
141
|
+
{developerAccountData.length > 0 && (
|
|
142
|
+
<div>
|
|
143
|
+
<h3>Developer account</h3>
|
|
144
|
+
{developerAccountData?.map((developerItem, idx) => (
|
|
145
|
+
<div
|
|
146
|
+
className="account-info"
|
|
147
|
+
onClick={() => {
|
|
148
|
+
setSelectedAccount(developerItem);
|
|
149
|
+
if (window.location.port) {
|
|
150
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/developer`;
|
|
151
|
+
} else {
|
|
152
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/developer`;
|
|
153
|
+
}
|
|
154
|
+
}}
|
|
155
|
+
key={idx}
|
|
156
|
+
>
|
|
157
|
+
<div className="avatar-container">
|
|
158
|
+
<img
|
|
159
|
+
src={developerItem?.profile_photo || props.avatar}
|
|
160
|
+
alt="account photo"
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
<div className="account-details">
|
|
164
|
+
<h1> {developerItem?.display_name || props.accountName}</h1>
|
|
165
|
+
<span>{props.notificationCount} </span>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
))}
|
|
71
169
|
</div>
|
|
72
|
-
|
|
170
|
+
)}
|
|
171
|
+
{instructorAccountData?.length > 0 && (
|
|
172
|
+
<div>
|
|
173
|
+
<h3>Instructor account</h3>
|
|
174
|
+
{instructorAccountData?.map((instructorItem, idx) => (
|
|
175
|
+
<div
|
|
176
|
+
className="account-info"
|
|
177
|
+
onClick={() => {
|
|
178
|
+
setSelectedAccount(instructorItem);
|
|
179
|
+
if (window.location.port) {
|
|
180
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/instructor`;
|
|
181
|
+
} else {
|
|
182
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/instructor`;
|
|
183
|
+
}
|
|
184
|
+
}}
|
|
185
|
+
key={idx}
|
|
186
|
+
>
|
|
187
|
+
<div className="avatar-container">
|
|
188
|
+
<img
|
|
189
|
+
src={instructorItem?.profile_photo || props.avatar}
|
|
190
|
+
alt="account photo"
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
193
|
+
<div className="account-details">
|
|
194
|
+
<h1>
|
|
195
|
+
{" "}
|
|
196
|
+
{instructorItem?.display_name || props.accountName}
|
|
197
|
+
</h1>
|
|
198
|
+
<span>{props.notificationCount} </span>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
))}
|
|
202
|
+
</div>
|
|
203
|
+
)}
|
|
204
|
+
{enterpriseAccountData?.length > 0 && (
|
|
205
|
+
<div>
|
|
206
|
+
<h3>Enterprise account</h3>
|
|
207
|
+
{enterpriseAccountData?.map((enterpriseItem, idx) => (
|
|
208
|
+
<div
|
|
209
|
+
className="account-info"
|
|
210
|
+
onClick={() => {
|
|
211
|
+
setSelectedAccount(enterpriseItem);
|
|
212
|
+
if (window.location.port) {
|
|
213
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/enterprise`;
|
|
214
|
+
} else {
|
|
215
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/enterprise`;
|
|
216
|
+
}
|
|
217
|
+
}}
|
|
218
|
+
key={idx}
|
|
219
|
+
>
|
|
220
|
+
<div className="avatar-container">
|
|
221
|
+
<img
|
|
222
|
+
src={enterpriseItem?.profile_photo || props.avatar}
|
|
223
|
+
alt="account photo"
|
|
224
|
+
/>
|
|
225
|
+
</div>
|
|
226
|
+
<div className="account-details">
|
|
227
|
+
<h1>
|
|
228
|
+
{" "}
|
|
229
|
+
{enterpriseItem?.display_name || props.accountName}
|
|
230
|
+
</h1>
|
|
231
|
+
<span>{props.notificationCount} </span>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
))}
|
|
235
|
+
</div>
|
|
236
|
+
)}
|
|
73
237
|
{/* // )} */}
|
|
74
238
|
</AccountDropdownBody>
|
|
75
239
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import useAxios from "axios-hooks";
|
|
2
|
+
|
|
3
|
+
const useHeader = () => {
|
|
4
|
+
// get user details
|
|
5
|
+
const [{ ...userDetails }, getUserDetails] = useAxios();
|
|
6
|
+
|
|
7
|
+
const handleGetUserDetails = async () => {
|
|
8
|
+
await getUserDetails({
|
|
9
|
+
method: "get",
|
|
10
|
+
url: "/iam/v1/users/me/",
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// get user accounts detail
|
|
15
|
+
|
|
16
|
+
const [{ ...userAccountsDetail }, getUserAccountsDetail] = useAxios();
|
|
17
|
+
|
|
18
|
+
const handleGetUserAccountsDetail = async () => {
|
|
19
|
+
await getUserAccountsDetail({
|
|
20
|
+
method: "get",
|
|
21
|
+
url: "/iam/v1/accounts/",
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
handleGetUserDetails,
|
|
26
|
+
userDetails,
|
|
27
|
+
handleGetUserAccountsDetail,
|
|
28
|
+
userAccountsDetail,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export default useHeader;
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
UserProfile,
|
|
20
20
|
CountryFlagGroup,
|
|
21
21
|
} from "./index.styled";
|
|
22
|
+
import useHeader from "./getHeaderDetails";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* @param {{
|
|
@@ -33,11 +34,17 @@ const HeaderComponent = (props) => {
|
|
|
33
34
|
const [selected, setSelected] = useState("ES");
|
|
34
35
|
const [isOpen, setIsOpen] = useState(false);
|
|
35
36
|
const [searchResultOpen, setSearchResultOpen] = useState(false);
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
const {
|
|
38
|
+
handleGetUserAccountsDetail,
|
|
39
|
+
handleGetUserDetails,
|
|
40
|
+
userAccountsDetail,
|
|
41
|
+
userDetails,
|
|
42
|
+
} = useHeader();
|
|
38
43
|
|
|
39
44
|
useEffect(() => {
|
|
40
45
|
setIsOpen(false);
|
|
46
|
+
handleGetUserAccountsDetail();
|
|
47
|
+
// handleGetUserDetails();
|
|
41
48
|
}, []);
|
|
42
49
|
|
|
43
50
|
return (
|
|
@@ -118,13 +125,14 @@ const HeaderComponent = (props) => {
|
|
|
118
125
|
{isOpen && (
|
|
119
126
|
<AccountDropdown
|
|
120
127
|
avatar={avatar}
|
|
121
|
-
activeAccountName={"
|
|
128
|
+
activeAccountName={"Default name"}
|
|
122
129
|
activeAccountType={"Personal Account"}
|
|
123
|
-
accountName={"
|
|
124
|
-
accountType={"
|
|
130
|
+
accountName={"Default name"}
|
|
131
|
+
accountType={"Default Account"}
|
|
125
132
|
notificationCount={"5"}
|
|
126
133
|
isOpen={isOpen}
|
|
127
134
|
setIsOpen={setIsOpen}
|
|
135
|
+
data={userAccountsDetail}
|
|
128
136
|
/>
|
|
129
137
|
)}
|
|
130
138
|
</Navbar>
|
|
@@ -176,7 +176,10 @@ export const CountryFlagGroup = styled.div`
|
|
|
176
176
|
height: 10px;
|
|
177
177
|
top: 18px;
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
& .ReactFlagsSelect-module_selectOptions__3LNBJ {
|
|
180
|
+
width: 155px !important;
|
|
181
|
+
font-size: 12px !important;
|
|
182
|
+
}
|
|
180
183
|
& .ReactFlagsSelect-module_flagsSelect__2pfa2 {
|
|
181
184
|
width: 100%;
|
|
182
185
|
padding-bottom: 0;
|
|
@@ -451,7 +454,10 @@ export const CountryFlagGroup2 = styled.div`
|
|
|
451
454
|
height: 7px;
|
|
452
455
|
top: 17px;
|
|
453
456
|
}
|
|
454
|
-
|
|
457
|
+
& .ReactFlagsSelect-module_selectOptions__3LNBJ {
|
|
458
|
+
width: 155px !important;
|
|
459
|
+
font-size: 12px !important;
|
|
460
|
+
}
|
|
455
461
|
& .ReactFlagsSelect-module_flagsSelect__2pfa2 {
|
|
456
462
|
width: 100%;
|
|
457
463
|
padding-bottom: 0;
|
package/src/components/index.js
CHANGED
|
@@ -26,3 +26,5 @@ export { default as NotificationThresholdComponent } from "./notificationThresho
|
|
|
26
26
|
export { default as DevAPIdocs } from "./developerAPIdocs";
|
|
27
27
|
export { default as Calender } from "./calender/input";
|
|
28
28
|
export { default as ErrorPage } from "./errorPage";
|
|
29
|
+
export { default as AppMainLayout } from "./AppMainLayout";
|
|
30
|
+
export { OutletContext as OutletContext } from "./AppMainLayout";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import {
|
|
4
4
|
UserCardContainer,
|
|
@@ -7,15 +7,31 @@ import {
|
|
|
7
7
|
Handle,
|
|
8
8
|
UserDetail,
|
|
9
9
|
} from "./styles";
|
|
10
|
+
import useHeader from "../../header/getHeaderDetails";
|
|
11
|
+
import Loader from "../../loader";
|
|
10
12
|
|
|
11
13
|
const UserCard = ({ user, isOpen }) => {
|
|
14
|
+
const { handleGetUserDetails, userDetails } = useHeader();
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
handleGetUserDetails();
|
|
17
|
+
}, []);
|
|
12
18
|
return (
|
|
13
19
|
<UserCardContainer isOpen={isOpen}>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
{userDetails?.loading ? (
|
|
21
|
+
<Loader />
|
|
22
|
+
) : (
|
|
23
|
+
<>
|
|
24
|
+
<Avatar src={user.avatar} isOpen={isOpen} />
|
|
25
|
+
<UserDetail isOpen={isOpen}>
|
|
26
|
+
<UserName>
|
|
27
|
+
{userDetails?.data?.first_name +
|
|
28
|
+
" " +
|
|
29
|
+
userDetails?.data?.last_name}
|
|
30
|
+
</UserName>
|
|
31
|
+
<Handle>{`@ ${userDetails?.data?.username}`}</Handle>
|
|
32
|
+
</UserDetail>
|
|
33
|
+
</>
|
|
34
|
+
)}
|
|
19
35
|
</UserCardContainer>
|
|
20
36
|
);
|
|
21
37
|
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// import { useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
FaSmile,
|
|
4
|
+
FaMicrophone,
|
|
5
|
+
FaHeadphonesAlt,
|
|
6
|
+
FaLanguage,
|
|
7
|
+
FaChartLine,
|
|
8
|
+
FaFileAlt,
|
|
9
|
+
FaBook,
|
|
10
|
+
FaUsers,
|
|
11
|
+
FaBullhorn,
|
|
12
|
+
FaUser,
|
|
13
|
+
FaCog,
|
|
14
|
+
FaQuestion,
|
|
15
|
+
FaCode,
|
|
16
|
+
} from "react-icons/fa";
|
|
17
|
+
// import { HiOutlineBookOpen } from "react-icons/hi";
|
|
18
|
+
import { BsChatSquareText } from "react-icons/bs";
|
|
19
|
+
import { MdOutlineBook } from "react-icons/md";
|
|
20
|
+
import UserImage from "../assets/images/dashboardImage.png";
|
|
21
|
+
import Learning from "../assets/svg/learning";
|
|
22
|
+
import { AwardIcon } from "../assets/svg/award";
|
|
23
|
+
import { DocumentIcon } from "../assets/svg/document";
|
|
24
|
+
import { TeamsIcon } from "../assets/svg/teams";
|
|
25
|
+
import { VolumeIcon } from "../assets/svg/volume";
|
|
26
|
+
import { BookIcon } from "../assets/svg/book";
|
|
27
|
+
import { DashboardIcon } from "../assets/svg/dashboard";
|
|
28
|
+
|
|
29
|
+
export const user = {
|
|
30
|
+
name: "John Doe",
|
|
31
|
+
handle: "@johndoe",
|
|
32
|
+
avatar: UserImage,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const leftNavMenu = [
|
|
36
|
+
{
|
|
37
|
+
path: "/learning",
|
|
38
|
+
label: "Learning",
|
|
39
|
+
icon: <Learning />,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
path: "/community",
|
|
43
|
+
label: "Community",
|
|
44
|
+
icon: <BsChatSquareText />,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
path: "/fun",
|
|
48
|
+
label: "Fun",
|
|
49
|
+
icon: <FaSmile />,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
path: "/duet",
|
|
53
|
+
label: "Duet",
|
|
54
|
+
icon: <FaHeadphonesAlt />,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
path: "/speech",
|
|
58
|
+
label: "Speech",
|
|
59
|
+
icon: <FaMicrophone />,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
path: "/dictionary",
|
|
63
|
+
label: "Dictionary",
|
|
64
|
+
icon: <MdOutlineBook />,
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
export const sideMenuOptions = [
|
|
69
|
+
{
|
|
70
|
+
userType: "developer",
|
|
71
|
+
routes: [
|
|
72
|
+
{
|
|
73
|
+
path: "/dashboard",
|
|
74
|
+
icon: <DashboardIcon />,
|
|
75
|
+
text: "Dashboard",
|
|
76
|
+
},
|
|
77
|
+
{ path: "/reports/students", icon: <AwardIcon />, text: "Reports" },
|
|
78
|
+
|
|
79
|
+
{
|
|
80
|
+
path: "/courses",
|
|
81
|
+
icon: <BookIcon />,
|
|
82
|
+
text: "Courses",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
path: "/manage-teams",
|
|
86
|
+
icon: <TeamsIcon />,
|
|
87
|
+
text: "Manage Teams",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
path: "/announcements",
|
|
91
|
+
icon: <VolumeIcon />,
|
|
92
|
+
text: "Announcements",
|
|
93
|
+
notifications: 3,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
userType: "user",
|
|
99
|
+
routes: [
|
|
100
|
+
{
|
|
101
|
+
path: "/dashboard",
|
|
102
|
+
icon: <FaChartLine />,
|
|
103
|
+
text: "Dashboard",
|
|
104
|
+
notifications: 1,
|
|
105
|
+
},
|
|
106
|
+
{ path: "/courses", icon: <FaBook />, text: "Courses" },
|
|
107
|
+
{ path: "/teams", icon: <FaUsers />, text: "My teams" },
|
|
108
|
+
{ path: "/profile", icon: <FaUser />, text: "Profile" },
|
|
109
|
+
{ path: "/help", icon: <FaQuestion />, text: "Help" },
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
];
|