davidar / vector-web

Vector+IPFS
https://ipfs.io/ipfs/QmUTJhudRGn2QRUz8eJ7wn8wxvpaJa5eBmhEexcwdPNa7h
Apache License 2.0
2 stars 0 forks source link

Vector/Web

Vector is a Matrix web client built using the Matrix React SDK (https://github.com/matrix-org/matrix-react-sdk).

Getting started

  1. Install or update node.js so that your npm is at least at version 2.0.0
  2. Clone the repo: git clone https://github.com/vector-im/vector-web.git
  3. Switch to the SDK directory: cd vector-web
  4. Install the prerequisites: npm install
  5. Switch to the example directory: cd examples/vector
  6. Install the example app prerequisites: npm install
  7. Build the example and start a server: npm start

Now open http://127.0.0.1:8080/ in your browser to see your newly built Vector.

Development

To work on the CSS and Javascript and have the bundle files update as you change the source files, you'll need to do two extra things:

  1. Link the react sdk package into the example: cd vector-web/examples/vector; npm link ../../
  2. Start a watcher for the CSS files: cd vector-web; npm run start:css

Note that you may need to restart the CSS builder if you add a new file. Note that npm start builds debug versions of the javascript and CSS, which are much larger than the production versions build by the npm run build commands.

IMPORTANT: If you customise components in your application (and hence require react from your app) you must be sure to:

  1. Make your app depend on react directly
  2. If you npm link matrix-react-sdk, manually remove the 'react' directory from matrix-react-sdk's node_modules folder, otherwise browserify will pull in both copies of react which causes the app to break.

How to customise the SDK

The matrix-react-sdk provides well-defined reusable UI components which may be customised/replaced by the developer to build into an app. A set of consistent UI components (View + CSS classes) is called a 'skin' - currently the SDK provides a very vanilla whitelabelled 'base skin'. In future the SDK could provide alternative skins (probably by extending the base skin) that provide more specific look and feels (e.g. "IRC-style", "Skype-style") etc. However, unlike Wordpress themes and similar, we don't normally expect app developers to define reusable skins. Instead you just go and incorporate your view customisations into your actual app.

The SDK uses the 'atomic' design pattern as seen at http://patternlab.io to encourage a very modular and reusable architecture, making it easy to customise and use UI widgets independently of the rest of the SDK and your app. In practice this means:

With all this in mind, here's how you go about skinning the react SDK UI components to embed a Matrix client into your app:

For more specific detail on any of these steps, look at the custom example in matrix-react-sdk/examples.