back-testing-react 1.0.4 → 1.0.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.
Files changed (60) hide show
  1. package/dist/cjs/index.js +17 -17
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/esm/index.js +17 -17
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/index.d.ts +35 -10
  6. package/package.json +5 -1
  7. package/src/components/back-testing-cat-legend/back-testing-cat-legend.css +1 -1
  8. package/src/components/back-testing-cat-legend/back-testing-cat-legend.tsx +7 -7
  9. package/src/components/back-testing-map/back-testing-map.css +1 -1
  10. package/src/components/back-testing-map/back-testing-map.service.ts +21 -5
  11. package/src/components/back-testing-map/back-testing-map.tsx +51 -18
  12. package/src/components/back-testing-map/back-testing-map.types.ts +74 -11
  13. package/src/components/back-testing-payout-info/back-testing-payout-info.css +112 -0
  14. package/src/components/back-testing-payout-info/back-testing-payout-info.tsx +371 -0
  15. package/src/components/back-testing-payout-info/back-testing-payout-info.types.ts +9 -0
  16. package/src/components/back-testing-stepper/back-testing-stepper.css +30 -0
  17. package/src/components/back-testing-stepper/back-testing-stepper.tsx +322 -0
  18. package/src/components/back-testing-stepper/back-testing-stepper.types.ts +41 -0
  19. package/src/components/back-testing-stepper/inputs/distance-input/distance-input.css +57 -0
  20. package/src/components/back-testing-stepper/inputs/distance-input/distance-input.stories.tsx +20 -0
  21. package/src/components/back-testing-stepper/inputs/distance-input/distance-input.tsx +93 -0
  22. package/src/components/back-testing-stepper/inputs/distance-input/distance-input.types.ts +41 -0
  23. package/src/components/back-testing-stepper/inputs/file-input/file-input.css +26 -0
  24. package/src/components/back-testing-stepper/inputs/file-input/file-input.stories.tsx +20 -0
  25. package/src/components/back-testing-stepper/inputs/file-input/file-input.tsx +43 -0
  26. package/src/components/back-testing-stepper/inputs/file-input/file-input.types.ts +10 -0
  27. package/src/components/back-testing-stepper/inputs/number-input/number-input.css +48 -0
  28. package/src/components/back-testing-stepper/inputs/number-input/number-input.stories.tsx +20 -0
  29. package/src/components/back-testing-stepper/inputs/number-input/number-input.tsx +55 -0
  30. package/src/components/back-testing-stepper/inputs/number-input/number-input.types.ts +12 -0
  31. package/src/components/back-testing-stepper/inputs/select-input/select-input.css +13 -0
  32. package/src/components/back-testing-stepper/inputs/select-input/select-input.stories.tsx +27 -0
  33. package/src/components/back-testing-stepper/inputs/select-input/select-input.tsx +63 -0
  34. package/src/components/back-testing-stepper/inputs/select-input/select-input.types.ts +8 -0
  35. package/src/components/back-testing-stepper/inputs/text-input/text-input.css +35 -0
  36. package/src/components/back-testing-stepper/inputs/text-input/text-input.stories.tsx +18 -0
  37. package/src/components/back-testing-stepper/inputs/text-input/text-input.tsx +32 -0
  38. package/src/components/back-testing-stepper/inputs/text-input/text-input.types.ts +6 -0
  39. package/src/components/back-testing-stepper/inputs/worldmap-search/worldmap-search.css +16 -0
  40. package/src/components/back-testing-stepper/inputs/worldmap-search/worldmap-search.stories.tsx +20 -0
  41. package/src/components/back-testing-stepper/inputs/worldmap-search/worldmap-search.tsx +151 -0
  42. package/src/components/back-testing-stepper/inputs/worldmap-search/worldmap-search.types.ts +11 -0
  43. package/src/components/back-testing-stepper/steps/input-anemometer/input-anemometer.css +0 -0
  44. package/src/components/back-testing-stepper/steps/input-anemometer/input-anemometer.tsx +188 -0
  45. package/src/components/back-testing-stepper/steps/input-anemometer/input-anemometer.types.ts +16 -0
  46. package/src/components/back-testing-stepper/steps/input-ciac/input-ciac.scss +0 -0
  47. package/src/components/back-testing-stepper/steps/input-ciac/input-ciac.tsx +225 -0
  48. package/src/components/back-testing-stepper/steps/input-ciac/input-ciac.types.ts +17 -0
  49. package/src/components/back-testing-stepper/steps/input-location/input-location.css +0 -0
  50. package/src/components/back-testing-stepper/steps/input-location/input-location.tsx +135 -0
  51. package/src/components/back-testing-stepper/steps/input-location/input-location.types.ts +16 -0
  52. package/src/components/back-testing-stepper/steps/input-proxy/input-proxy.css +0 -0
  53. package/src/components/back-testing-stepper/steps/input-proxy/input-proxy.tsx +173 -0
  54. package/src/components/back-testing-stepper/steps/input-proxy/input-proxy.types.ts +16 -0
  55. package/src/components/back-testing-stepper/steps/step.types.ts +58 -0
  56. package/src/components/back-testing-storm-legend/back-testing-storm-legend.stories.tsx +56 -33
  57. package/src/components/back-testing-wizard/back-testing-wizard.css +36 -0
  58. package/src/components/back-testing-wizard/back-testing-wizard.stories.tsx +734 -0
  59. package/src/components/back-testing-wizard/back-testing-wizard.tsx +102 -0
  60. package/src/components/back-testing-wizard/back-testing-wizard.types.ts +12 -0
