l-min-components 1.0.1022 → 1.0.1025
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
|
@@ -164,13 +164,6 @@ const AppMainLayout = () => {
|
|
|
164
164
|
const currentPlan = userPlanData?.data?.current_plan;
|
|
165
165
|
const planState = userPlanData?.data?.state;
|
|
166
166
|
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
const account = generalData?.selectedAccount;
|
|
169
|
-
if (account?.type?.toLocaleLowerCase() === "instructor") {
|
|
170
|
-
handleGetAllAffiliate();
|
|
171
|
-
}
|
|
172
|
-
}, [generalData]);
|
|
173
|
-
|
|
174
167
|
const wordBank = [
|
|
175
168
|
"Sign out",
|
|
176
169
|
"Learning",
|
|
@@ -307,8 +300,7 @@ const AppMainLayout = () => {
|
|
|
307
300
|
<CenterLayout isOpen={isOpen} style={centerLayoutStyle}>
|
|
308
301
|
{window.location.pathname.includes("instructor") &&
|
|
309
302
|
!window.location.pathname.includes("enterprise") &&
|
|
310
|
-
!window.location.pathname.includes("manage-teams") &&
|
|
311
|
-
getAllAffiliateData?.data?.count && (
|
|
303
|
+
!window.location.pathname.includes("manage-teams") && (
|
|
312
304
|
<InstructorAccountSwitcher
|
|
313
305
|
setAccountType={setAffiliatesActive}
|
|
314
306
|
data={getAllAffiliateData?.data?.results}
|
|
@@ -45,9 +45,10 @@ const useHeader = () => {
|
|
|
45
45
|
},
|
|
46
46
|
{ manual: true }
|
|
47
47
|
);
|
|
48
|
-
const handleGetAllAffiliate = async () => {
|
|
48
|
+
const handleGetAllAffiliate = async (params) => {
|
|
49
49
|
return await getAllAffiliate({
|
|
50
50
|
url: "/learn/v1/instructor/account/affiliate_enterprise_accounts/",
|
|
51
|
+
params,
|
|
51
52
|
});
|
|
52
53
|
};
|
|
53
54
|
|
|
@@ -14,19 +14,28 @@ const InstructorAccountSwitcher = ({
|
|
|
14
14
|
setAccountType,
|
|
15
15
|
data,
|
|
16
16
|
generalData,
|
|
17
|
-
loading,
|
|
18
17
|
onChange,
|
|
19
18
|
}) => {
|
|
20
19
|
const [expiryFlow, setExpiryFlow] = useState();
|
|
21
20
|
const [switchValue, setSwitchValue] = useState(null);
|
|
22
21
|
const [selectedValue, setSelectedValue] = useState(null);
|
|
22
|
+
const [search, setSearch] = useState("");
|
|
23
23
|
const {
|
|
24
24
|
getDefaultAffiliateData,
|
|
25
25
|
handleGetDefaultAffiliate,
|
|
26
26
|
handleSetDefaultAffiliate,
|
|
27
27
|
setDefaultAffiliateData,
|
|
28
|
+
handleGetAllAffiliate,
|
|
29
|
+
getAllAffiliateData,
|
|
28
30
|
} = useHeader();
|
|
29
31
|
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const account = generalData?.selectedAccount;
|
|
34
|
+
if (account?.type?.toLocaleLowerCase() === "instructor") {
|
|
35
|
+
handleGetAllAffiliate({ search });
|
|
36
|
+
}
|
|
37
|
+
}, [generalData?.selectedAccount, search]);
|
|
38
|
+
|
|
30
39
|
const dropdownList = data?.map((item) => {
|
|
31
40
|
const image = item?.profile_photo?.url;
|
|
32
41
|
return { name: item?.display_name, image, id: item?.id };
|
|
@@ -126,15 +135,16 @@ const InstructorAccountSwitcher = ({
|
|
|
126
135
|
|
|
127
136
|
useEffect(() => {
|
|
128
137
|
if (onChange) {
|
|
129
|
-
|
|
138
|
+
let cookieValue = getCookie();
|
|
139
|
+
if (cookieValue) onChange({ id: selectedValue?.id });
|
|
130
140
|
else onChange(null);
|
|
131
141
|
}
|
|
132
142
|
}, [selectedValue]);
|
|
133
|
-
return (
|
|
143
|
+
return getAllAffiliateData?.data?.count && !search ? (
|
|
134
144
|
<>
|
|
135
145
|
{(setDefaultAffiliateData?.loading ||
|
|
136
146
|
getDefaultAffiliateData?.loading ||
|
|
137
|
-
loading) && <FullPageLoader fixed hasBackground />}
|
|
147
|
+
getAllAffiliateData?.loading) && <FullPageLoader fixed hasBackground />}
|
|
138
148
|
{expiryFlow === "renew" && (
|
|
139
149
|
<RenewModal
|
|
140
150
|
close={() => setExpiryFlow(null)}
|
|
@@ -192,7 +202,10 @@ const InstructorAccountSwitcher = ({
|
|
|
192
202
|
<OutsideAlerter handleClick={() => setDropdown(false)}>
|
|
193
203
|
<AffiliatesDropDownWrapper>
|
|
194
204
|
<div className="search_wrapper">
|
|
195
|
-
<Search
|
|
205
|
+
<Search
|
|
206
|
+
placeholder="Search Affiliates"
|
|
207
|
+
onSubmit={setSearch}
|
|
208
|
+
/>
|
|
196
209
|
</div>
|
|
197
210
|
<ul>
|
|
198
211
|
{dropdownList?.map((item) => (
|
|
@@ -234,6 +247,8 @@ const InstructorAccountSwitcher = ({
|
|
|
234
247
|
</div>
|
|
235
248
|
</Container>
|
|
236
249
|
</>
|
|
250
|
+
) : (
|
|
251
|
+
<></>
|
|
237
252
|
);
|
|
238
253
|
};
|
|
239
254
|
|