@rileybathurst/paddle 1.9.3 → 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rileybathurst/paddle",
3
3
  "private": false,
4
- "version": "1.9.3",
4
+ "version": "1.9.5",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "tsc --noEmit && stay-gold && vite",
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
  }
@@ -35,13 +35,10 @@ const LineBreaker = ({ text }: { text: string; }) => {
35
35
  );
36
36
  }
37
37
 
38
- export const PaddlePricingChart = ({ rentalRates, branch }: paddlePricingChartTypes) => {
39
-
40
- console.log('paddle pricing chart testing');
41
- console.log('🦄');
42
- console.log(rentalRates);
43
- console.log(branch);
44
- console.log('🦖');
38
+ export const PaddlePricingChart = ({ rentalRates, branches }: paddlePricingChartTypes) => {
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")));
45
42
 
46
43
  return (
47
44
  <div className="pricing-chart">
@@ -57,7 +54,7 @@ export const PaddlePricingChart = ({ rentalRates, branch }: paddlePricingChartTy
57
54
 
58
55
  {rentalRates.nodes.map((rate) => (
59
56
  <div key={rate.id} className="column">
60
- {rate.retail && rate.branch.slug == branch.slug ? (
57
+ {rate.retail && rate.branches?.flat().some(branch => branch.slug === branches?.slug) ? (
61
58
  <Link to={`/retail/${rate.retail.sport.slug}/${rate.retail.brand.slug}/${rate.retail.slug}`}>
62
59
  <LineBreaker text={rate.item} />
63
60
  </Link>
@@ -5,14 +5,14 @@ export type paddlePricingChartTypes = {
5
5
  nodes: {
6
6
  id: React.Key;
7
7
  item: string;
8
- oneHour: number;
9
- threeHour: number;
10
- fullDay: number;
11
- pedalAdd?: number;
8
+ oneHour?: number | null;
9
+ threeHour?: number | null;
10
+ fullDay?: number | null;
11
+ pedalAdd?: number | null;
12
12
 
13
- branch: {
13
+ branches?: {
14
14
  slug: string;
15
- };
15
+ }[];
16
16
 
17
17
  retail?: {
18
18
  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
- branch: {
28
+ branches?: {
29
29
  slug: string;
30
- }
30
+ } | null;
31
31
  };