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

add tutorial.md #142

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open

Conversation

tinaba96
Copy link

@tinaba96 tinaba96 commented Sep 9, 2024

Created tutorial for new members.

@@ -0,0 +1,227 @@
# Tutorial <!-- omit in toc -->

- [Main Component](#main-component)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this content page



## Main Component
In the root(`Eplant/main.tsx`), you can see the `Eplant` component, whchi is our main component of our application.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "...which is our main component..."

</React.StrictMode>
```

We only have one single Route at the moment but we will have one Route for one component.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that we clarify here that it is the Eplant.tsx that handles routing. But you are correct, eventually we will expect to have one Route for each component.



## Eplant Layout
Eplant Layout (`Eplant/EplantLayout.tsx`) hosts the actual views and ViewContainer (`Eplant/UI/Layout/ViewContainer/index.tsx`) is main component that does this.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would clarify that the ViewContainer is the one that hosts the actual views, and handles the viewing options available to the view. It also provides a topbar, and a preview stack if necessary.



### useViewData
The `useViewDatai` function is a custom React hook designed to manage and load view data in the application. It leverages TypeScript generics to handle different types of view data, state, and actions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: useViewData



## View Interface
Please see the `View` interface in `View \index.ts`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path error: View/index.ts

### component:

A required React component that renders the view.
Takes props of type ViewProps<Data, State, Action>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can wrap this in ViewProps<Data, State, Action> to follow the pattern in L160?



## state
`state` (`Eplant/state/index.tsx`) is a React module that manages state using `Jotai` and provides various hooks and utility functions for managing application state in the application, which is similar to `Redux` and `React Hooks`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include a link to Jotai here? Thanks




## Eplant2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a stupid approach, but can you add a section here that clarifies that using the Developer's console from the browser and poking around ePlant2 is the way that a developer can find the BAR APIs that they will need to call?

### Reactivity:
Components automatically re-render when atom state changes.

## When you create a new `view`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yukthiw can you review this section?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@y330 if you can take a look as well that would be great. Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Collaborator

@mwkyuen mwkyuen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work with this tutorial! I love the content section. Everything LGTM, but I would like @Yukthiw to take a look at When you create a new view section.

Thanks again for the great work!

### getInitialData:

A required method that fetches the data needed for the view based on a given gene and provides loading feedback.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be mention on error handling in this document? Such as what happens when getInitialData works improperly?


## Eplant2
https://bar.utoronto.ca/eplant/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tutorial might benefit from a code template/boilerplate code to get started

Copy link
Collaborator

@Yukthiw Yukthiw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tinaba96
Copy link
Author

Thank you everyone for the comments!
I will update them this week!

@bdls-jamal
Copy link

I am unsure if this suggestion is unnecessary from other's perspectives but as a new joiner I think this tutorial would benefit from having mention of the config.ts file and updating that in order to display the new view. This is possible to figure out without explicit guidance but it may make things easier for those who know nothing about the code structure


Next, create the `GetStartedView` component that serves as an introductory view, guiding users on how to interact with the application.

### Define GetStartedView Component:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, why was the component, tile, index structure chosen for the tutorial? Is this the expected format for new views moving forward, or just for ease of new contributors learning how everything works? I noticed that other views do not follow this structure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants