l-min-components 1.0.216 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.216",
3
+ "version": "1.0.220",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -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
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.activeAccountName}
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 {
@@ -49,13 +49,14 @@ const HeaderComponent = (props) => {
49
49
  useEffect(() => {
50
50
  setIsOpen(false);
51
51
  handleGetUserAccountsDetail();
52
- // handleGetUserDetails();
52
+ handleGetUserDetails();
53
53
  }, []);
54
54
  useEffect(() => {
55
55
  if (userAccountsDetail?.data) {
56
56
  setGeneralData((generalData) => ({
57
57
  ...generalData,
58
58
  accounts: userAccountsDetail?.data,
59
+ user: userDetails?.data,
59
60
  }));
60
61
 
61
62
  let personalArray = [];
@@ -124,7 +125,12 @@ const HeaderComponent = (props) => {
124
125
  </a>
125
126
  </li> */}
126
127
  <li>
127
- <a href="#">
128
+ <a
129
+ onClick={() => {
130
+ window.location.href =
131
+ "https://developer-staging-01.learngual.com/settings/payment";
132
+ }}
133
+ >
128
134
  <SettingIcon /> Settings
129
135
  </a>
130
136
  </li>
@@ -196,6 +202,8 @@ const HeaderComponent = (props) => {
196
202
  isOpen={isOpen}
197
203
  setIsOpen={setIsOpen}
198
204
  data={userAccountsDetail}
205
+ selectedAccount={selectedAccount}
206
+ setSelectedAccount={setSelectedAccount}
199
207
  />
200
208
  )}
201
209
  </Navbar>
@@ -19,7 +19,7 @@ const SideMenu = ({
19
19
  routes,
20
20
  userType,
21
21
  onLogout = () => {},
22
- isOpen = false,
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
- to={route.path}
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}`, ({ isActive, isPending }) => {
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(NavLink)`
42
+ export const NavigationItemContainer = styled.p`
43
43
  text-decoration: none;
44
44
  display: flex;
45
45
  align-items: center;