l-min-components 1.0.214 → 1.0.220
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 +1 -1
- package/src/components/AppMainLayout/index.jsx +3 -0
- package/src/components/header/account-dropdown.jsx +18 -18
- package/src/components/header/index.jsx +65 -4
- package/src/components/header/index.styled.js +11 -1
- package/src/components/sideBar/sideMenu/index.jsx +18 -5
- package/src/components/sideBar/sideMenu/styles/index.jsx +1 -1
package/package.json
CHANGED
|
@@ -26,6 +26,9 @@ const AppMainLayout = () => {
|
|
|
26
26
|
const [rightLayout, setRightLayout] = useState(true);
|
|
27
27
|
const [rightComponent, setRightComponent] = useState();
|
|
28
28
|
const [generalData, setGeneralData] = useState({});
|
|
29
|
+
console.log("====================================");
|
|
30
|
+
console.log(generalData);
|
|
31
|
+
console.log("====================================");
|
|
29
32
|
return (
|
|
30
33
|
<OutletContext.Provider
|
|
31
34
|
value={{ setRightComponent, setRightLayout, generalData, setGeneralData }}
|
|
@@ -22,7 +22,7 @@ const AccountDropdown = (props) => {
|
|
|
22
22
|
const [developerAccountData, setDeveloperAccountData] = useState([]);
|
|
23
23
|
const [instructorAccountData, setInstructorAccountData] = useState([]);
|
|
24
24
|
const [enterpriseAccountData, setEnterpriseAccountData] = useState([]);
|
|
25
|
-
const [selectedAccount, setSelectedAccount] = useState();
|
|
25
|
+
// const [selectedAccount, setSelectedAccount] = useState();
|
|
26
26
|
const navigate = useNavigate();
|
|
27
27
|
const { pathname } = useLocation();
|
|
28
28
|
useEffect(() => {}, [pathname]);
|
|
@@ -64,52 +64,52 @@ const AccountDropdown = (props) => {
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
if (pathname?.includes("personal")) {
|
|
67
|
-
setSelectedAccount(personalArray[0]);
|
|
67
|
+
props?.setSelectedAccount(personalArray[0]);
|
|
68
68
|
}
|
|
69
69
|
if (window.location.host?.includes("developer")) {
|
|
70
|
-
setSelectedAccount(developerArray[0]);
|
|
70
|
+
props?.setSelectedAccount(developerArray[0]);
|
|
71
71
|
}
|
|
72
72
|
if (pathname?.includes("instructor")) {
|
|
73
|
-
setSelectedAccount(instructorArray[0]);
|
|
73
|
+
props?.setSelectedAccount(instructorArray[0]);
|
|
74
74
|
}
|
|
75
75
|
if (pathname?.includes("enterprise")) {
|
|
76
|
-
setSelectedAccount(enterpriseArray[0]);
|
|
76
|
+
props?.setSelectedAccount(enterpriseArray[0]);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}, [props?.data?.data]);
|
|
80
80
|
useEffect(() => {
|
|
81
|
-
if (selectedAccount?.type === "DEVELOPER") {
|
|
81
|
+
if (props?.selectedAccount?.type === "DEVELOPER") {
|
|
82
82
|
const date = new Date();
|
|
83
83
|
date.setDate(date.getDate() + 28);
|
|
84
84
|
document.cookie =
|
|
85
85
|
"activeDeveloperAccount=" +
|
|
86
|
-
selectedAccount?.id +
|
|
86
|
+
props?.selectedAccount?.id +
|
|
87
87
|
`; domain=${
|
|
88
88
|
window.location.href.includes("localhost")
|
|
89
89
|
? ".localhost"
|
|
90
90
|
: ".learngual.com"
|
|
91
91
|
}; path=/; expires=${date.toUTCString()};`;
|
|
92
92
|
}
|
|
93
|
-
}, [selectedAccount]);
|
|
93
|
+
}, [props?.selectedAccount]);
|
|
94
94
|
return (
|
|
95
95
|
<>
|
|
96
96
|
<AccountDropdownLayout>
|
|
97
97
|
<AccountDropdownHeader>
|
|
98
|
-
<div>
|
|
98
|
+
<div className="img_div">
|
|
99
99
|
<img
|
|
100
|
-
src={selectedAccount?.profile_photo || props?.avatar}
|
|
100
|
+
src={props?.selectedAccount?.profile_photo || props?.avatar}
|
|
101
101
|
alt="account photo"
|
|
102
102
|
/>
|
|
103
103
|
</div>
|
|
104
104
|
<div>
|
|
105
105
|
<h1>
|
|
106
106
|
{" "}
|
|
107
|
-
{selectedAccount?.display_name ||
|
|
108
|
-
selectedAccount?.metadata?.organization_name ||
|
|
109
|
-
props
|
|
107
|
+
{props?.selectedAccount?.display_name ||
|
|
108
|
+
props?.selectedAccount?.metadata?.organization_name ||
|
|
109
|
+
props?.activeAccountName}
|
|
110
110
|
</h1>
|
|
111
111
|
<h2 style={{ textTransform: "capitalize" }}>
|
|
112
|
-
{selectedAccount?.type || props.activeAccountType}{" "}
|
|
112
|
+
{props?.selectedAccount?.type || props.activeAccountType}{" "}
|
|
113
113
|
</h2>
|
|
114
114
|
</div>
|
|
115
115
|
<CloseIcon onClick={(e) => props.setIsOpen(!props.isOpen)} />
|
|
@@ -124,7 +124,7 @@ const AccountDropdown = (props) => {
|
|
|
124
124
|
<div
|
|
125
125
|
className="account-info"
|
|
126
126
|
onClick={() => {
|
|
127
|
-
setSelectedAccount(personalItem);
|
|
127
|
+
props?.setSelectedAccount(personalItem);
|
|
128
128
|
if (window.location.port) {
|
|
129
129
|
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/personal`;
|
|
130
130
|
} else {
|
|
@@ -154,7 +154,7 @@ const AccountDropdown = (props) => {
|
|
|
154
154
|
<div
|
|
155
155
|
className="account-info"
|
|
156
156
|
onClick={() => {
|
|
157
|
-
setSelectedAccount(developerItem);
|
|
157
|
+
props?.setSelectedAccount(developerItem);
|
|
158
158
|
|
|
159
159
|
if (
|
|
160
160
|
window.location.port &&
|
|
@@ -191,7 +191,7 @@ const AccountDropdown = (props) => {
|
|
|
191
191
|
<div
|
|
192
192
|
className="account-info"
|
|
193
193
|
onClick={() => {
|
|
194
|
-
setSelectedAccount(instructorItem);
|
|
194
|
+
props?.setSelectedAccount(instructorItem);
|
|
195
195
|
if (window.location.port) {
|
|
196
196
|
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/instructor`;
|
|
197
197
|
} else {
|
|
@@ -224,7 +224,7 @@ const AccountDropdown = (props) => {
|
|
|
224
224
|
<div
|
|
225
225
|
className="account-info"
|
|
226
226
|
onClick={() => {
|
|
227
|
-
setSelectedAccount(enterpriseItem);
|
|
227
|
+
props?.setSelectedAccount(enterpriseItem);
|
|
228
228
|
if (window.location.port) {
|
|
229
229
|
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/enterprise`;
|
|
230
230
|
} else {
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from "./index.styled";
|
|
22
22
|
import useHeader from "./getHeaderDetails";
|
|
23
23
|
import { OutletContext } from "..";
|
|
24
|
+
import { useLocation } from "react-router-dom";
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* @param {{
|
|
@@ -41,18 +42,66 @@ const HeaderComponent = (props) => {
|
|
|
41
42
|
userAccountsDetail,
|
|
42
43
|
userDetails,
|
|
43
44
|
} = useHeader();
|
|
45
|
+
const { pathname } = useLocation();
|
|
44
46
|
const { setGeneralData } = useContext(OutletContext);
|
|
47
|
+
const [selectedAccount, setSelectedAccount] = useState();
|
|
48
|
+
|
|
45
49
|
useEffect(() => {
|
|
46
50
|
setIsOpen(false);
|
|
47
51
|
handleGetUserAccountsDetail();
|
|
48
|
-
|
|
52
|
+
handleGetUserDetails();
|
|
49
53
|
}, []);
|
|
50
54
|
useEffect(() => {
|
|
51
55
|
if (userAccountsDetail?.data) {
|
|
52
56
|
setGeneralData((generalData) => ({
|
|
53
57
|
...generalData,
|
|
54
58
|
accounts: userAccountsDetail?.data,
|
|
59
|
+
user: userDetails?.data,
|
|
55
60
|
}));
|
|
61
|
+
|
|
62
|
+
let personalArray = [];
|
|
63
|
+
let developerArray = [];
|
|
64
|
+
let instructorArray = [];
|
|
65
|
+
let enterpriseArray = [];
|
|
66
|
+
props?.data?.data?.results?.map((accountItem, idx) => {
|
|
67
|
+
if (
|
|
68
|
+
accountItem?.type === "PERSONAL" &&
|
|
69
|
+
!personalAccountData?.includes(accountItem)
|
|
70
|
+
) {
|
|
71
|
+
personalArray.push(accountItem);
|
|
72
|
+
}
|
|
73
|
+
if (
|
|
74
|
+
accountItem?.type === "DEVELOPER" &&
|
|
75
|
+
!developerAccountData?.includes(accountItem)
|
|
76
|
+
) {
|
|
77
|
+
developerArray.push(accountItem);
|
|
78
|
+
}
|
|
79
|
+
if (
|
|
80
|
+
accountItem?.type === "INSTRUCTOR" &&
|
|
81
|
+
!instructorAccountData?.includes(accountItem)
|
|
82
|
+
) {
|
|
83
|
+
instructorArray.push(accountItem);
|
|
84
|
+
}
|
|
85
|
+
if (
|
|
86
|
+
accountItem?.type === "ENTERPRISE" &&
|
|
87
|
+
!enterpriseAccountData?.includes(accountItem)
|
|
88
|
+
) {
|
|
89
|
+
enterpriseArray.push(accountItem);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (pathname?.includes("personal")) {
|
|
94
|
+
setSelectedAccount(personalArray[0]);
|
|
95
|
+
}
|
|
96
|
+
if (window.location.host?.includes("developer")) {
|
|
97
|
+
setSelectedAccount(developerArray[0]);
|
|
98
|
+
}
|
|
99
|
+
if (pathname?.includes("instructor")) {
|
|
100
|
+
setSelectedAccount(instructorArray[0]);
|
|
101
|
+
}
|
|
102
|
+
if (pathname?.includes("enterprise")) {
|
|
103
|
+
setSelectedAccount(enterpriseArray[0]);
|
|
104
|
+
}
|
|
56
105
|
}
|
|
57
106
|
}, [userAccountsDetail?.data]);
|
|
58
107
|
|
|
@@ -76,7 +125,12 @@ const HeaderComponent = (props) => {
|
|
|
76
125
|
</a>
|
|
77
126
|
</li> */}
|
|
78
127
|
<li>
|
|
79
|
-
<a
|
|
128
|
+
<a
|
|
129
|
+
onClick={() => {
|
|
130
|
+
window.location.href =
|
|
131
|
+
"https://developer-staging-01.learngual.com/settings/payment";
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
80
134
|
<SettingIcon /> Settings
|
|
81
135
|
</a>
|
|
82
136
|
</li>
|
|
@@ -125,8 +179,13 @@ const HeaderComponent = (props) => {
|
|
|
125
179
|
<img src={props.avatar} alt="profile" />
|
|
126
180
|
</div>
|
|
127
181
|
<div className="user-info-container">
|
|
128
|
-
<h5>
|
|
129
|
-
|
|
182
|
+
<h5>
|
|
183
|
+
{selectedAccount?.display_name ||
|
|
184
|
+
selectedAccount?.metadata?.organization_name}
|
|
185
|
+
</h5>
|
|
186
|
+
<h6 style={{ textTransform: "capitalize" }}>
|
|
187
|
+
{selectedAccount?.type}
|
|
188
|
+
</h6>
|
|
130
189
|
</div>
|
|
131
190
|
<ArrowDownIcon width={16} height={10} />
|
|
132
191
|
</UserProfile>
|
|
@@ -143,6 +202,8 @@ const HeaderComponent = (props) => {
|
|
|
143
202
|
isOpen={isOpen}
|
|
144
203
|
setIsOpen={setIsOpen}
|
|
145
204
|
data={userAccountsDetail}
|
|
205
|
+
selectedAccount={selectedAccount}
|
|
206
|
+
setSelectedAccount={setSelectedAccount}
|
|
146
207
|
/>
|
|
147
208
|
)}
|
|
148
209
|
</Navbar>
|
|
@@ -239,7 +239,17 @@ export const AccountDropdownHeader = styled.div`
|
|
|
239
239
|
border-radius: 30px 30px 0 0;
|
|
240
240
|
width: 100%;
|
|
241
241
|
border-bottom: 1px solid rgba(51, 51, 51, 0.15);
|
|
242
|
-
|
|
242
|
+
& .img_div {
|
|
243
|
+
max-width: 50px;
|
|
244
|
+
max-height: 50px;
|
|
245
|
+
display: flex;
|
|
246
|
+
justify-content: center;
|
|
247
|
+
align-items: center;
|
|
248
|
+
img {
|
|
249
|
+
width: 100%;
|
|
250
|
+
height: 100%;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
243
253
|
& h1 {
|
|
244
254
|
font-family: "Poppins";
|
|
245
255
|
font-weight: 600;
|
|
@@ -19,7 +19,7 @@ const SideMenu = ({
|
|
|
19
19
|
routes,
|
|
20
20
|
userType,
|
|
21
21
|
onLogout = () => {},
|
|
22
|
-
isOpen
|
|
22
|
+
isOpen,
|
|
23
23
|
setIsOpen,
|
|
24
24
|
}) => {
|
|
25
25
|
// const [isOpen, setIsOpen] = useState(false);
|
|
@@ -38,11 +38,24 @@ const SideMenu = ({
|
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
40
|
<NavigationItemContainer
|
|
41
|
-
|
|
41
|
+
onClick={() => {
|
|
42
|
+
if (
|
|
43
|
+
window.location.hostname.includes("staging") &&
|
|
44
|
+
window.location.hostname.includes("developer")
|
|
45
|
+
) {
|
|
46
|
+
window.location.href = `developer-staging-01.learngual.com/${path}`;
|
|
47
|
+
} else if (window.location.hostname.includes("localhost")) {
|
|
48
|
+
window.location.href = `http://localhost:${window.location.port}${path}`;
|
|
49
|
+
} else if (
|
|
50
|
+
window.location.hostname.includes("developer") &&
|
|
51
|
+
!window.location.hostname.includes("staging")
|
|
52
|
+
) {
|
|
53
|
+
window.location.href = `developer.learngual.com/${path}`;
|
|
54
|
+
}
|
|
55
|
+
}}
|
|
56
|
+
// to={route.path}
|
|
42
57
|
key={index}
|
|
43
|
-
className={cx(`${route.text}
|
|
44
|
-
isActive ? "active" : "";
|
|
45
|
-
})}
|
|
58
|
+
className={cx(`${route.text} ${active ? "active" : ""}`)}
|
|
46
59
|
minimal={isOpen}
|
|
47
60
|
>
|
|
48
61
|
<IconContainer active={active}>{icon}</IconContainer>
|
|
@@ -39,7 +39,7 @@ export const NavigationContainer = styled.div`
|
|
|
39
39
|
justify-content: center;
|
|
40
40
|
margin-top: 20px;
|
|
41
41
|
`;
|
|
42
|
-
export const NavigationItemContainer = styled
|
|
42
|
+
export const NavigationItemContainer = styled.p`
|
|
43
43
|
text-decoration: none;
|
|
44
44
|
display: flex;
|
|
45
45
|
align-items: center;
|