l-min-components 1.0.701 → 1.0.708

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.
@@ -0,0 +1,210 @@
1
+ import { useState, useEffect } from "react";
2
+ import {
3
+ CardContainer,
4
+ CardBody,
5
+ CardHeader,
6
+ ModalCardContainer,
7
+ CloseModalButton,
8
+ ExpiryCardContainer,
9
+ } from "./index.styled";
10
+ import Modal from "react-modal";
11
+ import ButtonComponent from "../../button";
12
+ import RemoveUser from "./img/removeUser.png"
13
+ import { ErrorBookIcon } from "./img/book";
14
+ import moment from "moment";
15
+ import { toast, ToastContainer } from "react-toastify";
16
+ import "react-toastify/dist/ReactToastify.css";
17
+ import { useNavigate } from "react-router-dom";
18
+
19
+ const SubscriptionExpiredModal = ({
20
+ subscriptionExpiredModalIsOpen,
21
+ setSubscriptionExpiredModalIsOpen,
22
+ getCurrentSubscriptionData,
23
+ }) => {
24
+ const modalCustomStyles = {
25
+ overlay: {
26
+ position: "fixed",
27
+ top: 0,
28
+ left: 0,
29
+ right: 0,
30
+ bottom: 0,
31
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
32
+ zIndex: 9999999999,
33
+ transition: "opacity 1000ms ease-in-out",
34
+ },
35
+ content: {
36
+ position: "absolute",
37
+ overflow: "auto",
38
+ WebkitOverflowScrolling: "scroll",
39
+ outline: "none",
40
+ top: "40%",
41
+ left: "50%",
42
+ right: "auto",
43
+ bottom: "auto",
44
+ marginRight: "-50%",
45
+ transform: "translate(-50%, -50%)",
46
+ borderRadius: "30px",
47
+ border: "none",
48
+ zIndex: 333333333,
49
+ background: "transparent",
50
+ width: "780px",
51
+ },
52
+ };
53
+
54
+ const navigate = useNavigate();
55
+ const [countdown, setCountdown] = useState(null);
56
+
57
+ // useEffect(() => {
58
+ // const targetDate = moment(
59
+ // getCurrentSubscriptionData?.data?.grace_period_end,
60
+ // "YYYY-MM-DD"
61
+ // );
62
+ // const interval = setInterval(() => {
63
+ // const now = moment();
64
+ // const diff = targetDate.diff(now);
65
+ // const hours = Math.floor(diff / 3600000);
66
+ // const minutes = Math.floor((diff % 3600000) / 60000);
67
+ // const seconds = Math.floor((diff % 60000) / 1000);
68
+
69
+ // if (diff <= 0) {
70
+ // setCountdown("0h - 0m - 0s");
71
+ // } else {
72
+ // setCountdown(`${hours}h - ${minutes}m - ${seconds}s`);
73
+ // }
74
+ // }, 1000);
75
+
76
+ // return () => {
77
+ // clearInterval(interval);
78
+ // };
79
+ // }, []);
80
+
81
+ const noSubError = () => {
82
+ toast.error("Error getting your subscription, please try again!");
83
+ };
84
+
85
+ const subId = getCurrentSubscriptionData?.data?.id;
86
+
87
+ const handleNavigateRenewal = () => {
88
+ const host = window.location.hostname;
89
+ const port = window.location.port ? `:${window.location.port}` : "";
90
+ const protocol = window.location.protocol;
91
+ const baseUrl = `${protocol}//${host}${port}`;
92
+ const renewalPath = "/settings/payment/details/renewal";
93
+
94
+ if (subId) {
95
+ const renewalUrl = `${baseUrl}${renewalPath}?subId=${subId}`;
96
+ window.location.href = renewalUrl;
97
+ } else {
98
+ toast.error("Error getting your subscription, please try again!");
99
+ }
100
+ };
101
+
102
+ const expiryDate = moment("2024-05-31",
103
+ "YYYY-MM-DD"); // Replace with your expiry date
104
+
105
+ const isWithin10Days = moment().add(10, 'days').isSameOrBefore(expiryDate);
106
+
107
+ if (isWithin10Days) {
108
+ console.log('Expiry date is within 10 days');
109
+ } else {
110
+ console.log('Expiry date is more than 10 days away');
111
+ }
112
+ console.log(isWithin10Days)
113
+
114
+
115
+ const [daysLeft, setDaysLeft] = useState(null);
116
+
117
+ useEffect(() => {
118
+ const targetDate = moment(expiryDate);
119
+ const now = moment();
120
+ const diff = targetDate.diff(now, 'days');
121
+
122
+ setDaysLeft(diff);
123
+ }, [expiryDate]);
124
+ console.log(daysLeft)
125
+
126
+
127
+ return (
128
+ <Modal
129
+ isOpen={subscriptionExpiredModalIsOpen}
130
+ onRequestClose={() => setSubscriptionExpiredModalIsOpen(false)}
131
+ style={modalCustomStyles}
132
+ closeTimeoutMS={1000}
133
+ ariaHideApp={false}
134
+ contentLabel="Selected Option"
135
+ shouldCloseOnOverlayClick={false}
136
+ >
137
+ <ModalCardContainer>
138
+ {/* <CloseModalButton
139
+ onClick={() => {
140
+ setSubscriptionExpiredModalIsOpen(false);
141
+ }}
142
+ >
143
+ <IoMdClose />
144
+ </CloseModalButton> */}
145
+
146
+ <ExpiryCardContainer>
147
+ <CardBody>
148
+ <div className="expiry_modal_container">
149
+ <div className="logo_section">
150
+ <img src={RemoveUser} alt="shield" />
151
+ </div>
152
+
153
+ <div className="expiry_details">
154
+ <div className="enterprise_info">
155
+ <p>
156
+ <ErrorBookIcon />
157
+ </p>
158
+ <p> Enterprise</p>
159
+ </div>
160
+
161
+ <h6>
162
+ {" "}
163
+ Your subscription to Learngual{" "}
164
+ {getCurrentSubscriptionData?.data?.plan_name} has expired{" "}
165
+ </h6>
166
+ <p>
167
+ Your students and instructors will no longer be able to access
168
+ your courses after <br />
169
+ <span className="error-txt">{countdown}</span>
170
+ </p>
171
+
172
+ <div className="btn__footer">
173
+ <ButtonComponent
174
+ text={"Select Plan"}
175
+ type="secondary"
176
+ height={40}
177
+ styles={{
178
+ fontSize: "14px",
179
+ padding: "14px 9px",
180
+ margin: 0,
181
+ backgroundColor: "transparent",
182
+ }}
183
+ onClick={() =>
184
+ (window.location.href =
185
+ "https://559staging.learngual.com/settings/payment")
186
+ }
187
+ />
188
+ <ButtonComponent
189
+ text={"Renew subscription"}
190
+ type="submit"
191
+ height={40}
192
+ styles={{
193
+ fontSize: "14px",
194
+ padding: "14px 10px",
195
+ margin: 0,
196
+ boxShadow: "0px 7px 15px rgba(254, 191, 16, 0.25)",
197
+ }}
198
+ onClick={() => handleNavigateRenewal()}
199
+ />
200
+ </div>
201
+ </div>
202
+ </div>
203
+ </CardBody>
204
+ </ExpiryCardContainer>
205
+ </ModalCardContainer>
206
+ </Modal>
207
+ );
208
+ };
209
+
210
+ export default SubscriptionExpiredModal;
@@ -0,0 +1,39 @@
1
+ import useAxios from "axios-hooks";
2
+
3
+ const useAccount = () => {
4
+
5
+ // current plan
6
+ const [{ ...userPlanData }, getUserPlan] = useAxios(
7
+ {
8
+ url: `/payment/v1/current_plan/`,
9
+ method: "GET",
10
+ },
11
+
12
+ {
13
+ manual: true,
14
+ }
15
+ );
16
+
17
+ const handleGetUserPlan = async () => {
18
+ try {
19
+ await getUserPlan();
20
+ } catch (err) {
21
+ console.log(err);
22
+ }
23
+ };
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ return {
32
+
33
+ userPlanData,
34
+ handleGetUserPlan,
35
+
36
+
37
+ };
38
+ };
39
+ export default useAccount;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useState } from "react";
2
2
  import {
3
3
  BannerWrapper,
4
4
  InstructorContainer,
@@ -7,7 +7,7 @@ import {
7
7
  Container,
8
8
  Upgrade,
9
9
  Users,
10
- UploadProgressContainer
10
+ UploadProgressContainer,
11
11
  } from "../styles";
12
12
  import Button from "../../button";
13
13
  import CircularProgressBar from "../components/progressBar";
@@ -25,76 +25,75 @@ import SliderIcon from "../assets/slider";
25
25
 
26
26
  /**
27
27
  * @param {{
28
- * CourseClick: function,
29
- * UpgradeClick: function,
30
- * }} props - properties of graph Component
31
- *
32
- */
33
-
34
- const EnterpriseRightBar = ({UpgradeClick, CourseClick}) => {
28
+ * CourseClick: function,
29
+ * UpgradeClick: function,
30
+ * }} props - properties of graph Component
31
+ *
32
+ */
35
33
 
