nestiq-component-library 1.1.57 → 1.1.59

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.
@@ -1,46 +1,36 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
  import x from "../../assets/Images/icon_close_2.png";
3
3
  import mail_icon from "../../assets/Images/mail-icon.png";
4
- import SuccessPopUp from "../MessagePopup/SuccessPopup";
5
- import ErrorPopUp from "../MessagePopup/ErrorPopup";
6
4
  import "../MessagePopup/MessagePopUp.css";
7
- import showToast from "../ToastWrapper/ToastWrapper";
5
+ import { MessageModel } from "../../models/message.model";
8
6
 
9
7
  interface PopupProps {
10
- firstname: string;
11
- lastname: string;
12
- handleSendMessage: any;
13
- onClick: any;
8
+ sellerFirstName: string;
9
+ sellerLastName: string;
10
+ onCloseClick: () => void;
14
11
  themesList: any;
15
- sendDataToParent: any;
12
+ onSubmit: (formValues: MessageModel) => void;
16
13
  }
17
14
 
18
15
  export default function MessagePopUp(props: PopupProps) {
19
- const [showMessagePopUp, setshowMessagePopUp] = useState();
20
- const [showSuccessPopUp, setShowSuccessPopUp] = useState(false);
21
- const [showErrorPopUp, setShowErrorPopUp] = useState(false);
22
16
  const [themeId, setThemeId] = useState("");
23
17
  const [subject, setSubject] = useState("");
24
18
  const [messageText, setMessageText] = useState("");
25
19
  const [firstName, setFirstName] = useState("");
26
20
  const [lastName, setLastName] = useState("");
27
21
 
28
-
29
22
  const handleClose = () => {
30
- props.onClick();
23
+ props.onCloseClick();
31
24
  };
32
25
  function handleSendMessage() {
33
- props.sendDataToParent(themeId, subject, messageText, firstName, lastName);
34
- console.log("message sent", themeId, subject, messageText, firstName, lastName);
35
- };
36
-
26
+ props.onSubmit({ themeId, subject, messageText, firstName, lastName });
27
+ }
28
+
37
29
  useEffect(() => {
38
30
  const user = JSON.parse(localStorage.getItem("user") || "{}");
39
31
  if (user) {
40
32
  setFirstName(user.firstname || "");
41
33
  setLastName(user.lastname || "");
42
- } else if (!user) {
43
- console.log("no user");
44
34
  }
45
35
  }, []);
46
36
  return (
@@ -70,7 +60,7 @@ export default function MessagePopUp(props: PopupProps) {
70
60
  />
71
61
  </div>
72
62
  <div className="popUpHeader d-flex flex-column text-wrap mb-md-1 ">
73
- Nachricht senden {firstName} {lastName}
63
+ Nachricht senden {props.sellerFirstName} {props.sellerLastName}
74
64
  </div>
75
65
  </div>
76
66
 
@@ -92,7 +82,7 @@ export default function MessagePopUp(props: PopupProps) {
92
82
  <option key={theme.id} value={theme.id}>
93
83
  {theme.name}
94
84
  </option>
95
- )
85
+ ),
96
86
  )}
97
87
  </select>
98
88
  </div>
@@ -161,13 +151,6 @@ export default function MessagePopUp(props: PopupProps) {
161
151
  </div>
162
152
  </div>
163
153
  </div>
164
-
165
- {showSuccessPopUp && (
166
- <SuccessPopUp onClick={() => setShowSuccessPopUp(false)} />
167
- )}
168
- {showErrorPopUp && (
169
- <ErrorPopUp onClick={() => setShowErrorPopUp(false)} />
170
- )}
171
154
  </div>
172
155
  );
173
156
  }
@@ -12,6 +12,7 @@ import iconLayers from "../../assets/Images/layer_icon.svg";
12
12
  import FloorPlanPopup from "../FloorPlanPopup/FloorPlanPopup";
13
13
  import MessagePopUp from "../MessagePopup/MessagePopUp";
14
14
  import SharePopup from "../SharePopup/SharePopup";
15
+ import { MessageModel } from "../../models/message.model";
15
16
 
16
17
  interface PopupProps {
17
18
  property: {
@@ -35,18 +36,15 @@ interface PopupProps {
35
36
  };
36
37
  pictures: { contentUrl: string }[];
37
38
  };
38
- onClick: any;
39
39
  baseUrl: string;
40
- title: string;
41
40
  userData: {
42
41
  firstname: string;
43
42
  lastname: string;
44
43
  };
45
- handleSendMessage: any;
46
- firstname: any;
47
- lastname: any;
48
44
  themesList: any;
49
- sendData: any;
45
+ floorPlanUrl: string;
46
+ onMessagePopupSubmitClick: (formValues: MessageModel) => void;
47
+ messageOnClick: () => void;
50
48
  }