package/dist/index.d.ts CHANGED
@@ -5,13 +5,29 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  interface StormPayout {
6
6
  name: string;
7
7
  year: number;
8
- windspeedMPH: number;
9
- proxyPayout: number;
10
- anemometerPayout: number;
11
- category: number;
12
- ciacPayout: number;
13
8
  maxRecovery: number;
14
9
  maxRecoveryAmount: number;
10
+ proxy: {
11
+ name?: string;
12
+ year?: number;
13
+ category?: number;
14
+ windspeedMPH?: number;
15
+ proxyPayout: number;
16
+ };
17
+ anemometer: {
18
+ name?: string;
19
+ year?: number;
20
+ category?: number;
21
+ windspeedMPH?: number;
22
+ anemometerPayout: number;
23
+ };
24
+ ciac: {
25
+ name?: string;
26
+ year?: number;
27
+ category?: number;
28
+ windspeedMPH?: number;
29
+ ciacPayout: number;
30
+ };
15
31
  color?: string;
16
32
  stormTrack: {
17
33
  NAME: string;
@@ -36,17 +52,26 @@ interface BackTestingMapProps {
36
52
  } | undefined | null;
37
53
  limit: number | undefined | null;
38
54
  ciacRadius: number | undefined | null;
39
- anemometerCode: string;
40
- proxyPayouts: Payout[];
41
- anemometerPayouts: Payout[];
42
- ciacPayouts: Payout[];
55
+ anemometerCode: string | undefined | null;
56
+ proxyPayouts?: Payout[];
57
+ anemometerPayouts?: Payout[];
58
+ ciacPayouts?: Payout[];
43
59
  includeNoNameStorms?: boolean;
44
60
  includeZeroPayouts?: boolean;
61
+ proxyEnabled?: boolean;
62
+ anemometerEnabled?: boolean;
63
+ ciacEnabled?: boolean;
64
+ isCalculatePayoutEnabled?: boolean;
65
+ onCalculatePayoutEnabledChanged?: (e: boolean) => void;
45
66
  onViewChange?: (view: MapView) => void;
67
+ stormPayouts: StormPayout[];
46
68
  onCalculatePayouts?: (payouts: StormPayout[]) => void;
69
+ onLoad?: (e: React.MutableRefObject<mapboxgl.Map | undefined>) => void;
70
+ appStatus: ('loading' | 'idle');
71
+ onAppStatusChange: (e: 'loading' | 'idle') => void;
47
72
  }
48
73
  interface BackTestingActions {
49
- calculatePayouts: (proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNameStorms: boolean, includeZeroPayouts: boolean, limit: number) => void;
74
+ calculatePayouts: (proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNameStorms: boolean, includeZeroPayouts: boolean, limit: number, proxyEnabled: boolean, anemometerEnabled: boolean, ciacEnabled: boolean) => void;
50
75
  }
51
76
  declare enum MapView {
52
77
  CAT_INTENSITY = "__cat_view",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "back-testing-react",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Parametric back testing application developed by NormanMax Insurance Solutions",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -41,10 +41,14 @@
41
41
  "@emotion/react": "^11.13.3",
42
42
  "@emotion/styled": "^11.13.0",
43
43
  "@mapbox/search-js-core": "^1.0.0-beta.22",
44
+ "@mapbox/search-js-react": "^1.0.0-beta.24",
45
+ "@mui/icons-material": "^6.1.8",
44
46
  "@mui/material": "^6.1.6",
45
47
  "@turf/turf": "^7.1.0",
48
+ "@types/papaparse": "^5.3.15",
46
49
  "@types/react-dom": "^18.3.1",
47
50
  "mapbox-gl": "^3.8.0",
51
+ "papaparse": "^5.4.1",
48
52
  "rimraf": "^6.0.1"
49
53
  },
50
54
  "peerDependencies": {
@@ -20,7 +20,7 @@
20
20
  left: 5px;
21
21
  }
22
22
 
23
- .legend > .item-container:hover > item {
23
+ .legend > .item-container:hover > .item {
24
24
  opacity: 0.2;
25
25
  }
26
26
 
@@ -7,14 +7,14 @@ const BackTestingCatLegend: React.FC<BackTestingCatLegendProps> = (props) => {
7
7
  return(
8
8
  <div className={props.className + " legend"}>
9
9
  <div className="item-container">
10
- <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 5</span>}><span className="item" style={{backgroundColor:generateCATColor(5)}}/></Tooltip>
11
- <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 4</span>}><span className="item" style={{backgroundColor:generateCATColor(4)}}/></Tooltip>
12
- <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 3</span>}><span className="item" style={{backgroundColor:generateCATColor(3)}}/></Tooltip>
13
- <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 2</span>}><span className="item" style={{backgroundColor:generateCATColor(2)}}/></Tooltip>
14
- <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 1</span>}><span className="item" style={{backgroundColor:generateCATColor(1)}}/></Tooltip>
15
- <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Tropical Storm</span>}><span className="item" style={{backgroundColor:generateCATColor(0)}}/></Tooltip>
16
- <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Tropical Depression</span>}><span className="item" style={{backgroundColor:generateCATColor(-1)}}/></Tooltip>
17
10
  <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Tropical Expression</span>}><span className="item" style={{backgroundColor:generateCATColor(-2)}}/></Tooltip>
