User interface and Frontend for MoTrPAC Bioinformatics Center
MIT License
3
stars
0
forks
source link
readme
User interface and Frontend for MoTrPAC Bioinformatics Center
Directory Layout and Setup
File Structure
.
├── src
│ ├── assets: images, logos, etc.
│ ├── components: jsx UI components
│ ├── lib: static information like team member names and assay lists
│ ├── main.css: Compiled from sass/main.sass
│ ├── sass: source sass styling
│ ├── storybook.test.js: initialize snapshots for storybook tests
│ ├── storybookSnapshotInit.Skiptest.js: rename Skiptest to test to include snapshot testing
│ ├── testData: Mock data used in stories and tests
│ └── [Component/Feature Name]: contains reducers, actions, components, subcomponents, and tests
│ | └── __test__: contains the storybook story and jest tests for the feature.
├── public
├── .storybook: configuration for storybook
├── .eslintrc.js: ESlint configuration
├── .prettierrc.js: Prettier configuration
├── .stylelint.config.js: StyleLint configurations for Sass Linting
%PUBLIC_URL% evaluates to nothing if the application is running on the dev server so the images which require absolute urls may not display
Notes on redux integration
Components that need to be linked to a redux store in implementation are exported by default as connected functions/containers. They are also exported in pure function form (ex: "import { UploadScreen } from 'path/to/component' " for pure function and "import UploadScreen from 'path/to/component'" for container).
mapStateToProps used to link the section from the combined reducer to properties required by the container
mapDispatchtoProps defines required actions and what to send to a reducer.
redux-thunk middleware used to handle asynchronous requests like for authentication
Potential down the line dependency issues
Storybook has trouble integrating with react-router, I installed a package called storybook-react-router to make them work together. If you run in to an issue with storybook saying something like "You should not use outside " it has something to do with react-router and storybook-react-router
Current navigation/routing implementation
React-router is being used to handle routing
history ( createBrowserHistory ) is used to update location from button clicks and function calls ( history.push('path/to/new/location') )
\< Link > tags from react-router are used in place of \< a > tags handle navigation from links. Certain elements return \< Redirect to="path/to/new/location" > elements if protected and user not authenticated.
Analysis page only uses routing to differentiate between human and analysis (/analysis/human or /analysis/animal). After that it acts as a single page application.
Download Page Behavior
Makes call to backend for a list of uploads (size depending maxRows variable) on a given page. Expects backend to give total count of uploads fitting filters and the uploads for a specific page. (e.g on page 2, with 10 rows per page, expects items 11-20 from backend and a count of all rows that fit current filters)
Changing filters should also call backend
Cross-browser Testing Platform and Open Source ❤️ provided by Sauce Labs