@rileybathurst/paddle 1.9.15 → 1.9.17

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@rileybathurst/paddle",
3
3
  "private": false,
4
- "version": "1.9.15",
4
+ "version": "1.9.17",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "tsc --noEmit && stay-gold && vite",
@@ -12,16 +12,17 @@ export const PaddleLocationDeck = ({
12
12
 
13
13
  // TODO: testing
14
14
  console.log("PaddleLocationDeck phone", phone);
15
+ console.log(typeof phone);
15
16
 
16
17
  return (
17
18
  <section className="location-deck">
18
19
  {nodes.map((location: PaddleLocationTypes) => (
19
20
  <PaddleLocation
20
21
  key={location.id}
22
+ {...location}
21
23
  season_start={season_start}
22
24
  season_end={season_end}
23
25
  phone={phone}
24
- {...location}
25
26
  />
26
27
  ))}
27
28
  </section>
@@ -54,13 +54,17 @@ const Season = ({
54
54
 
55
55
  return (
56
56
  <div>
57
- <p>We&apos;re closed for the season</p>
57
+ {offSeasonDetails ? (
58
+ <p>{offSeasonDetails}</p>
59
+ ) : (
60
+ <p>We&apos;re closed for the season</p>
61
+ )}
58
62
 
59
63
  {currentDay < seasonStartDate ? (
60
64
  <p>We will reopen {season_start}, Weather Permitting</p>
61
65
  ) : null}
62
66
 
63
- {offSeasonDetails ? <p>{offSeasonDetails}</p> : null}
67
+
64
68
  </div>
65
69
  );
66
70
  }
@@ -68,7 +72,6 @@ const Season = ({
68
72
  console.warn(`No season start or end date provided for ${name}. Defaulting to off season.`);
69
73
  return (
70
74
  <div>
71
- <p>We&apos;re closed for the season</p>
72
75
  {offSeasonDetails ? <p>{offSeasonDetails}</p> : null}
73
76
  </div>
74
77
  );
@@ -87,11 +90,10 @@ type ContentTypes = {
87
90
  opening_time: string;
88
91
  closing_time: string;
89
92
 
90
- season_start?: string;
91
- season_end?: string;
93
+ season_start: string;
94
+ season_end: string;
92
95
 
93
96
  offSeasonDetails?: string;
94
- phone?: number;
95
97
  weatherPermitting?: boolean;
96
98
 
97
99
  streetAddress?: string;
@@ -116,7 +118,6 @@ const Content = ({
116
118
  season_start,
117
119
  season_end,
118
120
  offSeasonDetails,
119
- phone,
120
121
  }: ContentTypes) => {
121
122
  return (
122
123
  <React.Fragment>
@@ -156,10 +157,6 @@ const Content = ({
156
157
  <Markdown>{description.data.description}</Markdown>
157
158
  </div>
158
159
  )}
159
-
160
- {phone && (
161
- <Phone phone={phone} />
162
- )}
163
160
  </div>
164
161
  </React.Fragment>
165
162
  );
@@ -177,18 +174,18 @@ export const PaddleLocation = ({
177
174
  addressRegion,
178
175
  postalCode,
179
176
  commonName,
180
- season_start,
181
- season_end,
182
- phone,
183
177
  offSeasonDetails,
184
- weatherPermitting
178
+ weatherPermitting,
179
+ showThePhone,
180
+ phone,
181
+ season_start,
182
+ season_end
185
183
  }: PaddleLocationTypes) => {
186
184
 
187
- const phoneDidgits = Number(phone);
188
-
189
185
 
190
186
  // TODO: testing
191
187
  console.log("PaddleLocation phone", phone);
188
+ console.log(typeof phone);
192
189
 
193
190
  const content = (
194
191
  <Content
@@ -210,7 +207,7 @@ export const PaddleLocation = ({
210
207
  );
211
208
 
212
209
  return link.includes("http") ? (
213
- <div className={`location-wrapper ${phone ? 'phone-spacer' : ''}`}>
210
+ <div className={`location-wrapper ${showThePhone ? 'phone-spacer' : ''}`}>
214
211
  <a
215
212
  href={link}
216
213
  className="location"
@@ -220,17 +217,17 @@ export const PaddleLocation = ({
220
217
  >
221
218
  {content}
222
219
  </a>
223
- {phone && (
224
- <Phone phone={phoneDidgits} />
220
+ {showThePhone && phone && (
221
+ <Phone phone={phone} />
225
222
  )}
226
223
  </div>
227
224
  ) : (
228
- <div className={`location-wrapper ${phone ? 'phone-spacer' : ''}`}>
225
+ <div className={`location-wrapper ${showThePhone ? 'phone-spacer' : ''}`}>
229
226
  <Link to={link} className="location">
230
227
  {content}
231
228
  </Link>
232
- {phone && (
233
- <Phone phone={phoneDidgits} />
229
+ {showThePhone && phone && (
230
+ <Phone phone={phone} />
234
231
  )}
235
232
  </div>
236
233
  );
package/src/phone.tsx CHANGED
@@ -1,13 +1,19 @@
1
1
  import * as React from "react";
2
2
 
3
3
  interface FormatPhoneNumberTypes {
4
- phoneNumberString: number;
4
+ phone: number;
5
5
  }
6
- const FormatPhoneNumber = ({ phoneNumberString }: FormatPhoneNumberTypes) => {
7
- const phoneNumber = String(phoneNumberString);
6
+ const FormatPhoneNumber = ({ phone }: FormatPhoneNumberTypes) => {
7
+ const phoneNumber = String(phone);
8
+
9
+ // TODO: testing
10
+ console.log("FormatPhoneNumber phone", phone);
8
11
  const cleaned = `${phoneNumber}`.replace(/\D/g, "");
9
12
  const match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
10
13
  if (match) {
14
+
15
+ // TODO: testing
16
+ console.log("match", match);
11
17
  return `(${match[1]}) ${match[2]}-${match[3]}`;
12
18
  }
13
19
  return null;
@@ -19,7 +25,6 @@ type PhoneTypes = {
19
25
 
20
26
  const Phone = ({ phone }: PhoneTypes) => {
21
27
 
22
-
23
28
  // TODO: testing
24
29
  console.log("phone", phone);
25
30
 
@@ -28,7 +33,7 @@ const Phone = ({ phone }: PhoneTypes) => {
28
33
  rel="noopener noreferrer"
29
34
  className="button location-phone"
30
35
  >
31
- Phone: <FormatPhoneNumber phoneNumberString={phone} />
36
+ Phone: <FormatPhoneNumber phone={phone} />
32
37
  </a>
33
38
  );
34
39
  };
@@ -1,9 +1,8 @@
1
1
  import type { PaddleLocationTypes } from "./paddle-location-types";
2
2
 
3
3
  export type PaddleLocationDeckTypes = {
4
- background?: string;
5
- season_start?: string; // ? should this be optional? it created a problem with tours
6
- season_end?: string;
7
- phone?: string;
4
+ season_start: string;
5
+ season_end: string;
6
+ phone: number;
8
7
  nodes: PaddleLocationTypes[];
9
8
  };
@@ -15,7 +15,6 @@ export interface PaddleLocationTypes {
15
15
  season_start: string;
16
16
  season_end: string;
17
17
  };
18
- background?: string;
19
18
 
20
19
  streetAddress?: string;
21
20
  addressLocality?: string;
@@ -23,10 +22,12 @@ export interface PaddleLocationTypes {
23
22
  postalCode?: string;
24
23
  commonName?: string;
25
24
 
26
- season_start?: string;
27
- season_end?: string;
28
- phone?: string;
25
+ showThePhone: boolean;
29
26
 
30
27
  offSeasonDetails?: string;
31
28
  weatherPermitting?: boolean;
29
+
30
+ phone: number;
31
+ season_start: string;
32
+ season_end: string;
32
33
  }