Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environmental variables & sampling methods to standards page #1325

Merged
merged 27 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c7b17b7
initial commit from transferring otu of method-standards
LouisThedroux Jul 18, 2024
46e1f10
quick div to box fix for header not showing
LouisThedroux Jul 18, 2024
5327db5
Moving components around based off of Mac's suggestions.
LouisThedroux Jul 18, 2024
1be615f
update standards page layout
mauberti-bc Jul 24, 2024
02fb583
mock method data
mauberti-bc Jul 24, 2024
bfc3798
merge dev
mauberti-bc Jul 24, 2024
3521fbb
environment standards
mauberti-bc Jul 25, 2024
a6df334
Merge branch 'dev' of github.com:bcgov/biohubbc into double-standards
mauberti-bc Jul 25, 2024
ff84b21
add backend tests
mauberti-bc Jul 25, 2024
01232a4
replace getApiUserDBConnection with getDBConnection temporarily
mauberti-bc Jul 25, 2024
b4747da
lots of changes, MethodStandards Card and results, API path, sessions…
LouisThedroux Jul 31, 2024
00cf5fa
formatting, fixing SQL, adding unit chip
LouisThedroux Aug 1, 2024
66855f3
some fies to font, color, chevrons, chip etc
LouisThedroux Aug 2, 2024
aabd1e3
simplify standard cards
mauberti-bc Aug 6, 2024
bd4b2c8
Merge branch 'dev' into double-standards
mauberti-bc Aug 6, 2024
e74c10a
write tests
mauberti-bc Aug 6, 2024
9303735
Merge branch 'double-standards' of github.com:bcgov/biohubbc into dou…
mauberti-bc Aug 6, 2024
34eea75
species standards loading state
mauberti-bc Aug 6, 2024
5f39c35
fix missing keys
mauberti-bc Aug 6, 2024
dcc2676
shade of grey
mauberti-bc Aug 6, 2024
36db879
Merge branch 'dev' into double-standards
MacQSL Aug 7, 2024
cfafec3
ignore-skip
MacQSL Aug 7, 2024
25a20ba
fix: removed bad import from merge conflict
MacQSL Aug 7, 2024
253ef45
remove security from standards endpoints & address PR comments
mauberti-bc Aug 8, 2024
2d8f3a4
Merge branch 'dev' into double-standards
mauberti-bc Aug 10, 2024
c07bced
Merge branch 'dev' into double-standards
mauberti-bc Aug 15, 2024
86f9a2e
Merge branch 'dev' into double-standards
mauberti-bc Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/src/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import FundingSourcesRouter from 'features/funding-sources/FundingSourcesRouter'
import ProjectsRouter from 'features/projects/ProjectsRouter';
import ResourcesPage from 'features/resources/ResourcesPage';
import SpeciesStandardsPage from 'features/standards/SpeciesStandardsPage';
import DoubleStandardsPage from 'features/standards/DoubleStandardsPage';
import BaseLayout from 'layouts/BaseLayout';
import AccessDenied from 'pages/403/AccessDenied';
import NotFoundPage from 'pages/404/NotFoundPage';
Expand Down Expand Up @@ -105,6 +106,12 @@ const AppRouter: React.FC = () => {
</BaseLayout>
</RouteWithTitle>

<RouteWithTitle path="/doublestandards" title={getTitle('Double Standards')}>
<BaseLayout>
<DoubleStandardsPage />
</BaseLayout>
</RouteWithTitle>

<RouteWithTitle title={getTitle()} path="/">
<LandingPage />
</RouteWithTitle>
Expand Down
104 changes: 104 additions & 0 deletions app/src/features/standards/DoubleStandardsPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { Box, Container, Paper, ToggleButton, ToggleButtonGroup, Toolbar, Typography } from '@mui/material';
import { styled } from '@mui/system';
import PageHeader from 'components/layout/PageHeader';
import SpeciesAutocompleteField from 'components/species/components/SpeciesAutocompleteField';
import { useBiohubApi } from 'hooks/useBioHubApi';
import useDataLoader from 'hooks/useDataLoader';
import { ITaxonomy } from 'interfaces/useTaxonomyApi.interface';
import React, { useState } from 'react';
import SpeciesStandardsResults from './view/SpeciesStandardsResults';

/**
* Page to display both species and method standards and data capture standards
*
* @return {*}
*/

// Custom styled ToggleButton
const StyledToggleButton = styled(ToggleButton)(({ theme }) => ({
color: theme.palette.text.primary,
borderColor: theme.palette.primary.main,
'&.Mui-selected': {
backgroundColor: theme.palette.primary.main,
color: theme.palette.common.white
},
'&:hover': {
backgroundColor: theme.palette.primary.light,
color: theme.palette.common.primary
}
}));

const DoubleStandardsPage = () => {
const [currentTab, setCurrentTab] = useState('');

const biohubApi = useBiohubApi();
const standardsDataLoader = useDataLoader((species: ITaxonomy) =>
biohubApi.standards.getSpeciesStandards(species.tsn)
);

const views = [
{ label: 'Species Data & Variables', value: 'SPECIES' },
{ label: 'Data Capture & Methodologies', value: 'METHODS' }
];

return (
<>
<PageHeader title="Standards" />
<Container maxWidth="xl" sx={{ py: 3 }}>
<Paper>
<Toolbar style={{ display: 'flex', justifyContent: 'flex-start', width: '100%' }}>
<Box
sx={{ backgroundColor: 'primary.main', padding: 2, borderRadius: 4, width: 'auto', textAlign: 'center' }}>
<Typography variant="h4" sx={{ fontWeight: 'lighter', color: 'white' }}>
Standards for Species and Methodologies
</Typography>
</Box>
</Toolbar>

<Box py={2} px={3}>
<ToggleButtonGroup
value={currentTab}
onChange={(_event: React.MouseEvent<HTMLElement>, view: any) => setCurrentTab(view)}
exclusive
sx={{ mb: 2 }}>
{views.map((view) => (
<StyledToggleButton key={view.value} value={view.value}>
{view.label}
</StyledToggleButton>
))}
</ToggleButtonGroup>

{currentTab === 'SPECIES' && (
<SpeciesAutocompleteField
formikFieldName="tsn"
label={''}
handleSpecies={(value) => {
if (value) {
standardsDataLoader.refresh(value);
}
}}
/>
)}
{/* This is te bit of code that shoes the results for search bar. Is there a way to make sure this is only showing when currentTab is species? */}
<SpeciesStandardsResults data={standardsDataLoader.data} isLoading={standardsDataLoader.isLoading} />
LouisThedroux marked this conversation as resolved.
Show resolved Hide resolved

{/* Nothing really going on in this part riht now. Using the search bar to search methodologies in */}
{currentTab === 'METHODS' && (
<Box sx={{ mt: 2 }}>
<Typography variant="h5" sx={{ fontWeight: 'lighter' }}>
Data Capture & Methodologies Placeholder
</Typography>
<Typography variant="body2">
This is a placeholder for future functionality related to Data Capture & Methodologies API calls,
where ever that might come from (technique_attribute_quantitativ etc)
</Typography>
</Box>
)}
</Box>
</Paper>
</Container>
</>
);
};

export default DoubleStandardsPage;