-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGsSequencesByLocation.tsx
More file actions
55 lines (51 loc) · 1.93 KB
/
Copy pathGsSequencesByLocation.tsx
File metadata and controls
55 lines (51 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { type LapisFilter } from '@genspectrum/dashboard-components/util';
import type { FC } from 'react';
import { getSequencesByLocationMapData } from '../../util/getSequencesByLocationMapData';
import { defaultTablePageSize } from '../../views/View';
import { ComponentWrapper } from '../ComponentWrapper.tsx';
export type GsSequencesByLocationProps = {
title: string;
lapisLocationField: string;
lapisFilter: LapisFilter;
height?: string;
mapName?: string;
pageSize?: number;
};
export const GsSequencesByLocation: FC<GsSequencesByLocationProps> = ({
title,
height,
lapisLocationField,
lapisFilter,
mapName,
pageSize,
}) => {
const mapData = getSequencesByLocationMapData(mapName, window.location.href);
return (
<ComponentWrapper title={title} height={height}>
{mapData === undefined ? (
<gs-sequences-by-location
lapisLocationField={lapisLocationField}
lapisFilter={JSON.stringify(lapisFilter)}
pageSize={pageSize ?? defaultTablePageSize}
views={JSON.stringify(['table'])}
width='100%'
height={height ? '100%' : undefined}
/>
) : (
<gs-sequences-by-location
lapisLocationField={lapisLocationField}
lapisFilter={JSON.stringify(lapisFilter)}
pageSize={pageSize ?? defaultTablePageSize}
views={JSON.stringify(['map', 'table'])}
mapSource={JSON.stringify(mapData.mapSource)}
width='100%'
height={height ? '100%' : undefined}
zoom={mapData.zoom}
offsetX={mapData.offsetX}
offsetY={mapData.offsetY}
enableMapNavigation
/>
)}
</ComponentWrapper>
);
};