Skip to content

Commit eafda36

Browse files
authored
Merge pull request #167 from BioAnalyticResource/EpicBranch-routing
Epic Branch Final Step: Merge Epic Branch into Staging
2 parents 9221631 + 9983980 commit eafda36

File tree

105 files changed

+10584
-10488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+10584
-10488
lines changed

.eslintrc.cjs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ module.exports = {
2828
'simple-import-sort/imports': 'error',
2929
'simple-import-sort/exports': 'error',
3030
},
31-
'overrides': [
31+
overrides: [
3232
{
33-
'files': ['**/*.js', '**/*.ts', '**/*.tsx'],
34-
'rules': {
33+
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
34+
rules: {
3535
'simple-import-sort/imports': [
3636
'error',
3737
{
38-
'groups': [
38+
groups: [
3939
// `react` first, `next` second, then packages starting with a character
4040
['^react$', '^next', '^[a-z]'],
4141
// Packages starting with `@`
@@ -49,16 +49,16 @@ module.exports = {
4949
// Style imports
5050
['^.+\\.s?css$'],
5151
// Side effect imports
52-
['^\\u0000']
53-
]
54-
}
55-
]
56-
}
57-
}
52+
['^\\u0000'],
53+
],
54+
},
55+
],
56+
},
57+
},
5858
],
59-
"settings": {
60-
"react": {
61-
"version": "detect"
62-
}
63-
}
59+
settings: {
60+
react: {
61+
version: 'detect',
62+
},
63+
},
6464
}

.github/workflows/node.js.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ "main" ]
8+
branches: ['main']
99
pull_request:
10-
branches: [ "main" ]
10+
branches: ['main']
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615

1716
strategy:
@@ -20,12 +19,12 @@ jobs:
2019
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2120

2221
steps:
23-
- uses: actions/checkout@v4
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v4
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'npm'
29-
- run: npm ci
30-
- run: npm test
31-
- run: npm run build
22+
- uses: actions/checkout@v4
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: 'npm'
28+
- run: npm ci
29+
- run: npm test
30+
- run: npm run build

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"semi": false,
55
"singleQuote": true,
66
"jsxSingleQuote": true,
7-
"trailingComma":"es5"
7+
"trailingComma": "es5"
88
}

CONTRIBUTING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ First off, thank you for considering contributing to ePlant! By submitting your
44
agree that it can be shared under the terms of our license.
55

66
### Code of Conduct
7+
78
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
89

