nestiq-component-library 1.1.54 → 1.1.55

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.
@@ -12,15 +12,7 @@ interface PopupProps {
12
12
  handleSendMessage: any;
13
13
  onClick: any;
14
14
  themesList: any;
15
- requestObj: {
16
- fromUser: string;
17
- property: string;
18
- text: string;
19
- firstName: string;
20
- lastName: string;
21
- theme: string;
22
- subject: string;
23
- };
15
+ sendDataToParent: any;
24
16
  }
25
17
 
26
18
  export default function MessagePopUp(props: PopupProps) {
@@ -33,30 +25,15 @@ export default function MessagePopUp(props: PopupProps) {
33
25
  const [firstName, setFirstName] = useState("");
34
26
  const [lastName, setLastName] = useState("");
35
27
  const [id, setId] = useState("");
28
+ const [data, setData] = useState("");
36
29
 
37
30
  const handleClose = () => {
38
31
  props.onClick();
39
32
  };
40
- const handleSendMessage = () => {
41
- if (!messageText || !subject || !firstName || !lastName || !themeId) {
42
- // toast.warning("Please fill in all fields.");
43
- showToast("Please fill in all fields.", "warning");
44
- return;
45
- }
46
-
47
- const user = JSON.parse(localStorage.getItem("user" ) || "{}");
48
- const userId = user.id;
49
-
50
- const requestObj = {
51
- fromUser: `/users/${userId}`,
52
- property: `/properties/${id}`,
53
- text: messageText,
54
- firstName,
55
- lastName,
56
- theme: `/themes/${themeId}`,
57
- subject: subject,
58
- };
33
+ function handleSendMessage() {
34
+ props.sendDataToParent(data);
59
35
  };
36
+
60
37
  useEffect(() => {
61
38
  const user = JSON.parse(localStorage.getItem("user") || "{}");
62
39
  if (user) {
@@ -47,15 +47,7 @@ interface PopupProps {
47
47
  firstname: any;
48
48
  lastname: any;
49
49
  themesList: any;
50
- requestObj: {
51
- fromUser: string;
52
- property: string;
53
- text: string;
54
- firstName: string;
55
- lastName: string;
56
- theme: string;
57
- subject: string;
58
- };
50
+ handleDataFromChild: any;
59
51
  }
60
52
  export default function PropertyCard(props: PopupProps) {
61
53
  const [liked, setLiked] = useState(false);
@@ -65,6 +57,7 @@ export default function PropertyCard(props: PopupProps) {
65
57
  const [floorPlan, setFloorPlan] = useState(false);
66
58
  const [messagePopUp, setMessagPopUp] = useState(false);
67
59
  const [sharePopUp, setSharePopUp] = useState(false);
60
+ const [dataFromChild, setDataFromChild] = useState("");
68
61
 
69
62
  const pictureUrls =
70
63
  props.property?.pictures?.length > 0
@@ -95,7 +88,9 @@ export default function PropertyCard(props: PopupProps) {
95
88
  const messagePopupClose = () =>{
96
89
  setMessagPopUp(false);
97
90
  }
98
-
91
+ function handleDataFromChild(data: any) {
92
+ setDataFromChild(data);
93
+ }
99
94
  const handleArrowClickInMainImage = (direction: string) => {
100
95
  if (!props.property || pictureUrls.length === 0) return;
101
96
 
@@ -294,7 +289,7 @@ export default function PropertyCard(props: PopupProps) {
294
289
  firstname={props.firstname}
295
290
  lastname={props.lastname}
296
291
  themesList={props.themesList}
297
- requestObj={props.requestObj}
292
+ sendDataToParent={handleDataFromChild}
298
293
  />
299
294
  )}
300
295
  {sharePopUp && <SharePopup onClick={() => setSharePopUp(false)} />}