Skip to content

Commit

Permalink
feat(VariantDb): kids-first#2468 variant db page
Browse files Browse the repository at this point in the history
  • Loading branch information
adipaul1981 committed May 1, 2020
1 parent 363bf8c commit 8198f16
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 40 deletions.
82 changes: 44 additions & 38 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,25 @@ import ErrorBoundary from 'ErrorBoundary';
import ROUTES from 'common/routes';
import isPlainObject from 'lodash/isPlainObject';
import isEmpty from 'lodash/isEmpty';
import VariantDb from './components/VariantDb';

const userIsRequiredToLogIn = loggedInUser => {
return (
(loggedInUser === null ||
loggedInUser === undefined ||
(isPlainObject(loggedInUser) && isEmpty(loggedInUser))) &&
requireLogin
);
};
const userIsRequiredToLogIn = (loggedInUser) =>
(loggedInUser === null ||
loggedInUser === undefined ||
(isPlainObject(loggedInUser) && isEmpty(loggedInUser))) &&
requireLogin;

const userIsNotLoggedInOrMustCompleteJoinForm = loggedInUser => {
return (
!loggedInUser ||
isEmpty(loggedInUser) ||
!loggedInUser.roles ||
!loggedInUser.roles[0] ||
!loggedInUser.acceptedTerms
);
};
const userIsNotLoggedInOrMustCompleteJoinForm = (loggedInUser) =>
!loggedInUser ||
isEmpty(loggedInUser) ||
!loggedInUser.roles ||
!loggedInUser.roles[0] ||
!loggedInUser.acceptedTerms;

const userIsLoggedInButMustCompleteJoinForm = loggedInUser => {
return (
isPlainObject(loggedInUser) &&
!isEmpty(loggedInUser) &&
(!loggedInUser.roles || !loggedInUser.roles[0] || !loggedInUser.acceptedTerms)
);
};
const userIsLoggedInButMustCompleteJoinForm = (loggedInUser) =>
isPlainObject(loggedInUser) &&
!isEmpty(loggedInUser) &&
(!loggedInUser.roles || !loggedInUser.roles[0] || !loggedInUser.acceptedTerms);

