# onespot-dashboard-prototype

> Onespot Dashboard

Latest version **1.0.0** (published 2016-11-18) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install onespot-dashboard-prototype
pnpm add onespot-dashboard-prototype
yarn add onespot-dashboard-prototype
bun add onespot-dashboard-prototype
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-11-18 |
| First published | 2016-11-18 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 31 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3330 |
| Maintainers | onespot |

## Links

- npm: https://www.npmjs.com/package/onespot-dashboard-prototype
- Repository: https://github.com/gaearon/react-transform-boilerplate
- Homepage: https://github.com/gaearon/react-transform-boilerplate#readme
- Issues: https://github.com/gaearon/react-transform-boilerplate/issues
- npm.io page: https://npm.io/package/onespot-dashboard-prototype

## Dependencies (31)

- [react](https://npm.io/package/react.md) ^15.1.0
- [redux](https://npm.io/package/redux.md) ^3.5.2
- [lodash](https://npm.io/package/lodash.md) ^4.11.2
- [moment](https://npm.io/package/moment.md) ^2.12.0
- [history](https://npm.io/package/history.md) ^1.17.0
- [keycode](https://npm.io/package/keycode.md) ^2.1.1
- [immutable](https://npm.io/package/immutable.md) ^3.7.6
- [react-dom](https://npm.io/package/react-dom.md) ^15.1.0
- [url-parse](https://npm.io/package/url-parse.md) ^1.1.3
- [auth0-lock](https://npm.io/package/auth0-lock.md) ^9.2.1
- [classnames](https://npm.io/package/classnames.md) ^2.2.5
- [color-hash](https://npm.io/package/color-hash.md) ^1.0.3
- [highcharts](https://npm.io/package/highcharts.md) 4.2.5
- [react-fade](https://npm.io/package/react-fade.md) ^1.1.1
- [material-ui](https://npm.io/package/material-ui.md) ^0.15.4
- [react-media](https://npm.io/package/react-media.md) 1.2.1
- [react-redux](https://npm.io/package/react-redux.md) ^4.4.5
- [redux-thunk](https://npm.io/package/redux-thunk.md) ^2.1.0
- [typed-error](https://npm.io/package/typed-error.md) ^0.1.0
- [react-motion](https://npm.io/package/react-motion.md) ^0.4.3
- [react-router](https://npm.io/package/react-router.md) ^2.4.0
- [react-tether](https://npm.io/package/react-tether.md) ^0.5.2
- [highcharts-more](https://npm.io/package/highcharts-more.md) 0.0.8
- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^2.2.1
- [react-highcharts](https://npm.io/package/react-highcharts.md) ^8.3.0
- [react-router-redux](https://npm.io/package/react-router-redux.md) ^4.0.4
- [react-addons-update](https://npm.io/package/react-addons-update.md) ^15.1.0
- [react-event-listener](https://npm.io/package/react-event-listener.md) ^0.1.1
- [react-tap-event-plugin](https://npm.io/package/react-tap-event-plugin.md) ^1.0.0
- [@onespot/cloudinary-utils](https://npm.io/package/@onespot/cloudinary-utils.md) ^1.0.2
- [@onespot/onespot-elastic-search](https://npm.io/package/@onespot/onespot-elastic-search.md) ^0.1.17

## Recent versions

- 1.0.0 (latest) — 2016-11-18

## README

## Onespot Dashboard 


## Build

Using webpack to build the project.
A lot of the build configuration is based on - https://github.com/davezuko/react-redux-starter-kit

## Continuous Integration/Deployment

We use CircleCI to build the onespot dashboard. The build does the following steps

1. Lint the src files using ESLint
2. Run the flow type checker to check for any type errors
3. Run the tests
4. Build the project (bundle, uglify)
5. On green build, if we are on the master branch, upload the build artifacts to a versioned folder on S3
6. On green build, auto deploy the latest code to http://staging.dashboard.onespot.com

The build artifacts are uploaded to s3://onespot-dashboard/lib/builds/${version}/ where ${version} is the following -
${package.json version number}-${circleci build number}

The version number is also set in the code as part of the build process, and we make it available as a parameter on the
window object. To check the version number from the website, open the console and log out '\__DASHBOARD_VERSION__'. This 
version number also includes the git hash of the build.

## Deployment

The site is served from an S3 bucket configured to serve a website. 

Because we are not using hash history we need to add a rewrite rule to the s3 bucket. See this stackoverflow question detailing the rules that need to be added: 
http://stackoverflow.com/questions/16267339/s3-static-website-hosting-route-all-paths-to-index-html

Current staging server at http://staging.dashboard.onespot.com/

To deploy to the demo server, call the 'deploy-to-demo.sh' script in the project root, passing in the version number you wish
to deploy e.g.:  
```
./deploy-to-demo.sh 1.0.0-65
```

The script just copies the artifacts from the s3://onespot-dashboard/lib/builds/ folder to the demo s3 bucket


#### Deploying in progress code

If want to deploy some in progress code that is not merged in to master, you can use the 'npm run deploy:staging' command
to build and push the current code you are working on to http://onespot-dashboard-staging.s3-website-us-east-1.amazonaws.com/
This is a separate bucket that we can use for this purpose.

## CSS 

Currently uses CSS modules - https://github.com/css-modules/css-modules and some inline styling.
CSS modules is probably a better approach but material-ui uses inline styles so there are some cases where we 
have to use them.
Adding support for css modules is on their roadmap, so we may be able to clean this up in time.



## Dataloading

The app consists of two types of components - 

1. Container components - wired up to selected global state by redux, handle data fetching, state updates 
2. Presentional components - concerned with how things look, get their properties passed in to them, not aware of redux 


Data loading for the container components (bubblegraph, location map, time line, posts, visitors etc) is handled in the 
same way - 

1. Update the atom to indicate that we are making an api request for the component - the UI can then show a loading icon in this case
2. When the api call completes parse the response and set it on the global atom under the components key
3. Clear the loading indictor in the atom

The only thing that changes between the different component requests is
 
1. How the state maps to the api url
2. How the response should be parsed

There is a convenience method to create the data loading methods, which take the component key, a function to map the state to a url, and a function to parse the response.

See - (src/data-loading/data-loader.js) for the implementation.


## Testing
Currently using mocha, chai and sinon for mocking and stubbing.
Tests currently run in node, we need to add some tests that run in the browser. 

Integration testing
Looking at karma with phantom js

---
_Source: https://npm.io/package/onespot-dashboard-prototype · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
