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

feat: update browse categories interface #401

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"react-query": "^3.34.0",
"react-router-dom": "^6.2.2",
"react-scripts": "^5.0.0",
"react-sticky": "^6.0.3",
"react-tag-autocomplete": "^6.3.0",
"sass": "^1.38.1",
"typescript": "^5.1.3",
Expand Down
44 changes: 0 additions & 44 deletions client/src/components/Browse/Categories/BrowseCategories.scss

This file was deleted.

169 changes: 0 additions & 169 deletions client/src/components/Browse/Categories/BrowseCategories.tsx

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion client/src/components/Browse/Categories/index.ts

This file was deleted.

15 changes: 15 additions & 0 deletions client/src/components/BrowseCategories/BrowseCategories.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.browse-cats-container {
padding: 24px;

.browse-cats-title-container {
margin-bottom: 1.1em;
}

.browse-cats-title {
font-weight: 450;
}

.empty-msg {
margin: 1em;
}
}
73 changes: 73 additions & 0 deletions client/src/components/BrowseCategories/BrowseCategories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// hooks/dependencies
import React, { useState, useEffect } from 'react';
import { useGetDruggableSources } from 'hooks/queries/useGetSourceInfo';

// components
import { CategoriesListing } from './CategoriesListing/CategoriesListing';
import {
Box,
Grid,
Typography,
} from '@mui/material';

// styles
import './BrowseCategories.scss';
import { CategoriesCheckboxContainer } from './CategoriesCheckboxContainer/CategoriesCheckboxContainer';

export const BrowseCategories: React.FC = () => {
const [druggableSources, setDruggableSources] = useState([]);
const [checkedSources, setCheckedSources] = useState<any>([]);

const { data, isLoading, isError } = useGetDruggableSources();

useEffect(() => {
if (data?.sources?.nodes) {
const nodes = data?.sources?.nodes;
const sources: any = [];

nodes.forEach((node: any) => {
sources.push(node.sourceDbName);
});

setDruggableSources(
sources.sort((a: string, b: string) =>
a.toLowerCase().localeCompare(b.toLowerCase())
)
);
}
}, [data]);

useEffect(() => {
if (druggableSources) {
setCheckedSources(druggableSources);
}
}, [druggableSources]);

return (
<Box className="browse-cats-container">
<Grid
container
justifyContent="space-between"
className="browse-cats-title-container"
>
<Typography variant="h4" className="browse-cats-title">
Druggable Gene Categories
</Typography>
</Grid>
<Grid container>
<Grid>
<CategoriesCheckboxContainer
checkOptions={druggableSources}
checkedSources={checkedSources}
setCheckedSources={setCheckedSources}
isLoading={isLoading}
isError={isError}
/>
</Grid>
<Box className="browse-cats-accordion-horizontal-container" flex={1}>
<CategoriesListing checkedSources={checkedSources} sourcesLoaded={isLoading !== undefined && !isLoading && !isError}/>
</Box>
</Grid>
</Box>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.browse-cats-checkbox-container {
margin-right: 1em;
padding: 1em;
background-color: var(--background-light);
top: 0;
position: -webkit-sticky;
position: sticky;
}
Loading
Loading