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.
- package/dist/cjs/index.js +17 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +17 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +35 -10
- 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 +21 -5
- package/src/components/back-testing-map/back-testing-map.tsx +51 -18
- package/src/components/back-testing-map/back-testing-map.types.ts +74 -11
- 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-storm-legend/back-testing-storm-legend.stories.tsx +56 -33
- package/src/components/back-testing-wizard/back-testing-wizard.css +36 -0
- package/src/components/back-testing-wizard/back-testing-wizard.stories.tsx +734 -0
- package/src/components/back-testing-wizard/back-testing-wizard.tsx +102 -0
- package/src/components/back-testing-wizard/back-testing-wizard.types.ts +12 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import "./back-testing-wizard.css"
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { BackTestingMap } from "../back-testing-map";
|
|
5
|
+
import { generateInitialPayoutRequest, PayoutRequest } from "../back-testing-map/back-testing-map.types";
|
|
6
|
+
import BackTestingStepper from "../back-testing-stepper/back-testing-stepper";
|
|
7
|
+
import { BackTestingWizardProps } from "./back-testing-wizard.types";
|
|
8
|
+
import { StormPayout } from "../back-testing-map/back-testing-map.service";
|
|
9
|
+
import { PayoutWizardStepType, RadioChoice } from "../back-testing-stepper/steps/step.types";
|
|
10
|
+
|
|
11
|
+
function BackTestingWizard(props: BackTestingWizardProps){
|
|
12
|
+
|
|
13
|
+
const [payoutRequest, setPayoutRequest] = React.useState(generateInitialPayoutRequest());
|
|
14
|
+
const [stormPayouts, setStormPayouts] = React.useState<StormPayout[]>([])
|
|
15
|
+
const [mapInstanceRef, setMapInstanceRef] = React.useState<React.MutableRefObject<mapboxgl.Map | undefined>>();
|
|
16
|
+
|
|
17
|
+
const [wizardStep, setWizardStep] = React.useState<PayoutWizardStepType>(PayoutWizardStepType.INPUT_LOCATION);
|
|
18
|
+
const [proxyChoice, setProxyChoice] = React.useState<RadioChoice>(RadioChoice.DEFAULT);
|
|
19
|
+
const [anemometerChoice, setAnemometerChoice] = React.useState<RadioChoice>(RadioChoice.DEFAULT);
|
|
20
|
+
const [ciacChoice, setCIACChoice] = React.useState<RadioChoice>(RadioChoice.DEFAULT);
|
|
21
|
+
const [selectedProxyPayoutOption, setProxyPayoutOption] = React.useState<number>(props.selectedProxyPayoutOptionIndex);
|
|
22
|
+
const [selectedAnemometerPayoutOption, setAnemometerPayoutOption] = React.useState<number>(props.selectedAnemometerPayoutOptionIndex);
|
|
23
|
+
const [selectedCIACPayoutOption, setCIACPayoutOption] = React.useState<number>(props.selectedCIACPayoutOptionIndex);
|
|
24
|
+
const [isCalculatePayoutsEnabled, setCalculatePayoutsEnabled] = React.useState<boolean>(false);
|
|
25
|
+
const [appStatus, setAppStatus] = React.useState<'loading'|'idle'>('idle');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const handlePayoutRequestChange = (e: PayoutRequest) => {
|
|
29
|
+
setPayoutRequest(e);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const handleStormPayoutsChange = (e:StormPayout[]) => {
|
|
33
|
+
setStormPayouts(e);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="wizard-container">
|
|
38
|
+
<aside className="side-panel">
|
|
39
|
+
{props.apiAccessToken && mapInstanceRef && mapInstanceRef.current &&
|
|
40
|
+
<BackTestingStepper
|
|
41
|
+
mapAccessToken={props.mapAccessToken}
|
|
42
|
+
apiKey={props.apiAccessToken}
|
|
43
|
+
mapInstanceRef={mapInstanceRef}
|
|
44
|
+
payoutRequest={payoutRequest}
|
|
45
|
+
onPayoutRequestChange={handlePayoutRequestChange}
|
|
46
|
+
stormPayouts={stormPayouts}
|
|
47
|
+
currentStep={wizardStep}
|
|
48
|
+
onCurrentStepChange={setWizardStep}
|
|
49
|
+
proxyChoice={proxyChoice}
|
|
50
|
+
onProxyChoiceChange={setProxyChoice}
|
|
51
|
+
anemometerChoice={anemometerChoice}
|
|
52
|
+
onAnemometerChoiceChange={setAnemometerChoice}
|
|
53
|
+
ciacChoice={ciacChoice}
|
|
54
|
+
onCIACChoiceChange={setCIACChoice}
|
|
55
|
+
proxyPayoutOptions={props.proxyPayoutOptions}
|
|
56
|
+
anemometerPayoutOptions={props.anemometerPayoutOptions}
|
|
57
|
+
ciacPayoutOptions={props.ciacPayoutOptions}
|
|
58
|
+
selectedProxyPayoutOptionIndex={selectedProxyPayoutOption}
|
|
59
|
+
selectedAnemometerPayoutOptionIndex={selectedAnemometerPayoutOption}
|
|
60
|
+
selectedCIACPayoutOptionIndex={selectedCIACPayoutOption}
|
|
61
|
+
onProxyPayoutOptionChange={setProxyPayoutOption}
|
|
62
|
+
onAnemometerPayoutOptionChange={setAnemometerPayoutOption}
|
|
63
|
+
onCIACPayoutOptionChange={setCIACPayoutOption}
|
|
64
|
+
onStormPayoutsChanged={setStormPayouts}
|
|
65
|
+
onCalculatePayoutEnabledChanged={setCalculatePayoutsEnabled}
|
|
66
|
+
appStatus={appStatus}
|
|
67
|
+
>
|
|
68
|
+
</BackTestingStepper>
|
|
69
|
+
}
|
|
70
|
+
</aside>
|
|
71
|
+
<section className="main-panel">
|
|
72
|
+
{props.apiAccessToken &&
|
|
73
|
+
<BackTestingMap
|
|
74
|
+
apiAccessToken={props.apiAccessToken}
|
|
75
|
+
mapAccessToken={props.mapAccessToken}
|
|
76
|
+
appStatus={appStatus}
|
|
77
|
+
onAppStatusChange={setAppStatus}
|
|
78
|
+
location={payoutRequest.longitude && payoutRequest.latitude ? {longitude: payoutRequest.longitude, latitude:payoutRequest.latitude} : undefined}
|
|
79
|
+
ciacRadius={payoutRequest.ciac.shapes[0].radius}
|
|
80
|
+
anemometerCode={payoutRequest.anemometer.code}
|
|
81
|
+
proxyPayouts={payoutRequest.proxy.payouts}
|
|
82
|
+
anemometerPayouts={payoutRequest.anemometer.payouts}
|
|
83
|
+
stormPayouts={stormPayouts}
|
|
84
|
+
ciacPayouts={payoutRequest.ciac.payouts}
|
|
85
|
+
proxyEnabled={payoutRequest.proxy.enabled}
|
|
86
|
+
anemometerEnabled={payoutRequest.anemometer.enabled}
|
|
87
|
+
ciacEnabled={payoutRequest.ciac.enabled}
|
|
88
|
+
includeNoNameStorms={payoutRequest.ciac.includeNotNamedStorms}
|
|
89
|
+
includeZeroPayouts={payoutRequest.includeZeroPayouts}
|
|
90
|
+
limit={payoutRequest.limit}
|
|
91
|
+
isCalculatePayoutEnabled={isCalculatePayoutsEnabled}
|
|
92
|
+
onCalculatePayouts={(e:StormPayout[]) => {handleStormPayoutsChange(e)}}
|
|
93
|
+
onCalculatePayoutEnabledChanged={setCalculatePayoutsEnabled}
|
|
94
|
+
onLoad={(e:React.MutableRefObject<mapboxgl.Map | undefined>) => setMapInstanceRef(e)}>
|
|
95
|
+
</BackTestingMap>
|
|
96
|
+
}
|
|
97
|
+
</section>
|
|
98
|
+
</div>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export default BackTestingWizard
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Payout } from "../back-testing-map/back-testing-map.types";
|
|
2
|
+
|
|
3
|
+
export interface BackTestingWizardProps {
|
|
4
|
+
apiAccessToken:string,
|
|
5
|
+
mapAccessToken:string,
|
|
6
|
+
selectedProxyPayoutOptionIndex:number;
|
|
7
|
+
proxyPayoutOptions: {key:string,value: Payout[]}[],
|
|
8
|
+
selectedAnemometerPayoutOptionIndex:number;
|
|
9
|
+
anemometerPayoutOptions: {key:string,value: Payout[]}[],
|
|
10
|
+
selectedCIACPayoutOptionIndex:number;
|
|
11
|
+
ciacPayoutOptions: {key:string,value: Payout[]}[],
|
|
12
|
+
}
|