34
+ const EnterpriseRightBar = ({ UpgradeClick, CourseClick, gracePeriod, planState}) => {
35
+
36
36
  return (
37
- <InstructorContainer>
38
- <BannerWrapper>
39
- <div className="head_instructor head_enterprise">
40
- <h3>Best Course</h3>
41
- </div>
42
- <NewLanguage>
43
- <div className="top_section">
44
- <div className="lession_cont">
45
- <LessonIcon />
46
- <p> 9 lessions</p>
37
+ <InstructorContainer className={planState === "GRACE PERIOD" ? "grace_period" : ""}>
38
+ <BannerWrapper>
39
+ <div className="head_instructor head_enterprise">
40
+ <h3>Best Course</h3>
41
+ </div>
42
+ <NewLanguage>
43
+ <div className="top_section">
44
+ <div className="lession_cont">
45
+ <LessonIcon />
46
+ <p> 9 lessions</p>
47
+ </div>
48
+ <div className="flag_cont">
49
+ <LessonFlag />
50
+ </div>
47
51
  </div>
48
- <div className="flag_cont">
49
- <LessonFlag />
50
52
 
53
+ <div className="buttom_section">
54
+ <p>French for Beginners</p>
51
55
  </div>
56
+ </NewLanguage>
57
+ <SliderIcon />
58
+ </BannerWrapper>
59
+ <RecentAdded>
60
+ <div className="top_area">
61
+ <h5>Recently added</h5>
62
+ <p>See all</p>
52
63
  </div>
53
-
54
- <div className="buttom_section">
55
- <p>French for Beginners</p>
64
+ <div className="users_list">
65
+ <div className="user">
66
+ <img src={Ellipse} alt="user" />
67
+ </div>
68
+ <div className="user">
69
+ <img src={Ellipse2} alt="user" />
70
+ </div>
71
+ <div className="user">
72
+ <img src={Ellipse3} alt="user" />
73
+ </div>
74
+ <div className="user">
75
+ <img src={Ellipse4} alt="user" />
76
+ </div>
56
77
  </div>
57
- </NewLanguage>
58
- <SliderIcon />
59
- </BannerWrapper>
60
- <RecentAdded>
61
- <div className="top_area">
62
- <h5>Recently added</h5>
63
- <p>See all</p>
64
- </div>
65
- <div className="users_list">
66
- <div className="user">
67
- <img src={Ellipse} alt="user" />
68
- </div>
69
- <div className="user">
70
- <img src={Ellipse2} alt="user" />
71
- </div>
72
- <div className="user">
73
- <img src={Ellipse3} alt="user" />
74
- </div>
75
- <div className="user">
76
- <img src={Ellipse4} alt="user" />
77
- </div>
78
- </div>
79
- <Button
80
- type="primary"
81
- text="Create Course"
82
- styles={{
83
- marginTop: "29px",
84
- fontSize: "16px",
85
- width: "203px",
86
- gap: "8px",
87
- padding: "20px 6px",
88
- height: "40px",
89
- boxShadow: "0px 10px 20px 0px rgba(254, 191, 16, 0.25)",
90
- }}
91
- onClick={CourseClick}
92
- />
93
- </RecentAdded>
94
-
95
- <UpgradeComponent UpgradeClick={UpgradeClick} />
96
-
97
- </InstructorContainer>
78
+ <Button
79
+ type="primary"
80
+ text="Create Course"
81
+ disabled={planState === "GRACE PERIOD"}
82
+ styles={{
83
+ marginTop: "29px",
84
+ fontSize: "16px",
85
+ width: "203px",
86
+ gap: "8px",
87
+ padding: "20px 6px",
88
+ height: "40px",
89
+ boxShadow: "0px 10px 20px 0px rgba(254, 191, 16, 0.25)",
90
+ }}
91
+ onClick={CourseClick}
92
+ />
93
+ </RecentAdded>
94
+
95
+ <UpgradeComponent UpgradeClick={UpgradeClick} gracePeriod={gracePeriod} planState={planState} />
96
+ </InstructorContainer>
98
97
  );
99
98
  };
