l-min-components 1.0.262 → 1.0.266

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.262",
3
+ "version": "1.0.266",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
Binary file
@@ -26,6 +26,9 @@ export const CenterLayout = styled.div`
26
26
  /* max-width: 900px; */
27
27
  margin: ${({ isOpen }) =>
28
28
  isOpen ? "0px 252px 0 336px" : "0px 252px 0 145px"};
29
+ @media screen and (max-width: 1023px) {
30
+ margin-right: 0;
31
+ }
29
32
  overflow-y: scroll;
30
33
  transition: all 0.3s;
31
34
  scrollbar-width: thin;
@@ -53,6 +56,9 @@ export const RightLayout = styled.div`
53
56
  max-height: 609px;
54
57
  height: 609px;
55
58
  right: 20px;
59
+ @media screen and (max-width: 1023px) {
60
+ display: none;
61
+ }
56
62
  > div {
57
63
  width: 100%;
58
64
  }
@@ -35,8 +35,15 @@ const AccountDropdown = (props) => {
35
35
  ? ".localhost"
36
36
  : ".learngual.com"
37
37
  }; path=/; expires=${date.toUTCString()};`;
38
+ props?.setGeneralData((generalData) => ({
39
+ ...generalData,
40
+ accounts: props?.userAccountsDetail?.data,
41
+ user: props?.userDetails?.data,
42
+ selectedAccount: props?.selectedAccount,
43
+ }));
38
44
  }
39
45
  }, [props?.selectedAccount]);
46
+ console.log(props?.selectedAccount, "selected");
40
47
  return (
41
48
  <>
42
49
  <AccountDropdownLayout>
@@ -55,7 +62,8 @@ const AccountDropdown = (props) => {
55
62
  props?.activeAccountName}
56
63
  </h1>
57
64
  <h2 style={{ textTransform: "capitalize" }}>
58
- {props?.selectedAccount?.type || props.activeAccountType}{" "}
65
+ {props?.selectedAccount?.type?.toLowerCase() ||
66
+ props.activeAccountType}{" "}
59
67
  </h2>
60
68
  </div>
61
69
  </AccountDropdownHeader>
@@ -94,10 +102,12 @@ const AccountDropdown = (props) => {
94
102
  )} */}
95
103
  {props?.developerAccountData.length > 0 && (
96
104
  <div>
97
- <h3>Developer account</h3>
105
+ <h3 style={{ marginBottom: 10 }}>Developer account</h3>
98
106
  {props?.developerAccountData?.map((developerItem, idx) => (
99
107
  <div
100
- className="account-info"
108
+ className={`account-info ${
109
+ developerItem === props?.selectedAccount ? "activated" : ""
110
+ }`}
101
111
  onClick={() => {
102
112
  props?.setSelectedAccount(developerItem);
103
113
 
@@ -134,7 +144,9 @@ const AccountDropdown = (props) => {
134
144
  <h3>Instructor account</h3>
135
145
  {props?.instructorAccountData?.map((instructorItem, idx) => (
136
146
  <div
137
- className="account-info"
147
+ className={`account-info ${
148
+ instructorItem === props?.selectedAccount ? "activated" : ""
149
+ }`}
138
150
  onClick={() => {
139
151
  props?.setSelectedAccount(instructorItem);
140
152
  if (window.location.port) {
@@ -167,7 +179,9 @@ const AccountDropdown = (props) => {
167
179
  <h3>Enterprise account</h3>
168
180
  {props?.enterpriseAccountData?.map((enterpriseItem, idx) => (
169
181
  <div
170
- className="account-info"
182
+ className={`account-info ${
183
+ enterpriseItem === props?.selectedAccount ? "activated" : ""
184
+ }`}
171
185
  onClick={() => {
172
186
  props?.setSelectedAccount(enterpriseItem);
173
187
  if (window.location.port) {
@@ -22,7 +22,7 @@ import {
22
22
  import useHeader from "./getHeaderDetails";
23
23
  import { OutletContext } from "..";
24
24
  import { useLocation } from "react-router-dom";
25
- import usFlag from "../../assets/images/18165.jpg";
25
+ import usFlag from "../../assets/images/usFlag.png";
26
26
  /**
27
27
  * @param {{
28
28
  * type: string,
@@ -61,6 +61,7 @@ const HeaderComponent = (props) => {
61
61
  ...generalData,
62
62
  accounts: userAccountsDetail?.data,
63
63
  user: userDetails?.data,
64
+ selectedAccount,
64
65
  }));
65
66
  const cookies = document.cookie;
66
67
  const cookieArray = cookies.split(";");
@@ -198,6 +199,7 @@ const HeaderComponent = (props) => {
198
199
  window.location.href =
199
200
  "https://developer-staging-01.learngual.com/settings/";
200
201
  }}
202
+ style={{ cursor: "pointer" }}
201
203
  >
202
204
  <SettingIcon /> Settings
203
205
  </a>
@@ -307,6 +309,9 @@ const HeaderComponent = (props) => {
307
309
  setInstructorAccountData={setInstructorAccountData}
308
310
  enterpriseAccountData={enterpriseAccountData}
309
311
  setEnterpriseAccountData={setEnterpriseAccountData}
312
+ setGeneralData={setGeneralData}
313
+ userAccountsDetail={userAccountsDetail}
314
+ userDetails={userDetails}
310
315
  />
311
316
  )}
312
317
  </Navbar>
@@ -16,6 +16,14 @@ export const NavGroup = styled.div`
16
16
  width: 44%;
