l-min-components 1.0.1042 → 1.0.1050

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.1042",
3
+ "version": "1.0.1050",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -294,15 +294,17 @@ const AppMainLayout = () => {
294
294
  }
295
295
  </LeftLayout>
296
296
  <CenterLayout isOpen={isOpen} style={centerLayoutStyle}>
297
- {window.location.pathname.includes("instructor") &&
297
+ {
298
+ // window.location.pathname.includes("instructor") &&
298
299
  !window.location.pathname.includes("enterprise") &&
299
- !window.location.pathname.includes("manage-teams") && (
300
- <InstructorAccountSwitcher
301
- setAccountType={setAffiliatesActive}
302
- generalData={generalData}
303
- onChange={(v) => setAffiliateAccount(v)}
304
- />
305
- )}
300
+ !window.location.pathname.includes("manage-teams") && (
301
+ <InstructorAccountSwitcher
302
+ setAccountType={setAffiliatesActive}
303
+ generalData={generalData}
304
+ onChange={(v) => setAffiliateAccount(v)}
305
+ />
306
+ )
307
+ }
306
308
 
307
309
  {window.location.pathname.includes("enterprise") &&
308
310
  planState === "GRACE PERIOD" ? (
@@ -93,7 +93,7 @@ const HeaderComponent = (props) => {
93
93
  handleGetUnreadNotification(accountType);
94
94
  }
95
95
 
96
- if (accountType & accountType === "personal") {
96
+ if (accountType && accountType === "personal") {
97
97
  handleGetUnreadNotificationPersonal()
98
98
  }
99
99
  }, [accountType]);
@@ -32,10 +32,12 @@ const InstructorAccountSwitcher = ({ generalData, onChange }) => {
32
32
  }, [generalData?.selectedAccount, search]);
33
33
 
34
34
  const dropdownList = getAllAffiliateData?.data?.results?.map((item) => {
35
- const image = item?.profile_photo?.url;
35
+ const image = item?.profile_photo?.url || item?.profile_photo[1][1];
36
36
  return { name: item?.display_name, image, id: item?.id };
37
37
  });
38
38
 
39
+ console.log(dropdownList, getAllAffiliateData);
40
+
39
41
  const [dropdown, setDropdown] = useState(false);
40
42
 
41
43
  const getCookie = () => {
@@ -72,16 +74,24 @@ const InstructorAccountSwitcher = ({ generalData, onChange }) => {
72
74
  };
73
75
 
74
76
  const handleSwitch = (value) => {
75
- if (value === 2) {
76
- if (selectedValue) {
77
- setCookie(selectedValue?.id);
77
+ if (selectedValue) {
78
+ if (value === 2) {
79
+ if (selectedValue) {
80
+ setCookie(selectedValue?.id);
81
+ }
82
+ } else {
83
+ if (cookieValue) {
84
+ deleteCookies("affiliateAccount");
85
+ }
78
86
  }
87
+ window.location.href = "/instructor/dashboard";
79
88
  } else {
80
- if (cookieValue) {
81
- deleteCookies("affiliateAccount");
89
+ if (value === 2) {
90
+ setSwitchValue("affiliates");
91
+ } else {
92
+ setSwitchValue(null);
82
93
  }
83
94
  }
84
- window.location.href = "/instructor/dashboard";
85
95
  };
86
96
 
87
97
  useEffect(() => {
@@ -241,7 +251,7 @@ const Container = styled.div`
241
251
  background: #ffffff;
242
252
  border-radius: 25px;
243
253
  height: 60px;
244
- margin-bottom: 24px;
254
+ margin-bottom: 16px;
245
255
 
246
256
  .left {
247
257
  > p {
@@ -43,6 +43,8 @@ const InputSection = ({
43
43
  accountType,
44
44
  affiliates,
45
45
  courseID,
46
+ handleCreateMessage,
47
+ createMessageData,
46
48
  }) => {
47
49
  const [showEmoji, setShowEmoji] = useState();
48
50
  const [inputMethod, setInputMethod] = useState("text"); // text | recorder
@@ -56,8 +58,7 @@ const InputSection = ({
56
58
 
57
59
  const imageRef = useRef();
58
60
  const {
59
- handleCreateMessage,
60
- createMessageData,
61
+
61
62
  handleCreateMessageWithMedia,
62
63
  createMessageWithMediaData,
63
64
  createMessageAffiliateData,
@@ -94,29 +95,10 @@ const InputSection = ({
94
95
  if (inputMethod === "text") {
95
96
  // setNewMessages((prev) => [...prev, text]);
96
97
  setIsMessageSending(true);
97
- if (affiliates && accountType === "instructor") {
98
- setTimeout(() => {
99
- handleCreateMessageAffiliate(userID, text);
100
- }, 1000);
101
- }
102
-
103
- if (!affiliates && accountType === "instructor") {
104
- setTimeout(() => {
105
- handleCreateMessage(userID, accountType, text);
106
- }, 1000);
107
- }
108
98
 
109
- if (accountType === "enterprise") {
110
- setTimeout(() => {
111
- handleCreateMessage(userID, accountType, text, courseID);
112
- }, 1000);
113
- }
114
-
115
- if (accountType === "personal") {
116
- setTimeout(() => {
117
- handleCreateMessagePersonal(userID, text, courseID);
118
- }, 1000);
119
- }
99
+ setTimeout(() => {
100
+ handleCreateMessage(userID, accountType, text, courseID, "");
101
+ }, 1000);
120
102
  }
121
103
  };
122
104
 
@@ -255,12 +237,17 @@ const InputSection = ({
255
237
  </div>
256
238
  <button
257
239
  className={`send-box ${
258
- !text.text && (inputMethod === "text" || recording) ? "disabled" : ""
240
+ (!text.text && inputMethod !== "recorder") ||
241
+ createMessageData?.loading ||
242
+ recording
243
+ ? "disabled"
244
+ : ""
259
245
  }`}
260
246
  onClick={handleSendMessage}
261
247
  disabled={
262
- !text.text &&
263
- (inputMethod === "text" || recording || createMessageData?.loading)
248
+ (!text.text && inputMethod !== "recorder") ||
249
+ createMessageData?.loading ||
250
+ recording
264
251
  }
265
252
  >
266
253
  <SendIcon />