Git Product home page Git Product logo

substrate-light-ui's Introduction

license Actions Status Dependabot Status CodeClimate

Lichen (working title, previously "Substrate Light UI")

Lichen is a light-client-based, in-browser wallet for Substrate.

The Light UI is meant to be an intuitive interface for beginner users to easily interact with various Substrate chains. It is provided in two forms:

  • A Chrome/Firefox browser extension
  • A desktop application, built with Electron

Both provide the same functionalities and use the same UI, feel free to choose the medium that suits you best.

A very alpha version of the browser extension can be found in the Github Releases page.

You can also check out the master branch and build from source.

Overview

As of v0.3.0, the main functions are as follows:

  • Identity management - manage accounts and addresses, including ability to create, edit, restore, backup, and forget them.
  • Transfer balance - send and receive funds in the currency of the relevant substrate chain.
  • Embed a light client in a browser extension, and let Light UI be the user interface of this extension.

And here is a rough roadmap of what's coming next (see the v0.4.0-MVP milestone for details):

  • Handle changing:
    • provider,
    • chain spec,
    • user uploaded light client WASM blob or chain spec.
  • Provider injection inside dapps.
  • Improve overall beginner-friendliness (e.g. #67).

Build from sources

Dependencies

Make sure you have yarn >= 1.13.0 and nodejs >= 10.10.0. Then run

git clone https://github.com/paritytech/substrate-light-ui
cd ./substrate-light-ui
yarn install

Run the Browser Extension

yarn build:extension

Then install the extension:

  • Chrome:
    • go to chrome://extensions/
    • ensure you have the Development flag set
    • "Load unpacked" and point to packages/extension-app/build
    • if developing, after making changes - refresh the extension
  • Firefox:
    • go to about:debugging#addons
    • check "Enable add-on debugging"
    • click on "Load Temporary Add-on" and point to packages/extension-app/build/manifest.json
    • if developing, after making changes - reload the extension

Run the Electron App

For now, you need to bundle a Substrate node manually into the Electron app. To do so, first build a Substrate node for your platform (note: it can of course be a Polkadot/Kusama node, or any other Substrate node), and copy it as ./packages/electron-app/static/substrate:

cp /path/to/polkadot ./packages/electron-app/static/substrate

Then run:

yarn build:electron

The building might take some time, but you should see an Electron application after a while.

Troubleshooting: If it hangs on a white screen in Electron even though it has compiled and has been syncing for a long time, then simply choose 'View > Reload' (CMD + R on macOS) from the Electron menu.

Contributing

We welcome any and all contributions whether it is in the form of raising an issue, filing a PR, or participating in the discussions. Please read the Contributing Docs first.

Run with Hot-Reloading

If you would like to run this project with hot-reloading, use the following commands:

  • yarn start:ui: If you would only like to modify the UI, run this command and visit http://localhost:3000
  • yarn start:electron: Run the Electron app with hot reloading

substrate-light-ui's People

Contributors

amaury1093 avatar axelchalon avatar dependabot-preview[bot] avatar dependabot[bot] avatar goldsteinsveta avatar ltfschoen avatar pmespresso avatar shawntabrizi avatar siman avatar stefie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

substrate-light-ui's Issues

Minimized Header (identity card)

Just to have more space to work with, and also since the identity card is meant to just be a quick overview of, well, identity, it should be minimizable.

Then when user wants to see more things, or actually do something more involved with managing their identity, they can expand and go about their business.

header

Wire up Api

Use ApiRx for now, just showing the balance should be enough.

Find a nice way to connect ApiRx to React props: HOC (like light.js-react, or @polkadot/ui-api), or <Subscribable />?

` naclKeypairFromSeed(mnemonicToSeed(mnemonic))` takes a lot of time

Screenshot 2019-03-11 at 16 37 28

When I click on the refresh button here, it takes 2-3 seconds on my machine to generate a new keypair.

After adding some console.logs, it's this part that's slow.

private generateAddressFromMnemonic (mnemonic: string): string {
const { keyring } = this.context;
const keypair = naclKeypairFromSeed(mnemonicToSeed(mnemonic));
return keyring.encodeAddress(
keypair.publicKey
);
}

More console.logs should be added to investigate further.

update keyring.loadAll()

should look like:

 keyring.loadAll({
      addressPrefix: properties.get('networkId') || found.networkId as any,
      isDevelopment: isTestChain(chain || ''),
      type: 'ed25519'
    });

once Schnorkkel support PR polkadot-js/apps#710 is in

Confusion between wallet/account/address

Screenshot 2019-03-13 at 11 34 05

This screen is a bit confusing imo:

  • address book: I can't see the list of my addresses. The tab only allows adding addresses, and redirects to transfer
  • on the right are my accounts, but adding them is done on the left, either with Wallet (= add with phrase) or Create Account (= add new one).

Some ideas:

  • Remove the term "Wallet". Do as polkadot/apps, use "Accounts" for my accounts, and "Addresses" for my saved addresses.
  • Maybe have 2 panes: one on the left to see/add/remove my accounts (i.e. the current "Saved Accounts" pane, + a button to add/remove accounts); and one similar one on the right for my saved addresses.

Improve developer experience when debugging using styled-components

After implementing styled-components into the Fether project in this PR openethereum/fether#357, I found that when I tried went to debug in Dev Tools > Elements, it displays the CSS class name value of HTML elements as a hash of the styled-component name i.e.
<div class="sc-EHOje dGUdfn">, whereas previously it showed the class name.

To solve the issue I installed relevant tooling (see https://www.styled-components.com/docs/tooling) 'babel-plugin-styled-components' plugin that displays the style-component name that we specified instead of just the hash that's meaningless to me i.e. <div class="App__DivContent-sc-1l7hwf9-0 jhbGUD">, where DivContent is the name of the styled-component that we created.

However in this project we are using TypeScript, so we'd need this plugin https://www.styled-components.com/docs/tooling#typescript-plugin

Balances units knobs

Like in apps, be able to choose the granularity of the units on the particular chain.

Electron Packaging

To close this issue, we'd need to:

  • successfully run the electron-builder to generate a distributable
  • run the executable from multiple different machines
  • manually test that the features work on each machine

--

I've iceboxed this as we'd need to keep testing this as the project develops, so no point in doing it at this stage, though it's coming up.

Add precommit hook for common styling mistakes

tsc --noEmit and
Stuff like:

  • indentation
  • prop ordering
  • whitespaces
  • variable names too short or too long
  • lines that go on for too long
  • import ordering (absolute external paths vs. absolute same-workspace paths vs. relative paths)
  • ... and other stuff but these are the main annoyances

Failed to compile on `yarn start`

After yarn, yarn start I got errors in a console:

@polkadot/light-apps: Compiling...
@polkadot/light-apps: Failed to compile.
@polkadot/light-apps: /Users/alex/code/substrate-light-ui/packages/light-apps/src/Content/index.tsx
@polkadot/light-apps: Type error: Cannot find module '@polkadot/ui-components'.  TS2307
@polkadot/light-apps:      5 | import React from 'react';
@polkadot/light-apps:      6 | import { withRouter, RouteComponentProps } from 'react-router';
@polkadot/light-apps:   >  7 | import { Container, IdentityCard } from '@polkadot/ui-components';
@polkadot/light-apps:        |                                         ^
@polkadot/light-apps:      8 | 
@polkadot/light-apps:      9 | import routing from '../routing';
@polkadot/light-apps:     10 | import NotFound from './NotFound';

Storybook Second Pass

This is a nice to have but I think it will become increasingly useful as the project gets bigger. Basically Automated Visual Testing alerts us whenever a component doesn't visually look as expected. Complements unit tests (later on for more involved business logic), as "In a majority of cases, what a user sees is what you really care about, not how it was achieved."

Automated Visual Testing: https://storybook.js.org/docs/testing/automated-visual-testing/

TS: Don't use definitions inside build/ folders

Right now:

  1. We build each package's TS (yarn start does that), and put it in the correspondent build/ folder
  2. Other packages use the generated definitions from these build/ folder

Ideally:

  1. We don't need to build each package's TS
  2. Other packages use directly the source .ts files

Cf @polkadot/* projects, and the usage of baseUrl and paths fields in tsconfig.json. Make it work with CRA2.

Color Theme

use styled components theme for color scheme

LoadingScreen component

Places to add this:

  • While Submit Transfer hasn't yet Finalised
  • While connecting to node
  • While getting Balance

Governance App

I don't think this would be in the scope of the MVP but it is definitely coming up so opening this issue to start a discussion.

Update: July 19, 2019. Brain dump some ideas from the retreat.

Since users won't be authoring blocks or anything with the light client, I propose the governance app on substrate-light-ui will be to:
--- CORE

  • - Allow users to keep up with and vote on active proposals and upcoming referenda on the particular chain the user is subscribed to.
  • - Allow users to view and vote on the current council and its operating parameters.
    • - Bring in ability to vote on council as well, need to think more deeply on the UX to guide them toward a thoughtful decision. and more so towards guiding them away from thoughtless ones.
  • - Allow users opt to nominate validators instead perhaps as part of the onboarding process and ideally never have to think about it again. [WIP] #434 #390

--- NICE TO HAVE

  • - Figure out a way to make 1-click nomination actually a workable UX, particularly concerning the accounts setup and balance allocation between the accounts.
  • - Allow users to subscribe to certain types of governance referenda/proposals regarding which
    they wish to be notified, i.e. a broweser/taskbar notification, email, even SMS via Twilio
  • [ ]

They will not be able to participate in:

  • anything related to council Edit: yes, they are currently able to view the active council and eventually also to have a vote, but there'd need to be some more thought given to how to make that process mistake-proof as possible before letting that genie out of the box.
  • reporting misbehaviors Edit: this is only part of the consensus so of course it won't be a UI option.
  • proposing a runtime upgrade, or proposing anything at all, actually. Eventually, will include some more commonplace

https://wiki.parity.io/Validator-Set-Tutorial-4.html

Update FreeBalance Codec to Balance Type

Affected areas:

light-apps/IdentityCard.tsx:148
transfer-app/Saved:
identity-app/SavedAccounts:

Blocked by: @polkadot/api needs to have TS support for the freeBalances query

Decide what to put inside ui-components

Looking at the ui-components package (https://github.com/paritytech/substrate-light-ui/tree/d7a0759f8f40ec57a4f709e96c19254f12af2139/packages/ui-components/src), I feel that it's going to be a huge dump of UI-stuff-we-don't-know-where-to-put very soon, a la parity-js/ui.

I propose, in the ui-components package, to put only UI components that satisfy either:

  • Component is used across multiple other packages
  • Component might be used by external projects

It would be wise also to split components inside ui-components into:

  • those that are theme-related (Container, button, ...), i.e. the basics
  • those that are somewhat intelligent/complex (CopyButton, AddressSummary)

All other UI used inside the app should be app-specific components, hance don't go inside ui-components, but inside the relevant app.

We could also use Storybook to organize the UI components.

These are only ideas for now, what do you think?

Identity Change Shouldn't Require a forceUpdate()

Currently, after my PR in #36 the following actions require a forcible update of the entire component tree to show up. This is quite💩UX-wise and should be fixed:

  • Select account in Saved Accounts
  • Forget account in Identity Card (currently it looks like it actually updates but that is by manually setting state)
  • Adding account from Wallet

Potentially add types field to root tsconfig

Right now we're by default importing all the types from @types hence the issues with duplicate identifiers, i.e. we're getting duplicates from @types/react-native and styled-components even though not even making a react native app...

So we can specify exactly which types we want. something like:

{
  "extends": "./node_modules/@polkadot/dev/config/tsconfig",
  "types": ["node", "jest", "styled-components"] 
}

The only hesitation is that we need to be vigilant about the types field as more components get added throughout development. Especially as currently the only time the duplicate identifier issue comes up is with version 4.1.3 of styled-components and reverting to v4.1.0 solves the issue. If it comes up again somewhere else, this is defintiely a go. As of now, onice.

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.