Skip to content

Commit

Permalink
docs proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
javfg committed Nov 26, 2020
1 parent 2092253 commit bcd1217
Show file tree
Hide file tree
Showing 7 changed files with 462 additions and 67 deletions.
85 changes: 18 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,35 @@
# Open Targets Platform App

Experimental React app to update technological stack of [Open Targets Platform](www.targetvalidation.org).
[![Netlify Status](https://api.netlify.com/api/v1/badges/58a127ca-67c0-4cc3-b9e3-88dad47cfc7f/deploy-status)](https://app.netlify.com/sites/platform-app/deploys)

## Development
This repository holds the new [Open Targets Platform](https://www.targetvalidation.org) web app.

To start developing, follow these steps:

- Install Node version 12.x and [yarn](https://classic.yarnpkg.com/en/docs/install) version ^1.22
- Install dependencies with `yarn`
- Start the development server with `yarn start`

## Section structure

The target profile tab of the target page is broken up into sections. Each of these sections is encapsulated in one directory. To add a new one, try to follow the following layout guide:

```
target/
sections/
...
<section-id>/
custom/
... // it may help to put any other components you create here,
// to keep them separate from the template/expected ones below
Description.js
index.js
Section.js
sectionQuery.gql [OPTIONAL]
Summary.js
summaryQuery.gql [OPTIONAL]
```
It is a Single Page Application built on [React](https://reactjs.org/) using [Apollo GraphQL](https://www.apollographql.com/docs/react/v3.0-beta) for the data fetching and management and the [Material-UI](https://material-ui.com/) component collection.

The `index.js` file should have a structure as follows:
If you are interested in the backend, you can take a look at the [GraphQL Endpoint Browser](https://api-beta-dot-open-targets-eu-dev.appspot.com/api/v4/graphql/browser) and the [GraphQL Endpoint Schema](https://api-beta-dot-open-targets-eu-dev.appspot.com/api/v4/graphql/browser).

```js
// helps to load graphql files
import { loader } from 'graphql.macro';
## Development environment

// the name of your new section
export const id = '<section-id>';
// the nice name you want for your new section
export const name = '<section-name>';

// a function of the response of summaryQuery, to determine whether there is data for this target (and therefore whether to load the detail or not)
export const hasSummaryData = <function>;

// (optional) queries against platform-api, the new graphql api
export const summaryQuery = loader('./summaryQuery.gql');
export const sectionQuery = loader('./sectionQuery.gql');

// react components to render the data:
// typically a string, above the main content section, but could have links
export { default as DescriptionComponent } from './Description';
// typically a string, in the summary widget, but could be more complex
export { default as SummaryComponent } from './Summary';
// the main content section
export { default as SectionComponent } from './Section';

```
To start developing, follow these steps:

The same structure is followed on the disease and drug pages. Any components that you want to reuse can be placed in the `common` directory.
1. Install [NodeJS](https://nodejs.org/en/) version 12 or greater and [Yarn](https://classic.yarnpkg.com/en/docs/install) version ^1.22.
2. Install dependencies by running `yarn`.
3. Start the development server by running `yarn start`.

## Customisation
## Further documentation

To customise the platform app:
- [Contributing](docs/CONTRIBUTING.md)
- [Extending and customising the web app](docs/customisations.md)
- [Table component API](./src/components/Table/README.md)
- [Code of conduct](docs/CODE_OF_CONDUCT.md)

- Clone this repository.
- Create a directory somewhere outside this repository where you will put your customisation files.
- Add an environment variable called `$CUSTOMISATIONS_DIR` that points to the directory created in the step above.
- Inside your customisation directory you can overwrite or add new files following the same directory structure as `src/public`.
- When developing new customisations, you can use the `yarn start:customise` script inside this repository to see your customisations reflected
in the app while developing. When done developing customisations, run the `yarn reset` command.
- For production, you can produce a build containing the customisations by running the `yarn build:customise` script. This will create a `build`
directory that you can deploy.
## Special thanks

## Special Thanks
[<img src="./docs/netlify-logo.svg" alt="BrowserStack" width="325">](https://www.netlify.com/)

BrowserStack has allowed us to do cross-browser testing of the platform app at no cost.
[<img src="./docs/browserstack-logo.svg" alt="BrowserStack" width="400">](https://www.browserstack.com/)

<img src="./.github/docs/Browserstack-logo.svg" alt="BrowserStack" width="400">
[<img src="./docs/thehyve-logo.svg" alt="TheHyve" width="440">](https://www.thehyve.nl/)

## Copyright

Expand Down
72 changes: 72 additions & 0 deletions docs/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Open Targets Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at support@targetvalidation.org. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
64 changes: 64 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# How do I make a contribution?

👍🎉 **First off, thanks for taking the time to read this and contribute!** 🎉👍

Open Targets follows the usual open source project conventions for external contributions. Here is a quick rundown:

1. Find an [issue](https://github.com/opentargets/platform/issues?q=is%3Aissue+is%3Aopen) you are interested in addressing or a [feature](https://github.com/opentargets/platform/labels/Kind%3A%20New%20feature) you would like to help building in the [issue tracker repo](https://github.com/opentargets/platform). Consider posting in the issue to inform us about the work you are doing.

2. Fork the relevant repository to your GitHub account. Take a look at the [Development](../README.md#development) section of the readme for more information on how to get the development environment started.

3. Create a new branch for your work using `git checkout -b branch-name-here`.

4. Work on your contribution. Be sure to read the [guidelines](#guidelines) to stay on course with our best practices.

5. When you are done, open a pull request (PR) in the original repository:

- **The title** should be a short description of the changes made and the issue or bug number associated with your change. For example, you can title a pull request like so: "Removed dollar sign from links to resolve [opentargets/platform#1098](https://github.com/opentargets/platform/issues/1098)".

- In **the description** of the pull request, explain the changes that you made, any issues you think exist with the pull request you made, and any questions you have for the maintainer. It's OK if your pull request is not perfect (no pull request is), the reviewer will be able to help you fix any problems and improve it!

6. Wait for the pull request to be reviewed by a maintainer.

7. Make changes to the pull request if the reviewing maintainer recommends them.

8. Celebrate your success after your pull request is merged!

## <a name="guidelines"></a> General guidelines for contributing

1. A PR must address a single issue or feature.
2. There must always be an issue number associated with the PR (in the title or description).
3. Only one commit per PR\*.
4. Commit message should include the issue number.
5. The branch should be rebased on `alpha` before opening the PR.
6. No changes to code not directly related to your PR.
7. Includes documentation.

**\*** This limitation is enforced on most PRs. A large feature or an issue which pertain different logical units can have more than one commit; but the general rule is one issue per PR, one commit per PR.

## Coding conventions

We are using [prettier v1.15.1](https://prettier.io/). Setting this up should mostly get you on the right track. Also, if you are using [Visual Studio Code](https://code.visualstudio.com/), you can install the [prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) which enables you to automatically format your code on save.

# I have questions!

If you have any questions about contributing to Open Targets Platform you can head to our [Slack](https://opentargets-dev.slack.com/archives/C02UV8545), or post in the [issue tracker repo](https://github.com/opentargets/platform/issues).

Try to ask your question so it's as easy to answer as possible. If you're not sure how to do that these are some good guides:

- https://opensource.com/life/16/10/how-ask-technical-questions

- http://www.catb.org/esr/faqs/smart-questions.html

# What does the Code of Conduct mean for me?

Our [Code of Conduct](docs/CODE_OF_CONDUCT.md) means that you are responsible for treating everyone on the project with respect and courtesy regardless of their identity. If you are the victim of any inappropriate behavior or comments as described in our Code of Conduct, we are here for you and will do the best to ensure that the abuser is reprimanded appropriately, per our code.

# Acknowledgements

This contributor guidelines document is based on:

- [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/1/4/code-of-conduct/)
- [PurpleBooth/Good-CONTRIBUTING.md-template.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426)
- [QMK Firmware CONTRIBUTING.md](https://github.com/qmk/qmk_firmware/blob/master/docs/contributing.md)
- [Red Hat Keycloak CONTRIBUTING.md](https://github.com/keycloak/keycloak/blob/master/CONTRIBUTING.md)
File renamed without changes
65 changes: 65 additions & 0 deletions docs/customisations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Extending and customising the platform app

## Section structure

The target profile tab of the target page is broken up into sections. Each of these sections is encapsulated in one directory. To add a new one, try to follow the following layout guide:

```
target/
sections/
...
<section-id>/
custom/
... // it may help to put any other components you create here,
// to keep them separate from the template/expected ones below
Description.js
index.js
Section.js
sectionQuery.gql [OPTIONAL]
Summary.js
summaryQuery.gql [OPTIONAL]
```

The `index.js` file should have a structure as follows:

```js
// helps to load graphql files
import { loader } from 'graphql.macro';

// the name of your new section
export const id = '<section-id>';
// the nice name you want for your new section
export const name = '<section-name>';

// a function of the response of summaryQuery, to determine whether there is data for this target (and therefore whether to load the detail or not)
export const hasSummaryData = <function>;

// (optional) queries against platform-api, the new graphql api
export const summaryQuery = loader('./summaryQuery.gql');
export const sectionQuery = loader('./sectionQuery.gql');

// react components to render the data:
// typically a string, above the main content section, but could have links
export { default as DescriptionComponent } from './Description';
// typically a string, in the summary widget, but could be more complex
export { default as SummaryComponent } from './Summary';
// the main content section
export { default as SectionComponent } from './Section';

```

The same structure is followed on the disease and drug pages. Any components that you want to reuse can be placed in the `common` directory.

## Customisation

To customise the platform app:

- Clone this repository.
- Create a directory somewhere outside this repository where you will put your customisation files.
- Add an environment variable called `$CUSTOMISATIONS_DIR` that points to the directory created in the step above.
- Inside your customisation directory you can overwrite or add new files following the same directory structure as `src/public`.
- When developing new customisations, you can use the `yarn start:customise` script inside this repository to see your customisations reflected
in the app while developing. When done developing customisations, run the `yarn reset` command.
- For production, you can produce a build containing the customisations by running the `yarn build:customise` script. This will create a `build`
directory that you can deploy.
Loading

0 comments on commit bcd1217

Please sign in to comment.