11
+ <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Tropical Depression</span>}><span className="item" style={{backgroundColor:generateCATColor(-1)}}/></Tooltip>
12
+ <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Tropical Storm</span>}><span className="item" style={{backgroundColor:generateCATColor(0)}}/></Tooltip>
13
+ <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 1</span>}><span className="item" style={{backgroundColor:generateCATColor(1)}}/></Tooltip>
14
+ <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 2</span>}><span className="item" style={{backgroundColor:generateCATColor(2)}}/></Tooltip>
15
+ <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 3</span>}><span className="item" style={{backgroundColor:generateCATColor(3)}}/></Tooltip>
16
+ <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 4</span>}><span className="item" style={{backgroundColor:generateCATColor(4)}}/></Tooltip>
17
+ <Tooltip title={<span style={{ fontSize:'1.25em', padding:'2px' }}>Category 5</span>}><span className="item" style={{backgroundColor:generateCATColor(5)}}/></Tooltip>
18
18
  </div>
19
19
  </div>
20
20
  );
@@ -5,7 +5,7 @@ body{
5
5
 
6
6
  .map__wrapper{
7
7
  width: 100%;
8
- height: 100vh;
8
+ height: 100%;
9
9
  display: grid;
10
10
  grid-template-columns: 1fr;
11
11
  }
@@ -22,13 +22,29 @@ export class AppConfig {
22
22
  export interface StormPayout {
23
23
  name: string;
24
24
  year: number;
25
- windspeedMPH: number;
26
- proxyPayout: number;
27
- anemometerPayout: number;
28
- category: number;
29
- ciacPayout: number;
30
25
  maxRecovery: number;
31
26
  maxRecoveryAmount: number;
27
+ proxy:{
28
+ name?: string;
29
+ year?: number;
30
+ category?: number;
31
+ windspeedMPH?: number;
32
+ proxyPayout: number;
33
+ },
34
+ anemometer:{
35
+ name?: string;
36
+ year?: number;
37
+ category?: number;
38
+ windspeedMPH?: number;
39
+ anemometerPayout: number;
40
+ },
41
+ ciac:{
42
+ name?: string;
43
+ year?: number;
44
+ category?: number;
45
+ windspeedMPH?: number;
46
+ ciacPayout: number;
47
+ }
32
48
  color?: string;
33
49
  stormTrack:{
34
50
  NAME: string;
@@ -23,7 +23,6 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
23
23
  const [locationMarker, setLocationMarker] = useState<mapboxgl.Marker>(new mapboxgl.Marker());
24
24
  const [catCircle, setCatCircle] = useState<Feature<Polygon, GeoJsonProperties> | undefined>(undefined);
25
25
  const [mapView, setMapView] = useState<MapView>(MapView.CAT_INTENSITY);
26
- const [payouts, setPayouts] = useState<StormPayout[]>([]);
27
26
 
28
27
  const toggleView = (
29
28
  event: React.MouseEvent<HTMLElement>,
@@ -39,17 +38,17 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
39
38
  };
40
39
 
41
40
  useImperativeHandle(ref, () => ({
42
- calculatePayouts(proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNamedStorms: boolean, includeZeroPayouts: boolean, limit: number){
43
- calculatePayouts(proxyPayouts, anemometerCode, anemometerPayouts, ciacPayouts, includeNoNamedStorms, includeZeroPayouts, limit);
41
+ calculatePayouts(proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNamedStorms: boolean, includeZeroPayouts: boolean, limit: number, proxyEnabled: boolean, anemometerEnabled: boolean, ciacEnabled: boolean){
42
+ calculatePayouts(proxyPayouts, anemometerCode, anemometerPayouts, ciacPayouts, includeNoNamedStorms, includeZeroPayouts, limit, proxyEnabled, anemometerEnabled, ciacEnabled);
44
43
  }
45
44
  }));
46
45
 
47
- function calculatePayouts(proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNamedStorms: boolean, includeZeroPayouts: boolean, limit: number){
46
+ function calculatePayouts(proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNamedStorms: boolean, includeZeroPayouts: boolean, limit: number, proxyEnabled: boolean, anemometerEnabled: boolean, ciacEnabled: boolean){
48
47
  if(props.ciacRadius != undefined && props.ciacRadius != null && props.location != undefined && props.location != null){
49
48
  let latLng : LngLatLike = [props.location.longitude,props.location.latitude];
50
- const proxy = generateProxyRequest(latLng as [number,number], 1000, proxyPayouts);
51
- const anemometer = generateAnemometerRequest(latLng as [number,number], anemometerCode, anemometerPayouts);
52
- const ciac = generateCIACRequest(latLng as [number,number], props.ciacRadius, includeNoNamedStorms, ciacPayouts);
49
+ const proxy = generateProxyRequest(latLng as [number,number], 1000, proxyPayouts, proxyEnabled);
50
+ const anemometer = generateAnemometerRequest(latLng as [number,number], anemometerCode, anemometerPayouts, anemometerEnabled);
51
+ const ciac = generateCIACRequest(latLng as [number,number], props.ciacRadius, includeNoNamedStorms, ciacPayouts, ciacEnabled);
53
52
  let request : PayoutRequest = {
54
53
  includeZeroPayouts: includeZeroPayouts,
55
54
  limit: limit,
@@ -59,15 +58,22 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
59
58
  anemometer: anemometer,
60
59
  ciac: ciac
61
60
  }
61
+ props.onAppStatusChange('loading')
62
62
  fetchPayouts(request, props.apiAccessToken).then((data) => {
63
63
  let storms = data.payouts.map((storm,index) => { storm.color = randomColor(index); return storm})
64
- setPayouts(storms);
65
64
  if(props.onCalculatePayouts != undefined){
66
65
  props.onCalculatePayouts(storms);
67
66
  }
68
67
  }, (err) => {
69
68
  console.error(err);
70
69
  throw Error(err);
70
+ }).finally(() => {
71
+ if(props.isCalculatePayoutEnabled != undefined){
72
+ if(props.onCalculatePayoutEnabledChanged != undefined){
73
+ props.onCalculatePayoutEnabledChanged(false);
74
+ props.onAppStatusChange('idle')
75
+ }
76
+ }
71
77
  })
72
78
  }
73
79
  }
@@ -418,7 +424,9 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
418
424
  }
419
425
  popup.remove();
420
426
  });
421
-
427
+ if(props.onLoad != undefined){
428
+ props.onLoad(mapInstanceRef);
429
+ }
422
430
  });
423
431
  return () => mapInstanceRef.current?.remove();
424
432
 
@@ -445,15 +453,12 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
445
453
  let latLng : LngLatLike = [props.location.longitude,props.location.latitude];
446
454
  var circle = turf.circle(latLng as [number,number], props.ciacRadius, { steps:200, units: "miles"});
447
455
  setCatCircle(catCircle)
448
-
449
456
  const source = mapInstanceRef.current.getSource(CIAC_SOURCE)
450
457
  if (source){
451
- console.log("draw circle");
452
458
  (source as GeoJSONSource).setData({type: 'FeatureCollection', features: [circle]})
453
459
  }
454
460
  }
