GithubHelp home page GithubHelp logo

alex-cory / bodhi-ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bodhiproject/bodhi-ui

0.0 3.0 0.0 9.06 MB

ReactJS frontend that interacts with the Bodhi backend services

Home Page: https://www.bodhi.network/

License: GNU Lesser General Public License v3.0

JavaScript 99.08% HTML 0.43% Shell 0.05% CSS 0.44%

bodhi-ui's Introduction

Bodhi UI

ReactJS frontend that interacts with the Bodhi backend services

Travis Build Status

Get Started

Requirements

  • Node version greater than 8.6.0
  • Yarn or npm version greater than 6.0.0

Install

$ git clone https://github.com/bodhiproject/bodhi-ui.git
$ cd bodhi-ui
$ yarn
$ yarn upgrade    // this is important
$ npm install

Development Environment

To run the development server, run the corresponding run script and the API will point to the remote server with the correct port. After compilation, it will show success commands & automatically redirect to the browser. Any code changes will be observed and will hot reload.

// Accepted Flags
--localwallet   // Change compatibility for tx signing with a local wallet program, eg. Qtum Wallet

// Mainnet chain
$ yarn start:mainnet

// Testnet chain
$ yarn start:testnet

// Regtest chain - very fast block mining, can also mine blocks with API call
$ yarn start:regtest

To run the development server and point to a localhost server, run the following:

// Testnet chain on localhost
$ cd bodhi-server
$ npm run testnet:local   // Runs local testnet bodhi-server
$ cd bodhi-ui
$ yarn start:local        // Points to local testnet server

Production Build

To create an optimized production build of the app, you need to run a build command in you terminal at app root. Use the build command specific to the chain you want to point to. The build output files will be in /build.

// Accepted Flags
--chain=        // Sets the chain env variables. One of: mainnet, testnet, regtest
--localwallet   // Change compatibility for tx signing with a local wallet program, eg. Qtum Wallet
--output=       // Sets the output folder of the build files

// Mainnet chain
$ yarn build --chain=mainnet

// Testnet chain
$ yarn build --chain=testnet

// Regtest chain - very fast block mining, can also mine blocks with API call
$ yarn build --chain=regtest

Production Build Script

To create all production versions of the UI on the remote server, run /scripts/build-server-ui.sh. It will create deploy it to /var/www/bodhi/... and Nginx will handle the serving of the static app.

Standards

Javascript Standard

Airbnb Javascript Style Guide

Linting

$ npm run lint:fix    // get sweet link checking and fixing
$ npm run lint        // to see whats wrong

Localization

react-intl is used for localization.

Using FormattedMessage

  • Try to use FormattedMessage whenever possible.
  • id should match the id in the JSON file with all the strings.
  • Put the default text inside defaultMessage.
  • Dynamic variables can be declared in the values property.
<FormattedMessage
  id='app.greeting'
  description='Greeting to welcome the user to the app'
  defaultMessage='Hello, {name}!'
  values={{
    name: 'Eric'
  }}
/>

Using formatMessage

  • For use with inline strings like string templates.
  • Define messages at the top of the file using defineMessages.
const messages = defineMessages({
  greeting: {
    id: 'app.greeting',
    defaultMessage: 'Hello, {name}!',
  },
});

const localizedMessage = this.props.intl.formatMessage(messages.greeting, { { name: 'Eric' }});
// localizedMessage = 'Hello, Eric!'

Run Language Script

  1. Run npm run build:langs
  2. Update the newly translated strings in the corresponding language file. The language file is in ./src/languageProvider/locales.

LGPL-3.0 License

bodhi-ui's People

Contributors

alex-cory avatar amazingandyyy avatar bernardhan avatar chrisli30 avatar datoshy avatar dwalintukan avatar frankobe avatar goodthomas avatar ippudo avatar liviavinci avatar liviazhang avatar tt1943 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.