@genspectrum/dashboard-components 0.7.0 → 0.7.1
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/dashboard-components.js +200 -203
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +14 -14
- package/package.json +1 -1
- package/src/preact/aggregatedData/aggregate.tsx +41 -33
- package/src/preact/mutationComparison/mutation-comparison.tsx +32 -34
- package/src/preact/mutations/mutations.tsx +63 -56
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +33 -25
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +46 -64
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +29 -36
- package/standalone-bundle/dashboard-components.js +9689 -9706
- package/standalone-bundle/dashboard-components.js.map +1 -1
|
@@ -23,7 +23,7 @@ import { CsvDownloadButton } from '../components/csv-download-button';
|
|
|
23
23
|
import { ErrorBoundary } from '../components/error-boundary';
|
|
24
24
|
import { ErrorDisplay } from '../components/error-display';
|
|
25
25
|
import { Fullscreen } from '../components/fullscreen';
|
|
26
|
-
import Info from '../components/info';
|
|
26
|
+
import Info, { InfoComponentCode, InfoHeadline1, InfoParagraph } from '../components/info';
|
|
27
27
|
import { LoadingDisplay } from '../components/loading-display';
|
|
28
28
|
import { type DisplayedMutationType, MutationTypeSelector } from '../components/mutation-type-selector';
|
|
29
29
|
import { NoDataDisplay } from '../components/no-data-display';
|
|
@@ -36,7 +36,9 @@ import { useWebWorker } from '../webWorkers/useWebWorker';
|
|
|
36
36
|
|
|
37
37
|
export type View = 'grid';
|
|
38
38
|
|
|
39
|
-
export interface
|
|
39
|
+
export interface MutationsOverTimeProps {
|
|
40
|
+
width: string;
|
|
41
|
+
height: string;
|
|
40
42
|
lapisFilter: LapisFilter;
|
|
41
43
|
sequenceType: SequenceType;
|
|
42
44
|
views: View[];
|
|
@@ -44,31 +46,22 @@ export interface MutationsOverTimeInnerProps {
|
|
|
44
46
|
lapisDateField: string;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
export
|
|
48
|
-
width
|
|
49
|
-
height: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const MutationsOverTime: FunctionComponent<MutationsOverTimeProps> = ({ width, height, ...innerProps }) => {
|
|
49
|
+
export const MutationsOverTime: FunctionComponent<MutationsOverTimeProps> = (componentProps) => {
|
|
50
|
+
const { width, height } = componentProps;
|
|
53
51
|
const size = { height, width };
|
|
54
52
|
|
|
55
53
|
return (
|
|
56
54
|
<ErrorBoundary size={size}>
|
|
57
55
|
<ResizeContainer size={size}>
|
|
58
|
-
<MutationsOverTimeInner {...
|
|
56
|
+
<MutationsOverTimeInner {...componentProps} />
|
|
59
57
|
</ResizeContainer>
|
|
60
58
|
</ErrorBoundary>
|
|
61
59
|
);
|
|
62
60
|
};
|
|
63
61
|
|
|
64
|
-
export const MutationsOverTimeInner: FunctionComponent<
|
|
65
|
-
lapisFilter,
|
|
66
|
-
sequenceType,
|
|
67
|
-
views,
|
|
68
|
-
granularity,
|
|
69
|
-
lapisDateField,
|
|
70
|
-
}) => {
|
|
62
|
+
export const MutationsOverTimeInner: FunctionComponent<MutationsOverTimeProps> = (componentProps) => {
|
|
71
63
|
const lapis = useContext(LapisUrlContext);
|
|
64
|
+
const { lapisFilter, sequenceType, granularity, lapisDateField } = componentProps;
|
|
72
65
|
|
|
73
66
|
const { data, error, isLoading } = useWebWorker<MutationOverTimeQuery, MutationOverTimeWorkerResponse>(
|
|
74
67
|
{
|
|
@@ -99,29 +92,26 @@ export const MutationsOverTimeInner: FunctionComponent<MutationsOverTimeInnerPro
|
|
|
99
92
|
<MutationsOverTimeTabs
|
|
100
93
|
overallMutationData={overallMutationData}
|
|
101
94
|
mutationOverTimeData={mutationOverTimeData}
|
|
102
|
-
|
|
103
|
-
views={views}
|
|
95
|
+
originalComponentProps={componentProps}
|
|
104
96
|
/>
|
|
105
97
|
);
|
|
106
98
|
};
|
|
107
99
|
|
|
108
100
|
type MutationOverTimeTabsProps = {
|
|
109
101
|
mutationOverTimeData: BaseMutationOverTimeDataMap;
|
|
110
|
-
|
|
111
|
-
views: View[];
|
|
102
|
+
originalComponentProps: MutationsOverTimeProps;
|
|
112
103
|
overallMutationData: SubstitutionOrDeletionEntry<Substitution, Deletion>[];
|
|
113
104
|
};
|
|
114
105
|
|
|
115
106
|
const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
116
107
|
mutationOverTimeData,
|
|
117
|
-
|
|
118
|
-
views,
|
|
108
|
+
originalComponentProps,
|
|
119
109
|
overallMutationData,
|
|
120
110
|
}) => {
|
|
121
111
|
const [proportionInterval, setProportionInterval] = useState({ min: 0.05, max: 0.9 });
|
|
122
112
|
const [colorScale, setColorScale] = useState<ColorScale>({ min: 0, max: 1, color: 'indigo' });
|
|
123
113
|
|
|
124
|
-
const [displayedSegments, setDisplayedSegments] = useDisplayedSegments(sequenceType);
|
|
114
|
+
const [displayedSegments, setDisplayedSegments] = useDisplayedSegments(originalComponentProps.sequenceType);
|
|
125
115
|
const [displayedMutationTypes, setDisplayedMutationTypes] = useState<DisplayedMutationType[]>([
|
|
126
116
|
{ label: 'Substitutions', checked: true, type: 'substitution' },
|
|
127
117
|
{ label: 'Deletions', checked: true, type: 'deletion' },
|
|
@@ -153,7 +143,7 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
|
153
143
|
}
|
|
154
144
|
};
|
|
155
145
|
|
|
156
|
-
const tabs = views.map((view) => getTab(view));
|
|
146
|
+
const tabs = originalComponentProps.views.map((view) => getTab(view));
|
|
157
147
|
|
|
158
148
|
const toolbar = (activeTab: string) => (
|
|
159
149
|
<Toolbar
|
|
@@ -167,6 +157,7 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
|
167
157
|
filteredData={filteredData}
|
|
168
158
|
colorScale={colorScale}
|
|
169
159
|
setColorScale={setColorScale}
|
|
160
|
+
originalComponentProps={originalComponentProps}
|
|
170
161
|
/>
|
|
171
162
|
);
|
|
172
163
|
|
|
@@ -184,6 +175,7 @@ type ToolbarProps = {
|
|
|
184
175
|
filteredData: MutationOverTimeDataMap;
|
|
185
176
|
colorScale: ColorScale;
|
|
186
177
|
setColorScale: Dispatch<StateUpdater<ColorScale>>;
|
|
178
|
+
originalComponentProps: MutationsOverTimeProps;
|
|
187
179
|
};
|
|
188
180
|
|
|
189
181
|
const Toolbar: FunctionComponent<ToolbarProps> = ({
|
|
@@ -197,6 +189,7 @@ const Toolbar: FunctionComponent<ToolbarProps> = ({
|
|
|
197
189
|
filteredData,
|
|
198
190
|
colorScale,
|
|
199
191
|
setColorScale,
|
|
192
|
+
originalComponentProps,
|
|
200
193
|
}) => {
|
|
201
194
|
return (
|
|
202
195
|
<>
|
|
@@ -219,12 +212,27 @@ const Toolbar: FunctionComponent<ToolbarProps> = ({
|
|
|
219
212
|
getData={() => getDownloadData(filteredData)}
|
|
220
213
|
filename='mutations_over_time.csv'
|
|
221
214
|
/>
|
|
222
|
-
<
|
|
215
|
+
<MutationsOverTimeInfo originalComponentProps={originalComponentProps} />
|
|
223
216
|
<Fullscreen />
|
|
224
217
|
</>
|
|
225
218
|
);
|
|
226
219
|
};
|
|
227
220
|
|
|
221
|
+
type MutationsOverTimeInfoProps = {
|
|
222
|
+
originalComponentProps: MutationsOverTimeProps;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const MutationsOverTimeInfo: FunctionComponent<MutationsOverTimeInfoProps> = ({ originalComponentProps }) => {
|
|
226
|
+
const lapis = useContext(LapisUrlContext);
|
|
227
|
+
return (
|
|
228
|
+
<Info>
|
|
229
|
+
<InfoHeadline1>Info for mutations over time</InfoHeadline1>
|
|
230
|
+
<InfoParagraph>TODO: https://github.com/GenSpectrum/dashboard-components/issues/441</InfoParagraph>
|
|
231
|
+
<InfoComponentCode componentName='mutations-over-time' params={originalComponentProps} lapisUrl={lapis} />
|
|
232
|
+
</Info>
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
|
|
228
236
|
function getDownloadData(filteredData: MutationOverTimeDataMap) {
|
|
229
237
|
const dates = filteredData.getSecondAxisKeys().map((date) => toTemporalClass(date));
|
|
230
238
|
|
|
@@ -15,7 +15,7 @@ import { CsvDownloadButton } from '../components/csv-download-button';
|
|
|
15
15
|
import { ErrorBoundary } from '../components/error-boundary';
|
|
16
16
|
import { ErrorDisplay } from '../components/error-display';
|
|
17
17
|
import { Fullscreen } from '../components/fullscreen';
|
|
18
|
-
import Info, { InfoHeadline1, InfoParagraph } from '../components/info';
|
|
18
|
+
import Info, { InfoComponentCode, InfoHeadline1, InfoParagraph } from '../components/info';
|
|
19
19
|
import { LoadingDisplay } from '../components/loading-display';
|
|
20
20
|
import { NoDataDisplay } from '../components/no-data-display';
|
|
21
21
|
import { ResizeContainer } from '../components/resize-container';
|
|
@@ -26,12 +26,9 @@ import { useQuery } from '../useQuery';
|
|
|
26
26
|
|
|
27
27
|
type NumberSequencesOverTimeView = 'bar' | 'line' | 'table';
|
|
28
28
|
|
|
29
|
-
export interface NumberSequencesOverTimeProps
|
|
29
|
+
export interface NumberSequencesOverTimeProps {
|
|
30
30
|
width: string;
|
|
31
31
|
height: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface NumberSequencesOverTimeInnerProps {
|
|
35
32
|
lapisFilter: NamedLapisFilter | NamedLapisFilter[];
|
|
36
33
|
lapisDateField: string;
|
|
37
34
|
views: NumberSequencesOverTimeView[];
|
|
@@ -40,26 +37,21 @@ interface NumberSequencesOverTimeInnerProps {
|
|
|
40
37
|
pageSize: boolean | number;
|
|
41
38
|
}
|
|
42
39
|
|
|
43
|
-
export const NumberSequencesOverTime = (
|
|
40
|
+
export const NumberSequencesOverTime = (componentProps: NumberSequencesOverTimeProps) => {
|
|
41
|
+
const { width, height } = componentProps;
|
|
44
42
|
const size = { height, width };
|
|
45
43
|
|
|
46
44
|
return (
|
|
47
45
|
<ErrorBoundary size={size}>
|
|
48
46
|
<ResizeContainer size={size}>
|
|
49
|
-
<NumberSequencesOverTimeInner {...
|
|
47
|
+
<NumberSequencesOverTimeInner {...componentProps} />
|
|
50
48
|
</ResizeContainer>
|
|
51
49
|
</ErrorBoundary>
|
|
52
50
|
);
|
|
53
51
|
};
|
|
54
52
|
|
|
55
|
-
const NumberSequencesOverTimeInner = ({
|
|
56
|
-
lapisFilter,
|
|
57
|
-
granularity,
|
|
58
|
-
smoothingWindow,
|
|
59
|
-
lapisDateField,
|
|
60
|
-
views,
|
|
61
|
-
pageSize,
|
|
62
|
-
}: NumberSequencesOverTimeInnerProps) => {
|
|
53
|
+
const NumberSequencesOverTimeInner = (componentProps: NumberSequencesOverTimeProps) => {
|
|
54
|
+
const { lapisFilter, lapisDateField, granularity, smoothingWindow } = componentProps;
|
|
63
55
|
const lapis = useContext(LapisUrlContext);
|
|
64
56
|
|
|
65
57
|
const { data, error, isLoading } = useQuery(
|
|
@@ -79,32 +71,15 @@ const NumberSequencesOverTimeInner = ({
|
|
|
79
71
|
return <NoDataDisplay />;
|
|
80
72
|
}
|
|
81
73
|
|
|
82
|
-
return
|
|
83
|
-
<NumberSequencesOverTimeTabs
|
|
84
|
-
views={views}
|
|
85
|
-
data={data}
|
|
86
|
-
granularity={granularity}
|
|
87
|
-
smoothingWindow={smoothingWindow}
|
|
88
|
-
pageSize={pageSize}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
74
|
+
return <NumberSequencesOverTimeTabs data={data} originalComponentProps={componentProps} />;
|
|
91
75
|
};
|
|
92
76
|
|
|
93
77
|
interface NumberSequencesOverTimeTabsProps {
|
|
94
|
-
views: NumberSequencesOverTimeView[];
|
|
95
78
|
data: NumberOfSequencesDatasets;
|
|
96
|
-
|
|
97
|
-
smoothingWindow: number;
|
|
98
|
-
pageSize: boolean | number;
|
|
79
|
+
originalComponentProps: NumberSequencesOverTimeProps;
|
|
99
80
|
}
|
|
100
81
|
|
|
101
|
-
const NumberSequencesOverTimeTabs = ({
|
|
102
|
-
views,
|
|
103
|
-
data,
|
|
104
|
-
granularity,
|
|
105
|
-
smoothingWindow,
|
|
106
|
-
pageSize,
|
|
107
|
-
}: NumberSequencesOverTimeTabsProps) => {
|
|
82
|
+
const NumberSequencesOverTimeTabs = ({ data, originalComponentProps }: NumberSequencesOverTimeTabsProps) => {
|
|
108
83
|
const [yAxisScaleType, setYAxisScaleType] = useState<ScaleType>('linear');
|
|
109
84
|
|
|
110
85
|
const getTab = (view: NumberSequencesOverTimeView) => {
|
|
@@ -122,7 +97,13 @@ const NumberSequencesOverTimeTabs = ({
|
|
|
122
97
|
case 'table':
|
|
123
98
|
return {
|
|
124
99
|
title: 'Table',
|
|
125
|
-
content:
|
|
100
|
+
content: (
|
|
101
|
+
<NumberSequencesOverTimeTable
|
|
102
|
+
data={data}
|
|
103
|
+
granularity={originalComponentProps.granularity}
|
|
104
|
+
pageSize={originalComponentProps.pageSize}
|
|
105
|
+
/>
|
|
106
|
+
),
|
|
126
107
|
};
|
|
127
108
|
default:
|
|
128
109
|
throw new Error(`Unknown view: ${view}`);
|
|
@@ -131,15 +112,14 @@ const NumberSequencesOverTimeTabs = ({
|
|
|
131
112
|
|
|
132
113
|
return (
|
|
133
114
|
<Tabs
|
|
134
|
-
tabs={views.map((view) => getTab(view))}
|
|
115
|
+
tabs={originalComponentProps.views.map((view) => getTab(view))}
|
|
135
116
|
toolbar={(activeTab) => (
|
|
136
117
|
<Toolbar
|
|
137
118
|
activeTab={activeTab}
|
|
138
119
|
data={data}
|
|
139
|
-
granularity={granularity}
|
|
140
|
-
smoothingWindow={smoothingWindow}
|
|
141
120
|
yAxisScaleType={yAxisScaleType}
|
|
142
121
|
setYAxisScaleType={setYAxisScaleType}
|
|
122
|
+
originalComponentProps={originalComponentProps}
|
|
143
123
|
/>
|
|
144
124
|
)}
|
|
145
125
|
/>
|
|
@@ -149,20 +129,12 @@ const NumberSequencesOverTimeTabs = ({
|
|
|
149
129
|
interface ToolbarProps {
|
|
150
130
|
activeTab: string;
|
|
151
131
|
data: NumberOfSequencesDatasets;
|
|
152
|
-
granularity: TemporalGranularity;
|
|
153
132
|
yAxisScaleType: ScaleType;
|
|
154
133
|
setYAxisScaleType: (scaleType: ScaleType) => void;
|
|
155
|
-
|
|
134
|
+
originalComponentProps: NumberSequencesOverTimeProps;
|
|
156
135
|
}
|
|
157
136
|
|
|
158
|
-
const Toolbar = ({
|
|
159
|
-
activeTab,
|
|
160
|
-
data,
|
|
161
|
-
granularity,
|
|
162
|
-
yAxisScaleType,
|
|
163
|
-
setYAxisScaleType,
|
|
164
|
-
smoothingWindow,
|
|
165
|
-
}: ToolbarProps) => {
|
|
137
|
+
const Toolbar = ({ activeTab, data, yAxisScaleType, setYAxisScaleType, originalComponentProps }: ToolbarProps) => {
|
|
166
138
|
return (
|
|
167
139
|
<>
|
|
168
140
|
{activeTab !== 'Table' && (
|
|
@@ -174,29 +146,39 @@ const Toolbar = ({
|
|
|
174
146
|
)}
|
|
175
147
|
<CsvDownloadButton
|
|
176
148
|
className='mx-1 btn btn-xs'
|
|
177
|
-
getData={() => getNumberOfSequencesOverTimeTableData(data, granularity)}
|
|
149
|
+
getData={() => getNumberOfSequencesOverTimeTableData(data, originalComponentProps.granularity)}
|
|
178
150
|
filename='number_of_sequences_over_time.csv'
|
|
179
151
|
/>
|
|
180
|
-
<NumberSequencesOverTimeInfo
|
|
152
|
+
<NumberSequencesOverTimeInfo originalComponentProps={originalComponentProps} />
|
|
181
153
|
<Fullscreen />
|
|
182
154
|
</>
|
|
183
155
|
);
|
|
184
156
|
};
|
|
185
157
|
|
|
186
158
|
type NumberSequencesOverTimeInfoProps = {
|
|
187
|
-
|
|
188
|
-
smoothingWindow: number;
|
|
159
|
+
originalComponentProps: NumberSequencesOverTimeProps;
|
|
189
160
|
};
|
|
190
161
|
|
|
191
162
|
const NumberSequencesOverTimeInfo: FunctionComponent<NumberSequencesOverTimeInfoProps> = ({
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
163
|
+
originalComponentProps,
|
|
164
|
+
}) => {
|
|
165
|
+
const lapis = useContext(LapisUrlContext);
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<Info>
|
|
169
|
+
<InfoHeadline1>Number of sequences over time</InfoHeadline1>
|
|
170
|
+
<InfoParagraph>
|
|
171
|
+
This presents the number of available sequences of a variant per{' '}
|
|
172
|
+
<b>{originalComponentProps.granularity}</b>
|
|
173
|
+
{originalComponentProps.smoothingWindow > 0 &&
|
|
174
|
+
`, smoothed using a ${originalComponentProps.smoothingWindow}-${originalComponentProps.granularity} sliding window`}
|
|
175
|
+
.
|
|
176
|
+
</InfoParagraph>
|
|
177
|
+
<InfoComponentCode
|
|
178
|
+
componentName='number-sequences-over-time'
|
|
179
|
+
params={originalComponentProps}
|
|
180
|
+
lapisUrl={lapis}
|
|
181
|
+
/>
|
|
182
|
+
</Info>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
@@ -11,7 +11,7 @@ import { LapisUrlContext } from '../LapisUrlContext';
|
|
|
11
11
|
import { ErrorBoundary } from '../components/error-boundary';
|
|
12
12
|
import { ErrorDisplay } from '../components/error-display';
|
|
13
13
|
import { Fullscreen } from '../components/fullscreen';
|
|
14
|
-
import Info, { InfoHeadline1, InfoHeadline2, InfoLink, InfoParagraph } from '../components/info';
|
|
14
|
+
import Info, { InfoComponentCode, InfoHeadline1, InfoHeadline2, InfoLink, InfoParagraph } from '../components/info';
|
|
15
15
|
import { LoadingDisplay } from '../components/loading-display';
|
|
16
16
|
import { NoDataDisplay } from '../components/no-data-display';
|
|
17
17
|
import { ResizeContainer } from '../components/resize-container';
|
|
@@ -23,12 +23,9 @@ import { useQuery } from '../useQuery';
|
|
|
23
23
|
|
|
24
24
|
export type View = 'line';
|
|
25
25
|
|
|
26
|
-
export interface RelativeGrowthAdvantageProps
|
|
26
|
+
export interface RelativeGrowthAdvantageProps {
|
|
27
27
|
width: string;
|
|
28
28
|
height: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface RelativeGrowthAdvantagePropsInner {
|
|
32
29
|
numeratorFilter: LapisFilter;
|
|
33
30
|
denominatorFilter: LapisFilter;
|
|
34
31
|
generationTime: number;
|
|
@@ -37,36 +34,28 @@ export interface RelativeGrowthAdvantagePropsInner {
|
|
|
37
34
|
yAxisMaxConfig: YAxisMaxConfig;
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
export const RelativeGrowthAdvantage: FunctionComponent<RelativeGrowthAdvantageProps> = ({
|
|
41
|
-
width,
|
|
42
|
-
height,
|
|
43
|
-
...innerProps
|
|
44
|
-
}) => {
|
|
37
|
+
export const RelativeGrowthAdvantage: FunctionComponent<RelativeGrowthAdvantageProps> = (componentProps) => {
|
|
38
|
+
const { width, height } = componentProps;
|
|
45
39
|
const size = { height, width };
|
|
46
40
|
|
|
47
41
|
return (
|
|
48
42
|
<ErrorBoundary size={size}>
|
|
49
43
|
<ResizeContainer size={size}>
|
|
50
|
-
<RelativeGrowthAdvantageInner {...
|
|
44
|
+
<RelativeGrowthAdvantageInner {...componentProps} />
|
|
51
45
|
</ResizeContainer>
|
|
52
46
|
</ErrorBoundary>
|
|
53
47
|
);
|
|
54
48
|
};
|
|
55
49
|
|
|
56
|
-
export const RelativeGrowthAdvantageInner: FunctionComponent<
|
|
57
|
-
numeratorFilter,
|
|
58
|
-
denominatorFilter,
|
|
59
|
-
generationTime,
|
|
60
|
-
views,
|
|
61
|
-
lapisDateField,
|
|
62
|
-
yAxisMaxConfig,
|
|
63
|
-
}) => {
|
|
50
|
+
export const RelativeGrowthAdvantageInner: FunctionComponent<RelativeGrowthAdvantageProps> = (componentProps) => {
|
|
64
51
|
const lapis = useContext(LapisUrlContext);
|
|
52
|
+
const { numeratorFilter, denominatorFilter, generationTime, lapisDateField } = componentProps;
|
|
53
|
+
|
|
65
54
|
const [yAxisScaleType, setYAxisScaleType] = useState<ScaleType>('linear');
|
|
66
55
|
|
|
67
56
|
const { data, error, isLoading } = useQuery(
|
|
68
57
|
() => queryRelativeGrowthAdvantage(numeratorFilter, denominatorFilter, generationTime, lapis, lapisDateField),
|
|
69
|
-
[lapis, numeratorFilter, denominatorFilter, generationTime,
|
|
58
|
+
[lapis, numeratorFilter, denominatorFilter, generationTime, lapisDateField],
|
|
70
59
|
);
|
|
71
60
|
|
|
72
61
|
if (isLoading) {
|
|
@@ -86,9 +75,7 @@ export const RelativeGrowthAdvantageInner: FunctionComponent<RelativeGrowthAdvan
|
|
|
86
75
|
data={data}
|
|
87
76
|
yAxisScaleType={yAxisScaleType}
|
|
88
77
|
setYAxisScaleType={setYAxisScaleType}
|
|
89
|
-
|
|
90
|
-
generationTime={generationTime}
|
|
91
|
-
yAxisMaxConfig={yAxisMaxConfig}
|
|
78
|
+
originalComponentProps={componentProps}
|
|
92
79
|
/>
|
|
93
80
|
);
|
|
94
81
|
};
|
|
@@ -97,18 +84,14 @@ type RelativeGrowthAdvantageTabsProps = {
|
|
|
97
84
|
data: NonNullable<RelativeGrowthAdvantageData>;
|
|
98
85
|
yAxisScaleType: ScaleType;
|
|
99
86
|
setYAxisScaleType: (scaleType: ScaleType) => void;
|
|
100
|
-
|
|
101
|
-
generationTime: number;
|
|
102
|
-
yAxisMaxConfig: YAxisMaxConfig;
|
|
87
|
+
originalComponentProps: RelativeGrowthAdvantageProps;
|
|
103
88
|
};
|
|
104
89
|
|
|
105
90
|
const RelativeGrowthAdvantageTabs: FunctionComponent<RelativeGrowthAdvantageTabsProps> = ({
|
|
106
91
|
data,
|
|
107
92
|
yAxisScaleType,
|
|
108
93
|
setYAxisScaleType,
|
|
109
|
-
|
|
110
|
-
generationTime,
|
|
111
|
-
yAxisMaxConfig,
|
|
94
|
+
originalComponentProps,
|
|
112
95
|
}) => {
|
|
113
96
|
const getTab = (view: View) => {
|
|
114
97
|
switch (view) {
|
|
@@ -123,17 +106,17 @@ const RelativeGrowthAdvantageTabs: FunctionComponent<RelativeGrowthAdvantageTabs
|
|
|
123
106
|
params: data.params,
|
|
124
107
|
}}
|
|
125
108
|
yAxisScaleType={yAxisScaleType}
|
|
126
|
-
yAxisMaxConfig={yAxisMaxConfig}
|
|
109
|
+
yAxisMaxConfig={originalComponentProps.yAxisMaxConfig}
|
|
127
110
|
/>
|
|
128
111
|
),
|
|
129
112
|
};
|
|
130
113
|
}
|
|
131
114
|
};
|
|
132
115
|
|
|
133
|
-
const tabs = views.map((view) => getTab(view));
|
|
116
|
+
const tabs = originalComponentProps.views.map((view) => getTab(view));
|
|
134
117
|
const toolbar = () => (
|
|
135
118
|
<RelativeGrowthAdvantageToolbar
|
|
136
|
-
|
|
119
|
+
originalComponentProps={originalComponentProps}
|
|
137
120
|
yAxisScaleType={yAxisScaleType}
|
|
138
121
|
setYAxisScaleType={setYAxisScaleType}
|
|
139
122
|
/>
|
|
@@ -145,24 +128,29 @@ const RelativeGrowthAdvantageTabs: FunctionComponent<RelativeGrowthAdvantageTabs
|
|
|
145
128
|
type RelativeGrowthAdvantageToolbarProps = {
|
|
146
129
|
yAxisScaleType: ScaleType;
|
|
147
130
|
setYAxisScaleType: (scaleType: ScaleType) => void;
|
|
148
|
-
|
|
131
|
+
originalComponentProps: RelativeGrowthAdvantageProps;
|
|
149
132
|
};
|
|
150
133
|
|
|
151
134
|
const RelativeGrowthAdvantageToolbar: FunctionComponent<RelativeGrowthAdvantageToolbarProps> = ({
|
|
152
135
|
yAxisScaleType,
|
|
153
136
|
setYAxisScaleType,
|
|
154
|
-
|
|
137
|
+
originalComponentProps,
|
|
155
138
|
}) => {
|
|
156
139
|
return (
|
|
157
140
|
<>
|
|
158
141
|
<ScalingSelector yAxisScaleType={yAxisScaleType} setYAxisScaleType={setYAxisScaleType} />
|
|
159
|
-
<RelativeGrowthAdvantageInfo
|
|
142
|
+
<RelativeGrowthAdvantageInfo originalComponentProps={originalComponentProps} />
|
|
160
143
|
<Fullscreen />
|
|
161
144
|
</>
|
|
162
145
|
);
|
|
163
146
|
};
|
|
164
147
|
|
|
165
|
-
const RelativeGrowthAdvantageInfo: FunctionComponent<{
|
|
148
|
+
const RelativeGrowthAdvantageInfo: FunctionComponent<{ originalComponentProps: RelativeGrowthAdvantageProps }> = ({
|
|
149
|
+
originalComponentProps,
|
|
150
|
+
}) => {
|
|
151
|
+
const lapis = useContext(LapisUrlContext);
|
|
152
|
+
const generationTime = originalComponentProps.generationTime;
|
|
153
|
+
|
|
166
154
|
return (
|
|
167
155
|
<Info>
|
|
168
156
|
<InfoHeadline1>Relative growth advantage</InfoHeadline1>
|
|
@@ -193,6 +181,11 @@ const RelativeGrowthAdvantageInfo: FunctionComponent<{ generationTime: number }>
|
|
|
193
181
|
10.1016/j.epidem.2021.100480
|
|
194
182
|
</InfoLink>
|
|
195
183
|
</InfoParagraph>
|
|
184
|
+
<InfoComponentCode
|
|
185
|
+
componentName='relative-growth-advantage'
|
|
186
|
+
params={originalComponentProps}
|
|
187
|
+
lapisUrl={lapis}
|
|
188
|
+
/>
|
|
196
189
|
</Info>
|
|
197
190
|
);
|
|
198
191
|
};
|