-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathCollection.jsx
More file actions
59 lines (54 loc) · 2.45 KB
/
Collection.jsx
File metadata and controls
59 lines (54 loc) · 2.45 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
56
57
58
59
import React, { useState } from 'react';
import { Link, useLocation, useNavigate, useParams } from 'react-router-dom';
import { Typography, Grid, Tabs, Tab } from '@mui/material';
import { CenteredFrame } from '../components/Common/CenteredFrame';
import Box from '@mui/material/Box';
import { SnapshotsTab } from '../components/Snapshots/SnapshotsTab';
import CollectionInfo from '../components/Collections/CollectionInfo';
import PointsTabs from '../components/Points/PointsTabs';
import SearchQuality from '../components/Collections/SearchQuality/SearchQuality';
import { useClient } from '../context/client-context';
function Collection() {
const { collectionName } = useParams();
const navigate = useNavigate();
const location = useLocation();
const [currentTab, setCurrentTab] = useState(location.hash.slice(1) || 'points');
const { isRestricted } = useClient();
const handleTabChange = (event, newValue) => {
if (typeof newValue !== 'string') {
return;
}
setCurrentTab(newValue);
navigate(`#${newValue}`);
};
return (
<>
<CenteredFrame>
<Grid container maxWidth={'xl'} spacing={3}>
<Grid xs={12} item>
<Typography variant="h4">{collectionName}</Typography>
</Grid>
<Grid xs={12} item>
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
<Tabs value={currentTab} onChange={handleTabChange} aria-label="basic tabs example">
<Tab label="Points" value={'points'} />
<Tab label="Info" value={'info'} />
{!isRestricted && <Tab label="Search Quality" value={'quality'} />}
{!isRestricted && <Tab label="Snapshots" value={'snapshots'} />}
<Tab label="Visualize" component={Link} to={`${location.pathname}/visualize`} />
<Tab label="Graph" component={Link} to={`${location.pathname}/graph`} />
</Tabs>
</Box>
</Grid>
<Grid xs={12} item>
{currentTab === 'info' && <CollectionInfo collectionName={collectionName} />}
{!isRestricted && currentTab === 'quality' && <SearchQuality collectionName={collectionName} />}
{currentTab === 'points' && <PointsTabs collectionName={collectionName} />}
{!isRestricted && currentTab === 'snapshots' && <SnapshotsTab collectionName={collectionName} />}
</Grid>
</Grid>
</CenteredFrame>
</>
);
}
export default Collection;