@tenancy.nz/reports 1.1.4 → 1.1.6

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.
@@ -6,7 +6,7 @@ var React = require('react');
6
6
 
7
7
  var styles = {
8
8
  container: {
9
- marginTop: "24px",
9
+ marginTop: "12px",
10
10
  color: "#595959",
11
11
  width: "100%"
12
12
  },
@@ -14,9 +14,9 @@ var styles = {
14
14
  fontStyle: "italic",
15
15
  color: "inherit",
16
16
  fontWeight: "300",
17
- fontSize: "14px",
17
+ fontSize: "9px",
18
18
  lineHeight: "1.43",
19
- fontFamily: "inherit",
19
+ fontFamily: '"Montserrat", sans-serif',
20
20
  margin: "0",
21
21
  padding: "0"
22
22
  }
@@ -28,7 +28,7 @@ function ReportFooter(_ref) {
28
28
  style: styles.container
29
29
  }, /* @__PURE__ */React.createElement("div", {
30
30
  style: styles.text
31
- }, text || "This PDF is for - purposes."));
31
+ }, text));
32
32
  }
33
33
 
34
34
  exports.default = ReportFooter;
@@ -6,34 +6,35 @@ var React = require('react');
6
6
 
7
7
  var styles = {
8
8
  container: {
9
- marginBottom: "24px",
9
+ marginBottom: "12px",
10
10
  borderBottom: "1px solid #E0E0E0",
11
- paddingBottom: "8px",
11
+ paddingBottom: "4px",
12
12
  display: "flex",
13
13
  alignItems: "flex-start",
14
14
  color: "#0e0044",
15
- width: "100%"
15
+ width: "100%",
16
+ fontFamily: '"Montserrat", sans-serif'
16
17
  },
17
18
  heading: {
18
- fontSize: "32px",
19
+ fontSize: "18px",
19
20
  fontWeight: "700",
20
21
  padding: "0",
21
- margin: "0 0 8px 0",
22
+ margin: "0 0 4px 0",
22
23
  lineHeight: "1.3",
23
24
  color: "inherit",
24
- fontFamily: "inherit"
25
+ fontFamily: '"Montserrat", sans-serif'
25
26
  },
26
27
  subheading: {
27
- fontSize: "17px",
28
+ fontSize: "9px",
28
29
  fontWeight: "500",
29
30
  padding: "0",
30
31
  margin: "0",
31
32
  lineHeight: "1.3",
32
33
  color: "inherit",
33
- fontFamily: "inherit"
34
+ fontFamily: '"Montserrat", sans-serif'
34
35
  },
35
36
  imgContainer: {
36
- width: "150px",
37
+ width: "100px",
37
38
  height: "35px"
38
39
  },
39
40
  img: {
@@ -5,23 +5,27 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var ui = require('@tenancy.nz/ui');
7
7
  var featureUi = require('@tenancy.nz/feature-ui');
8
+ var ReportFooter = require('./ReportFooter.cjs');
9
+ var ReportHeader = require('./ReportHeader.cjs');
8
10
 
11
+ var propertyRent = function propertyRent(property) {
12
+ if (!property) {
13
+ return "";
14
+ }
15
+ var rentAmount = String(property.rent_amount).replace(".00", "");
16
+ var rentFrequency = String(property.rental_period).charAt(0).toLowerCase();
17
+ return !Number.isNaN(Number.parseInt(rentAmount, 10)) ? "$".concat(rentAmount, "/").concat(rentFrequency) : "";
18
+ };
9
19
  function ViewingAnalyticsReport(_ref) {
10
20
  var eventData = _ref.eventData;
11
21
  var stats = eventData.stats || {};
12
22
  var properties = eventData.properties || [];
13
- return /* @__PURE__ */React.createElement(ui.ThemeProvider, null, /* @__PURE__ */React.createElement(ui.Box, {
14
- padding: "20px"
15
- }, /* @__PURE__ */React.createElement(ui.Box, {
23
+ return /* @__PURE__ */React.createElement(ui.ThemeProvider, null, /* @__PURE__ */React.createElement(ui.Box, null, /* @__PURE__ */React.createElement(ui.Box, {
16
24
  mb: 6,
17
25
  display: "flex",
18
26
  justify: "space-between",
19
27
  align: "start"
20
- }, /* @__PURE__ */React.createElement(ui.Box, null, /* @__PURE__ */React.createElement(ui.Heading, {
21
- variant: "h1",
22
- as: "h1",
23
- gutterBottom: false
24
- }, "Analytics Report")), /* @__PURE__ */React.createElement(ui.Box, {
28
+ }, /* @__PURE__ */React.createElement(ui.Box, {
25
29
  display: "flex",
26
30
  align: "flex-end",
27
31
  direction: "column"
@@ -65,13 +69,16 @@ function ViewingAnalyticsReport(_ref) {
65
69
  agreementsCount: stats.agreements_count,
66
70
  agreementsFinalisedCount: stats.agreements_finalised_count,
67
71
  filterDaysCount: eventData.filterDaysCount
68
- }), /* @__PURE__ */React.createElement(ui.Box, null, /* @__PURE__ */React.createElement(ui.Heading, {
69
- variant: "h4",
72
+ }), /* @__PURE__ */React.createElement(ui.Box, {
73
+ sx: {
74
+ mt: "28px"
75
+ }
76
+ }, /* @__PURE__ */React.createElement(ui.Heading, {
70
77
  as: "h4",
71
- mt: "20px",
72
- gutterBottom: false
78
+ sx: {
79
+ mb: "16px"
80
+ }
73
81
  }, "Top 5 properties"), /* @__PURE__ */React.createElement(featureUi.GridList, {
74
- mt: "20px",
75
82
  items: properties,
76
83
  spacing: 5,
77
84
  emptyComponent: /* @__PURE__ */React.createElement(ui.Text, null, "No results to show"),
@@ -80,19 +87,20 @@ function ViewingAnalyticsReport(_ref) {
80
87
  item: true,
81
88
  xs: 12
82
89
  }, /* @__PURE__ */React.createElement(featureUi.PropertyCard, {
83
- propertyAddress: property.short_address,
84
- listingDate: "",
85
- daysOnMarket: "",
86
- weeklyRent: property.rent_amount,
90
+ address: property.short_address,
91
+ rent: propertyRent(property),
87
92
  viewingsCount: property.viewings_count,
88
93
  enquiriesCount: property.enquiries_count,
89
- propertyImage: property.thumb_url,
90
- beds: property.num_bedrooms,
91
- baths: property.num_bathrooms,
92
- carports: property.num_cars
94
+ imgSrc: property.thumb_url,
95
+ noOfBedrooms: property.num_bedrooms,
96
+ noOfBathrooms: property.num_bathrooms,
97
+ noOfCarparks: property.num_cars,
98
+ outlined: true
93
99
  }));
94
100
  }
95
101
  }))));
96
102
  }
103
+ ViewingAnalyticsReport.Footer = ReportFooter.default;
104
+ ViewingAnalyticsReport.Header = ReportHeader.default;
97
105
 
98
106
  exports.default = ViewingAnalyticsReport;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  var styles = {
4
4
  container: {
5
- marginTop: "24px",
5
+ marginTop: "12px",
6
6
  color: "#595959",
7
7
  width: "100%"
8
8
  },
@@ -10,9 +10,9 @@ var styles = {
10
10
  fontStyle: "italic",
11
11
  color: "inherit",
12
12
  fontWeight: "300",
13
- fontSize: "14px",
13
+ fontSize: "9px",
14
14
  lineHeight: "1.43",
15
- fontFamily: "inherit",
15
+ fontFamily: '"Montserrat", sans-serif',
16
16
  margin: "0",
17
17
  padding: "0"
18
18
  }
@@ -24,7 +24,7 @@ function ReportFooter(_ref) {
24
24
  style: styles.container
25
25
  }, /* @__PURE__ */React.createElement("div", {
26
26
  style: styles.text
27
- }, text || "This PDF is for - purposes."));
27
+ }, text));
28
28
  }
29
29
 
30
30
  export { ReportFooter as default };
@@ -2,34 +2,35 @@ import React from 'react';
2
2
 
3
3
  var styles = {
4
4
  container: {
5
- marginBottom: "24px",
5
+ marginBottom: "12px",
6
6
  borderBottom: "1px solid #E0E0E0",
7
- paddingBottom: "8px",
7
+ paddingBottom: "4px",
8
8
  display: "flex",
9
9
  alignItems: "flex-start",
10
10
  color: "#0e0044",
11
- width: "100%"
11
+ width: "100%",
12
+ fontFamily: '"Montserrat", sans-serif'
12
13
  },
13
14
  heading: {
14
- fontSize: "32px",
15
+ fontSize: "18px",
15
16
  fontWeight: "700",
16
17
  padding: "0",
17
- margin: "0 0 8px 0",
18
+ margin: "0 0 4px 0",
18
19
  lineHeight: "1.3",
19
20
  color: "inherit",
20
- fontFamily: "inherit"
21
+ fontFamily: '"Montserrat", sans-serif'
21
22
  },
22
23
  subheading: {
23
- fontSize: "17px",
24
+ fontSize: "9px",
24
25
  fontWeight: "500",
25
26
  padding: "0",
26
27
  margin: "0",
27
28
  lineHeight: "1.3",
28
29
  color: "inherit",
29
- fontFamily: "inherit"
30
+ fontFamily: '"Montserrat", sans-serif'
30
31
  },
31
32
  imgContainer: {
32
- width: "150px",
33
+ width: "100px",
33
34
  height: "35px"
34
35
  },
35
36
  img: {
@@ -1,23 +1,27 @@
1
1
  import React from 'react';
2
- import { ThemeProvider, Box, Heading, Text, Grid } from '@tenancy.nz/ui';
2
+ import { ThemeProvider, Box, Text, Heading, Grid } from '@tenancy.nz/ui';
3
3
  import { AnalyticsSection, GridList, PropertyCard } from '@tenancy.nz/feature-ui';
4
+ import ReportFooter from './ReportFooter.js';
5
+ import ReportHeader from './ReportHeader.js';
4
6
 
7
+ var propertyRent = function propertyRent(property) {
8
+ if (!property) {
9
+ return "";
10
+ }
11
+ var rentAmount = String(property.rent_amount).replace(".00", "");
12
+ var rentFrequency = String(property.rental_period).charAt(0).toLowerCase();
13
+ return !Number.isNaN(Number.parseInt(rentAmount, 10)) ? "$".concat(rentAmount, "/").concat(rentFrequency) : "";
14
+ };
5
15
  function ViewingAnalyticsReport(_ref) {
6
16
  var eventData = _ref.eventData;
7
17
  var stats = eventData.stats || {};
8
18
  var properties = eventData.properties || [];
9
- return /* @__PURE__ */React.createElement(ThemeProvider, null, /* @__PURE__ */React.createElement(Box, {
10
- padding: "20px"
11
- }, /* @__PURE__ */React.createElement(Box, {
19
+ return /* @__PURE__ */React.createElement(ThemeProvider, null, /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Box, {
12
20
  mb: 6,
13
21
  display: "flex",
14
22
  justify: "space-between",
15
23
  align: "start"
16
- }, /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Heading, {
17
- variant: "h1",
18
- as: "h1",
19
- gutterBottom: false
20
- }, "Analytics Report")), /* @__PURE__ */React.createElement(Box, {
24
+ }, /* @__PURE__ */React.createElement(Box, {
21
25
  display: "flex",
22
26
  align: "flex-end",
23
27
  direction: "column"
@@ -61,13 +65,16 @@ function ViewingAnalyticsReport(_ref) {
61
65
  agreementsCount: stats.agreements_count,
62
66
  agreementsFinalisedCount: stats.agreements_finalised_count,
63
67
  filterDaysCount: eventData.filterDaysCount
64
- }), /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Heading, {
65
- variant: "h4",
68
+ }), /* @__PURE__ */React.createElement(Box, {
69
+ sx: {
70
+ mt: "28px"
71
+ }
72
+ }, /* @__PURE__ */React.createElement(Heading, {
66
73
  as: "h4",
67
- mt: "20px",
68
- gutterBottom: false
74
+ sx: {
75
+ mb: "16px"
76
+ }
69
77
  }, "Top 5 properties"), /* @__PURE__ */React.createElement(GridList, {
70
- mt: "20px",
71
78
  items: properties,
72
79
  spacing: 5,
73
80
  emptyComponent: /* @__PURE__ */React.createElement(Text, null, "No results to show"),
@@ -76,19 +83,20 @@ function ViewingAnalyticsReport(_ref) {
76
83
  item: true,
77
84
  xs: 12
78
85
  }, /* @__PURE__ */React.createElement(PropertyCard, {
79
- propertyAddress: property.short_address,
80
- listingDate: "",
81
- daysOnMarket: "",
82
- weeklyRent: property.rent_amount,
86
+ address: property.short_address,
87
+ rent: propertyRent(property),
83
88
  viewingsCount: property.viewings_count,
84
89
  enquiriesCount: property.enquiries_count,
85
- propertyImage: property.thumb_url,
86
- beds: property.num_bedrooms,
87
- baths: property.num_bathrooms,
88
- carports: property.num_cars
90
+ imgSrc: property.thumb_url,
91
+ noOfBedrooms: property.num_bedrooms,
92
+ noOfBathrooms: property.num_bathrooms,
93
+ noOfCarparks: property.num_cars,
94
+ outlined: true
89
95
  }));
90
96
  }
91
97
  }))));
92
98
  }
99
+ ViewingAnalyticsReport.Footer = ReportFooter;
100
+ ViewingAnalyticsReport.Header = ReportHeader;
93
101
 
94
102
  export { ViewingAnalyticsReport as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tenancy.nz/reports",
3
3
  "description": "React UI reporting components.",
4
- "version": "1.1.4",
4
+ "version": "1.1.6",
5
5
  "author": "TPS <https://www.tenancy.co.nz>",
6
6
  "license": "ISC",
7
7
  "type": "module",
@@ -14,12 +14,12 @@
14
14
  "peerDependencies": {
15
15
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
16
16
  "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
17
- "@tenancy.nz/feature-ui": "1.1.4",
18
- "@tenancy.nz/ui": "1.1.4"
17
+ "@tenancy.nz/feature-ui": "1.1.6",
18
+ "@tenancy.nz/ui": "1.1.6"
19
19
  },
20
20
  "devDependencies": {
21
- "@tenancy.nz/feature-ui": "1.1.4",
22
- "@tenancy.nz/ui": "1.1.4"
21
+ "@tenancy.nz/feature-ui": "1.1.6",
22
+ "@tenancy.nz/ui": "1.1.6"
23
23
  },
24
24
  "dependencies": {
25
25
  "react-uid": "^2.4.0"