455
461
  } else {
456
- console.log("skip circle")
457
462
  if(mapInstanceRef?.current){
458
463
  setCatCircle(undefined)
459
464
  const source = mapInstanceRef.current.getSource(CIAC_SOURCE)
@@ -467,17 +472,45 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
467
472
 
468
473
  useEffect(() => {
469
474
  if(mapLoaded){
470
- updateStormTracks(payouts,mapView)
475
+ updateStormTracks(props.stormPayouts,mapView)
471
476
  }
472
- },[mapLoaded,payouts,mapView])
477
+ },[mapLoaded,props.stormPayouts,mapView])
473
478
 
474
479
  useEffect(() => {
475
480
  if(mapLoaded){
476
- if(props.location && props.limit && props.proxyPayouts && props.anemometerCode && props.anemometerPayouts && props.ciacRadius && props.ciacRadius && mapInstanceRef){
477
- calculatePayouts(props.proxyPayouts, props.anemometerCode, props.anemometerPayouts, props.ciacPayouts, false, false, props.limit)
481
+ if(props.location && props.limit && props.proxyPayouts && (props.anemometerCode != undefined && props.anemometerCode != null) && props.anemometerPayouts && props.ciacRadius && props.ciacRadius && props.ciacPayouts && mapInstanceRef){
482
+ if(props.isCalculatePayoutEnabled != undefined){
483
+ if(props.isCalculatePayoutEnabled == true){
484
+ calculatePayouts(
485
+ props.proxyPayouts,
486
+ props.anemometerCode,
487
+ props.anemometerPayouts,
488
+ props.ciacPayouts,
489
+ false,
490
+ false,
491
+ props.limit,
492
+ props.proxyEnabled != undefined ? props.proxyEnabled : true,
493
+ props.anemometerEnabled != undefined ? props.anemometerEnabled : true,
494
+ props.ciacEnabled != undefined ? props.ciacEnabled : true
495
+ )
496
+ }
497
+ }else {
498
+ calculatePayouts(
499
+ props.proxyPayouts,
500
+ props.anemometerCode,
501
+ props.anemometerPayouts,
502
+ props.ciacPayouts,
503
+ false,
504
+ false,
505
+ props.limit,
506
+ props.proxyEnabled != undefined ? props.proxyEnabled : true,
507
+ props.anemometerEnabled != undefined ? props.anemometerEnabled : true,
508
+ props.ciacEnabled != undefined ? props.ciacEnabled : true
509
+ )
510
+ }
478
511
  }
479
512
  }
480
- },[props.location, props.limit, props.proxyPayouts, props.anemometerCode, props.anemometerPayouts, props.ciacRadius, props.ciacRadius, mapInstanceRef, mapLoaded])
513
+ },[props.location, props.limit, props.proxyPayouts, props.anemometerCode, props.anemometerPayouts, props.ciacRadius, props.ciacPayouts, props.ciacRadius, mapInstanceRef, mapLoaded])
481
514
 
