l-min-components 1.0.214 → 1.0.216
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
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 }}
|
|
@@ -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,7 +42,10 @@ 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();
|
|
@@ -53,6 +57,50 @@ const HeaderComponent = (props) => {
|
|
|
53
57
|
...generalData,
|
|
54
58
|
accounts: userAccountsDetail?.data,
|
|
55
59
|
}));
|
|
60
|
+
|
|
61
|
+
let personalArray = [];
|
|
62
|
+
let developerArray = [];
|
|
63
|
+
let instructorArray = [];
|
|
64
|
+
let enterpriseArray = [];
|
|
65
|
+
props?.data?.data?.results?.map((accountItem, idx) => {
|
|
66
|
+
if (
|
|
67
|
+
accountItem?.type === "PERSONAL" &&
|
|
68
|
+
!personalAccountData?.includes(accountItem)
|
|
69
|
+
) {
|
|
70
|
+
personalArray.push(accountItem);
|
|
71
|
+
}
|
|
72
|
+
if (
|
|
73
|
+
accountItem?.type === "DEVELOPER" &&
|
|
74
|
+
!developerAccountData?.includes(accountItem)
|
|
75
|
+
) {
|
|
76
|
+
developerArray.push(accountItem);
|
|
77
|
+
}
|
|
78
|
+
if (
|
|
79
|
+
accountItem?.type === "INSTRUCTOR" &&
|
|
80
|
+
!instructorAccountData?.includes(accountItem)
|
|
81
|
+
) {
|
|
82
|
+
instructorArray.push(accountItem);
|
|
83
|
+
}
|
|
84
|
+
if (
|
|
85
|
+
accountItem?.type === "ENTERPRISE" &&
|
|
86
|
+
!enterpriseAccountData?.includes(accountItem)
|
|
87
|
+
) {
|
|
88
|
+
enterpriseArray.push(accountItem);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (pathname?.includes("personal")) {
|
|
93
|
+
setSelectedAccount(personalArray[0]);
|
|
94
|
+
}
|
|
95
|
+
if (window.location.host?.includes("developer")) {
|
|
96
|
+
setSelectedAccount(developerArray[0]);
|
|
97
|
+
}
|
|
98
|
+
if (pathname?.includes("instructor")) {
|
|
99
|
+
setSelectedAccount(instructorArray[0]);
|
|
100
|
+
}
|
|
101
|
+
if (pathname?.includes("enterprise")) {
|
|
102
|
+
setSelectedAccount(enterpriseArray[0]);
|
|
103
|
+
}
|
|
56
104
|
}
|
|
57
105
|
}, [userAccountsDetail?.data]);
|
|
58
106
|
|
|
@@ -125,8 +173,13 @@ const HeaderComponent = (props) => {
|
|
|
125
173
|
<img src={props.avatar} alt="profile" />
|
|
126
174
|
</div>
|
|
127
175
|
<div className="user-info-container">
|
|
128
|
-
<h5>
|
|
129
|
-
|
|
176
|
+
<h5>
|
|
177
|
+
{selectedAccount?.display_name ||
|
|
178
|
+
selectedAccount?.metadata?.organization_name}
|
|
179
|
+
</h5>
|
|
180
|
+
<h6 style={{ textTransform: "capitalize" }}>
|
|
181
|
+
{selectedAccount?.type}
|
|
182
|
+
</h6>
|
|
130
183
|
</div>
|
|
131
184
|
<ArrowDownIcon width={16} height={10} />
|
|
132
185
|
</UserProfile>
|
|
@@ -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;
|