@rileybathurst/paddle 1.9.4 → 1.9.5
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
package/src/App.tsx
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
// * this is the opening vite page to test functions with
|
|
2
|
+
|
|
1
3
|
import { useState } from 'react'
|
|
2
4
|
import reactLogo from './assets/react.svg'
|
|
3
5
|
import viteLogo from '/vite.svg'
|
|
6
|
+
import { PaddlePricingChart } from './paddle-pricing-chart'
|
|
4
7
|
|
|
5
8
|
function App() {
|
|
6
9
|
const [count, setCount] = useState(0)
|
|
@@ -27,6 +30,70 @@ function App() {
|
|
|
27
30
|
<p className="read-the-docs">
|
|
28
31
|
Click on the Vite and React logos to learn more
|
|
29
32
|
</p>
|
|
33
|
+
|
|
34
|
+
{/* testing */}
|
|
35
|
+
<PaddlePricingChart
|
|
36
|
+
rentalRates={{
|
|
37
|
+
nodes: [
|
|
38
|
+
{
|
|
39
|
+
"id": "0bcc4411-43e9-55a4-9a61-313a27198c23",
|
|
40
|
+
"item": "Single Kayak",
|
|
41
|
+
"oneHour": 32,
|
|
42
|
+
"threeHour": 64,
|
|
43
|
+
"fullDay": 96,
|
|
44
|
+
"pedalAdd": 10,
|
|
45
|
+
"branches": [],
|
|
46
|
+
"retail": null
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "dad19f3d-3381-573a-b37d-6c4970e60c61",
|
|
50
|
+
"item": "Double Kayak",
|
|
51
|
+
"oneHour": 48,
|
|
52
|
+
"threeHour": 96,
|
|
53
|
+
"fullDay": 110,
|
|
54
|
+
"pedalAdd": 20,
|
|
55
|
+
"branches": [],
|
|
56
|
+
"retail": null
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "531d03f2-2348-564f-b4e5-d00fc2810f6b",
|
|
60
|
+
"item": "Paddle board",
|
|
61
|
+
"oneHour": 32,
|
|
62
|
+
"threeHour": 64,
|
|
63
|
+
"fullDay": 96,
|
|
64
|
+
"pedalAdd": null,
|
|
65
|
+
"branches": [],
|
|
66
|
+
"retail": null
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "cc6bb238-1c66-56d7-89ae-3cd3d99e5502",
|
|
70
|
+
"item": "Inflatable Paddle Board*",
|
|
71
|
+
"oneHour": null,
|
|
72
|
+
"threeHour": null,
|
|
73
|
+
"fullDay": 96,
|
|
74
|
+
"pedalAdd": null,
|
|
75
|
+
"branches": [
|
|
76
|
+
{
|
|
77
|
+
"slug": "tahoe-city"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"retail": {
|
|
81
|
+
"slug": "breeze-wing",
|
|
82
|
+
"sport": {
|
|
83
|
+
"slug": "paddleboard"
|
|
84
|
+
},
|
|
85
|
+
"brand": {
|
|
86
|
+
"slug": "tahe"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}}
|
|
92
|
+
branches={{
|
|
93
|
+
// slug: 'south-tahoe'
|
|
94
|
+
slug: 'tahoe-city'
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
30
97
|
</>
|
|
31
98
|
)
|
|
32
99
|
}
|
|
@@ -36,14 +36,9 @@ const LineBreaker = ({ text }: { text: string; }) => {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export const PaddlePricingChart = ({ rentalRates, branches }: paddlePricingChartTypes) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
console.log(
|
|
42
|
-
console.log(rentalRates);
|
|
43
|
-
console.log(branches);
|
|
44
|
-
console.log('🦖');
|
|
45
|
-
|
|
46
|
-
console.log(rentalRates.nodes.map(rate => rate.branches?.map(branch => branch.slug)));
|
|
39
|
+
console.log(rentalRates.nodes.map(rate => rate.branches?.map(
|
|
40
|
+
branch => branch.slug
|
|
41
|
+
).flat().some(slug => slug === branches?.slug) && console.log("found a match")));
|
|
47
42
|
|
|
48
43
|
return (
|
|
49
44
|
<div className="pricing-chart">
|
|
@@ -59,7 +54,7 @@ export const PaddlePricingChart = ({ rentalRates, branches }: paddlePricingChart
|
|
|
59
54
|
|
|
60
55
|
{rentalRates.nodes.map((rate) => (
|
|
61
56
|
<div key={rate.id} className="column">
|
|
62
|
-
{rate.retail && rate.branches?.some(branch => branch.slug === branches?.slug) ? (
|
|
57
|
+
{rate.retail && rate.branches?.flat().some(branch => branch.slug === branches?.slug) ? (
|
|
63
58
|
<Link to={`/retail/${rate.retail.sport.slug}/${rate.retail.brand.slug}/${rate.retail.slug}`}>
|
|
64
59
|
<LineBreaker text={rate.item} />
|
|
65
60
|
</Link>
|
|
@@ -5,10 +5,10 @@ export type paddlePricingChartTypes = {
|
|
|
5
5
|
nodes: {
|
|
6
6
|
id: React.Key;
|
|
7
7
|
item: string;
|
|
8
|
-
oneHour
|
|
9
|
-
threeHour
|
|
10
|
-
fullDay
|
|
11
|
-
pedalAdd?: number;
|
|
8
|
+
oneHour?: number | null;
|
|
9
|
+
threeHour?: number | null;
|
|
10
|
+
fullDay?: number | null;
|
|
11
|
+
pedalAdd?: number | null;
|
|
12
12
|
|
|
13
13
|
branches?: {
|
|
14
14
|
slug: string;
|
|
@@ -22,10 +22,10 @@ export type paddlePricingChartTypes = {
|
|
|
22
22
|
brand: {
|
|
23
23
|
slug: string;
|
|
24
24
|
};
|
|
25
|
-
};
|
|
25
|
+
} | null;
|
|
26
26
|
}[];
|
|
27
27
|
};
|
|
28
28
|
branches?: {
|
|
29
29
|
slug: string;
|
|
30
|
-
}
|
|
30
|
+
} | null;
|
|
31
31
|
};
|