482
515
  return(
483
516
  <div className="map__wrapper">
@@ -494,7 +527,7 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
494
527
  <ToggleButton value={MapView.CAT_INTENSITY}>CAT Strength View</ToggleButton>
495
528
  <ToggleButton value={MapView.STORMS}>Storms View</ToggleButton>
496
529
  </ToggleButtonGroup>
497
- {mapView == MapView.STORMS && <BackTestingStormLegend stormTracks={payouts}/>}
530
+ {mapView == MapView.STORMS && <BackTestingStormLegend stormTracks={props.stormPayouts}/>}
498
531
  <div ref={mapContainerRef} className="map__container" />
499
532
  </div>
500
533
  );
@@ -15,6 +15,7 @@ export interface Shape {
15
15
  }
16
16
 
17
17
  export interface ProxyRequest {
18
+ enabled: boolean;
18
19
  radius: number;
19
20
  latitude: number | undefined;
20
21
  longitude: number | undefined;
@@ -22,6 +23,7 @@ export interface ProxyRequest {
22
23
  }
23
24
 
24
25
  export interface AnemometerRequest {
26
+ enabled: boolean;
25
27
  code: string
26
28
  latitude: number | undefined;
27
29
  longitude: number | undefined;
@@ -29,6 +31,7 @@ export interface AnemometerRequest {
29
31
  }
30
32
 
31
33
  export interface CIACRequest {
34
+ enabled: boolean;
32
35
  includeNotNamedStorms: boolean;
33
36
  shapes: Shape[];
34
37
  payouts: Payout[] | undefined;
@@ -50,18 +53,27 @@ export interface BackTestingMapProps {
50
53
  location: {longitude: number, latitude: number } | undefined | null,
51
54
  limit: number | undefined | null,
52
55
  ciacRadius: number | undefined | null,
53
- anemometerCode: string,
54
- proxyPayouts: Payout[],
55
- anemometerPayouts: Payout[],
56
- ciacPayouts: Payout[],
56
+ anemometerCode: string | undefined | null,
57
+ proxyPayouts?: Payout[],
58
+ anemometerPayouts?: Payout[],
59
+ ciacPayouts?: Payout[],
57
60
  includeNoNameStorms?: boolean,
58
61
  includeZeroPayouts?: boolean,
59
- onViewChange?: (view: MapView) => void
60
- onCalculatePayouts?: (payouts: StormPayout[]) => void
62
+ proxyEnabled?: boolean,
63
+ anemometerEnabled?: boolean,
64
+ ciacEnabled?: boolean,
65
+ isCalculatePayoutEnabled?: boolean,
66
+ onCalculatePayoutEnabledChanged?: (e:boolean) => void,
67
+ onViewChange?: (view: MapView) => void,
68
+ stormPayouts: StormPayout[],
69
+ onCalculatePayouts?: (payouts: StormPayout[]) => void ,
70
+ onLoad?: (e:React.MutableRefObject<mapboxgl.Map | undefined>) => void
71
+ appStatus: ('loading'| 'idle')
72
+ onAppStatusChange: (e: 'loading'| 'idle') => void
61
73
  }
62
74
 
63
75
  export interface BackTestingActions {
64
- calculatePayouts: (proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNameStorms: boolean, includeZeroPayouts: boolean, limit: number) => void,
76
+ calculatePayouts: (proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNameStorms: boolean, includeZeroPayouts: boolean, limit: number, proxyEnabled: boolean, anemometerEnabled: boolean, ciacEnabled: boolean) => void,
65
77
  }
66
78
 
67
79
  export enum MapView {
@@ -138,9 +150,10 @@ export function randomColor(index:number): string {
138
150
  return `hsla(${hue}, 90%, 60%, 1)`;
139
151
  }
140
152
 
141
- export function generateProxyRequest(latLng: [number,number], radius: number, payouts: Payout[] | undefined ){
153
+ export function generateProxyRequest(latLng: [number|undefined,number|undefined], radius: number, payouts: Payout[] | undefined, enabled: boolean ){
142
154
  let coord = (latLng);
143
155
  let proxy : ProxyRequest = {
156
+ enabled:enabled,
144
157
  radius: radius,
145
158
  latitude: coord[1],
146
159
  longitude: coord[0],
@@ -149,9 +162,10 @@ export function generateProxyRequest(latLng: [number,number], radius: number, pa
149
162
  return proxy
150
163
  }
151
164
 
152
- export function generateAnemometerRequest(latLng: [number,number], anemometerCode:string, payouts: Payout[] | undefined){
165
+ export function generateAnemometerRequest(latLng: [number|undefined,number|undefined], anemometerCode:string, payouts: Payout[] | undefined, enabled: boolean){
153
166
  let coord = (latLng);
154
167
  let anemometer : AnemometerRequest = {
168
+ enabled:enabled,
155
169
  code:anemometerCode,
156
170
  latitude: coord[1],
157
171
  longitude: coord[0],
@@ -160,9 +174,10 @@ export function generateAnemometerRequest(latLng: [number,number], anemometerCod
160
174
  return anemometer
161
175
  }
162
176
 
163
- export function generateCIACRequest(latLng: [number,number], radius: number | undefined, includeNoNameStorms: boolean, payouts: Payout[] | undefined){
177
+ export function generateCIACRequest(latLng: [number|undefined,number|undefined], radius: number | undefined, includeNoNameStorms: boolean, payouts: Payout[] | undefined, enabled: boolean){
164
178
  let coord = (latLng);
165
179
  let ciac : CIACRequest = {
180
+ enabled:enabled,
166
181
  shapes:[{
167
182
  type: "__circle",
168
183
  latitude: coord[1],
@@ -173,4 +188,52 @@ export function generateCIACRequest(latLng: [number,number], radius: number | un
173
188
  payouts: payouts
174
189
  }
175
190
  return ciac
176
- }
191
+ }
192
+
193
+ export function generateInitialProxyRequest() : ProxyRequest {
194
+ return {
195
+ enabled:true,
196
+ latitude: undefined,
197
+ longitude: undefined,
198
+ radius: 1000,
199
+ payouts: undefined
200
+ }
201
+ }
202
+
203
+ export function generateInitialAnemometerRequest() : AnemometerRequest {
204
+ return {
205
+ enabled:true,
206
+ code: "",
207
+ latitude: undefined,
208
+ longitude: undefined,
209
+ payouts: undefined
210
+ }
211
+ }
212
+
213
+ export function generateInitialCIACRequest() : CIACRequest {
214
+ return {
215
+ enabled:true,
216
+ includeNotNamedStorms: false,
217
+ shapes: [
218
+ {
219
+ type: "__circle",
220
+ latitude: undefined,
221
+ longitude: undefined,
222
+ radius: 15
223
+ }
224
+ ],
225
+ payouts: undefined
226
+ }
227
+ }
228
+
229
+ export function generateInitialPayoutRequest() : PayoutRequest {
230
+ return {
231
+ limit: 0,
232
+ latitude: undefined,
233
+ longitude: undefined,
234
+ includeZeroPayouts: false,
235
+ proxy: generateInitialProxyRequest(),
236
+ anemometer: generateInitialAnemometerRequest(),
237
+ ciac: generateInitialCIACRequest()
238
+ }
239
+ }
@@ -0,0 +1,112 @@
1
+ .payout-info-container {
2
+ padding:0;
3
+ font-family: system-ui, sans-serif;
4
+ }
5
+
6
+ .payout-info-container .header{
7
+ margin: 15px;
8
+ }
9
+
10
+ .payout-info-container ::-webkit-scrollbar{
11
+ width: 10px;
12
+ }
13
+
14
+ .payout-info-container ::-webkit-scrollbar-track {
15
+ background: #f1f1f1;
16
+ }
17
+
18
+ .payout-info-container ::-webkit-scrollbar-thumnb {
19
+ background: #c7c6c6;
20
+ }
21
+
22
+ .payout-info-container ::-webkit-scrollbar-thumb:hover {
23
+ background: #868686;
24
+ }
25
+
26
+ .payout-info-container .wind {
27
+ height: 25px;
28
+ line-height: 25px;
29
+ text-align: center;
30
+ color: black;
31
+ font-weight: 700;
32
+ font-size: 0.8em;
33
+ padding: 3px 10px;
34
+ border-radius: 2px;
35
+ border: 0.5px solid darkgray;
36
+ }
37
+
38
+ .payout-info-container .cat{
39
+ height: 25px;
40
+ line-height: 25px;
41
+ text-align: center;
42
+ color: white;
43
+ font-weight: 700;
44
+ font-size: 0.8em;
45
+ padding: 3px 10px;
46
+ border-radius: 2px;
47
+ margin-right: 5px;
48
+ }
49
+
50
+ .payout-info-container .cat.cat-5{
51
+ background-color: #fc5c0d;
52
+ }
53
+
54
+ .payout-info-container .cat.cat-4{
55
+ background-color: #fa8d0e;
56
+ }
57
+
58
+ .payout-info-container .cat.cat-3{
59
+ background-color: #f7be0f;
60
+ }
61
+
62
+ .payout-info-container .cat.cat-2{
63
+ background-color: #f6d70f;
64
+ }
65
+
66
+ .payout-info-container .cat.cat-1{
67
+ background-color: #c0e826;
68
+ }
69
+
70
+ .payout-info-container .cat.cat-0{
71
+ background-color: #9cf435;
72
+ }
73
+
74
+ .payout-info-container .cat.cat--1{
75
+ background-color: #78ff44;
76
+ }
77
+
78
+ .payout-info-container .cat.cat--2{
79
+ background-color: #78ff44;
80
+ }
81
+
82
+ .payout-info-container .cat.cat--3{
83
+ background-color: #78ff44;
84
+ }
85
+
86
+ .payout-info-container .cat.cat--4{
87
+ background-color: #78ff44;
88
+ }
89
+
90
+ .payout-info-container .cat.cat--5{
91
+ background-color: #78ff44;
92
+ }
93
+
94
+ .payout-info-container .cat.cat--10{
95
+ background-color: #7d837b;
96
+ }
97
+
98
+ .payout-info-container .scroll-container{
99
+ height: calc(100vh - 2.5em - 15px - 15px - 75px);
100
+ overflow-y:hidden;
101
+ scrollbar-gutter: stable;
102
+ position: relative;
103
+ top: 10px;
104
+ }
105
+
106
+ .payout-info-container .scroll-container:hover{
107
+ overflow-y: auto;
108
+ }
109
+
110
+ .payout-info-container .scroll-container .card-container:last-child div{
111
+ margin-bottom: 0px;
112
+ }