51
49
  export default function PropertyCard(props: PopupProps) {
52
50
  const [liked, setLiked] = useState(false);
@@ -56,16 +54,11 @@ export default function PropertyCard(props: PopupProps) {
56
54
  const [floorPlan, setFloorPlan] = useState(false);
57
55
  const [messagePopUp, setMessagPopUp] = useState(false);
58
56
  const [sharePopUp, setSharePopUp] = useState(false);
59
- const [themeId, setThemeId] = useState("");
60
- const [subject, setSubject] = useState("");
61
- const [messageText, setMessageText] = useState("");
62
- const [firstName, setFirstName] = useState("");
63
- const [lastName, setLastName] = useState("");
64
57
 
65
58
  const pictureUrls =
66
59
  props.property?.pictures?.length > 0
67
60
  ? props.property.pictures.map(
68
- (picture) => `${props.baseUrl}${picture.contentUrl}`
61
+ (picture) => `${props.baseUrl}${picture.contentUrl}`,
69
62
  )
70
63
  : [noImageIcon];
71
64
 
@@ -74,39 +67,17 @@ export default function PropertyCard(props: PopupProps) {
74
67
  setLiked(!liked);
75
68
  };
76
69
  const floorPlanOnClick = () => {
77
- setFloorPlan(true);
70
+ if (props.floorPlanUrl) {
71
+ setFloorPlan(true);
72
+ }
78
73
  };
79
74
  const handleMessagPopUp = () => {
80
- setMessagPopUp(true);
81
- console.log("messagePopUp", messagePopUp);
75
+ // setMessagPopUp(true);
76
+ props.messageOnClick();
82
77
  };
83
78
  const handleSharePopUp = () => {
84
79
  setSharePopUp(true);
85
- console.log("sharePopUp", sharePopUp);
86
- };
87
- const handleClosePopup = () => {
88
- setFloorPlan(false);
89
- setMessagPopUp(false);
90
- };
91
- const messagePopupClose = () => {
92
- setMessagPopUp(false);
93
80
  };
94
- function handleDataFromChild(
95
- firstName: string,
96
- lastName: string,
97
- themeId: string,
98
- subject: string,
99
- messageText: string
100
- ) {
101
- setFirstName(firstName);
102
- setLastName(lastName);
103
- setThemeId(themeId);
104
- setSubject(subject);
105
- setMessageText(messageText);
106
- }
107
- function handleSendMessage() {
108
- props.sendData(themeId, subject, messageText, firstName, lastName);
109
- }
110
81
 
111
82
  const handleArrowClickInMainImage = (direction: string) => {
112
83
  if (!props.property || pictureUrls.length === 0) return;
@@ -295,21 +266,20 @@ export default function PropertyCard(props: PopupProps) {
295
266
  </div>
296
267
  {floorPlan && (
297
268
  <FloorPlanPopup
298
- contentUrl={props.property.pictures[0]?.contentUrl || noImageIcon}
269
+ contentUrl={props.floorPlanUrl}
299
270
  onCloseClick={() => setFloorPlan(false)}
300
271
  />
301
272
  )}
302
- {messagePopUp && (
273
+ {/* {messagePopUp && (
303
274
  <MessagePopUp
304
- onClick={() => setMessagPopUp(false)}
305
- handleSendMessage={props.handleSendMessage}
306
- firstname={props.firstname}
307
- lastname={props.lastname}
275
+ onCloseClick={() => setMessagPopUp(false)}
276
+ sellerFirstName={props.userData?.firstname}
277
+ sellerLastName={props.userData?.lastname}
308
278
  themesList={props.themesList}
309
- sendDataToParent={handleDataFromChild}
279
+ onSubmit={props.onMessagePopupSubmitClick}
310
280
  />
311
281
  )}
312
- {sharePopUp && <SharePopup onClick={() => setSharePopUp(false)} />}
282
+ {sharePopUp && <SharePopup onClick={() => setSharePopUp(false)} />} */}
313
283
  </div>
314
284
  );
315
285
  }
package/src/index.tsx CHANGED
@@ -11,7 +11,7 @@ export { default as SharePopup } from "./components/SharePopup/SharePopup";
11
11
  export { default as FloorPlanPopup } from "./components/FloorPlanPopup/FloorPlanPopup";
12
12
  export { default as NewPropertyCard } from "./components/NewPropertyCard/NewPropertyCard";
13
13
  export { default as MessagePopUp } from "./components/MessagePopup/MessagePopUp";
14
-
14
+ export { default as SuccessPopup } from "./components/MessagePopup/SuccessPopup";
15
15
  // TOASTER WRAPPER AND FUNCTION
16
16
  export {
17
17
  default as ToastWrapper,
@@ -0,0 +1,7 @@
1
+ export interface MessageModel {
2
+ themeId: string;
3
+ subject: string;
4
+ messageText: string;
5
+ firstName: string;
6
+ lastName: string;
7
+ }