@rileybathurst/paddle 0.0.95 → 0.0.96

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": "0.0.95",
4
+ "version": "0.0.96",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -4,6 +4,7 @@ import * as React from "react"
4
4
  import { Link } from 'gatsby';
5
5
  import Markdown from "react-markdown";
6
6
  import type { LocationCardTypes } from "./types/location-card-types";
7
+ import HourMin from "./hour-min";
7
8
 
8
9
  interface SeasonTypes {
9
10
  season_start: string;
@@ -12,42 +13,34 @@ interface SeasonTypes {
12
13
  closing_time: string;
13
14
  name: string;
14
15
  }
15
- function Season({ name }: SeasonTypes) {
16
+ function Season({ name, season_start, season_end, opening_time, closing_time }: SeasonTypes) {
16
17
 
17
18
  // TODO: these need a query but thats not the most important first step
18
19
  if (name === "Free Parking Lot" || name === "Parking" || name === "Delivery") {
19
20
  return null;
20
21
  }
21
22
 
22
- // console.log(opening_time);
23
+ const currentDay = new Date();
24
+ const seasonStartDate = new Date(season_start);
25
+ const seasonEndDate = new Date(season_end);
23
26
 
24
- /* if (new Date(season_start) < new Date()) {
25
- return (
26
- <p>
27
- {opening_time ? "Open Daily: " : null}
28
- <HourMin time={opening_time} />
29
- {opening_time ? " - : " : null}
30
- <HourMin time={closing_time} />
31
- </p>
32
- )
33
- } */
34
-
35
- /* return (
27
+ if (currentDay < seasonStartDate || currentDay > seasonEndDate) {
28
+ return (
36
29
  <p>
37
- We&apos;re closed for the season:<br />
38
- We will reopen<br />
39
- {season_start} - {season_end}<br />
40
- Weather Permitting
30
+ {opening_time ? "Open Daily: " : null}
31
+ <HourMin time={opening_time} />
32
+ {opening_time ? " - : " : null}
33
+ <HourMin time={closing_time} />
41
34
  </p>
42
- ) */
35
+ )
36
+ }
37
+
43
38
  return (
44
39
  <p>
45
- {/* {opening_time ? "Open Daily: " : null} */}
46
- Open Daily 9:30am - 5:30pm<br />
40
+ We&apos;re closed for the season:<br />
41
+ We will reopen<br />
42
+ {season_start} - {season_end}<br />
47
43
  Weather Permitting
48
- {/* <HourMin time={opening_time} /> */}
49
- {/* {opening_time ? " - : " : null} */}
50
- {/* <HourMin time={closing_time} /> */}
51
44
  </p>
52
45
  )
53
46
  }
@@ -68,12 +61,18 @@ interface ContentTypes {
68
61
  opening_time: string;
69
62
  closing_time: string;
70
63
 
71
- locale: {
72
- season_start: string;
73
- season_end: string;
74
- };
64
+
65
+ season_start: string;
66
+ season_end: string;
67
+
68
+ streetAddress?: string;
69
+ addressLocality?: string;
70
+ addressRegion?: string;
71
+ postalCode?: string;
72
+ commonName?: string;
73
+
75
74
  }
