back-testing-react 1.0.5 → 1.0.7
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/dist/cjs/index.js +21 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +21 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/package.json +5 -1
- package/src/components/back-testing-cat-legend/back-testing-cat-legend.css +1 -1
- package/src/components/back-testing-cat-legend/back-testing-cat-legend.tsx +7 -7
- package/src/components/back-testing-map/back-testing-map.css +1 -1
- package/src/components/back-testing-map/back-testing-map.service.ts +19 -4
- package/src/components/back-testing-map/back-testing-map.tsx +51 -18
- package/src/components/back-testing-map/back-testing-map.types.ts +68 -10
- package/src/components/back-testing-payout-info/back-testing-payout-info.css +112 -0
- package/src/components/back-testing-payout-info/back-testing-payout-info.tsx +371 -0
- package/src/components/back-testing-payout-info/back-testing-payout-info.types.ts +9 -0
- package/src/components/back-testing-stepper/back-testing-stepper.css +30 -0
- package/src/components/back-testing-stepper/back-testing-stepper.tsx +322 -0
- package/src/components/back-testing-stepper/back-testing-stepper.types.ts +41 -0
- package/src/components/back-testing-stepper/inputs/distance-input/distance-input.css +57 -0
- package/src/components/back-testing-stepper/inputs/distance-input/distance-input.stories.tsx +20 -0
- package/src/components/back-testing-stepper/inputs/distance-input/distance-input.tsx +93 -0
- package/src/components/back-testing-stepper/inputs/distance-input/distance-input.types.ts +41 -0
- package/src/components/back-testing-stepper/inputs/file-input/file-input.css +26 -0
- package/src/components/back-testing-stepper/inputs/file-input/file-input.stories.tsx +20 -0
- package/src/components/back-testing-stepper/inputs/file-input/file-input.tsx +43 -0
- package/src/components/back-testing-stepper/inputs/file-input/file-input.types.ts +10 -0
- package/src/components/back-testing-stepper/inputs/number-input/number-input.css +48 -0
- package/src/components/back-testing-stepper/inputs/number-input/number-input.stories.tsx +20 -0
- package/src/components/back-testing-stepper/inputs/number-input/number-input.tsx +55 -0
- package/src/components/back-testing-stepper/inputs/number-input/number-input.types.ts +12 -0
- package/src/components/back-testing-stepper/inputs/select-input/select-input.css +13 -0
- package/src/components/back-testing-stepper/inputs/select-input/select-input.stories.tsx +27 -0
- package/src/components/back-testing-stepper/inputs/select-input/select-input.tsx +63 -0
- package/src/components/back-testing-stepper/inputs/select-input/select-input.types.ts +8 -0
- package/src/components/back-testing-stepper/inputs/text-input/text-input.css +35 -0
- package/src/components/back-testing-stepper/inputs/text-input/text-input.stories.tsx +18 -0
- package/src/components/back-testing-stepper/inputs/text-input/text-input.tsx +32 -0
- package/src/components/back-testing-stepper/inputs/text-input/text-input.types.ts +6 -0
- package/src/components/back-testing-stepper/inputs/worldmap-search/worldmap-search.css +16 -0
- package/src/components/back-testing-stepper/inputs/worldmap-search/worldmap-search.stories.tsx +20 -0
- package/src/components/back-testing-stepper/inputs/worldmap-search/worldmap-search.tsx +151 -0
- package/src/components/back-testing-stepper/inputs/worldmap-search/worldmap-search.types.ts +11 -0
- package/src/components/back-testing-stepper/steps/input-anemometer/input-anemometer.css +0 -0
- package/src/components/back-testing-stepper/steps/input-anemometer/input-anemometer.tsx +188 -0
- package/src/components/back-testing-stepper/steps/input-anemometer/input-anemometer.types.ts +16 -0
- package/src/components/back-testing-stepper/steps/input-ciac/input-ciac.scss +0 -0
- package/src/components/back-testing-stepper/steps/input-ciac/input-ciac.tsx +225 -0
- package/src/components/back-testing-stepper/steps/input-ciac/input-ciac.types.ts +17 -0
- package/src/components/back-testing-stepper/steps/input-location/input-location.css +0 -0
- package/src/components/back-testing-stepper/steps/input-location/input-location.tsx +135 -0
- package/src/components/back-testing-stepper/steps/input-location/input-location.types.ts +16 -0
- package/src/components/back-testing-stepper/steps/input-proxy/input-proxy.css +0 -0
- package/src/components/back-testing-stepper/steps/input-proxy/input-proxy.tsx +173 -0
- package/src/components/back-testing-stepper/steps/input-proxy/input-proxy.types.ts +16 -0
- package/src/components/back-testing-stepper/steps/step.types.ts +58 -0
- package/src/components/back-testing-wizard/back-testing-wizard.css +36 -0
- package/src/components/back-testing-wizard/back-testing-wizard.stories.tsx +735 -0
- package/src/components/back-testing-wizard/back-testing-wizard.tsx +103 -0
- package/src/components/back-testing-wizard/back-testing-wizard.types.ts +13 -0
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ interface Payout {
|
|
|
46
46
|
interface BackTestingMapProps {
|
|
47
47
|
mapAccessToken: string;
|
|
48
48
|
apiAccessToken: string;
|
|
49
|
+
env: 'dev' | 'uat' | 'prod';
|
|
49
50
|
location: {
|
|
50
51
|
longitude: number;
|
|
51
52
|
latitude: number;
|
|
@@ -58,11 +59,20 @@ interface BackTestingMapProps {
|
|
|
58
59
|
ciacPayouts?: Payout[];
|
|
59
60
|
includeNoNameStorms?: boolean;
|
|
60
61
|
includeZeroPayouts?: boolean;
|
|
62
|
+
proxyEnabled?: boolean;
|
|
63
|
+
anemometerEnabled?: boolean;
|
|
64
|
+
ciacEnabled?: boolean;
|
|
65
|
+
isCalculatePayoutEnabled?: boolean;
|
|
66
|
+
onCalculatePayoutEnabledChanged?: (e: boolean) => void;
|
|
61
67
|
onViewChange?: (view: MapView) => void;
|
|
68
|
+
stormPayouts: StormPayout[];
|
|
62
69
|
onCalculatePayouts?: (payouts: StormPayout[]) => void;
|
|
70
|
+
onLoad?: (e: React.MutableRefObject<mapboxgl.Map | undefined>) => void;
|
|
71
|
+
appStatus: ('loading' | 'idle');
|
|
72
|
+
onAppStatusChange: (e: 'loading' | 'idle') => void;
|
|
63
73
|
}
|
|
64
74
|
interface BackTestingActions {
|
|
65
|
-
calculatePayouts: (proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNameStorms: boolean, includeZeroPayouts: boolean, limit: number) => void;
|
|
75
|
+
calculatePayouts: (proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNameStorms: boolean, includeZeroPayouts: boolean, limit: number, proxyEnabled: boolean, anemometerEnabled: boolean, ciacEnabled: boolean) => void;
|
|
66
76
|
}
|
|
67
77
|
declare enum MapView {
|
|
68
78
|
CAT_INTENSITY = "__cat_view",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "back-testing-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
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": {
|
|
@@ -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
|
);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Point } from "geojson";
|
|
2
2
|
import { PayoutRequest } from "./back-testing-map.types";
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const DEV_API_ROOT_URI='https://api-dev.nms3939.com'
|
|
5
|
+
const UAT_API_ROOT_URI='https://api-uat.nms3939.com'
|
|
6
|
+
const PROD_API_ROOT_URI='https://api-prod.nms3939.com'
|
|
5
7
|
|
|
6
8
|
export class AppConfig {
|
|
7
9
|
public static readonly endpoints = {
|
|
@@ -61,8 +63,9 @@ export interface PayoutResponse {
|
|
|
61
63
|
payouts: StormPayout[];
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
export const fetchPayouts = async (request: PayoutRequest, apiKey: string) => {
|
|
65
|
-
const
|
|
66
|
+
export const fetchPayouts = async (request: PayoutRequest, apiKey: string, env: 'dev' | 'uat' | 'prod') => {
|
|
67
|
+
const rootURI = selectRootURI(env);
|
|
68
|
+
const url = rootURI + AppConfig.endpoints.backTesting.payouts;
|
|
66
69
|
|
|
67
70
|
const response = await fetch(url, {
|
|
68
71
|
method: "POST",
|
|
@@ -76,4 +79,16 @@ export const fetchPayouts = async (request: PayoutRequest, apiKey: string) => {
|
|
|
76
79
|
const result: PayoutResponse = await response.json();
|
|
77
80
|
return result;
|
|
78
81
|
|
|
79
|
-
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
function selectRootURI( env: 'dev' | 'uat' | 'prod'){
|
|
85
|
+
let rootURI = '';
|
|
86
|
+
if(env == 'dev'){
|
|
87
|
+
rootURI = DEV_API_ROOT_URI;
|
|
88
|
+
} else if (env == 'uat'){
|
|
89
|
+
rootURI = UAT_API_ROOT_URI;
|
|
90
|
+
} else {
|
|
91
|
+
rootURI = PROD_API_ROOT_URI;
|
|
92
|
+
}
|
|
93
|
+
return rootURI;
|
|
94
|
+
}
|
|
@@ -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
|
}
|
|
62
|
-
|
|
61
|
+
props.onAppStatusChange('loading')
|
|
62
|
+
fetchPayouts(request, props.apiAccessToken,props.env).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,14 +472,42 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
|
|
|
467
472
|
|
|
468
473
|
useEffect(() => {
|
|
469
474
|
if(mapLoaded){
|
|
470
|
-
updateStormTracks(
|
|
475
|
+
updateStormTracks(props.stormPayouts,mapView)
|
|
471
476
|
}
|
|
472
|
-
},[mapLoaded,
|
|
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 && props.ciacPayouts && mapInstanceRef){
|
|
477
|
-
|
|
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
513
|
},[props.location, props.limit, props.proxyPayouts, props.anemometerCode, props.anemometerPayouts, props.ciacRadius, props.ciacPayouts, props.ciacRadius, mapInstanceRef, mapLoaded])
|
|
@@ -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={
|
|
530
|
+
{mapView == MapView.STORMS && <BackTestingStormLegend stormTracks={props.stormPayouts}/>}
|
|
498
531
|
<div ref={mapContainerRef} className="map__container" />
|
|
499
532
|
</div>
|
|
500
533
|
);
|
|
@@ -50,6 +50,7 @@ export interface PayoutRequest {
|
|
|
50
50
|
export interface BackTestingMapProps {
|
|
51
51
|
mapAccessToken: string,
|
|
52
52
|
apiAccessToken: string,
|
|
53
|
+
env: 'dev'|'uat'|'prod',
|
|
53
54
|
location: {longitude: number, latitude: number } | undefined | null,
|
|
54
55
|
limit: number | undefined | null,
|
|
55
56
|
ciacRadius: number | undefined | null,
|
|
@@ -59,12 +60,21 @@ export interface BackTestingMapProps {
|
|
|
59
60
|
ciacPayouts?: Payout[],
|
|
60
61
|
includeNoNameStorms?: boolean,
|
|
61
62
|
includeZeroPayouts?: boolean,
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
proxyEnabled?: boolean,
|
|
64
|
+
anemometerEnabled?: boolean,
|
|
65
|
+
ciacEnabled?: boolean,
|
|
66
|
+
isCalculatePayoutEnabled?: boolean,
|
|
67
|
+
onCalculatePayoutEnabledChanged?: (e:boolean) => void,
|
|
68
|
+
onViewChange?: (view: MapView) => void,
|
|
69
|
+
stormPayouts: StormPayout[],
|
|
70
|
+
onCalculatePayouts?: (payouts: StormPayout[]) => void ,
|
|
71
|
+
onLoad?: (e:React.MutableRefObject<mapboxgl.Map | undefined>) => void
|
|
72
|
+
appStatus: ('loading'| 'idle')
|
|
73
|
+
onAppStatusChange: (e: 'loading'| 'idle') => void
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
export interface BackTestingActions {
|
|
67
|
-
calculatePayouts: (proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNameStorms: boolean, includeZeroPayouts: boolean, limit: number) => void,
|
|
77
|
+
calculatePayouts: (proxyPayouts: Payout[], anemometerCode: string, anemometerPayouts: Payout[], ciacPayouts: Payout[], includeNoNameStorms: boolean, includeZeroPayouts: boolean, limit: number, proxyEnabled: boolean, anemometerEnabled: boolean, ciacEnabled: boolean) => void,
|
|
68
78
|
}
|
|
69
79
|
|
|
70
80
|
export enum MapView {
|
|
@@ -141,10 +151,10 @@ export function randomColor(index:number): string {
|
|
|
141
151
|
return `hsla(${hue}, 90%, 60%, 1)`;
|
|
142
152
|
}
|
|
143
153
|
|
|
144
|
-
export function generateProxyRequest(latLng: [number,number], radius: number, payouts: Payout[] | undefined ){
|
|
154
|
+
export function generateProxyRequest(latLng: [number|undefined,number|undefined], radius: number, payouts: Payout[] | undefined, enabled: boolean ){
|
|
145
155
|
let coord = (latLng);
|
|
146
156
|
let proxy : ProxyRequest = {
|
|
147
|
-
enabled:
|
|
157
|
+
enabled:enabled,
|
|
148
158
|
radius: radius,
|
|
149
159
|
latitude: coord[1],
|
|
150
160
|
longitude: coord[0],
|
|
@@ -153,10 +163,10 @@ export function generateProxyRequest(latLng: [number,number], radius: number, pa
|
|
|
153
163
|
return proxy
|
|
154
164
|
}
|
|
155
165
|
|
|
156
|
-
export function generateAnemometerRequest(latLng: [number,number], anemometerCode:string, payouts: Payout[] | undefined){
|
|
166
|
+
export function generateAnemometerRequest(latLng: [number|undefined,number|undefined], anemometerCode:string, payouts: Payout[] | undefined, enabled: boolean){
|
|
157
167
|
let coord = (latLng);
|
|
158
168
|
let anemometer : AnemometerRequest = {
|
|
159
|
-
enabled:
|
|
169
|
+
enabled:enabled,
|
|
160
170
|
code:anemometerCode,
|
|
161
171
|
latitude: coord[1],
|
|
162
172
|
longitude: coord[0],
|
|
@@ -165,10 +175,10 @@ export function generateAnemometerRequest(latLng: [number,number], anemometerCod
|
|
|
165
175
|
return anemometer
|
|
166
176
|
}
|
|
167
177
|
|
|
168
|
-
export function generateCIACRequest(latLng: [number,number], radius: number | undefined, includeNoNameStorms: boolean, payouts: Payout[] | undefined){
|
|
178
|
+
export function generateCIACRequest(latLng: [number|undefined,number|undefined], radius: number | undefined, includeNoNameStorms: boolean, payouts: Payout[] | undefined, enabled: boolean){
|
|
169
179
|
let coord = (latLng);
|
|
170
180
|
let ciac : CIACRequest = {
|
|
171
|
-
enabled:
|
|
181
|
+
enabled:enabled,
|
|
172
182
|
shapes:[{
|
|
173
183
|
type: "__circle",
|
|
174
184
|
latitude: coord[1],
|
|
@@ -179,4 +189,52 @@ export function generateCIACRequest(latLng: [number,number], radius: number | un
|
|
|
179
189
|
payouts: payouts
|
|
180
190
|
}
|
|
181
191
|
return ciac
|
|
182
|
-
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function generateInitialProxyRequest() : ProxyRequest {
|
|
195
|
+
return {
|
|
196
|
+
enabled:true,
|
|
197
|
+
latitude: undefined,
|
|
198
|
+
longitude: undefined,
|
|
199
|
+
radius: 1000,
|
|
200
|
+
payouts: undefined
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function generateInitialAnemometerRequest() : AnemometerRequest {
|
|
205
|
+
return {
|
|
206
|
+
enabled:true,
|
|
207
|
+
code: "",
|
|
208
|
+
latitude: undefined,
|
|
209
|
+
longitude: undefined,
|
|
210
|
+
payouts: undefined
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function generateInitialCIACRequest() : CIACRequest {
|
|
215
|
+
return {
|
|
216
|
+
enabled:true,
|
|
217
|
+
includeNotNamedStorms: false,
|
|
218
|
+
shapes: [
|
|
219
|
+
{
|
|
220
|
+
type: "__circle",
|
|
221
|
+
latitude: undefined,
|
|
222
|
+
longitude: undefined,
|
|
223
|
+
radius: 15
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
payouts: undefined
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export function generateInitialPayoutRequest() : PayoutRequest {
|
|
231
|
+
return {
|
|
232
|
+
limit: 0,
|
|
233
|
+
latitude: undefined,
|
|
234
|
+
longitude: undefined,
|
|
235
|
+
includeZeroPayouts: false,
|
|
236
|
+
proxy: generateInitialProxyRequest(),
|
|
237
|
+
anemometer: generateInitialAnemometerRequest(),
|
|
238
|
+
ciac: generateInitialCIACRequest()
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -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
|
+
}
|