nestiq-component-library 1.1.53 → 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.
@@ -4,19 +4,19 @@ import mail_icon from "../../assets/Images/mail-icon.png";
4
4
  import SuccessPopUp from "../MessagePopup/SuccessPopup";
5
5
  import ErrorPopUp from "../MessagePopup/ErrorPopup";
6
6
  import "../MessagePopup/MessagePopUp.css";
7
- // import { showToast } from "nestiq-component-library";
7
+ import showToast from "../ToastWrapper/ToastWrapper";
8
8
 
9
9
  interface PopupProps {
10
10
  firstname: string;
11
11
  lastname: string;
12
12
  handleSendMessage: any;
13
13
  onClick: any;
14
- themesList:any;
14
+ themesList: any;
15
+ sendDataToParent: any;
15
16
  }
16
17
 
17
- export default function MessagePopUp(props:PopupProps) {
18
-
19
- const [showMessagePopUp, setshowMessagePopUp]= useState();
18
+ export default function MessagePopUp(props: PopupProps) {
19
+ const [showMessagePopUp, setshowMessagePopUp] = useState();
20
20
  const [showSuccessPopUp, setShowSuccessPopUp] = useState(false);
21
21
  const [showErrorPopUp, setShowErrorPopUp] = useState(false);
22
22
  const [themeId, setThemeId] = useState("");
@@ -24,22 +24,25 @@ export default function MessagePopUp(props:PopupProps) {
24
24
  const [messageText, setMessageText] = useState("");
25
25
  const [firstName, setFirstName] = useState("");
26
26
  const [lastName, setLastName] = useState("");
27
+ const [id, setId] = useState("");
28
+ const [data, setData] = useState("");
27
29
 
28
30
  const handleClose = () => {
29
31
  props.onClick();
30
32
  };
31
- const handleSendMessage = () => {
32
- props.handleSendMessage();
33
- }
34
- useEffect(() => {
35
- const user = JSON.parse(localStorage.getItem("user") || "{}");
36
- if (user) {
37
- setFirstName(user.firstname || "");
38
- setLastName(user.lastname || "");
39
- } else if (!user) {
40
- console.log("no user");
41
- }
42
- }, []);
33
+ function handleSendMessage() {
34
+ props.sendDataToParent(data);
35
+ };
36
+
37
+ useEffect(() => {
38
+ const user = JSON.parse(localStorage.getItem("user") || "{}");
39
+ if (user) {
40
+ setFirstName(user.firstname || "");
41
+ setLastName(user.lastname || "");
42
+ } else if (!user) {
43
+ console.log("no user");
44
+ }
45
+ }, []);
43
46
  return (
44
47
  <div>
45
48
  <div className="popup-overlay">
@@ -47,6 +47,7 @@ interface PopupProps {
47
47
  firstname: any;
48
48
  lastname: any;
49
49
  themesList: any;
50
+ handleDataFromChild: any;
50
51
  }
51
52
  export default function PropertyCard(props: PopupProps) {
52
53
  const [liked, setLiked] = useState(false);
@@ -56,6 +57,7 @@ export default function PropertyCard(props: PopupProps) {
56
57
  const [floorPlan, setFloorPlan] = useState(false);
57
58
  const [messagePopUp, setMessagPopUp] = useState(false);
58
59
  const [sharePopUp, setSharePopUp] = useState(false);
60
+ const [dataFromChild, setDataFromChild] = useState("");
59
61
 
60
62
  const pictureUrls =
61
63
  props.property?.pictures?.length > 0
@@ -86,7 +88,9 @@ export default function PropertyCard(props: PopupProps) {
86
88
  const messagePopupClose = () =>{
87
89
  setMessagPopUp(false);
88
90
  }
89
-
91
+ function handleDataFromChild(data: any) {
92
+ setDataFromChild(data);
93
+ }
90
94
  const handleArrowClickInMainImage = (direction: string) => {
91
95
  if (!props.property || pictureUrls.length === 0) return;
92
96
 
@@ -285,6 +289,7 @@ export default function PropertyCard(props: PopupProps) {
285
289
  firstname={props.firstname}
286
290
  lastname={props.lastname}
287
291
  themesList={props.themesList}
292
+ sendDataToParent={handleDataFromChild}
288
293
  />
289
294
  )}
290
295
  {sharePopUp && <SharePopup onClick={() => setSharePopUp(false)} />}