Skip to content
This repository was archived by the owner on Jan 14, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
432 changes: 432 additions & 0 deletions ui/contracts/BlockApps.sol

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions ui/initfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"errorCodes": {
"contractName": "ErrorCodes",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
},
"version": {
"contractName": "Version",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
},
"userRole": {
"contractName": "UserRole",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
},
"user": {
"contractName": "User",
"contractFilename": "contracts/BlockApps.sol",
"args": {
"_account": "78fcb4b5c16e83d63866f0b82544cdf475710075",
"_username": "ABC",
"_pwHash": "qiyh4XPJGsOZ2MEAyLkfWqeQ",
"_id": "1000000000",
"_role": "ADMIN"
}
},
"util": {
"contractName": "Util",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
},
"userManager": {
"contractName": "UserManager",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
},
"projectState": {
"contractName": "ProjectState",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
},
"project": {
"contractName": "Project",
"contractFilename": "contracts/BlockApps.sol",
"args": {
"_name": "ABC",
"_buyer": "XYZ",
"_description": "DEFG",
"_spec": "HIJ",
"_price": "1000",
"_created": "1281930090",
"_targetDelivery": "1681930090"
}
},
"projectEvent": {
"contractName": "ProjectEvent",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
},
"bidState": {
"contractName": "BidState",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
},
"bid": {
"contractName": "Bid",
"contractFilename": "contracts/BlockApps.sol",
"args": {
"_id": "1000000000",
"_name": "ABC",
"_supplier": "XYZ",
"_amount": "1000"
}
},
"projectManager": {
"contractName": "ProjectManager",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
},
"adminInterface": {
"contractName": "AdminInterface",
"contractFilename": "contracts/BlockApps.sol",
"args": {}
}
}
9 changes: 6 additions & 3 deletions ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "ui",
"author": "BlockApps Inc",
"version": "0.1.0",
"private": true,
"homepage": ".",
"dependencies": {
"mixpanel-browser": "^2.11.1",
"react": "15.5.4",
Expand All @@ -22,7 +24,8 @@
"devDependencies": {
"node-sass": "^4.5.2",
"npm-run-all": "^4.0.2",
"react-scripts": "0.9.5"
"react-scripts": "0.9.5",
"read-package-json": "^2.0.13"
},
"scripts": {
"build-css": "node-sass src/ -o src/",
Expand All @@ -32,8 +35,8 @@
"start:back": "npm-run-all -p watch-css start-js > stdout.text 2> stderr.txt &",
"start-js-windows": "react-scripts start",
"start-windows": "npm-run-all -p watch-css start-js-windows",
"build": "npm run build-css && react-scripts build",
"build": "npm run build-css && react-scripts build && cp initfile.json ./build && node scripts/create-metadata.js && cp -a contracts ./build && cd build && zip -r app.zip *",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
}
1 change: 1 addition & 0 deletions ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="addresses.js"></script>
<!--
Notice the use of %PUBLIC_URL% in the tag above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
22 changes: 22 additions & 0 deletions ui/scripts/create-metadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const readJson = require('read-package-json');
const fs = require('fs');

readJson('package.json', (err, data) => {
if (err) {
console.log('Could not read package.json', err);
return;
}

const metadata = {
name: data.name,
description: data.description,
maintainer: data.author.name,
version: data.version,
};

fs.writeFile('build/metadata.json',JSON.stringify(metadata,null,2), 'utf8', (err) => {
if(err) {
console.log('Failed to write metadata.json', err);
}
});
});
4 changes: 2 additions & 2 deletions ui/src/components/App/components/UserBadge/user-badge.saga.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
userBalanceSuccess,
userBalanceFailure
} from './user-badge.actions';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';
import { API_URL, API_MOCK } from '../../../../environment';
import { handleApiError } from '../../../../lib/apiErrorHandler';

Expand Down Expand Up @@ -47,7 +47,7 @@ function* submitGetBalance(action) {
{
yield put(userBalanceFailure(err));
}
browserHistory.push('/projects');
hashHistory.push('/projects');
}

export default function* watchBalanceSubmit() {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/EnsureAuthenticated/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component } from 'react';
import { connect } from 'react-redux';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';

class EnsureAuthenticated extends Component {
componentDidMount() {
if(!this.props.authenticated) {
browserHistory.replace('/login');
hashHistory.replace('/login');
}
}

Expand Down
4 changes: 2 additions & 2 deletions ui/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
import { Router, hashHistory } from 'react-router';
import routes from './routes';
import { Provider } from 'react-redux';
import { syncHistoryWithStore } from 'react-router-redux';
Expand All @@ -9,7 +9,7 @@ import './index.css';
import { IntlProvider } from 'react-intl'

const store = configureStore();
const history = syncHistoryWithStore(browserHistory, store);
const history = syncHistoryWithStore(hashHistory, store);

ReactDOM.render(
<Provider store={store}>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/scenes/Login/login.saga.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
userLoginSuccess,
userLoginFailure
} from './login.actions';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';
import { API_URL, API_MOCK } from '../../environment';
import { handleApiError } from '../../lib/apiErrorHandler';
import { showLoading, hideLoading } from 'react-redux-loading-bar';
Expand Down Expand Up @@ -59,7 +59,7 @@ function* submitLogin(action) {
yield put(userLoginFailure(err));
yield put(hideLoading());
}
browserHistory.push('/projects');
hashHistory.push('/projects');
}