100
99
 
@@ -7,11 +7,11 @@ import UpgradeIcon from "../assets/Feature.png";
7
7
  import EnterpriseUpgrade from "../assets/enterpriseUpgrade.png"
8
8
 
9
9
 
10
- const UpgradeComponent = ({UpgradeClick}) => {
10
+ const UpgradeComponent = ({UpgradeClick, gracePeriod, planState}) => {
11
11
 
12
12
  return (
13
13
 
14
- <Upgrade>
14
+ <Upgrade className={planState === "GRACE PERIOD" ? "deactivated" : ""}>
15
15
  <div className="container">
16
16
  <img src={EnterpriseUpgrade} alt="upgrad box" />
17
17
  <div className="upgrade_text">
@@ -22,7 +22,8 @@ const UpgradeComponent = ({UpgradeClick}) => {
22
22
  </p>
23
23
  <Button
24
24
  type="primary"
25
- text="Upgrade"
25
+ text="Buy Slot"
26
+ disabled={planState === "GRACE PERIOD"}
26
27
  styles={{
27
28
  marginTop: "12px",
28
29
  fontSize: "16px",
@@ -30,6 +31,7 @@ const UpgradeComponent = ({UpgradeClick}) => {
30
31
  height: "38.641px",
31
32
  gap: "8px",
32
33
  padding: "15.457px 30.913px",
34
+ boxShadow: "0px 10px 20px 0px rgba(254, 191, 16, 0.25)",
33
35
  }}
34
36
  onClick={UpgradeClick}
35
37
  />