Skip to content

Commit

Permalink
Merge pull request #453 from dgidb/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
katiestahl authored Nov 14, 2023
2 parents 718b21b + e236bc6 commit be8317d
Show file tree
Hide file tree
Showing 13 changed files with 170 additions and 80 deletions.
10 changes: 9 additions & 1 deletion client/src/components/Layout/MainLayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ body {
}

header {
display: flex;
background: -webkit-linear-gradient(
var(--header-gradient-1),
var(--header-gradient-2)
Expand Down Expand Up @@ -62,6 +61,15 @@ header {
color: var(--background);
}

.header-banner {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 15px;
background-color: #f0e7c0;
padding: 10px;
}

nav {
flex-grow: 1;
display: flex;
Expand Down
212 changes: 147 additions & 65 deletions client/src/components/Layout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@ import { useContext, useState } from 'react';
import { useNavigate } from 'react-router-dom';

// client state
import { ActionTypes } from 'stores/Global/reducers';
import { GlobalClientContext } from 'stores/Global/GlobalClient';

// style
import './MainLayout.scss';
import { Box, Button, IconButton, Menu, MenuItem } from '@mui/material';
import HighlightOffIcon from '@mui/icons-material/HighlightOff';
import {
Box,
Button,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
IconButton,
Link,
Menu,
MenuItem,
} from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';
import ReleaseInformation from 'components/Shared/ReleaseInformation/ReleaseInformation';

type MainLayoutProps = {
Expand All @@ -18,6 +29,9 @@ type MainLayoutProps = {

const Header: React.FC = () => {
const [anchorEl, setAnchorEl] = useState(null);
const [hideBanner, setHideBanner] = useState(
window.localStorage.getItem('banner-closed')
);

const handleOpen = (event: any) => {
setAnchorEl(event.currentTarget);
Expand All @@ -27,87 +41,154 @@ const Header: React.FC = () => {
setAnchorEl(null);
};

const handleCloseNotificationBanner = () => {
setHideBanner('true');
window.localStorage.setItem('banner-closed', 'true');
};

const navigate = useNavigate();

return (
<header>
<div className="header-logo" onClick={() => navigate('/')}>
DGIdb
</div>
<nav>
<ul>
<li>
<Button className="browse-button" onClick={handleOpen}>
Browse
</Button>
<Menu
id="simple-menu"
anchorEl={anchorEl}
open={Boolean(anchorEl)}
onClose={handleClose}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'center',
}}
transformOrigin={{
vertical: 'top',
horizontal: 'center',
}}
>
<MenuItem
onClick={() => {
handleClose();
navigate('/browse/categories');
<Box display="flex">
<div className="header-logo" onClick={() => navigate('/')}>
DGIdb
</div>
<nav>
<ul>
<li>
<Button className="browse-button" onClick={handleOpen}>
Browse
</Button>
<Menu
id="simple-menu"
anchorEl={anchorEl}
open={Boolean(anchorEl)}
onClose={handleClose}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'center',
}}
>
Categories
</MenuItem>
<MenuItem
onClick={() => {
handleClose();
navigate('/browse/sources');
transformOrigin={{
vertical: 'top',
horizontal: 'center',
}}
>
Sources
</MenuItem>
</Menu>
</li>
<li onClick={() => navigate('/about')}>About</li>
<li onClick={() => navigate('/downloads')}>Downloads</li>
</ul>
</nav>
<MenuItem
onClick={() => {
handleClose();
navigate('/browse/categories');
}}
>
Categories
</MenuItem>
<MenuItem
onClick={() => {
handleClose();
navigate('/browse/sources');
}}
>
Sources
</MenuItem>
</Menu>
</li>
<li onClick={() => navigate('/about')}>About</li>
<li onClick={() => navigate('/downloads')}>Downloads</li>
</ul>
</nav>
</Box>
{!hideBanner ? (
<Box className="header-banner">
<Box>
The previous version of DGIdb can be found at{' '}
<Link href="https://old.dgidb.org" color="inherit">
old.dgidb.org
</Link>{' '}
until June 1st, 2024.
</Box>
<IconButton
aria-label="close"
size="small"
onClick={handleCloseNotificationBanner}
>
<CloseIcon fontSize="inherit" />
</IconButton>
</Box>
) : (
''
)}
</header>
);
};

const Footer: React.FC = () => {
const { state, dispatch } = useContext(GlobalClientContext);

return (
<footer>
{state.themeSettings.showDisclaimer && (
<div>
Disclaimer: This resource is intended for purely research purposes. It
should not be used for emergencies or medical or professional advice.
<IconButton
style={{
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
marginLeft: '10px',
fontSize: '25px',
}}
onClick={() => dispatch({ type: ActionTypes.HideDisclaimer })}
>
<HighlightOffIcon />
</IconButton>
</div>
)}
<ReleaseInformation />
</footer>
);
};

const DisclaimerPopup: React.FC = () => {
const [hideDisclaimer, setHideDisclaimer] = useState(
window.localStorage.getItem('disclaimer-closed')
);

const handleClose = () => {
setHideDisclaimer('true');
window.localStorage.setItem('disclaimer-closed', 'true');
};

return (
<>
<Dialog
open={!(hideDisclaimer === 'true')}
onClose={handleClose}
aria-labelledby="disclaimer-dialog-title"
aria-describedby="disclaimer-dialog-description"
>
<DialogTitle id="disclaimer-dialog-title">
<b>Disclaimer:</b> This resource is intended for purely research
purposes. It should not be used for emergencies or medical or
professional advice.
</DialogTitle>
<IconButton
aria-label="close"
size="small"
onClick={handleClose}
sx={{
position: 'absolute',
right: 8,
top: 8,
}}
>
<CloseIcon fontSize="inherit" />
</IconButton>
<hr />
<DialogContent>
<DialogContentText id="disclaimer-dialog-description">
<Box mb={2}>
{
'A finding of a drug-gene interaction or potentially druggable category does not necessarily indicate effectiveness (or lack thereof) of any drug or treatment regimen. A finding of no interaction or no potentially druggable category does not necessarily indicate lack of effectiveness of any drug or treatment regimen. Drug-gene interactions or potentially druggable categories are not presented in ranked order of potential or predicted efficacy.'
}
</Box>
<Box>
{
"The dgidb.org website does not provide any medical or healthcare products, services or advice, and is not for medical emergencies or urgent situations. IF YOU THINK YOU MAY HAVE A MEDICAL EMERGENCY, CALL YOUR DOCTOR OR 911 IMMEDIATELY. Information contained on this website is not a substitute for a doctor's medical judgment or advice. We recommend that you discuss your specific, individual health concerns with your doctor or health care professional."
}
</Box>
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleClose} color="secondary">
Close
</Button>
</DialogActions>
</Dialog>
</>
);
};

export const MainLayout = ({ children }: MainLayoutProps) => {
const { state } = useContext(GlobalClientContext);

Expand All @@ -129,6 +210,7 @@ export const MainLayout = ({ children }: MainLayoutProps) => {

return (
<div className={'layout-container'} data-theme={theme}>
<DisclaimerPopup />
<Header />
<div className="content-container">
<Box className="content">{children}</Box>
Expand Down
12 changes: 6 additions & 6 deletions server/public/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.67042d2f.css",
"main.js": "/static/js/main.42779595.js",
"main.css": "/static/css/main.bcd4797d.css",
"main.js": "/static/js/main.5cec3dbf.js",
"static/js/461.86214142.chunk.js": "/static/js/461.86214142.chunk.js",
"static/js/80.a852d8b5.chunk.js": "/static/js/80.a852d8b5.chunk.js",
"static/js/990.d59bee53.chunk.js": "/static/js/990.d59bee53.chunk.js",
Expand All @@ -27,8 +27,8 @@
"static/js/964.9202084e.chunk.js": "/static/js/964.9202084e.chunk.js",
"static/js/925.a41f4405.chunk.js": "/static/js/925.a41f4405.chunk.js",
"index.html": "/index.html",
"main.67042d2f.css.map": "/static/css/main.67042d2f.css.map",
"main.42779595.js.map": "/static/js/main.42779595.js.map",
"main.bcd4797d.css.map": "/static/css/main.bcd4797d.css.map",
"main.5cec3dbf.js.map": "/static/js/main.5cec3dbf.js.map",
"461.86214142.chunk.js.map": "/static/js/461.86214142.chunk.js.map",
"80.a852d8b5.chunk.js.map": "/static/js/80.a852d8b5.chunk.js.map",
"990.d59bee53.chunk.js.map": "/static/js/990.d59bee53.chunk.js.map",
Expand All @@ -55,7 +55,7 @@
"925.a41f4405.chunk.js.map": "/static/js/925.a41f4405.chunk.js.map"
},
"entrypoints": [
"static/css/main.67042d2f.css",
"static/js/main.42779595.js"
"static/css/main.bcd4797d.css",
"static/js/main.5cec3dbf.js"
]
}
2 changes: 1 addition & 1 deletion server/public/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="DGIdb, The Drug Gene Interaction Database, is a research resource that can be used to search candidate genes or drugs against the known and potentially druggable genome."/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;350;400;500;700;800&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Lato:wght@100;300;350;400;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@200;300;350;400;500;600&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/dgidb-icon_48.png"/><link rel="manifest" href="/manifest.json"/><title>DGIdb</title><script defer="defer" src="/static/js/main.42779595.js"></script><link href="/static/css/main.67042d2f.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="DGIdb, The Drug Gene Interaction Database, is a research resource that can be used to search candidate genes or drugs against the known and potentially druggable genome."/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;350;400;500;700;800&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Lato:wght@100;300;350;400;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@200;300;350;400;500;600&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/dgidb-icon_48.png"/><link rel="manifest" href="/manifest.json"/><title>DGIdb</title><script defer="defer" src="/static/js/main.5cec3dbf.js"></script><link href="/static/css/main.bcd4797d.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
2 changes: 0 additions & 2 deletions server/public/static/css/main.67042d2f.css

This file was deleted.

1 change: 0 additions & 1 deletion server/public/static/css/main.67042d2f.css.map

This file was deleted.

2 changes: 2 additions & 0 deletions server/public/static/css/main.bcd4797d.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions server/public/static/css/main.bcd4797d.css.map

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions server/public/static/js/main.42779595.js

This file was deleted.

1 change: 0 additions & 1 deletion server/public/static/js/main.42779595.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions server/public/static/js/main.5cec3dbf.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions server/public/static/js/main.5cec3dbf.js.map

Large diffs are not rendered by default.

0 comments on commit be8317d

Please sign in to comment.