76
- function Content({ svg, name, address, description, opening_time, closing_time, locale }: ContentTypes) {
75
+ function Content({ svg, name, address, description, opening_time, closing_time, streetAddress, addressLocality, addressRegion, postalCode, commonName }: ContentTypes) {
77
76
  return (
78
77
  <>
79
78
  <div
@@ -82,10 +81,24 @@ function Content({ svg, name, address, description, opening_time, closing_time,
82
81
  />
83
82
 
84
83
  <div>
85
- <h3 className="elbrus">{name}</h3>
86
- <Markdown className="react-markdown">
87
- {address.data.address}
88
- </Markdown>
84
+
85
+ {streetAddress || addressLocality || addressRegion || postalCode || commonName ? (
86
+ <address>
87
+ {commonName ? <span>{commonName}<br /></span> : null}
88
+ {streetAddress ? <span>{streetAddress}<br /></span> : null}
89
+ {addressLocality ? <span>{addressLocality}, </span> : null}
90
+ {addressRegion ? <span>{addressRegion} </span> : null}
91
+ {postalCode ? <span>{postalCode}<br /></span> : null}
92
+ </address>
93
+ ) :
94
+
95
+ (<>
96
+ <h3 className="elbrus">{name}</h3>
97
+ <Markdown className="react-markdown">
98
+ {address.data.address}
99
+ </Markdown>
100
+ </>)}
101
+
89
102
  </div>
90
103
 
91
104
  <div>
@@ -106,7 +119,7 @@ function Content({ svg, name, address, description, opening_time, closing_time,
106
119
  )
107
120
  }
108
121
 
109
- export function PaddleLocationCard({ svg, name, link, address, description, opening_time, closing_time, locale, background }: LocationCardTypes) {
122
+ export function PaddleLocationCard({ svg, name, link, address, description, opening_time, closing_time, background, streetAddress, addressLocality, addressRegion, postalCode, commonName, season_start, season_end }: LocationCardTypes) {
110
123
  if (link.includes('http')) {
111
124
  return (
112
125
  <a href={link}
@@ -122,7 +135,16 @@ export function PaddleLocationCard({ svg, name, link, address, description, open
122
135
  description={description}
123
136
  opening_time={opening_time}
124
137
  closing_time={closing_time}
125
- locale={locale}
138
+
139
+ streetAddress={streetAddress}
140
+ addressLocality={addressLocality}
141
+ addressRegion={addressRegion}
142
+ postalCode={postalCode}
143
+ commonName={commonName}
144
+
145
+ season_start={season_start}
146
+ season_end={season_end}
147
+
126
148
  />
127
149
  </a>
128
150
  )
@@ -139,7 +161,15 @@ export function PaddleLocationCard({ svg, name, link, address, description, open
139
161
  description={description}
140
162
  opening_time={opening_time}
141
163
  closing_time={closing_time}
142
- locale={locale}
164
+
165
+ streetAddress={streetAddress}
166
+ addressLocality={addressLocality}
167
+ addressRegion={addressRegion}
168
+ postalCode={postalCode}
169
+ commonName={commonName}
170
+
171
+ season_start={season_start}
172
+ season_end={season_end}
143
173
  />
144
174
  </Link>
145
175
  )
@@ -0,0 +1,31 @@
1
+ import * as React from "react"
2
+
3
+ interface HourMinTypes {
4
+ time: string;
5
+ }
6
+ const HourMin = ({ time }: HourMinTypes) => {
7
+ if (time) {
8
+ const hoursString = time.split(':')[0];
9
+ const mins = time.split(':')[1];
10
+
11
+ let hoursInt = Number.parseInt(hoursString, 10);
12
+ const ampm = hoursInt >= 12 ? 'pm' : 'am';
13
+
14
+ /* if (hoursInt < 10) {
15
+ hoursDisplay = hoursInt.replace('0', '');
16
+ } */
17
+
18
+ if (hoursInt > 12) {
19
+ hoursInt = hoursInt - 12;
20
+ }
21
+
22
+ return (
23
+ <>{hoursInt}:{mins}{ampm}</>
24
+ );
25
+ }
26
+
27
+ return null;
28
+
29
+ }
30
+
31
+ export default HourMin
@@ -21,4 +21,13 @@ export interface LocationCardTypes {
21
21
  season_end: string;
22
22
  };
23
23
  background?: string;
24
+
25
+ streetAddress?: string;
26
+ addressLocality?: string;
27
+ addressRegion?: string;
28
+ postalCode?: string;
29
+ commonName?: string;
30
+
31
+ season_start?: string;
32
+ season_end?: string;
24
33
  }