const forceSelectRole = ({ loggedInUser, isLoadingUser, WrapperPage = Page, ...props }) => {
if (isLoadingUser) {
Expand Down Expand Up @@ -99,7 +91,7 @@ const App = compose(
<Route
path={ROUTES.cohortBuilder}
exact
render={props =>
render={(props) =>
forceSelectRole({
isLoadingUser,
Component: CohortBuilder,
Expand All @@ -116,21 +108,35 @@ const App = compose(
<Route
path={ROUTES.searchMember}
exact
render={props => {
return forceSelectRole({
render={(props) =>
forceSelectRole({
isLoadingUser,
Component: MemberSearchPage,
loggedInUser,
isAdmin: state.isAdmin,
loggedInUserToken: state.loggedInUserToken,
...props,
});
}}
})
}
/>
<Route
path={ROUTES.variantDb}
exact
render={(props) =>
forceSelectRole({
isLoadingUser,
Component: VariantDb,
loggedInUser,
isAdmin: state.isAdmin,
loggedInUserToken: state.loggedInUserToken,
...props,
})
}
/>
<Route
path={`${ROUTES.file}/:fileId`}
exact
render={props =>
render={(props) =>
forceSelectRole({
api,
isLoadingUser,
Expand All @@ -144,7 +150,7 @@ const App = compose(
<Route
path={`${ROUTES.participant}/:participantId`}
exact
render={props =>
render={(props) =>
forceSelectRole({
isLoadingUser,
loggedInUser,
Expand All @@ -157,7 +163,7 @@ const App = compose(
<Route
path={`${ROUTES.search}/:index`}
exact
render={props =>
render={(props) =>
forceSelectRole({
isLoadingUser,
Component: FileRepo,
Expand All @@ -172,7 +178,7 @@ const App = compose(
<Route
path={ROUTES.dashboard}
exact
render={props =>
render={(props) =>
forceSelectRole({
api,
isLoadingUser,
Expand All @@ -185,7 +191,7 @@ const App = compose(
<Route
path={ROUTES.join}
exact
render={props => {
render={(props) => {
if (userIsNotLoggedInOrMustCompleteJoinForm(loggedInUser)) {
return (
<ApiContext.Provider
Expand Down Expand Up @@ -214,7 +220,7 @@ const App = compose(
<Route
path="/"
exact
render={props =>
render={(props) =>
forceSelectRole({
api,
isLoadingUser,
Expand All @@ -228,7 +234,7 @@ const App = compose(
<Route
path={ROUTES.orcid}
exact
render={props => (
render={(props) => (
<SideImagePage
logo={logo}
backgroundImage={scienceBgPath}
Expand All @@ -246,7 +252,7 @@ const App = compose(
<Route
path={ROUTES.profile}
exact
render={props =>
render={(props) =>
forceSelectRole({
api,
isLoadingUser,
Expand All @@ -260,7 +266,7 @@ const App = compose(
<Route
path={`${ROUTES.user}/:userID`}
exact
render={props => {
render={(props) => {
const userIdUrlParam = props.match.params.userID;
return forceSelectRole({
api,
Expand Down
Binary file added src/assets/appache-zeppelin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/common/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const ROUTES = {
search: '/search',
searchMember: '/memberPage',
user: '/user',
variantDb: '/variantDb',
profile: '/profile',
};

Expand Down
12 changes: 10 additions & 2 deletions src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const renderAlertIfAny = (loggedInUser, currentError, dismissError) => {
return null;
};

const Header = props => {
const Header = (props) => {
const {
currentError,
dismissError,
Expand Down Expand Up @@ -114,6 +114,14 @@ const Header = props => {
Explore Data
</NavLink>
</li>
<li>
<NavLink currentPathName={currentPathName} to={ROUTES.variantDb}>
<ExploreDataIcon
style={{ top: '3px', position: 'relative', fill: 'currentColor' }}
/>{' '}
Variant DB
</NavLink>
</li>
<li>
<NavLink currentPathName={currentPathName} to={`${ROUTES.search}/file`}>
<DatabaseIcon /> File Repository
Expand Down Expand Up @@ -168,7 +176,7 @@ Header.propTypes = {
enabledFeatures: PropTypes.object,
};

const mapStateToProps = state => ({
const mapStateToProps = (state) => ({
loggedInUser: state.user.loggedInUser,
currentError: state.errors.currentError,
});
Expand Down
12 changes: 12 additions & 0 deletions src/components/VariantDb/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

.ant-list-item {
padding: 5px;
}

.white-background {
background: #FFFFFF;
}

.middle-align {
text-align: center;
}
91 changes: 91 additions & 0 deletions src/components/VariantDb/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import * as React from 'react';
import { Button, Col, List, Row } from 'antd';
import { Typography } from 'antd';
import { RocketOutlined } from '@ant-design/icons';
import azicon from 'assets/appache-zeppelin.png';

import './index.css';

const { Title } = Typography;

class VariantDb extends React.Component {
data = [
{
name: 'Studies',
value: 13,
},
{
name: 'Participants',
value: <div>14494</div>,
},
{
name: 'Genes',
value: 21393,
},
{
name: 'Variants',
value: 29848393,
},
{
name: 'Exomic variants',
value: 2387298,
},
];

render() {
return (
<div className="background-container" style={{ padding: 32 }}>
<Row>
<Col flex={'auto'} span={16}>
<Title level={2}>Germline Small Variant Database</Title>
<Title level={4}>
The Kids First germline small variant data warehouse contains harmonized variant calls
and clinical data on probands and their parents.
</Title>
</Col>
<Col span={8}></Col>
</Row>
<Row justify={'center'} gutter={24}>
<Col span={16}>
<div
className={'white-background middle-align'}
style={{ height: '100%', paddingTop: 24, paddingBottom: 24 }}
>
<img alt="AppacheZeppelin" src={azicon} />
<div style={{ paddingTop: 24, paddingBottom: 24 }}>
Kids First is providing members with their own SPARK cluster running a web-based
Zeppelin notrebooks dansbox to explore, query and visualize its germline variant
datasets. Using Zeppelin, bioinformaticians can create interactive data analytics
and collaborative documents with SQL, Scala, Python, and more..
</div>
<Button type={'primary'} icon={<RocketOutlined />}>
Launch your SPARK cluster with Zeppelin
</Button>
</div>
</Col>
<Col className={'white-background'} span={8}>
<List
header={
<Row justify={'space-between'}>
<Title level={4}>Data Release 1</Title>
<div>May 13, 2020</div>
</Row>
}
dataSource={this.data}
renderItem={(item) => (
<List.Item>
<Row style={{ display: 'contents' }}>
<Col>{item.name}:</Col>
<Col>{item.value}</Col>
</Row>
</List.Item>
)}
/>
</Col>
</Row>
</div>
);
}
}

export default VariantDb;

0 comments on commit 8198f16

Please sign in to comment.