17
17
  display: flex;
18
18
  justify-content: end;
19
+ align-items: center;
20
+ @media screen and (max-width: 1530px) {
21
+ width: fit-content;
22
+ margin-left: auto;
23
+ }
24
+ @media screen and (max-width: 1023px) {
25
+ display: none;
26
+ }
19
27
  .language_dropdown {
20
28
  display: flex;
21
29
  align-items: center;
@@ -68,6 +76,9 @@ export const Nav = styled.ul`
68
76
  margin: 0 10px;
69
77
  padding: 0 5px;
70
78
  width: 57%;
79
+ @media screen and (max-width: 1530px) {
80
+ width: 40%;
81
+ }
71
82
  & li {
72
83
  display: flex;
73
84
  align-items: center;
@@ -118,6 +129,14 @@ export const SearchInputGroup = styled.div`
118
129
  padding: 9px;
119
130
  margin: 0 15px;
120
131
  position: relative;
132
+ @media screen and (max-width: 1530px) {
133
+ width: 200px;
134
+ padding: 9px;
135
+ height: fit-content;
136
+ input {
137
+ width: 100%;
138
+ }
139
+ }
121
140
  &:focus {
122
141
  width: 130px;
123
142
  }
@@ -191,6 +210,9 @@ export const UserProfile = styled.div`
191
210
  color: rgba(49, 51, 51, 1);
192
211
  font-size: 16px;
193
212
  font-weight: 700;
213
+ @media screen and (max-width: 1530px) {
214
+ font-size: 12px;
215
+ }
194
216
  }
195
217
 
196
218
  & h6 {
@@ -270,7 +292,7 @@ export const AccountDropdownLayout = styled.div`
270
292
  background-color: #ffffff;
271
293
  font-family: "Nunito";
272
294
  width: 286px;
273
- min-height: 300px;
295
+ max-height: 530px;
274
296
  box-shadow: 0px 2px 40px rgba(0, 0, 0, 0.08);
275
297
  border-radius: 30px;
276
298
  display: flex;
@@ -370,6 +392,9 @@ export const AccountDropdownBody = styled.div`
370
392
  }
371
393
  }
372
394
  }
395
+ & .activated {
396
+ background-color: rgba(239, 248, 248, 1);
397
+ }
373
398
 
374
399
  & .account-details {
375
400
  margin-left: 10px;
@@ -5,7 +5,7 @@ import { Navbar2, NavGroup2, Nav2, CountryFlagGroup2 } from "./index.styled";
5
5
  import { ArrowDownIcon } from "./assets/svg/arrow-down";
6
6
  import ButtonComponent from "../button";
7
7
  import { useLocation, useNavigate } from "react-router-dom";
8
- import usFlag from "../../assets/images/18165.jpg";
8
+ import usFlag from "../../assets/images/usFlag.png";
9
9
 
10
10
  /**
11
11
  * @param {{
@@ -33,8 +33,28 @@ const SideMenu = ({
33
33
 
34
34
  const renderNavigationItem = (route, index) => {
35
35
  const { icon, text, notifications, path } = route;
36
- const active = window.location.pathname === route.path;
37
- console.log(active);
36
+ const handlePathCheck = () => {
37
+ let statusText;
38
+ console.log(window.location.pathname, "pathname");
39
+ if (
40
+ (window.location.pathname.includes("api") && path === "/") ||
41
+ (window.location.pathname === "/" && path === "/")
42
+ ) {
43
+ return (statusText = true);
44
+ }
45
+ if (
46
+ window.location.pathname.includes("documentation") &&
47
+ path === "/documentation"
48
+ ) {
49
+ return (statusText = true);
50
+ }
51
+ if (window.location.pathname.includes("report") && path === "/report") {
52
+ return (statusText = true);
53
+ } else {
54
+ return (statusText = false);
55
+ }
56
+ };
57
+ const active = handlePathCheck();
38
58
 
39
59
  return (
40
60
  <NavigationItemContainer
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from "react";
1
+ import React, { useContext, useEffect, useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import {
4
4
  UserCardContainer,
@@ -10,15 +10,41 @@ import {
10
10
  import useHeader from "../../header/getHeaderDetails";
11
11
  import Loader from "../../loader";
12
12
  import avatar from "../../../assets/images/avatar.png";
13
+ import { OutletContext } from "../../AppMainLayout";
13
14
 
14
15
  const UserCard = ({ user, isOpen }) => {
15
16
  const { handleGetUserDetails, userDetails } = useHeader();
17
+ const [organizationName, setOrganizationName] = useState();
18
+ const { generalData } = useContext(OutletContext);
16
19
  useEffect(() => {
17
20
  handleGetUserDetails();
18
- }, []);
21
+ if (generalData?.accounts) {
22
+ const cookies = document.cookie;
23
+ const cookieArray = cookies.split(";");
24
+ let activeDeveloperAccount;
25
+ for (let i = 0; i < cookieArray.length; i++) {
26
+ const cookie = cookieArray[i].trim();
27
+ if (cookie.startsWith("activeDeveloperAccount=")) {
28
+ activeDeveloperAccount = cookie.substring(
29
+ "activeDeveloperAccount=".length,
30
+ cookie.length
31
+ );
32
+ break;
33
+ }
34
+ }
35
+
36
+ generalData?.accounts?.results?.map((account, idx) => {
37
+ if (account?.id === activeDeveloperAccount) {
38
+ return setOrganizationName(account?.metadata?.organization_name);
39
+ }
40
+ });
41
+ }
42
+ }, [generalData]);
43
+ console.log(generalData, "data");
44
+
19
45
  return (
20
46
  <UserCardContainer isOpen={isOpen}>
21
- {userDetails?.loading ? (
47
+ {userDetails?.loading && !organizationName ? (
22
48
  <Loader zoom={0.3} />
23
49
  ) : (
24
50
  <>
@@ -27,12 +53,14 @@ const UserCard = ({ user, isOpen }) => {
27
53
  isOpen={isOpen}
28
54
  />
29
55
  <UserDetail isOpen={isOpen}>
30
- <UserName>
31
- {userDetails?.data?.first_name +
32
- " " +
33
- userDetails?.data?.last_name}
34
- </UserName>
35
- <Handle>{`@ ${userDetails?.data?.username}`}</Handle>
56
+ <UserName>Hello</UserName>
57
+ <Handle
58
+ style={{
59
+ textTransform: "capitalize",
60
+ fontWeight: 700,
61
+ fontSize: 15,
62
+ }}
63
+ >{`${organizationName}.`}</Handle>
36
64
  </UserDetail>
37
65
  </>
38
66
  )}