910
## How to Contribute
@@ -39,7 +40,7 @@ We welcome feature requests! To suggest a new feature, please open an issue on G
3940
```bash
4041
git remote add upstream https://github.com/BioAnalyticResource/ePlant
4142
```
42-
4. **Verify versions**: Most folks are working with _Node v18.0.0^ and npm 9.8.0^. [You can install Node from here.](https://nodejs.org/en/download/package-manager)
43+
4. **Verify versions**: Most folks are working with \_Node v18.0.0^ and npm 9.8.0^. [You can install Node from here.](https://nodejs.org/en/download/package-manager)
4344
```bash
4445
node -v
4546
npm -v
@@ -54,12 +55,13 @@ We welcome feature requests! To suggest a new feature, please open an issue on G
5455
```
5556

5657
### Submitting changes
58+
5759
1. **Create a branch**
5860
```bash
5961
git checkout -b your-branch-name
6062
```
6163
2. **Make changes**: Make changes in your forked repository.
62-
3. **Test your changes**: Make sure your changes are working correctly.
64+
3. **Test your changes**: Make sure your changes are working correctly.
6365
4. **Commit your changes**:
6466
```bash
6567
git commit -m "Your commit message"
@@ -80,19 +82,23 @@ Please include in the PR:
8082
- **Notes (Optional)**: Additional notes.
8183

8284
### Code Style
85+
8386
This is an abridged version of the [Google style guide](https://google.github.io/styleguide/tsguide.html) and [MS Typescript Coding guidelines](https://github.com/microsoft/TypeScript/wiki/Coding-guidelines), plus some tweaks to make it our own.
8487

8588
Use Prettier and ESLint for code formatting. You may want to install the plugin for your IDE to get live feedback and you can configure your IDE to apply auto formatting when you save a file. Using the tsconfig.json file, you can customize the rules for type checking. Avoid removing and/or ignoring default rules as much as possible. If you feel strongly about a rule please outline the changes into a PR and we can discuss the merits of introducing a new change.
8689

8790
All the new code must be written in typescript and all the types should be clearly defined in the project.
8891

8992
### Documentation
93+
9094
If your change affects any part of the documentation, please update the `README.md` accordingly.
9195

9296
### Testing
97+
9398
Make sure to run all tests before submitting your changes. If you add new functionality, please include tests for it.
9499

95100
### Getting Help
101+
96102
If you need help, feel free to ask questions by opening an issue. We appreciate your contributions!
97103

98104
Thank you for contributing to ePlant!

Eplant/Eplant.tsx

Lines changed: 74 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,90 @@
11
// import useStateWithStorage from '@eplant/util/useStateWithStorage'
2-
import { Route, Routes } from 'react-router-dom'
32

4-
import { CssBaseline, ThemeProvider } from '@mui/material'
3+
import { useEffect } from 'react'
4+
5+
import { Box, CircularProgress, CssBaseline, useTheme } from '@mui/material'
6+
import { ThemeProvider } from '@mui/material/styles'
57

68
import { dark, light } from './css/theme'
7-
import Sidebar from './UI/Sidebar'
9+
import { URLStateProvider } from './state/URLStateProvider'
10+
import { ViewContainer } from './UI/Layout/ViewContainer'
11+
import Sidebar, { collapsedSidebarWidth, sidebarWidth } from './UI/Sidebar'
812
import { useConfig } from './config'
9-
import EplantLayout from './EplantLayout'
10-
import { useDarkMode } from './state'
13+
import {
14+
useActiveGeneId,
15+
useActiveViewId,
16+
useDarkMode,
17+
useGeneticElements,
18+
usePageLoad,
19+
useSidebarState,
20+
} from './state'
21+
import { updateColors } from './updateColors'
1122
export type EplantProps = Record<string, never>
12-
export default function Eplant() {
13-
const { rootPath } = useConfig()
14-
const [darkMode] = useDarkMode()
1523

16-
return (
17-
<ThemeProvider theme={darkMode ? dark : light}>
18-
<CssBaseline />
19-
<Routes>
20-
<Route path={rootPath}>
21-
<Route index element={<MainEplant />} />
22-
</Route>
23-
</Routes>
24-
</ThemeProvider>
25-
)
26-
}
2724
/**
2825
* The main Eplant component. This is the root of the application. It contains the left nav and the layout.
2926
* @returns {JSX.Element} The rendered Eplant component
3027
*/
28+
const Eplant = () => {
29+
const [darkMode] = useDarkMode()
30+
const [isCollapse, setIsCollapse] = useSidebarState()
31+
const [activeGeneId, setActiveGeneId] = useActiveGeneId()
32+
const [activeViewId, setActiveViewId] = useActiveViewId()
33+
const theme = useTheme()
34+
const [globalProgress, loaded] = usePageLoad()
35+
const config = useConfig()
36+
useEffect(() => {
37+
if (loaded) {
38+
updateColors(theme)
39+
}
40+
}, [theme, loaded])
3141

32-
// SideBar and EplantLayout children
33-
export function MainEplant() {
3442
return (
35-
<>
43+
<ThemeProvider theme={darkMode ? dark : light}>
44+
<CssBaseline />
3645
<Sidebar />
37-
<EplantLayout />
38-
</>
46+
<URLStateProvider>
47+
<Box
48+
sx={(theme) => ({
49+
height: `calc(100% - ${theme.spacing(1)})`,
50+
left: `${isCollapse ? collapsedSidebarWidth : sidebarWidth}px`,
51+
right: '0px',
52+
position: 'absolute',
53+
marginTop: '0.5rem',
54+
boxSizing: 'border-box',
55+
transition: 'left 1s ease-out',
56+
backgroundColor: theme.palette.background.paper,
57+
})}
58+
>
59+
<Box
60+
sx={{
61+
width: '100%',
62+
height: '100%',
63+
display: 'flex',
64+
alignItems: 'stretch',
65+
justifyContent: 'stretch',
66+
}}
67+
>
68+
<div />
69+
{loaded ? (
70+
<ViewContainer
71+
sx={{
72+
width: '100%',
73+
height: '100%',
74+
}}
75+
></ViewContainer>
76+
) : (
77+
<div>
78+
<CircularProgress
79+
variant='indeterminate'
80+
value={globalProgress * 100}
81+
/>
82+
</div>
83+
)}
84+
</Box>
85+
</Box>
86+
</URLStateProvider>
87+
</ThemeProvider>
3988
)
4089
}
90+
export default Eplant

Eplant/EplantLayout.tsx

Lines changed: 0 additions & 93 deletions
This file was deleted.

Eplant/GeneticElement.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ export default class GeneticElement {
5050
export type SpeciesApi = {
5151
searchGene: (term: string) => Promise<GeneticElement | null>
5252
autocomplete: (term: string) => Promise<string[]>
53-
loaders: {
54-
[key: string]: (
55-
gene: GeneticElement,
56-
loadEvent: (amount: number) => void
57-
) => Promise<any>
58-
}
5953
}
6054

6155
/**

Eplant/Species/arabidopsis/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@ import axios from 'axios'
33
import { Species } from '@eplant/GeneticElement'
44
import GeneticElement from '@eplant/GeneticElement'
55

6-
import GeneInfoViewLoader from './loaders/GeneInfoView'
7-
import ArabidopsisPublicationViewer from './loaders/PublicationViewer'
86
const arabidopsis: Species = new Species('Arabidopsis', {
97
autocomplete,
108
searchGene,
11-
loaders: {
12-
'gene-info': GeneInfoViewLoader,
13-
'publication-viewer': ArabidopsisPublicationViewer,
14-
},
159
})
1610
async function autocomplete(s: string) {
1711
return (

0 commit comments

Comments
 (0)