export default function* watchLoginSubmit() {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/scenes/Projects/components/BidModal/bidModal.saga.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
bidSuccess,
bidFailure
} from './bidModal.actions';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';
import { API_URL, API_MOCK } from '../../../../environment';
import { handleApiError } from '../../../../lib/apiErrorHandler';
import { showLoading, hideLoading } from 'react-redux-loading-bar';
Expand Down Expand Up @@ -54,7 +54,7 @@ function* submitBid(action){
yield put(hideLoading());
yield put(bidSuccess());
yield put(setUserMessage('Bid Success'));
browserHistory.goBack();
hashHistory.goBack();
}
catch(err) {
yield put(hideLoading());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
acceptBidSuccess,
acceptBidFailure
} from '../actions/acceptBid.actions';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';
import { API_URL, API_MOCK } from '../../../../../../../../../environment';
import { handleApiError } from '../../../../../../../../../lib/apiErrorHandler';
import { showLoading, hideLoading } from 'react-redux-loading-bar';
Expand Down Expand Up @@ -49,7 +49,7 @@ function* acceptBid(action){
yield put(acceptBidSuccess());
yield put(userBalanceSubmit(action.username));
yield put(setUserMessage('Bid Accepted'));
browserHistory.goBack(); // todo: update current project data on the page instead?
hashHistory.goBack(); // todo: update current project data on the page instead?
}
catch(err) {
yield put(acceptBidFailure(err));
Expand Down
4 changes: 2 additions & 2 deletions ui/src/scenes/Projects/components/Project/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';
import Button from 'react-md/lib/Buttons/Button';
import Chip from 'react-md/lib/Chips';
import Toolbar from 'react-md/lib/Toolbars';
Expand Down Expand Up @@ -118,7 +118,7 @@ class Project extends Component {
onClick={(e) => {
e.stopPropagation();
mixpanel.track('home_click');
browserHistory.push('/projects');
hashHistory.push('/projects');
}
}>
home
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
projectEventSuccess,
projectEventFailure
} from '../actions/project-event.actions';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';
import { API_URL, API_MOCK } from '../../../../../environment';
import { handleApiError } from '../../../../../lib/apiErrorHandler';
import { PROJECT_EVENTS } from '../../../../../constants';
Expand Down Expand Up @@ -52,7 +52,7 @@ function* projectEvent(action){
yield put(userBalanceSubmit(action.username));
yield put(hideLoading());
yield put(setUserMessage('Item ' + PROJECT_EVENTS[action.projectEvent]));
browserHistory.goBack(); // todo: update current project data on the page instead?
hashHistory.goBack(); // todo: update current project data on the page instead?
}
catch(err) {
yield put(projectEventFailure(err));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
projectCreateSuccess,
projectCreateFailure
} from '../actions/project-create.actions';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';
import { API_URL } from '../../../../../environment';
import { handleApiError } from '../../../../../lib/apiErrorHandler';
import { showLoading, hideLoading } from 'react-redux-loading-bar';
Expand Down Expand Up @@ -38,7 +38,7 @@ function* submitProjectCreate(action) {
if(response.data.project) {
yield put(projectCreateSuccess(response.data.project));
yield put(setUserMessage('Contract Created Successfully'));
browserHistory.push('/projects');
hashHistory.push('/projects');
yield put(setUserMessage('Contract Created Successfully'));
}
}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/scenes/Projects/components/ProjectList/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';
import { FormattedNumber, FormattedDate } from 'react-intl';

import Card from 'react-md/lib/Cards/Card';
Expand All @@ -25,7 +25,7 @@ class ProjectList extends Component {
handleProjectClick = function (e, projectName) {
e.stopPropagation();
mixpanel.track('project_click');
browserHistory.push(`/projects/${encodeURI(projectName)}`);
hashHistory.push(`/projects/${encodeURI(projectName)}`);
};

render() {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/scenes/Projects/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { browserHistory } from 'react-router';
import { hashHistory } from 'react-router';
import { connect } from 'react-redux';
import Button from 'react-md/lib/Buttons/Button';
import Toolbar from 'react-md/lib/Toolbars';
Expand All @@ -12,7 +12,7 @@ class Projects extends Component {
handleNewProjectClick = function(e) {
e.stopPropagation();
mixpanel.track('create_project_modal_click');
browserHistory.push(`/projects/create`);
hashHistory.push(`/projects/create`);
};

// TODO: move to common place
Expand Down