Reorganisation + Electron fixes (#118)

* Updates package versions

* Updating versions with RCs

* Updated landing page with stock images

* Begins refactoring of websocket
Adds Help component

* Dark theme for charts

* event Event

* Adds cryptocurrency font
Updates wallet to use it

* Rejigs the location of assets

* rxjs update
wallet font correction

* renaming websocket service

* Refactors websocket use
Destroys and subscribes appropriately
Also handles when websocket is not available with intervals

* Fixes issues with electron by rebasing with Maxime GRIS electron builder

* License change

* Readme update

* Parses available and enabled currencies to create an object {Name:X, Enabled:Y}

* Adds methods to convert from string arrays to objects with enabled status for all currencies

* Uses a localstorage cache for config for 15 minutes

* Moves handling of settings to config object

* Fix typescripting

* Fixes issue with saving and loading

* Slows websocket repeats
Adds cool new dictionary style item and iterable.
Updatres currency-list.component to list all enabled currencies and exchanges (still doesn't do anything)

* Updates selected-currency.component to display all currencies ticker updates if there is no selected currency
Will display only selected currency results once it is set
Sets a new property to ensure all currency names are consistent for currency list plans

* Fixes issue where only one component could listen to the websocket at once
Allows you to select a currency in exchange grid mode

* Adds selected currency support to buy & sell components
Updates selected currency ticker to update on change faster

* Adds Online status indicator

* Removal of console.logs for working features

* Allows currency-list.component to aggregate on currency and list exchanges that match it

* Highlights selected currency in currency-list.component
Allows you to select a currency
This commit is contained in:
Scott
2018-05-04 15:07:11 +10:00
committed by Adrian Gallagher
parent 1a473fb59c
commit d882c1dff4
141 changed files with 15572 additions and 7927 deletions

View File

@@ -1,7 +1,7 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "angular-electron"
"name": "gocryptotrader-web"
},
"apps": [
{
@@ -9,7 +9,9 @@
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
"favicon.ico",
"favicon.png",
"favicon.256x256.png"
],
"index": "index.html",
"main": "main.ts",
@@ -21,8 +23,7 @@
"styles": [
"styles.scss"
],
"scripts": [
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
@@ -37,13 +38,16 @@
},
"lint": [
{
"project": "src/tsconfig.app.json"
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json"
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json"
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
@@ -53,7 +57,6 @@
},
"defaults": {
"styleExt": "scss",
"component": {
}
"component": {}
}
}

2
web/.gitignore vendored
View File

@@ -5,6 +5,7 @@
/tmp
/out-tsc
/app-builds
main.js
# dependencies
/node_modules
@@ -33,6 +34,7 @@
npm-debug.log
testem.log
/typings
package-lock.json
# e2e
/e2e/*.js

View File

@@ -1,194 +1,7 @@
Apache License
==============
Copyright 2018 - GloriousCode
Copyright 2017 - Maxime GRIS
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
_Version 2.0, January 2004_
_&lt;<http://www.apache.org/licenses/>&gt;_
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
### Terms and Conditions for use, reproduction, and distribution
#### 1. Definitions
“License” shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
“Licensor” shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
“Legal Entity” shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, “control” means **(i)** the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
outstanding shares, or **(iii)** beneficial ownership of such entity.
“You” (or “Your”) shall mean an individual or Legal Entity exercising
permissions granted by this License.
“Source” form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
“Object” form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
“Work” shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
“Derivative Works” shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
“Contribution” shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
“submitted” means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as “Not a Contribution.”
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
#### 2. Grant of Copyright License
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
#### 3. Grant of Patent License
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
#### 4. Redistribution
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
this License; and
* **(b)** You must cause any modified files to carry prominent notices stating that You
changed the files; and
* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
#### 5. Submission of Contributions
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
#### 6. Trademarks
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
#### 7. Disclaimer of Warranty
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
#### 8. Limitation of Liability
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
#### 9. Accepting Warranty or Additional Liability
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
_END OF TERMS AND CONDITIONS_
### APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets `[]` replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same “printed page” as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -46,32 +46,41 @@ npm install -g @angular/cli
npm run start:web
```
Voila! You can use GoCryptoTrader web app in a local development environment with webpack watching!
Currently runs with:
## To build for production
- Angular v5.2.5
- Angular-CLI v1.6.4
- Electron v1.8.2
- Electron Builder v20.0.4
+ Using development variables (environments/index.ts) : `npm run electron:dev`
+ Using production variables (environments/index.prod.ts) : `npm run electron:prod`
Your built files are in the /dist folder.
## To build for development
- **in a terminal window** -> npm start
Voila! You can use your Angular + Electron app in a local development environment with hot reload !
## Manage your environment variables
- Using local variables : `npm start` or `cross-env ENV=local npm start`
- Using development variables : `cross-env ENV=dev npm start`
- Using production variables : `cross-env ENV=prod npm start`
## Included Commands
|Command|Description|
|--|--|
|`npm run start:web`| Execute the app in the brower |
|`npm run ng:serve`| Execute the app in the browser |
|`npm run start:web`| Execute the app in the browser |
|`npm run build`| Build the app. Your built files are in the /dist folder. |
|`npm run build:prod`| Build the app with Angular aot. Your built files are in the /dist folder. |
|`npm run electron:local`| Builds your application and start electron
|`npm run electron:linux`| Builds your application and creates an app consumable on linux system |
|`npm run electron:windows`| On a Windows OS, builds your application and creates an app consumable in windows 32/64 bit systems |
|`npm run electron:mac`| On a MAC OS, builds your application and generates a `.app` file of your application that can be run on Ma |
|`npm run electron:mac`| On a MAC OS, builds your application and generates a `.app` file of your application that can be run on Mac |
## Execute E2E tests
**Your application is optimised. Only /dist folder and node dependencies are included in the executable.**
You can find end-to-end tests in /e2e folder.
You can run tests with the command lines below:
+ **in a terminal window** -> First, start a web server on port 4200 : `npm run start:web`
+ **in another terminal window** -> Then, launch Protractor (E2E framework): `npm run e2e`
## Contributors
@@ -94,9 +103,8 @@ When submitting a PR, please abide by our coding guidelines:
## Donations
<img src="https://github.com/thrasher-/gocryptotrader/blob/master/web/src/assets/early-dumb-donate.png?raw=true" hspace="70">
<img src="https://github.com/thrasher-/gocryptotrader/blob/master/web/src/assets/images/donate.png?raw=true" hspace="70">
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -9,6 +9,7 @@ describe('angular-electron App', () => {
});
it('should display message saying App works !', () => {
page.navigateTo('/');
expect(element(by.css('app-home h1')).getText()).toMatch('App works !');
});
});

24
web/electron-builder.json Normal file
View File

@@ -0,0 +1,24 @@
{
"productName": "gocyrptotrader-web",
"directories": {
"output": "app-builds"
},
"win": {
"icon": "dist",
"target": [
"portable"
]
},
"mac": {
"icon": "dist",
"target": [
"dmg"
]
},
"linux": {
"icon": "dist",
"target": [
"AppImage"
]
}
}

View File

@@ -0,0 +1,196 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Cordova Hooks
Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. Hook scripts could be defined by adding them to the special predefined folder (`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run serially in the following order:
* Application hooks from `/hooks`;
* Application hooks from `config.xml`;
* Plugin hooks from `plugins/.../plugin.xml`.
__Remember__: Make your scripts executable.
__Note__: `.cordova/hooks` directory is also supported for backward compatibility, but we don't recommend using it as it is deprecated.
## Supported hook types
The following hook types are supported:
after_build/
after_compile/
after_docs/
after_emulate/
after_platform_add/
after_platform_rm/
after_platform_ls/
after_plugin_add/
after_plugin_ls/
after_plugin_rm/
after_plugin_search/
after_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed
after_prepare/
after_run/
after_serve/
before_build/
before_compile/
before_docs/
before_emulate/
before_platform_add/
before_platform_rm/
before_platform_ls/
before_plugin_add/
before_plugin_ls/
before_plugin_rm/
before_plugin_search/
before_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed
before_plugin_uninstall/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being uninstalled
before_prepare/
before_run/
before_serve/
pre_package/ <-- Windows 8 and Windows Phone only.
## Ways to define hooks
### Via '/hooks' directory
To execute custom action when corresponding hook type is fired, use hook type as a name for a subfolder inside 'hooks' directory and place you script file here, for example:
# script file will be automatically executed after each build
hooks/after_build/after_build_custom_action.js
### Config.xml
Hooks can be defined in project's `config.xml` using `<hook>` elements, for example:
<hook type="before_build" src="scripts/appBeforeBuild.bat" />
<hook type="before_build" src="scripts/appBeforeBuild.js" />
<hook type="before_plugin_install" src="scripts/appBeforePluginInstall.js" />
<platform name="wp8">
<hook type="before_build" src="scripts/wp8/appWP8BeforeBuild.bat" />
<hook type="before_build" src="scripts/wp8/appWP8BeforeBuild.js" />
<hook type="before_plugin_install" src="scripts/wp8/appWP8BeforePluginInstall.js" />
...
</platform>
<platform name="windows8">
<hook type="before_build" src="scripts/windows8/appWin8BeforeBuild.bat" />
<hook type="before_build" src="scripts/windows8/appWin8BeforeBuild.js" />
<hook type="before_plugin_install" src="scripts/windows8/appWin8BeforePluginInstall.js" />
...
</platform>
### Plugin hooks (plugin.xml)
As a plugin developer you can define hook scripts using `<hook>` elements in a `plugin.xml` like that:
<hook type="before_plugin_install" src="scripts/beforeInstall.js" />
<hook type="after_build" src="scripts/afterBuild.js" />
<platform name="wp8">
<hook type="before_plugin_install" src="scripts/wp8BeforeInstall.js" />
<hook type="before_build" src="scripts/wp8BeforeBuild.js" />
...
</platform>
`before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired exclusively for the plugin being installed/uninstalled.
## Script Interface
### Javascript
If you are writing hooks in Javascript you should use the following module definition:
```javascript
module.exports = function(context) {
...
}
```
You can make your scipts async using Q:
```javascript
module.exports = function(context) {
var Q = context.requireCordovaModule('q');
var deferral = new Q.defer();
setTimeout(function(){
console.log('hook.js>> end');
deferral.resolve();
}, 1000);
return deferral.promise;
}
```
`context` object contains hook type, executed script full path, hook options, command-line arguments passed to Cordova and top-level "cordova" object:
```json
{
"hook": "before_plugin_install",
"scriptLocation": "c:\\script\\full\\path\\appBeforePluginInstall.js",
"cmdLine": "The\\exact\\command\\cordova\\run\\with arguments",
"opts": {
"projectRoot":"C:\\path\\to\\the\\project",
"cordova": {
"platforms": ["wp8"],
"plugins": ["com.plugin.withhooks"],
"version": "0.21.7-dev"
},
"plugin": {
"id": "com.plugin.withhooks",
"pluginInfo": {
...
},
"platform": "wp8",
"dir": "C:\\path\\to\\the\\project\\plugins\\com.plugin.withhooks"
}
},
"cordova": {...}
}
```
`context.opts.plugin` object will only be passed to plugin hooks scripts.
You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way:
```javascript
var Q = context.requireCordovaModule('q');
```
__Note__: new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below.
### Non-javascript
Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
* CORDOVA_VERSION - The version of the Cordova-CLI.
* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
* CORDOVA_HOOK - Path to the hook that is being executed.
* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
If a script returns a non-zero exit code, then the parent cordova command will be aborted.
## Writing hooks
We highly recommend writing your hooks using Node.js so that they are
cross-platform. Some good examples are shown here:
[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)
Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example:
#!/usr/bin/env [name_of_interpreter_executable]

View File

@@ -0,0 +1,23 @@
import { CONF_LOCAL } from '../environments/environment.local';
import { CONF_DEV } from '../environments/environment.dev';
import { CONF_PROD } from '../environments/environment.prod';
const ENV = 'PROFILE';
const LOCAL: String = 'local';
const DEV: String = 'dev';
const PROD: String = 'prod';
let conf: any;
console.log('Env', ENV);
if (ENV === PROD) {
conf = CONF_PROD;
} else if (ENV === DEV) {
conf = CONF_DEV;
} else {
conf = CONF_LOCAL;
}
export const AppConfig = Object.assign({}, conf);

View File

@@ -0,0 +1,20 @@
// require:
var replace = require("replace");
var fs = require('fs-extra');
var path = require('path');
// use:
var profile = process.env.ENV ? process.env.ENV : 'local';
console.log('Moving the configuration detection file template ...');
fs.copySync(path.resolve(__dirname,'./app.config.ts.tpl'), path.resolve(__dirname,'../../src/app/app.config.ts'));
console.log('Application profile : ' + profile);
replace({
regex: "'PROFILE'",
replacement: "'" + profile + "'",
paths: ['src/app/app.config.ts'],
recursive: true,
silent: true,
});

View File

@@ -0,0 +1,23 @@
import { CONF_LOCAL } from '../environments/environment.local';
import { CONF_DEV } from '../environments/environment.dev';
import { CONF_PROD } from '../environments/environment.prod';
const ENV = 'PROFILE';
const LOCAL: String = 'local';
const DEV: String = 'dev';
const PROD: String = 'prod';
let conf: any;
console.log('Env', ENV);
if (ENV === PROD) {
conf = CONF_PROD;
} else if (ENV === DEV) {
conf = CONF_DEV;
} else {
conf = CONF_LOCAL;
}
export const AppConfig = Object.assign({}, conf);

View File

@@ -0,0 +1,23 @@
import { CONF_LOCAL } from '../environments/environment.local';
import { CONF_DEV } from '../environments/environment.dev';
import { CONF_PROD } from '../environments/environment.prod';
const ENV = 'PROFILE';
const LOCAL: String = 'local';
const DEV: String = 'dev';
const PROD: String = 'prod';
let conf: any;
console.log('Env', ENV);
if (ENV === PROD) {
conf = CONF_PROD;
} else if (ENV === DEV) {
conf = CONF_DEV;
} else {
conf = CONF_LOCAL;
}
export const AppConfig = Object.assign({}, conf);

View File

@@ -1,14 +1,15 @@
import { app, BrowserWindow, screen } from 'electron';
import * as path from 'path';
import * as url from 'url';
let win, serve;
const args = process.argv.slice(1);
serve = args.some(val => val === '--serve');
if (serve) {
require('electron-reload')(__dirname, {
});
try {
require('dotenv').config();
} catch {
console.log('asar');
}
function createWindow() {
@@ -24,14 +25,20 @@ function createWindow() {
height: size.height
});
// and load the index.html of the app.
win.loadURL('file://' + __dirname + '/index.html');
// Open the DevTools.
if (serve) {
win.webContents.openDevTools();
require('electron-reload')(__dirname, {
electron: require(`${__dirname}/node_modules/electron`)});
win.loadURL('http://localhost:4200');
} else {
win.loadURL(url.format({
pathname: path.join(__dirname, 'dist/index.html'),
protocol: 'file:',
slashes: true
}));
}
win.webContents.openDevTools();
// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store window

19389
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,60 +0,0 @@
"use strict";
var packager = require('electron-packager');
const pkg = require('./package.json');
const argv = require('minimist')(process.argv.slice(1));
const appName = argv.name || pkg.name;
const buildVersion = pkg.version || '1.0';
const shouldUseAsar = argv.asar || false;
const shouldBuildAll = argv.all || false;
const arch = argv.arch || 'all';
const platform = argv.platform || 'darwin';
const DEFAULT_OPTS = {
dir: './dist',
name: appName,
asar: shouldUseAsar,
buildVersion: buildVersion
};
pack(platform, arch, function done(err, appPath) {
if (err) {
console.log(err);
} else {
console.log('Application packaged successfuly!', appPath);
}
});
function pack(plat, arch, cb) {
// there is no darwin ia32 electron
if (plat === 'darwin' && arch === 'ia32') return;
let icon = 'src/favicon';
if (icon) {
DEFAULT_OPTS.icon = icon + (() => {
let extension = '.png';
if (plat === 'darwin') {
extension = '.icns';
} else if (plat === 'win32') {
extension = '.ico';
}
return extension;
})();
}
const opts = Object.assign({}, DEFAULT_OPTS, {
platform: plat,
arch,
prune: true,
overwrite: true,
all: shouldBuildAll,
out: `app-builds`
});
console.log(opts)
packager(opts, cb);
}

View File

@@ -1,6 +1,6 @@
{
"name": "gocryptotrader-web",
"version": "0.1.0",
"version": "0.3.0",
"description": "Front-end interface for GoCryptoTrader",
"homepage": "https://github.com/thrasher-/gocryptotrader",
"author": {
@@ -27,97 +27,72 @@
"main": "main.js",
"private": true,
"scripts": {
"postinstall": "npx electron-builder install-app-deps",
"ng": "ng",
"lint": "ng lint",
"start": "webpack --watch",
"start:web": "webpack-dev-server --content-base . --port 4200 --inline",
"build:electron:main": "tsc main.ts --outDir dist && copyfiles package.json dist && cd dist && npm install --prod && cd ..",
"build": "webpack --display-error-details && npm run build:electron:main",
"build:prod": "cross-env NODE_ENV=production npm run build",
"electron:serve": "npm run build:electron:main && electron ./dist --serve",
"electron:test": "electron ./dist",
"electron:dev": "npm run build && electron ./dist",
"electron:prod": "npm run build:prod && electron ./dist",
"electron:linux": "npm run build:prod && node package.js --asar --platform=linux --arch=x64",
"electron:windows": "npm run build:prod && node package.js --asar --platform=win32 --arch=ia32",
"electron:mac": "npm run build:prod && node package.js --asar --platform=darwin --arch=x64",
"start": "node hooks/environments/set_profile.js && npm-run-all -p ng:serve electron:serve",
"build": "node hooks/environments/set_profile.js && ng build && npm run electron:tsc",
"build:prod": "node hooks/environments/set_profile.js && ng build --prod && npm run electron:tsc",
"ng:serve": "ng serve -o",
"electron:tsc": "tsc main.ts",
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:tsc && electron . --serve",
"electron:local": "npm run build:prod && electron .",
"electron:linux": "npm run build:prod && npx electron-builder build --linux",
"electron:windows": "npm run build:prod && npx electron-builder build --windows",
"electron:mac": "npm run build:prod && npx electron-builder build --mac",
"test": "karma start ./karma.conf.js",
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet && npm run build",
"e2e": "protractor ./protractor.conf.js"
},
"dependencies": {
"@amcharts/amcharts3-angular": "^2.0.3",
"@angular/animations": "5.2.2",
"@angular/cdk": "5.2.4",
"@angular/common": "5.2.2",
"@angular/compiler": "5.2.2",
"@angular/core": "5.2.2",
"@angular/forms": "5.2.2",
"@angular/http": "5.2.2",
"@angular/material": "5.2.4",
"@angular/platform-browser": "5.2.2",
"@angular/platform-browser-dynamic": "5.2.2",
"@angular/router": "5.2.2",
"@ngtools/webpack": "1.9.6",
"amstock3": "^3.21.12",
"core-js": "2.4.1",
"enhanced-resolve": "3.3.0",
"extract-text-webpack-plugin": "^3.0.2",
"html-webpack-plugin": "^2.30.1",
"node-sass": "^4.7.2",
"rxjs": "^5.5.0",
"zone.js": "0.8.12"
"pree2e:build": "webdriver-manager update --gecko false && npm run ng serve",
"pree2e:protractor": "wait-on http-get://localhost:4200/ && protractor ./protractor.conf.js",
"e2e": "npm-run-all -p -r pree2e:build pree2e:protractor",
"start:web": "ng serve -o"
},
"dependencies": {},
"devDependencies": {
"@angular/cli": "1.6.6",
"@angular/compiler-cli": "5.2.2",
"@types/bluebird": "3.5.8",
"@angular/cli": "1.7.4",
"@angular/common": "5.2.9",
"@angular/compiler": "5.2.9",
"@angular/compiler-cli": "5.2.9",
"@angular/core": "5.2.9",
"@angular/forms": "5.2.9",
"@angular/http": "5.2.9",
"@angular/animations": "5.2.9",
"@angular/language-service": "5.2.9",
"@angular/platform-browser": "5.2.9",
"@angular/platform-browser-dynamic": "5.2.9",
"@angular/router": "5.2.9",
"@angular/material": "5.2.5",
"@angular/cdk": "5.2.5",
"@amcharts/amcharts3-angular": "2.1.0",
"@ngx-translate/core": "9.1.1",
"@ngx-translate/http-loader": "2.0.1",
"@types/core-js": "0.9.36",
"@types/jasmine": "2.5.53",
"@types/jasmine": "2.8.6",
"@types/jasminewd2": "2.0.3",
"@types/node": "7.0.7",
"autoprefixer": "7.1.1",
"codelyzer": "4.1.0",
"copyfiles": "1.2.0",
"cross-env": "5.0.1",
"css-loader": "0.28.4",
"cssnano": "3.10.0",
"electron": "1.6.16",
"electron-packager": "8.7.2",
"electron-reload": "1.2.1",
"exports-loader": "0.6.4",
"extract-zip": "=1.6.5",
"file-loader": "0.11.2",
"html-loader": "0.4.5",
"istanbul-instrumenter-loader": "2.0.0",
"jasmine-core": "2.6.4",
"jasmine-spec-reporter": "4.1.1",
"json-loader": "0.5.4",
"karma": "1.7.0",
"codelyzer": "4.2.1",
"core-js": "2.5.5",
"cross-env": "5.1.4",
"dotenv": "5.0.1",
"electron": "1.8.4",
"electron-builder": "20.8.1",
"electron-reload": "1.2.2",
"fs-extra": "5.0.0",
"jasmine-core": "2.99.1",
"jasmine-spec-reporter": "4.2.1",
"karma": "2.0.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "0.2.0",
"karma-jasmine": "1.1.0",
"karma-coverage-istanbul-reporter": "1.4.2",
"karma-jasmine": "1.1.1",
"karma-jasmine-html-reporter": "0.2.2",
"karma-sourcemap-loader": "0.3.7",
"less-loader": "4.0.4",
"minimist": "1.2.0",
"mkdirp": "0.5.1",
"postcss-loader": "1.3.3",
"postcss-url": "7.0.0",
"protractor": "5.1.2",
"raw-loader": "0.5.1",
"sass-loader": "6.0.6",
"script-loader": "0.7.0",
"source-map-loader": "0.2.1",
"style-loader": "0.18.2",
"stylus-loader": "3.0.1",
"ts-node": "3.1.0",
"tslint": "5.4.3",
"typescript": "2.4.2",
"url-loader": "0.5.9",
"npm-run-all": "4.1.2",
"npx": "10.0.1",
"protractor": "5.3.1",
"replace": "0.3.0",
"rxjs": "5.5.8",
"ts-node": "4.1.0",
"tslint": "5.9.1",
"typescript": "2.6.2",
"wait-on": "2.1.0",
"webdriver-manager": "12.0.6",
"webpack": "^3.10.0",
"webpack-dev-server": "2.11.1"
},
"license": "SEE LICENSE IN LICENSE.md"
"zone.js": "0.8.26"
}
}

1
web/postcss.config.js Normal file
View File

@@ -0,0 +1 @@
module.exports = {};

View File

@@ -5,7 +5,6 @@ const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 25000,
getPageTimeout: 15000,
delayBrowserTimeInSeconds: 0,
specs: [
'./e2e/**/*.e2e-spec.ts'
@@ -13,18 +12,20 @@ exports.config = {
capabilities: {
'browserName': 'chrome',
chromeOptions: {
binary: './node_modules/electron/dist/electron.exe',
args: ['--test-type=webdriver', 'app=dist/main.js']
args: ["--no-sandbox", "--headless", "--disable-gpu"]
}
},
chromeOnly: true,
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () { }
print: function () { },
realtimeFailure: true
},
useAllAngular2AppRoots: true,
beforeLaunch: function () {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'

View File

@@ -53,6 +53,10 @@ const routes: Routes = [
{
path: 'currency-list',
component: CurrencyListComponent
},
{
path: 'help',
component: CurrencyListComponent
}
];

View File

@@ -1,58 +1,70 @@
<app-navbar class="navbar mat-elevation-z6"></app-navbar>
<mat-sidenav-container class="container ">
<mat-sidenav #sidenav mode="side" class="sidebar" opened="true">
<mat-nav-list>
<mat-list-item routerLink="dashboard" routerLinkActive="dashboard-highlight">
<mat-icon>view_quilt</mat-icon>&nbsp;
<h3>Dashboard</h3>
</mat-list-item>
<mat-list-item routerLink="wallet" routerLinkActive="wallet-highlight">
<mat-icon>account_balance_wallet</mat-icon>&nbsp;
<h3>Wallet</h3>
</mat-list-item>
<mat-list-item routerLink="trading" routerLinkActive="trading-highlight">
<mat-icon>swap_horiz</mat-icon>&nbsp;
<h3>Trading</h3>
</mat-list-item>
<mat-list-item routerLink="history" routerLinkActive="history-highlight">
<mat-icon>history</mat-icon>&nbsp;
<h3>History</h3>
</mat-list-item>
<mat-list-item routerLink="settings" routerLinkActive="settings-highlight">
<mat-icon>settings</mat-icon>&nbsp;
<h3>Settings</h3>
</mat-list-item>
<mat-list-item routerLink="donate" routerLinkActive="donate-highlight">
<mat-icon>thumb_up</mat-icon>&nbsp;
<h3>Donate</h3>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item>
<mat-icon>grade</mat-icon>&nbsp;
<a href="https://github.com/thrasher-/gocryptotrader" target="_blank">
<h3>GitHub</h3>
</a>
</mat-list-item>
<mat-list-item>
<mat-icon>view_agenda</mat-icon>&nbsp;
<a href="https://trello.com/b/ZAhMhpOy/gocryptotrader" target="_blank">
<h3>Trello</h3>
</a>
</mat-list-item>
<mat-list-item>
<mat-icon>apps</mat-icon>&nbsp;
<a href="https://gocryptotrader.herokuapp.com/" target="_blank">
<h3>Slack</h3>
</a>
</mat-list-item>
<mat-list-item>
<mat-icon>bug_report</mat-icon>&nbsp;
<a href="https://github.com/thrasher-/gocryptotrader/issues/new" target="_blank">
<h3>Report a bug</h3>
</a>
</mat-list-item>
</mat-nav-list>
</mat-sidenav>
<router-outlet class="main"></router-outlet>
</mat-sidenav-container>
<mat-sidenav #sidenav mode="side" class="sidebar" opened="true">
<mat-nav-list>
<mat-list-item routerLink="dashboard" routerLinkActive="dashboard-highlight">
<mat-icon>view_quilt</mat-icon>&nbsp;
<h3>Dashboard</h3>
</mat-list-item>
<mat-list-item routerLink="wallet" routerLinkActive="wallet-highlight">
<mat-icon>account_balance_wallet</mat-icon>&nbsp;
<h3>Wallet</h3>
</mat-list-item>
<mat-list-item routerLink="trading" routerLinkActive="trading-highlight">
<mat-icon>swap_horiz</mat-icon>&nbsp;
<h3>Trading</h3>
</mat-list-item>
<mat-list-item routerLink="history" routerLinkActive="history-highlight">
<mat-icon>history</mat-icon>&nbsp;
<h3>History</h3>
</mat-list-item>
<mat-list-item routerLink="settings" routerLinkActive="settings-highlight">
<mat-icon>settings</mat-icon>&nbsp;
<h3>Settings</h3>
</mat-list-item>
<mat-list-item routerLink="help_outline" routerLinkActive="help-highlight">
<mat-icon>help</mat-icon>&nbsp;
<h3>Help</h3>
</mat-list-item>
<mat-list-item routerLink="donate" routerLinkActive="donate-highlight">
<mat-icon>thumb_up</mat-icon>&nbsp;
<h3>Donate</h3>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item>
<mat-icon>grade</mat-icon>&nbsp;
<a href="https://github.com/thrasher-/gocryptotrader" target="_blank">
<h3>GitHub</h3>
</a>
</mat-list-item>
<mat-list-item>
<mat-icon>view_agenda</mat-icon>&nbsp;
<a href="https://trello.com/b/ZAhMhpOy/gocryptotrader" target="_blank">
<h3>Trello</h3>
</a>
</mat-list-item>
<mat-list-item>
<mat-icon>apps</mat-icon>&nbsp;
<a href="https://gocryptotrader.herokuapp.com/" target="_blank">
<h3>Slack</h3>
</a>
</mat-list-item>
<mat-list-item>
<mat-icon>bug_report</mat-icon>&nbsp;
<a href="https://github.com/thrasher-/gocryptotrader/issues/new" target="_blank">
<h3>Report a bug</h3>
</a>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item *ngIf="isConnected" matTooltip="Online!">
<mat-icon>network_wifi</mat-icon>&nbsp;
</mat-list-item>
<mat-list-item *ngIf="!isConnected" matTooltip="Offline">
<mat-icon>signal_wifi_off</mat-icon>&nbsp;
</mat-list-item>
</mat-nav-list>
</mat-sidenav>
<router-outlet class="main"></router-outlet>
</mat-sidenav-container>

View File

@@ -41,6 +41,10 @@
color: blueviolet !important;
}
.help-highlight {
color: red !important;
}
.settings-highlight {
color: magenta !important;
}

View File

@@ -3,6 +3,7 @@ import { ElectronService } from './providers/electron.service';
import { MatSidenav } from '@angular/material';
import { SidebarService } from './services/sidebar/sidebar.service';
import { Router, NavigationEnd } from '@angular/router';
import {WebsocketResponseHandlerService }from './services/websocket-response-handler/websocket-response-handler.service';
@Component({
selector: 'app-root',
@@ -11,10 +12,12 @@ import { Router, NavigationEnd } from '@angular/router';
})
export class AppComponent {
sidebarService: SidebarService
public currentUrl:string;
public currentUrl: string;
@ViewChild('sidenav') public sidenav: MatSidenav;
private ws : WebsocketResponseHandlerService;
public isConnected :boolean = false;
constructor(public electronService: ElectronService,something: SidebarService, private router:Router) {
constructor(public electronService: ElectronService, sidebarService: SidebarService, private router: Router, private websocketHandler: WebsocketResponseHandlerService) {
if (electronService.isElectron()) {
console.log('Mode electron');
@@ -26,18 +29,26 @@ export class AppComponent {
console.log('Mode web');
}
this.sidebarService = something;
router.events.subscribe(event => {
this.isConnected = this.websocketHandler.isConnected;
this.sidebarService = sidebarService;
router.events.subscribe(event => {
if (event instanceof NavigationEnd ) {
console.log("current url",event.url); // event.url has current url
this.currentUrl = event.url;
}
});
if (event instanceof NavigationEnd) {
this.isConnected = this.websocketHandler.isConnected;
console.log("current url", event.url); // event.url has current url
this.currentUrl = event.url;
}
});
var interval = setInterval(() => {
this.isConnected = this.websocketHandler.isConnected;
}, 2000);
}
ngOnInit() {
this.sidebarService.setSidenav(this.sidenav);
}
//This will be replaced with a log in prompt which will then add the credentials to session storage
window.sessionStorage["username"] = "admin";
window.sessionStorage["password"] = "e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a";
}
}

23
web/src/app/app.config.ts Normal file
View File

@@ -0,0 +1,23 @@
import { CONF_LOCAL } from '../environments/environment.local';
import { CONF_DEV } from '../environments/environment.dev';
import { CONF_PROD } from '../environments/environment.prod';
const ENV = 'local';
const LOCAL: String = 'local';
const DEV: String = 'dev';
const PROD: String = 'prod';
let conf: any;
console.log('Env', ENV);
if (ENV === PROD) {
conf = CONF_PROD;
} else if (ENV === DEV) {
conf = CONF_DEV;
} else {
conf = CONF_LOCAL;
}
export const AppConfig = Object.assign({}, conf);

View File

@@ -42,9 +42,10 @@ import { DonateComponent } from './pages/donate/donate.component';
import { NavbarComponent } from './shared/navbar/navbar.component';
import { AllEnabledCurrencyTickersComponent } from './shared/all-updates-ticker/all-updates-ticker.component';
import { ThemePickerComponent } from './shared/theme-picker/theme-picker';
import {IterateMapPipe, EnabledCurrenciesPipe} from './shared/classes/pipes';
//services
import { WebsocketService } from './services/websocket/websocket.service';
import { WebsocketHandlerService } from './services/websocket-handler/websocket-handler.service';
import { WebsocketResponseHandlerService } from './services/websocket-response-handler/websocket-response-handler.service';
import { SidebarService } from './services/sidebar/sidebar.service';
import { ElectronService } from './providers/electron.service';
import { StyleManagerService } from './services/style-manager/style-manager.service';
@@ -69,6 +70,7 @@ import { BuyFormComponent } from './shared/buy-form/buy-form.component';
import { ExchangeGridComponent } from './pages/exchange-grid/exchange-grid.component';
import { CurrencyListComponent } from './pages/currency-list/currency-list.component';
import { SellFormComponent } from './shared/sell-form/sell-form.component';
import { HelpComponent } from './pages/help/help.component';
@NgModule({
@@ -95,6 +97,9 @@ import { SellFormComponent } from './shared/sell-form/sell-form.component';
ExchangeGridComponent,
CurrencyListComponent,
SellFormComponent,
HelpComponent,
IterateMapPipe,
EnabledCurrenciesPipe
],
imports: [
BrowserModule,
@@ -124,7 +129,7 @@ import { SellFormComponent } from './shared/sell-form/sell-form.component';
providers: [
ElectronService,
WebsocketService,
WebsocketHandlerService,
WebsocketResponseHandlerService,
SidebarService,
StyleManagerService,
ThemeStorageService,

View File

@@ -1,35 +1,23 @@
<mat-list>
<h3 matSubheader>Poloniex</h3>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>BTC_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>LTC_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>ETH_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
<mat-divider></mat-divider>
<h3 matSubheader>Kraken</h3>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>BTC_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>LTC_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>ETH_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
</mat-list>
<mat-accordion>
<mat-expansion-panel *ngFor="let currency of exchangeCurrencies | iterateMap">
<mat-expansion-panel-header [ngClass]="{'selected' : selectedCurrency == currency.value}" >
<mat-panel-title>
{{currency.value}}
</mat-panel-title>
<mat-panel-description>
</mat-panel-description>
</mat-expansion-panel-header>
image and blurb
<div>
<i>Only displaying enabled currencies</i>
</div>
<form class="form-content">
<mat-list>
<mat-list-item [ngClass]="{'selected' : selectedExchange == exchange}" *ngFor="let exchange of currency.key" >
<h4 matLine>{{exchange}}</h4>
<button mat-button (click)="selectCurrency(exchange, currency.value)">SELECT</button>
</mat-list-item>
</mat-list>
</form>
</mat-expansion-panel>
</mat-accordion>

View File

@@ -6,4 +6,8 @@
}
.ETH {
color:darkslategrey;
}
.selected, .selected:hover, .selected:focus, .selected::selection {
background: rgba(100,250,100,0.2);
}

View File

@@ -1,15 +1,73 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, OnDestroy, Pipe, PipeTransform} from '@angular/core';
import { WebsocketResponseHandlerService} from './../../services/websocket-response-handler/websocket-response-handler.service';
import { WebSocketMessageType, WebSocketMessage} from './../../shared/classes/websocket';
import { Config, CurrencyPairRedux} from './../../shared/classes/config';
import { EnabledCurrenciesPipe, IterateMapPipe} from './../../shared/classes/pipes';
@Component({
selector: 'app-currency-list',
templateUrl: './currency-list.component.html',
styleUrls: ['./currency-list.component.scss']
styleUrls: ['./currency-list.component.scss'],
})
export class CurrencyListComponent implements OnInit {
public settings: Config = new Config();
private ws: WebsocketResponseHandlerService;
public selectedCurrency :string;
public selectedExchange :string;
public exchangeCurrencies: Map <string, string[] > = new Map < string, string[] > ();
constructor() { }
constructor(private websocketHandler: WebsocketResponseHandlerService) {
this.selectedExchange = window.localStorage["selectedExchange"];
this.selectedCurrency = window.localStorage["selectedCurrency"];
this.ws = websocketHandler;
this.ws.shared.subscribe(msg => {
if (msg.event === WebSocketMessageType.GetConfig) {
this.settings.setConfig(msg.data);
this.getExchangeCurrencies();
}
});
}
ngOnInit() {
this.getSettings();
}
public selectCurrency(exchange:string,currency:string) {
window.localStorage["selectedExchange"] = exchange;
window.localStorage["selectedCurrency"] = currency;
this.selectedExchange = window.localStorage["selectedExchange"];
this.selectedCurrency = window.localStorage["selectedCurrency"];
}
public getExchangeCurrencies(): void {
for (var i = 0; i < this.settings.Exchanges.length; i++) {
if (this.settings.Exchanges[i].Enabled === true) {
for (var j = 0; j < this.settings.Exchanges[i].Pairs.length; j++) {
if(this.settings.Exchanges[i].Pairs[j].Enabled) {
if(this.exchangeCurrencies.has(this.settings.Exchanges[i].Pairs[j].ParsedName)) {
var array = this.exchangeCurrencies.get(this.settings.Exchanges[i].Pairs[j].ParsedName);
array.push(this.settings.Exchanges[i].Name);
this.exchangeCurrencies.set(this.settings.Exchanges[i].Pairs[j].ParsedName, array);
} else {
var exchangeArray = new Array<string>();
exchangeArray.push(this.settings.Exchanges[i].Name);
this.exchangeCurrencies.set(this.settings.Exchanges[i].Pairs[j].ParsedName, exchangeArray);
}
}
}
}
}
this.exchangeCurrencies.forEach((value: string[], key: string) => {});
}
private getSettings(): void {
if (this.settings.isConfigCacheValid()) {
this.settings.setConfig(JSON.parse(window.localStorage['config']))
this.getExchangeCurrencies();
} else {
this.ws.messages.next(WebSocketMessage.GetSettingsMessage());
}
}
}

View File

@@ -40,7 +40,7 @@ mat-card-footer button {
position: fixed;
top: auto;
right: 5rem;
bottom: 3rem;
bottom: 5rem;
left: auto;
z-index: 2;
display: flex;
@@ -49,7 +49,7 @@ mat-card-footer button {
.buy-sell-card {
width: 20rem;
height: 22rem;
height: 24rem;
margin-left: auto;
margin-right: 1rem;
z-index: 3;

View File

@@ -1,17 +1,17 @@
<mat-card class="full-card">
<mat-card class="full-card">
<mat-card-header>
<mat-card-title>Donations</mat-card-title>
<mat-card-subtitle>We give our thanks</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<img class="heart" src="/assets/early-dumb-donate.png"/>
<p>If this framework helped you in any way, or you would like to support the developers working on it, please donate</p>
<mat-list>
<mat-list-item >
<mat-icon mat-list-icon class="BTC">attach_money</mat-icon>
<h4 mat-line>Address:</h4>
<h4 mat-line>1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB</h4>
</mat-list-item>
</mat-list>
<img class="heart" src="./assets/images/donate.png" />
<p>If this framework helped you in any way, or you would like to support the developers working on it, please donate</p>
<mat-list>
<mat-list-item>
<mat-icon mat-list-icon class="BTC">attach_money</mat-icon>
<h4 mat-line>Address:</h4>
<h4 mat-line>1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB</h4>
</mat-list-item>
</mat-list>
</mat-card-content>
</mat-card>

View File

@@ -1,59 +1,22 @@
<mat-accordion>
<mat-expansion-panel >
<mat-expansion-panel-header>
<mat-expansion-panel *ngFor="let exchange of exchangeCurrencies | iterateMap">
<mat-expansion-panel-header [ngClass]="{'selected' : selectedExchange == exchange.value}">
<mat-panel-title>
Poloniex
{{exchange.value}}
</mat-panel-title>
<mat-panel-description>
</mat-panel-description>
</mat-expansion-panel-header>
image and blurb
<div>
<i>Only displaying enabled currencies</i>
</div>
<form class="form-content">
<mat-list>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>BTC_USD</h4>
<button mat-button>SELECT</button>
<mat-list-item [ngClass]="{'selected' : selectedCurrency == currency.ParsedName}" *ngFor="let currency of exchange.key | enabledCurrencies" >
<h4 matLine>{{currency.ParsedName}}</h4>
<button mat-button (click)="selectCurrency(exchange.value,currency.ParsedName)">SELECT</button>
</mat-list-item>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>LTC_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>ETH_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
</mat-list>
</form>
</mat-expansion-panel><mat-expansion-panel >
<mat-expansion-panel-header>
<mat-panel-title>
Kraken
</mat-panel-title>
<mat-panel-description>
</mat-panel-description>
</mat-expansion-panel-header>
image and blurb
<form class="form-content">
<mat-list>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>BTC_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>LTC_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
<mat-list-item >
<mat-icon matListIcon>attach_money</mat-icon>
<h4 matLine>ETH_USD</h4>
<button mat-button>SELECT</button>
</mat-list-item>
</mat-list>
</form>
</mat-expansion-panel>

View File

@@ -0,0 +1,3 @@
.selected, .selected:hover, .selected:focus, .selected::selection {
background: rgba(100,250,100,0.2);
}

View File

@@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, OnDestroy, Pipe, PipeTransform} from '@angular/core';
import { WebsocketResponseHandlerService} from './../../services/websocket-response-handler/websocket-response-handler.service';
import { WebSocketMessageType, WebSocketMessage} from './../../shared/classes/websocket';
import { Config, CurrencyPairRedux} from './../../shared/classes/config';
import { EnabledCurrenciesPipe, IterateMapPipe} from './../../shared/classes/pipes';
@Component({
selector: 'app-exchange-grid',
@@ -6,10 +10,54 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./exchange-grid.component.scss']
})
export class ExchangeGridComponent implements OnInit {
public settings: Config = new Config();
private ws: WebsocketResponseHandlerService;
public selectedCurrency :string;
public selectedExchange :string;
public exchangeCurrencies: Map < string, CurrencyPairRedux[] > = new Map < string, CurrencyPairRedux[] > ();
constructor() { }
ngOnInit() {
constructor(private websocketHandler: WebsocketResponseHandlerService) {
this.selectedExchange = window.localStorage["selectedExchange"];
this.selectedCurrency = window.localStorage["selectedCurrency"];
this.ws = websocketHandler;
this.ws.shared.subscribe(msg => {
if (msg.event === WebSocketMessageType.GetConfig) {
this.settings.setConfig(msg.data);
this.getExchangeCurrencies();
}
});
}
ngOnInit() {
this.getSettings();
}
public selectCurrency(exchange:string,currency:string) {
window.localStorage["selectedExchange"] = exchange;
window.localStorage["selectedCurrency"] = currency;
this.selectedExchange = window.localStorage["selectedExchange"];
this.selectedCurrency = window.localStorage["selectedCurrency"];
}
public getExchangeCurrencies(): void {
for (var i = 0; i < this.settings.Exchanges.length; i++) {
if (this.settings.Exchanges[i].Enabled === true) {
this.exchangeCurrencies.set(this.settings.Exchanges[i].Name, this.settings.Exchanges[i].Pairs)
}
}
this.exchangeCurrencies.forEach((value: CurrencyPairRedux[], key: string) => {});
}
private getSettings(): void {
if (this.settings.isConfigCacheValid()) {
this.settings.setConfig(JSON.parse(window.localStorage['config']))
this.getExchangeCurrencies();
} else {
this.ws.messages.next(WebSocketMessage.GetSettingsMessage());
}
}
}

View File

@@ -0,0 +1,3 @@
<p>
help works!
</p>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HelpComponent } from './help.component';
describe('HelpComponent', () => {
let component: HelpComponent;
let fixture: ComponentFixture<HelpComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HelpComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HelpComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-help',
templateUrl: './help.component.html',
styleUrls: ['./help.component.scss']
})
export class HelpComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@@ -1,5 +1,56 @@
<div class="docs-homepage-promo">
<h2 class="mat-h1">Welcome to GoCryptoTrader</h2>
<h1 class="mat-h1">Welcome to GoCryptoTrader</h1>
<p>GoCryptoTrader is a multi-currency, multi-exchange trader for cryptocurrencies</p>
<p>It is under active development and you can see its development progress by clicking the trello button to the left</p>
<p>If you like what you see, consider clicking the donation button to the left</p>
<div class="docs-homepage-row">
<div class="docs-homepage-promo-img">
<img src="./assets/exchanges.jpg" />
</div>
<div class="docs-homepage-promo-desc">
<h2>Multi-currency, multi-exchange</h2>
<p>With support for over 25 of the top cryptocurrency exchanges</p>
<div class="docs-homepage-bottom-start">
<a mat-raised-button class="docs-button" routerLink="dashboard">Get started</a>
</div>
</div>
</div>
<div class="docs-homepage-row docs-homepage-reverse-row">
<div class="docs-homepage-promo-img">
<img src="./assets/loop.png" />
</div>
<div class="docs-homepage-promo-desc">
<h2>High speed, low drag</h2>
<p>Constant checking of all enabled exchanges* to get you the most up to date information</p>
<div class="docs-homepage-bottom-start">
<a mat-raised-button class="docs-button" routerLink="dashboard">Get started</a>
</div>
</div>
</div>
<div class="docs-homepage-row">
<div class="docs-homepage-promo-img">
<img src="./assets/centralised.png" />
</div>
<div class="docs-homepage-promo-desc">
<h2>Centralised management</h2>
<p>Add and manage all your wallets from one application</p>
<div class="docs-homepage-bottom-start">
<a mat-raised-button class="docs-button" routerLink="dashboard">Get started</a>
</div>
</div>
</div>
<div class="docs-homepage-row docs-homepage-reverse-row">
<div class="docs-homepage-promo-img">
<img src="./assets/material.png" />
</div>
<div class="docs-homepage-promo-desc">
<h2>Optimized for Angular</h2>
<p>The latest tech with Material design lets you focus on what's important</p>
<div class="docs-homepage-bottom-start">
<a mat-raised-button class="docs-button" routerLink="dashboard">Get started</a>
</div>
</div>
</div>
<div class="docs-homepage-bottom-start">
<a mat-raised-button class="docs-button" routerLink="dashboard">Get started</a>
</div>
</div>

View File

@@ -1,3 +1,71 @@
.example-card {
width: 400px;
}
.docs-homepage-promo {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
padding: 16px;
}
.docs-homepage-promo h2 {
font-size: 25px;
font-weight: 400;
margin: 0 0 16px 0;
padding: 0;
}
.docs-homepage-promo p {
font-size: 16px;
font-weight: 400;
line-height: 28px;
margin: 0 0 24px 0;
padding: 0;
}
.docs-homepage-promo-img img {
max-width: 90%;
max-height: 300px;
}
.docs-homepage-promo-desc {
line-height: 2;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.docs-homepage-promo-desc,
.docs-homepage-promo-img {
width: 50%;
}
.docs-homepage-promo-img {
text-align: center;
}
.docs-homepage-row {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 50%;
margin: 60px 0;
}
.docs-homepage-reverse-row {
-webkit-box-orient: horizontal;
-webkit-box-direction: reverse;
-ms-flex-direction: row-reverse;
flex-direction: row-reverse;
}

View File

@@ -7,7 +7,7 @@
<mat-accordion>
<mat-expansion-panel *ngIf="settings.SMSGlobal != null">
<mat-expansion-panel-header >
<mat-expansion-panel-header>
<mat-panel-title>
SMS Global
</mat-panel-title>
@@ -15,7 +15,7 @@
SMS configuration and contact management
<mat-icon>phone_iphone</mat-icon>
</mat-panel-description>
</mat-expansion-panel-header>
</mat-expansion-panel-header>
<form class="form-content">
<mat-checkbox name="smsEnabled" [(ngModel)]="settings.SMSGlobal.Enabled">Enabled</mat-checkbox>
<div mat-line></div>
@@ -53,25 +53,23 @@
<form class="form-content">
<mat-checkbox name="exchangeEnabled" [(ngModel)]="exchange.Enabled">Enabled</mat-checkbox>
<div mat-line></div>
<mat-form-field>
<input matInput name="apiKey" [(ngModel)]="exchange.APIKey" [disabled]="!exchange.Enabled" placeholder="API Key*">
</mat-form-field>
<mat-form-field>
<input matInput name="apiSecretKey" [(ngModel)]="exchange.APISecret" [disabled]="!exchange.Enabled" placeholder="API Secret Key*">
</mat-form-field>
<mat-form-field>
<input matInput name="apiClientId" [(ngModel)]="exchange.ClientID" [disabled]="!exchange.Enabled" placeholder="API ClientID">
</mat-form-field>
<div mat-line></div>
<mat-panel-description>
Enabled Currency pairs {{enabledCurrencies.selectedOptions.selected.length}} - Managed via config temporarily
</mat-panel-description>
<div mat-line></div>
<mat-selection-list #enabledCurrencies>
<mat-list-option [disabled]="!exchange.Enabled || true" *ngFor="let currency of exchange.AvailablePairs.split(',')">
{{currency}}
</mat-list-option>
</mat-selection-list>
<mat-form-field>
<input matInput name="apiKey" [(ngModel)]="exchange.APIKey" [disabled]="!exchange.Enabled" placeholder="API Key*">
</mat-form-field>
<mat-form-field>
<input matInput name="apiSecretKey" [(ngModel)]="exchange.APISecret" [disabled]="!exchange.Enabled" placeholder="API Secret Key*">
</mat-form-field>
<mat-form-field>
<input matInput name="apiClientId" [(ngModel)]="exchange.ClientID" [disabled]="!exchange.Enabled" placeholder="API ClientID">
</mat-form-field>
<div mat-line></div>
<h4>
Enabled currencies
</h4>
<div *ngFor="let currency of exchange.Pairs">
<p>{{currency.Name}}</p>
<mat-checkbox name="{{currency.Name}}2" [(ngModel)]="currency.Enabled"></mat-checkbox>
</div>
</form>
</mat-expansion-panel>
</mat-accordion>

View File

@@ -1,145 +1,50 @@
import { Component, OnInit } from '@angular/core';
import { WebsocketHandlerService } from './../../services/websocket-handler/websocket-handler.service';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { WebsocketResponseHandlerService } from './../../services/websocket-response-handler/websocket-response-handler.service';
import { WebSocketMessageType, WebSocketMessage } from './../../shared/classes/websocket';
import { Config, CurrencyPairRedux } from './../../shared/classes/config';
@Component({
selector: 'app-settings',
templateUrl: './settings.component.html',
styleUrls: ['./settings.component.scss']
styleUrls: ['./settings.component.scss'],
})
export class SettingsComponent implements OnInit {
public settings: Config = null;
private ws: WebsocketHandlerService;
private failCount = 0;
private timer: any;
public settings: Config = new Config();
private ws: WebsocketResponseHandlerService;
private getSettingsMessage = {
Event: 'GetConfig',
data: null,
};
constructor(private websocketHandler: WebsocketHandlerService) {
constructor(private websocketHandler: WebsocketResponseHandlerService) {
this.ws = websocketHandler;
this.ws.messages.subscribe(msg => {
if (msg.Event === 'GetConfig') {
this.settings = <Config>msg.data;
} else if (msg.Event === 'SaveConfig') {
// something!
}
});
}
ngOnInit() {
this.ws.shared.subscribe(msg => {
if (msg.event === WebSocketMessageType.GetConfig) {
this.settings.setConfig(msg.data);
} else if (msg.event === WebSocketMessageType.SaveConfig) {
// check if err is returned, then display some notification
}
});
this.getSettings();
}
private getSettings(): void {
this.ws.messages.next(this.getSettingsMessage);
this.resendMessageIfPageRefreshed();
if(this.settings.isConfigCacheValid()) {
this.settings.setConfig(JSON.parse(window.localStorage['config']))
} else {
this.ws.messages.next(WebSocketMessage.GetSettingsMessage());
}
}
private saveSettings(): void {
//Send the message
this.settings.fromReduxToArray()
var settingsSave = {
Event: 'SaveConfig',
data: this.settings,
}
this.ws.messages.next(settingsSave);
}
//there has to be a better way
private resendMessageIfPageRefreshed(): void {
if (this.failCount <= 10) {
setTimeout(() => {
if (this.settings === null) {
//console.log(this.failCount);
//console.log('Settings hasnt been set. Trying again');
this.failCount++;
this.getSettings();
}
}, 1000);
} else {
// something has gone wrong
console.log('Could not load settings. Check if GocryptoTrader server is running, otherwise open a ticket');
}
}
}
export interface CurrencyPairFormat {
Uppercase: boolean;
Delimiter: string;
}
export interface PortfolioAddresses {
Addresses?: any;
}
export interface Contact {
Name: string;
Number: string;
Enabled: boolean;
}
export interface SMSGlobal {
Enabled: boolean;
Username: string;
Password: string;
Contacts: Contact[];
}
export interface Webserver {
Enabled: boolean;
AdminUsername: string;
AdminPassword: string;
ListenAddress: string;
WebsocketConnectionLimit: number;
WebsocketAllowInsecureOrigin: boolean;
}
export interface ConfigCurrencyPairFormat {
Uppercase: boolean;
Index: string;
Delimiter: string;
}
export interface RequestCurrencyPairFormat {
Uppercase: boolean;
Index: string;
Delimiter: string;
Separator: string;
}
export interface Exchange {
Name: string;
Enabled: boolean;
Verbose: boolean;
Websocket: boolean;
RESTPollingDelay: number;
AuthenticatedAPISupport: boolean;
APIKey: string;
APISecret: string;
AvailablePairs: string;
EnabledPairs: string;
BaseCurrencies: string;
AssetTypes: string;
ConfigCurrencyPairFormat: ConfigCurrencyPairFormat;
RequestCurrencyPairFormat: RequestCurrencyPairFormat;
ClientID: string;
}
export interface Config {
Name: string;
EncryptConfig?: number;
Cryptocurrencies: string;
CurrencyExchangeProvider: string;
CurrencyPairFormat: CurrencyPairFormat;
PortfolioAddresses: PortfolioAddresses;
SMSGlobal: SMSGlobal;
Webserver: Webserver;
Exchanges: Exchange[];
}

View File

@@ -11,7 +11,7 @@
<mat-list>
<mat-list-item *ngFor="let coin of wallet?.coin_totals">
<mat-icon mat-list-icon [ngClass]="coin.coin">{{coin.icon}}</mat-icon>
<i [ngClass]="coin.icon"></i>
<h4 mat-line>{{coin.coin}}</h4>
<h4 mat-line>{{coin.balance}}</h4>
</mat-list-item>
@@ -26,21 +26,21 @@
</mat-expansion-panel-header>
<mat-list>
<mat-list-item *ngFor="let coin of wallet?.online_summary.BTC">
<mat-icon mat-list-icon class="BTC">{{coinIcon('BTC')}}</mat-icon>
<i class="cc btc"></i>
<h4 mat-line>Address: {{coin.address}}</h4>
<h4 mat-line>{{coin.balance}}{{coin.coin}} - {{coin.percentage}}%</h4>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item *ngFor="let coin of wallet?.online_summary.LTC">
<mat-icon mat-list-icon class="LTC">{{coinIcon('LTC')}}</mat-icon>
<i class="cc ltc"></i>
<h4 mat-line>Address: {{coin.address}}</h4>
<h4 mat-line>{{coin.balance}}{{coin.coin}} - {{coin.percentage}}%</h4>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item *ngFor="let coin of wallet?.online_summary.ETH">
<mat-icon mat-list-icon class="ETH">{{coinIcon('ETH')}}</mat-icon>
<i class="cc eth"></i>
<h4 mat-line>Address: {{coin.address}}</h4>
<h4 mat-line>{{coin.balance}}{{coin.coin}} - {{coin.percentage}}%</h4>
</mat-list-item>
@@ -55,21 +55,21 @@
</mat-expansion-panel-header>
<mat-list>
<mat-list-item *ngFor="let coin of wallet?.offline_summary.BTC">
<mat-icon mat-list-icon class="BTC">{{coinIcon('BTC')}}</mat-icon>
<i class="cc btc"></i>
<h4 mat-line>Address: {{coin.address}}</h4>
<h4 mat-line>{{coin.balance}}{{coin.coin}} - {{coin.percentage}}%</h4>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item *ngFor="let coin of wallet?.offline_summary.LTC">
<mat-icon mat-list-icon class="LTC">{{coinIcon('LTC')}}</mat-icon>
<i class="cc ltc"></i>
<h4 mat-line>Address: {{coin.address}}</h4>
<h4 mat-line>{{coin.balance}}{{coin.coin}} - {{coin.percentage}}%</h4>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item *ngFor="let coin of wallet?.offline_summary.ETH">
<mat-icon mat-list-icon class="ETH">{{coinIcon('ETH')}}</mat-icon>
<i class="cc eth"></i>
<h4 mat-line>Address: {{coin.address}}</h4>
<h4 mat-line>{{coin.balance}}{{coin.coin}} - {{coin.percentage}}%</h4>
</mat-list-item>
@@ -85,7 +85,7 @@
<mat-list>
<mat-list-item *ngFor="let coin of wallet?.coins_online">
<mat-icon mat-list-icon [ngClass]="coin.coin">{{coin.icon}}</mat-icon>
<i [ngClass]="coin.icon"></i>
<h4 mat-line>{{coin.coin}}</h4>
<h4 mat-line>{{coin.balance}}</h4>
</mat-list-item>
@@ -101,7 +101,7 @@
<mat-list>
<mat-list-item *ngFor="let coin of wallet?.coins_offline">
<mat-icon mat-list-icon [ngClass]="coin.coin">{{coin.icon}}</mat-icon>
<i [ngClass]="coin.icon"></i>
<h4 mat-line>{{coin.coin}}</h4>
<h4 mat-line>{{coin.balance}}</h4>
</mat-list-item>

View File

@@ -1,34 +1,33 @@
import { Component, OnInit } from '@angular/core';
import { WebsocketHandlerService } from './../../services/websocket-handler/websocket-handler.service';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { WebsocketResponseHandlerService } from './../../services/websocket-response-handler/websocket-response-handler.service';
import { Wallet, CoinTotal } from './../../shared/classes/wallet';
import {Sort} from '@angular/material';
import { Sort } from '@angular/material';
import { WebSocketMessageType, WebSocketMessage } from './../../shared/classes/websocket';
@Component({
selector: 'app-wallet',
templateUrl: './wallet.component.html',
styleUrls: ['./wallet.component.scss']
styleUrls: ['./wallet.component.scss'],
})
export class WalletComponent implements OnInit {
private ws: WebsocketHandlerService;
private ws: WebsocketResponseHandlerService;
private failCount = 0;
private timer: any;
public wallet: Wallet;
displayedColumns = ['coin', 'balance'];
private getWalletMessage = {
Event: 'GetPortfolio',
event: 'GetPortfolio',
data: null,
};
constructor(private websocketHandler: WebsocketHandlerService) {
constructor(private websocketHandler: WebsocketResponseHandlerService) {
this.wallet= null;
this.ws = websocketHandler;
this.ws.messages.subscribe(msg => {
if (msg.Event === 'GetPortfolio') {
console.log(JSON.stringify(msg.data));
this.ws.shared.subscribe(msg => {
if (msg.event === WebSocketMessageType.GetPortfolio) {
this.wallet = <Wallet>msg.data;
this.attachIcon(this.wallet.coin_totals);
this.attachIcon(this.wallet.coins_offline);
this.attachIcon(this.wallet.coins_online);
@@ -44,11 +43,19 @@ export class WalletComponent implements OnInit {
});
}
ngOnInit() {
this.setWallet();
}
private setWallet():void {
this.ws.messages.next(this.getWalletMessage);
}
public coinIcon(coin:string) :string {
switch(coin) {
case "BTC": return "attach_money";
case "LTC": return "attach_money";
case "ETH": return "attach_money";
case "BTC": return "cc BTC";
case "LTC": return "cc LTC";
case "ETH": return "cc ETH";
}
}
@@ -60,28 +67,5 @@ export class WalletComponent implements OnInit {
}
}
ngOnInit() {
this.setWallet();
}
//there has to be a better way
private resendMessageIfPageRefreshed(): void {
if (this.failCount <= 10) {
setTimeout(() => {
if (this.wallet === null || this.wallet === undefined) {
this.failCount++;
this.setWallet();
}
}, 1000);
} else {
console.log('Could not load wallet. Check if GocryptoTrader server is running, otherwise open a ticket');
}
}
private setWallet():void {
this.ws.messages.next(this.getWalletMessage);
this.resendMessageIfPageRefreshed();
}
}

View File

@@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { WebsocketHandlerService } from './websocket-handler.service';
describe('WebsocketHandlerService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [WebsocketHandlerService]
});
});
it('should be created', inject([WebsocketHandlerService], (service: WebsocketHandlerService) => {
expect(service).toBeTruthy();
}));
});

View File

@@ -1,44 +0,0 @@
import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs/Rx';
import { WebsocketService } from './../../services/websocket/websocket.service';
const WEBSOCKET_URL = 'ws://localhost:9050/ws';
export interface Message {
Event: string,
data:any,
Exchange:string,
AssetType:string
}
@Injectable()
export class WebsocketHandlerService {
public messages: Subject<any>;
private authenticateMessage = {
Event:'auth',
data:{"username":"admin","password":"e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a"},
}
public authenticate() {
this.messages.next(this.authenticateMessage);
}
constructor(wsService: WebsocketService) {
this.messages = <Subject<Message>>wsService
.connect(WEBSOCKET_URL)
.map((response: MessageEvent): Message => {
let data = JSON.parse(response.data);
// variables aren't consistent yet. Here's a hack!
var dataData = data.Data === undefined ? data.data : data.Data;
var eventEvent = data.Event === undefined ? data.event : data.Event;
return {
Event: eventEvent,
data: dataData,
Exchange: data.exchange,
AssetType: data.assetType
}
});
}
}

View File

@@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';
import { WebsocketResponseHandlerService } from './websocket-response-handler.service';
describe('WebsocketHandlerService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [WebsocketResponseHandlerService]
});
});
it('should be created', inject([WebsocketResponseHandlerService], (service: WebsocketResponseHandlerService) => {
expect(service).toBeTruthy();
}));
});

View File

@@ -0,0 +1,37 @@
import { NgModule, Injectable, Optional, SkipSelf } from '@angular/core';
import { Observable, Subject } from 'rxjs/Rx';
import { WebsocketService } from './../../services/websocket/websocket.service';
import { WebSocketMessage } from './../../shared/classes/websocket';
const WEBSOCKET_URL = 'ws://localhost:9050/ws';
@NgModule({
})
export class WebsocketResponseHandlerService {
public messages: Subject<any>;
public shared: Observable<WebSocketMessage>;
public isConnected :boolean = false;
constructor(@Optional() @SkipSelf() parentModule: WebsocketResponseHandlerService, wsService: WebsocketService) {
this.messages = <Subject<WebSocketMessage>>wsService
.connect(WEBSOCKET_URL)
.map((response: MessageEvent): WebSocketMessage => {
this.isConnected = wsService.isConnected;
let websocketResponseMessage = JSON.parse(response.data);
var websocketResponseData = websocketResponseMessage.Data === undefined ? websocketResponseMessage.data : websocketResponseMessage.Data;
var websocketResponseEvent = websocketResponseMessage.Event === undefined ? websocketResponseMessage.event : websocketResponseMessage.Event;
let responseMessage = new WebSocketMessage();
responseMessage.event = websocketResponseEvent;
responseMessage.data = websocketResponseData;
responseMessage.exchange = websocketResponseMessage.exchange;
responseMessage.assetType = websocketResponseMessage.assetType;
return responseMessage;
});
this.isConnected = wsService.isConnected;
this.shared = this.messages.share(); //multicast
}
}

View File

@@ -1,45 +1,62 @@
import { Injectable } from '@angular/core';
import {Subject, Observable, Observer } from 'rxjs/Rx';
import { Injectable, Optional, SkipSelf, NgModule } from '@angular/core';
import { Subject, Observable, Observer } from 'rxjs/Rx';
import { WebSocketMessage } from './../../shared/classes/websocket';
@Injectable()
@NgModule()
export class WebsocketService {
constructor() { }
public isConnected :boolean = false;
constructor (@Optional() @SkipSelf() parentModule: WebsocketService) {
if (parentModule) {
throw new Error(
'WebsocketService is already loaded. Import it in the AppModule only');
}
}
private subject: Subject<MessageEvent>;
public connect(url): Subject<MessageEvent> {
if (!this.subject) {
this.subject = this.create(url);
}
}
return this.subject;
}
private authenticateMessage = {
Event:'auth',
data:{"username":"admin","password":"e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a"},
}
private isAuth = false;
private create(url): Subject<MessageEvent> {
let ws = new WebSocket(url);
let observable = Observable.create(
(obs: Observer<MessageEvent>) => {
ws.onmessage = obs.next.bind(obs);
ws.onerror = obs.error.bind(obs);
ws.onclose = obs.complete.bind(obs);
return ws.close.bind(ws);
})
let observer = {
next: (data: any) => {
if (ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify(this.authenticateMessage));
ws.send(JSON.stringify(data));
(obs: Observer<MessageEvent>) => {
ws.onmessage = obs.next.bind(obs);
ws.onerror = obs.error.bind(obs);
ws.onclose = () => {
this.isConnected = false;
obs.complete.bind(obs) };
ws.onopen = () => {
this.isConnected = true;
ws.send(JSON.stringify(WebSocketMessage.CreateAuthenticationMessage()));
};
return ws.close.bind(ws);
})
let observer = {
next: (data: any) => {
var counter = 0;
var interval = setInterval(() => {
if (counter == 10) {
clearInterval(interval);
}
if (ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify(data));
clearInterval(interval);
this.isConnected = true;
}
counter++;
}, 400);
if (ws.readyState !== WebSocket.OPEN) {
new Error("Failed to send message to websocket after 10 attempts");
this.isConnected = false;
}
}
}
}
return Subject.create(observer, observable);
}
return Subject.create(observer, observable);
}
}

View File

@@ -1,3 +1 @@
<div *ngIf="showTicker" class="one-time-animation" >
<p>{{message}}</p>
</div>
{{tickerCard.Exchange}} {{tickerCard.CurrencyPair}} Last: {{this.tickerCard.Last}}

View File

@@ -1,61 +1,86 @@
import { Component, OnInit } from '@angular/core';
import { WebsocketHandlerService } from './../../services/websocket-handler/websocket-handler.service';
import {Component, OnInit, OnDestroy }from '@angular/core';
import {WebsocketResponseHandlerService }from './../../services/websocket-response-handler/websocket-response-handler.service';
import {WebSocketMessageType }from './../../shared/classes/websocket';
@Component({
selector: 'app-all-updates-ticker',
templateUrl: './all-updates-ticker.component.html',
styleUrls: ['./all-updates-ticker.component.scss']
@Component( {
selector:'app-all-updates-ticker',
templateUrl:'./all-updates-ticker.component.html',
styleUrls:['./all-updates-ticker.component.scss'],
})
export class AllEnabledCurrencyTickersComponent implements OnInit {
private ws: WebsocketHandlerService;
allCurrencies:ExchangeCurrency[];
tickerCard: TickerUpdate;
showTicker:boolean;
message:string;
allCurrencies:ExchangeCurrency[] = < ExchangeCurrency[] > []; ;
private ws:WebsocketResponseHandlerService;
tickerCard:TickerUpdate = new TickerUpdate();
showTicker:boolean = true;
message:string;
constructor(private websocketHandler: WebsocketHandlerService) {
this.ws = websocketHandler;
this.allCurrencies = <ExchangeCurrency[]>[];
this.ws.messages.subscribe(msg => {
if (msg.Event === 'ticker_update') {
this.showTicker = false;
var modal = <ExchangeCurrency>{};
modal.currencyPair = msg.data.CurrencyPair;
modal.exchangeName = msg.Exchange;
var ticker = <TickerUpdate>msg.data;
this.tickerCard = ticker;
this.tickerCard.Exchange = msg.Exchange;
if(this.tickerCard.Last > 0) {
this.showTicker = true;
this.message = this.tickerCard.Exchange + " " + this.tickerCard.CurrencyPair + " Last: " + this.tickerCard.Last;
constructor(private websocketHandler: WebsocketResponseHandlerService) {
this.tickerCard.Exchange = "Loading";
this.tickerCard.CurrencyPair = "...";
this.tickerCard.Last = -1;
this.ws = websocketHandler;
this.ws.shared.subscribe(msg => {
if (msg.event === WebSocketMessageType.TickerUpdate) {
if (window.localStorage["selectedExchange"] !== undefined &&
window.localStorage["selectedCurrency"] !== undefined) {
this.tickerCard.Exchange = window.localStorage["selectedExchange"];
this.tickerCard.CurrencyPair = window.localStorage["selectedCurrency"];
if (msg.exchange == window.localStorage["selectedExchange"]) {
if (this.stripCurrencyCharacters(msg.data.CurrencyPair) == window.localStorage["selectedCurrency"]) {
this.updateTicker(msg)
}
}
}else {
this.updateTicker(msg)
}
}
});
});
}
ngOnInit() { }
private updateTicker(msg:any):void {
var modal = < ExchangeCurrency > {};
modal.currencyPair = msg.data.CurrencyPair;
modal.exchangeName = msg.exchange;
var ticker = < TickerUpdate > msg.data;
this.tickerCard = ticker;
this.tickerCard.Exchange = msg.exchange;
this.message = this.tickerCard.Exchange + " " + this.tickerCard.CurrencyPair + " Last: " + this.tickerCard.Last;
}
ngOnInit() {
}
private stripCurrencyCharacters(name:string):string {
name = name.replace('_', '');
name = name.replace('-', '');
name = name.replace(' ', '');
name = name.toLocaleUpperCase();
return name;
}
}
export interface ExchangeCurrency {
currencyPair: string;
exchangeName:string;
currencyPair:string;
exchangeName:string;
}
export interface CurrencyPair {
delimiter: string;
first_currency: string;
second_currency: string;
delimiter:string;
first_currency:string;
second_currency:string;
}
export interface TickerUpdate {
Pair: CurrencyPair;
CurrencyPair: string;
Last: number;
High: number;
Low: number;
Bid: number;
Ask: number;
Volume: number;
PriceATH: number;
Exchange:string;
export class TickerUpdate {
Pair:CurrencyPair;
CurrencyPair:string;
Last:number;
High:number;
Low:number;
Bid:number;
Ask:number;
Volume:number;
PriceATH:number;
Exchange:string;
}

View File

@@ -1,12 +1,24 @@
<form class="form-content">
<div *ngIf="showErrorMessage">
<h4>{{chooseCurrencyMessage}}</h4>
<button routerLink="/exchange-grid" mat-raised-button color="primary">Choose currency</button>
</div>
<div *ngIf="!showErrorMessage">
<mat-form-field>
<input matInput disabled="disabled" name="exchange" [ngModel]="exchangeName" placeholder="Exchange">
</mat-form-field>
<mat-form-field>
<input matInput disabled="disabled" name="currency" [ngModel]="currencyName" placeholder="Currency">
</mat-form-field>
</div>
<mat-form-field>
<input matInput name="smsUsername" placeholder="Amount">
<input matInput name="amount" placeholder="Amount">
</mat-form-field>
<mat-form-field>
<input matInput name="smsPassword" placeholder="Offer">
<input matInput name="offer" placeholder="Offer">
</mat-form-field>
<div mat-line></div>
<div class="spacer">
<button mat-raised-button color="primary">CONFIRM BUY</button>
<button [disabled]="showErrorMessage" mat-raised-button color="primary">CONFIRM BUY</button>
</div>
</form>

View File

@@ -6,9 +6,20 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./buy-form.component.scss']
})
export class BuyFormComponent implements OnInit {
public exchangeName :string;
public currencyName :string;
public chooseCurrencyMessage :string = "Please select a currency";
public showErrorMessage :boolean;
constructor() { }
ngOnInit() {
if (window.localStorage["selectedExchange"] !== undefined &&
window.localStorage["selectedCurrency"] !== undefined) {
this.exchangeName = window.localStorage["selectedExchange"];
this.currencyName = window.localStorage["selectedCurrency"];
} else {
this.showErrorMessage = true;
}
}
}

View File

@@ -0,0 +1,175 @@
export class Config {
Name: string;
EncryptConfig?: number;
Cryptocurrencies: string;
CurrencyExchangeProvider: string;
CurrencyPairFormat: CurrencyPairFormat;
PortfolioAddresses: PortfolioAddresses;
SMSGlobal: SMSGlobal;
Webserver: Webserver;
Exchanges: Exchange[];
public isConfigCacheValid() : boolean {
let dateStored = +new Date(window.localStorage['configDate']);
let dateNow = +new Date();
var dateDifference = Math.abs(dateNow - dateStored)
var diffMins = Math.floor((dateDifference / 1000) / 60);
(diffMins)
if(isNaN(new Date(dateStored).getTime()) || diffMins > 15) {
return false;
}
else {
return true
}
}
public setConfig(data: any) : void {
var configData = <Config>data;
this.Cryptocurrencies = configData.Cryptocurrencies
this.CurrencyExchangeProvider = configData.CurrencyExchangeProvider
this.Exchanges = configData.Exchanges
this.CurrencyPairFormat = configData.CurrencyPairFormat
this.EncryptConfig = configData.EncryptConfig
this.Exchanges = configData.Exchanges
this.Name = configData.Name
this.PortfolioAddresses = configData.PortfolioAddresses
this.SMSGlobal = configData.SMSGlobal
this.Webserver = configData.Webserver
this.fromArrayToRedux()
}
public fromArrayToRedux() : void {
for (var i = 0; i < this.Exchanges.length; i++) {
this.Exchanges[i].Pairs = new Array<CurrencyPairRedux>();
var avail = this.Exchanges[i].AvailablePairs.split(',');
var enabled = this.Exchanges[i].EnabledPairs.split(',');
for (var j = 0; j < avail.length; j++) {
var currencyPair = new CurrencyPairRedux();
currencyPair.Name = avail[j]
currencyPair.ParsedName = this.stripCurrencyCharacters(avail[j]);
if (enabled.indexOf(avail[j]) > 0) {
currencyPair.Enabled = true;
} else {
currencyPair.Enabled = false;
}
this.Exchanges[i].Pairs.push(currencyPair);
}
}
window.localStorage['config'] = JSON.stringify(this);
window.localStorage['configDate'] = new Date().toString();
}
public parseSettings() : void {
}
private stripCurrencyCharacters(name:string) :string {
name = name.replace('_', '');
name = name.replace('-', '');
name = name.replace(' ', '');
name = name.toLocaleUpperCase();
return name;
}
public fromReduxToArray() : void {
for (var i = 0; i < this.Exchanges.length; i++) {
// Step 1, iterate over the Pairs
var enabled = this.Exchanges[i].EnabledPairs.split(',');
for (var j = 0; j < this.Exchanges[i].Pairs.length; j++) {
if (this.Exchanges[i].Pairs[j].Enabled) {
if (enabled.indexOf(this.Exchanges[i].Pairs[j].Name) == -1) {
// Step 3 if its not in the enabled list, add it
enabled.push(this.Exchanges[i].Pairs[j].Name);
} else {
}
} else {
if (enabled.indexOf(this.Exchanges[i].Pairs[j].Name) > -1) {
enabled.splice(enabled.indexOf(this.Exchanges[i].Pairs[j].Name), 1);
} else {
}
}
}
//Step 4 JSONifiy the enabled list and set it to the this.settings.Exchanges[i].EnabledPairs
this.Exchanges[i].EnabledPairs = enabled.join();
}
}
}
export class CurrencyPairRedux {
Name: string;
ParsedName: string;
Enabled: boolean;
}
export interface CurrencyPairFormat {
Uppercase: boolean;
Delimiter: string;
}
export interface PortfolioAddresses {
Addresses?: any;
}
export interface Contact {
Name: string;
Number: string;
Enabled: boolean;
}
export interface SMSGlobal {
Enabled: boolean;
Username: string;
Password: string;
Contacts: Contact[];
}
export interface Webserver {
Enabled: boolean;
AdminUsername: string;
AdminPassword: string;
ListenAddress: string;
WebsocketConnectionLimit: number;
WebsocketAllowInsecureOrigin: boolean;
}
export interface ConfigCurrencyPairFormat {
Uppercase: boolean;
Index: string;
Delimiter: string;
}
export interface RequestCurrencyPairFormat {
Uppercase: boolean;
Index: string;
Delimiter: string;
Separator: string;
}
export interface Exchange {
Name: string;
Enabled: boolean;
Verbose: boolean;
Websocket: boolean;
RESTPollingDelay: number;
AuthenticatedAPISupport: boolean;
APIKey: string;
APISecret: string;
AvailablePairs: string;
EnabledPairs: string;
BaseCurrencies: string;
AssetTypes: string;
ConfigCurrencyPairFormat: ConfigCurrencyPairFormat;
RequestCurrencyPairFormat: RequestCurrencyPairFormat;
ClientID: string;
Pairs: CurrencyPairRedux[];
}

View File

@@ -0,0 +1,45 @@
import { Component, OnInit, OnDestroy, Pipe, PipeTransform } from '@angular/core';
import { CurrencyPairRedux } from './../../shared/classes/config';
@Pipe({
name: 'iterateMap'
})
export class IterateMapPipe implements PipeTransform {
transform(iterable: any, args: any[]): any {
let result = [];
if (iterable.entries) {
iterable.forEach((key, value) => {
result.push({
key,
value
});
});
} else {
for (let key in iterable) {
if (iterable.hasOwnProperty(key)) {
result.push({
key,
value: iterable[key]
});
}
}
}
return result;
}
}
@Pipe({
name: 'enabledCurrencies'
})
export class EnabledCurrenciesPipe implements PipeTransform {
transform(items: CurrencyPairRedux[], args: any[]): any {
if (!items) {
return items;
}
return items.filter(item => item.Enabled === true);
}
}

View File

@@ -0,0 +1,32 @@
export class WebSocketMessage {
public event: string;
public data: any;
public exchange: string;
public assetType: string;
public static CreateAuthenticationMessage(): WebSocketMessage {
var response = new WebSocketMessage();
response.event = WebSocketMessageType.Auth;
response.data = { "username": window.sessionStorage["username"], "password": window.sessionStorage["password"] };
return response;
};
public static GetSettingsMessage() : WebSocketMessage {
var response = new WebSocketMessage();
response.event = WebSocketMessageType.GetConfig;
response.data = null;
return response;
}
}
export class WebSocketMessageType {
public static Auth: string = "auth";
public static GetConfig: string = "GetConfig";
public static SaveConfig: string = "SaveConfig";
public static GetPortfolio: string = "GetPortfolio";
public static TickerUpdate: string = "ticker_update";
}

View File

@@ -7,7 +7,6 @@
</a>
<app-selected-currency></app-selected-currency>
<div class="flex-spacer"></div>
<app-all-updates-ticker></app-all-updates-ticker>
<theme-picker></theme-picker>
&nbsp;
&nbsp;

View File

@@ -64,7 +64,7 @@ export class PriceHistoryComponent implements OnInit {
public options = {
"type": "serial",
"theme": "light",
"theme": "dark",
"dataDateFormat": "YYYY-MM-DD",
"zoomOutOnDataUpdate": false,
"valueAxes": [{
@@ -158,7 +158,6 @@ export class PriceHistoryComponent implements OnInit {
e.chart.firstPoint = e.item;
}
//console.log(e.item);
e.chart.validateData();
}
}],

View File

@@ -1,4 +1,5 @@
<button mat-button routerLink="exchange-grid" matTooltip="Change currency">POLONIEX: BTC_USD (placeholder)</button>
<button class="currency-button" mat-button routerLink="exchange-grid" matTooltip="Change currency"><app-all-updates-ticker></app-all-updates-ticker></button>
<button mat-icon-button routerLink="currency-list" matTooltip="View currency list">
<mat-icon>
view_list

View File

@@ -0,0 +1,4 @@
.currency-button {
width: 20rem;
text-align: left;
}

View File

@@ -1,12 +1,24 @@
<form class="form-content">
<mat-form-field>
<input matInput name="smsUsername" placeholder="Amount">
</mat-form-field>
<mat-form-field>
<input matInput name="smsPassword" placeholder="Offer">
</mat-form-field>
<div mat-line></div>
<div *ngIf="showErrorMessage">
<h4>{{chooseCurrencyMessage}}</h4>
<button routerLink="/exchange-grid" mat-raised-button color="primary">Choose currency</button>
</div>
<div *ngIf="!showErrorMessage">
<mat-form-field>
<input matInput disabled="disabled" name="exchange" [ngModel]="exchangeName" placeholder="Exchange">
</mat-form-field>
<mat-form-field>
<input matInput disabled="disabled" name="currency" [ngModel]="currencyName" placeholder="Currency">
</mat-form-field>
</div>
<mat-form-field>
<input matInput name="amount" placeholder="Amount">
</mat-form-field>
<mat-form-field>
<input matInput name="offer" placeholder="Offer">
</mat-form-field>
<div mat-line></div>
<div class="spacer">
<button mat-raised-button color="primary">CONFIRM SELL</button>
</div>
</form>
<button [disabled]="showErrorMessage" mat-raised-button color="primary">CONFIRM SELL</button>
</div>
</form>

View File

@@ -6,10 +6,20 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./sell-form.component.scss']
})
export class SellFormComponent implements OnInit {
constructor() { }
ngOnInit() {
}
public exchangeName :string;
public currencyName :string;
public chooseCurrencyMessage :string = "Please select a currency";
public showErrorMessage :boolean;
constructor() { }
ngOnInit() {
if (window.localStorage["selectedExchange"] !== undefined &&
window.localStorage["selectedCurrency"] !== undefined) {
this.exchangeName = window.localStorage["selectedExchange"];
this.currencyName = window.localStorage["selectedCurrency"];
} else {
this.showErrorMessage = true;
}
}
}

View File

@@ -73,7 +73,7 @@ export class ThemePickerComponent {
if (theme.isDefault) {
this.styleManager.removeStyle('theme');
} else {
this.styleManager.setStyle('theme', `assets/${theme.href}`);
this.styleManager.setStyle('theme', `assets/themes/${theme.href}`);
}
if (this.currentTheme) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

View File

@@ -0,0 +1,106 @@
i.cc.ARCH, i.cc.ARCH-alt { color: #002652; }
i.cc.BANX, i.cc.BANX-alt { color: #225BA6; }
i.cc.BC, i.cc.BC-alt { color: #202121; }
i.cc.BCN, i.cc.BCN-alt { color: #964F51; }
i.cc.BTC, i.cc.BTC-alt { color: #F7931A; }
i.cc.BTCD, i.cc.BTCD-alt { color: #2A72DC; }
i.cc.BTS, i.cc.BTS-alt { color: #03A9E0; }
i.cc.DASH, i.cc.DASH-alt { color: #1c75bc; }
i.cc.DOGE, i.cc.DOGE-alt { color: #BA9F33; }
i.cc.FC2, i.cc.FC2-alt { color: #040405; }
i.cc.FTC, i.cc.FTC-alt { color: #679EF1; }
i.cc.GEMZ, i.cc.GEMZ-alt { color: #e86060; }
i.cc.GRC, i.cc.GRC-alt { color: #88A13C; }
i.cc.IFC, i.cc.IFC-alt { color: #ed272d; }
i.cc.KORE, i.cc.KORE-alt { color: #DF4124; }
i.cc.LTC, i.cc.LTC-alt { color: #838383; }
i.cc.MAID, i.cc.MAID-alt { color: #5492D6; }
i.cc.MSC, i.cc.MSC-alt { color: #1D4983; }
i.cc.NBT { color: #FFC93D; }
i.cc.NMC, i.cc.NMC-alt { color: #6787B7; }
i.cc.NOTE, i.cc.NOTE-alt { color: #42daff; }
i.cc.NXT, i.cc.NXT-alt { color: #008FBB; }
i.cc.OPAL, i.cc.OPAL-alt { color: #7193AA; }
i.cc.POT, i.cc.POT-alt { color: #105B2F; }
i.cc.PPC, i.cc.PPC-alt { color: #3FA30C; }
i.cc.QRK, i.cc.QRK-alt { color: #22AABF; }
i.cc.RBT, i.cc.RBT-alt { color: #0d4982; }
i.cc.SDC, i.cc.SDC-alt { color: #981D2D; }
i.cc.STR, i.cc.STR-alt { color: #08B5E5; }
i.cc.SYNC, i.cc.SYNC-alt { color: #008DD2; }
i.cc.UNITY, i.cc.UNITY-alt { color: #ED8527; }
i.cc.VIOR, i.cc.VIOR-alt { color: #1F52A4; }
i.cc.VPN, i.cc.VPN-alt { color: #589700; }
i.cc.VRC, i.cc.VRC-alt { color: #418bca; }
i.cc.VTC, i.cc.VTC-alt { color: #1b5c2e; }
i.cc.XCP, i.cc.XCP-alt { color: #EC1550; }
i.cc.XEM, i.cc.XEM-alt { color: #41bf76; }
i.cc.XMR { color: #FF6600; }
i.cc.XRP, i.cc.XRP-alt { color: #346AA9; }
i.cc.YBC, i.cc.YBC-alt { color: #D6C154; }
i.cc.DMD, i.cc.DMD-alt { color: #5497b2; }
i.cc.FRK, i.cc.FRK-alt { color: #0633cd; }
i.cc.IOC, i.cc.IOC-alt { color: #2fa3de; }
i.cc.LDOGE, i.cc.LDOGE-alt { color: #ffcc00; }
i.cc.MTR, i.cc.MTR-alt { color: #b92429; }
i.cc.MUE, i.cc.MUE-alt { color: #f5a10e; }
i.cc.XAI, i.cc.XAI-alt { color: #2ef99f; }
i.cc.XBS, i.cc.XBS-alt { color: #d3261d; }
i.cc.XPM, i.cc.XPM-alt { color: #e5b625; }
i.cc.BAY, i.cc.BAY-alt { color: #584ba1; }
i.cc.DGB, i.cc.DGB-alt { color: #0066cc; }
i.cc.EMC, i.cc.EMC-alt { color: #674c8c; }
i.cc.ETH, i.cc.ETH-alt { color: #282828; }
i.cc.MINT, i.cc.MINT-alt { color: #006835; }
i.cc.MONA, i.cc.MONA-alt { color: #a99364; }
i.cc.MRC { color: #4279bd; }
i.cc.NEU, i.cc.NEU-alt { color: #2983c0; }
i.cc.NVC, i.cc.NVC-alt { color: #ecab41; }
i.cc.AEON, i.cc.AEON-alt { color: #164450; }
i.cc.AMP, i.cc.AMP-alt { color: #048DD2; }
i.cc.ANC, i.cc.ANC-alt { color: #000; }
i.cc.BTA { color: #210094; }
i.cc.CLAM, i.cc.CLAM-alt { color: #D6AB31; }
i.cc.CLOAK, i.cc.CLOAK-alt { color: #DF3F1E; }
i.cc.DCR, i.cc.DCR-alt { color: #43A2CA; }
i.cc.NEOS, i.cc.NEOS-alt { color: #3771B1; }
i.cc.NLG, i.cc.NLG-alt { color: #003E7E; }
i.cc.OK, i.cc.OK-alt { color: #0165A4; }
i.cc.OMNI, i.cc.OMNI-alt { color: #18347E; }
i.cc.RBY, i.cc.RBY-alt { color: #D31F26; }
i.cc.SCOT, i.cc.SCOT-alt { color: #3498DB; }
i.cc.SJCX, i.cc.SJCX-alt { color: #003366; }
i.cc.START, i.cc.START-alt { color: #01AEF0; }
i.cc.SYS, i.cc.SYS-alt { color: #0098DA; }
i.cc.VNL, i.cc.VNL-alt { color: #404249; }
i.cc.TX, i.cc.TX-alt { color: #1F8BCC; }
i.cc.XVG, i.cc.XVG-alt { color: #42AFB2; }
i.cc.FCT, i.cc.FCT-alt { color: #2175BB; }
i.cc.GDC, i.cc.GDC-alt { color: #E9A226; }
i.cc.JBS, i.cc.JBS-alt { color: #1A8BCD; }
i.cc.LISK, i.cc.LISK-alt { color: #1A6896; }
i.cc.PIGGY, i.cc.PIGGY-alt { color: #F27A7A; }
i.cc.RBIES, i.cc.RBIES-alt { color: #C62436; }
i.cc.SAR, i.cc.SAR-alt { color: #1B72B8; }
i.cc.SLG, i.cc.SLG-alt { color: #5A6875; }
i.cc.USDT, i.cc.USDT-alt { color: #2CA07A; }
i.cc.ZEIT, i.cc.ZEIT-alt { color: #ACACAC; }
i.cc.DGD, i.cc.DGX { color: #D8A24A; }
i.cc.ADC, i.cc.ADC-alt { color: #3CB0E5; }
i.cc.BSD, i.cc.BSD-alt { color: #1186E7; }
i.cc.DAO, i.cc.DAO-alt { color: #FF3B3B; }
i.cc.ERC, i.cc.ERC-alt { color: #101E84; }
i.cc.ETC, i.cc.ETC-alt { color: #669073; }
i.cc.GLD, i.cc.GLD-alt { color: #E8BE24; }
i.cc.GRS { color: #648FA0; }
i.cc.KOBO { color: #80C342; }
i.cc.LBC, i.cc.LBC-alt { color: #015C47; }
i.cc.PINK, i.cc.PINK-alt { color: #ED31CA; }
i.cc.RDD, i.cc.RDD-alt { color: #ED1C24; }
i.cc.RISE, i.cc.RISE-alt { color: #43CEA2; }
i.cc.SIA, i.cc.SIA-alt { color: #00CBA0; }
i.cc.SLS, i.cc.SLS-alt { color: #1EB549; }
i.cc.SNRG, i.cc.SNRG-alt { color: #160363; }
i.cc.STEEM, i.cc.STEEM-alt { color: #1A5099; }
i.cc.STRAT, i.cc.STRAT-alt { color: #33C7F5; }
i.cc.SWIFT, i.cc.SWIFT-alt { color: #428BCA; }

View File

@@ -0,0 +1,645 @@
@font-face {
font-family: 'cryptocoins';
src: url('./../fonts/cryptocoins.eot?d2eit9');
src: url('./../fonts/cryptocoins.eot?d2eit9#iefix') format('embedded-opentype'),
url('./../fonts/cryptocoins.ttf?d2eit9') format('truetype'),
url('./../fonts/cryptocoins.woff?d2eit9') format('woff'),
url('./../fonts/cryptocoins.svg?d2eit9#cryptocoins') format('svg');
font-weight: normal;
font-style: normal;
}
i.cc {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'cryptocoins' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
i.cc.SAR:before {
content: "\e900";
}
i.cc.SAR-alt:before {
content: "\e901";
}
i.cc.SCOT:before {
content: "\e902";
}
i.cc.SCOT-alt:before {
content: "\e903";
}
i.cc.SDC:before {
content: "\e904";
}
i.cc.SDC-alt:before {
content: "\e905";
}
i.cc.SIA:before {
content: "\e906";
}
i.cc.SIA-alt:before {
content: "\e907";
}
i.cc.SJCX:before {
content: "\e908";
}
i.cc.SJCX-alt:before {
content: "\e909";
}
i.cc.SLG:before {
content: "\e90a";
}
i.cc.SLG-alt:before {
content: "\e90b";
}
i.cc.SLS:before {
content: "\e90c";
}
i.cc.SLS-alt:before {
content: "\e90d";
}
i.cc.SNRG:before {
content: "\e90e";
}
i.cc.SNRG-alt:before {
content: "\e90f";
}
i.cc.START:before {
content: "\e910";
}
i.cc.START-alt:before {
content: "\e911";
}
i.cc.STEEM:before {
content: "\e912";
}
i.cc.STEEM-alt:before {
content: "\e913";
}
i.cc.STR:before {
content: "\e914";
}
i.cc.STR-alt:before {
content: "\e915";
}
i.cc.STRAT:before {
content: "\e916";
}
i.cc.STRAT-alt:before {
content: "\e917";
}
i.cc.SWIFT:before {
content: "\e918";
}
i.cc.SWIFT-alt:before {
content: "\e919";
}
i.cc.SYNC:before {
content: "\e91a";
}
i.cc.SYNC-alt:before {
content: "\e91b";
}
i.cc.SYS:before {
content: "\e91c";
}
i.cc.SYS-alt:before {
content: "\e91d";
}
i.cc.TX:before {
content: "\e91e";
}
i.cc.TX-alt:before {
content: "\e91f";
}
i.cc.UNITY:before {
content: "\e920";
}
i.cc.UNITY-alt:before {
content: "\e921";
}
i.cc.USDT:before {
content: "\e922";
}
i.cc.USDT-alt:before {
content: "\e923";
}
i.cc.VIOR:before {
content: "\e924";
}
i.cc.VIOR-alt:before {
content: "\e925";
}
i.cc.VNL:before {
content: "\e926";
}
i.cc.VNL-alt:before {
content: "\e927";
}
i.cc.VPN:before {
content: "\e928";
}
i.cc.VPN-alt:before {
content: "\e929";
}
i.cc.VRC:before {
content: "\e92a";
}
i.cc.VRC-alt:before {
content: "\e92b";
}
i.cc.VTC:before {
content: "\e92c";
}
i.cc.VTC-alt:before {
content: "\e92d";
}
i.cc.XAI:before {
content: "\e92e";
}
i.cc.XAI-alt:before {
content: "\e92f";
}
i.cc.XBS:before {
content: "\e930";
}
i.cc.XBS-alt:before {
content: "\e931";
}
i.cc.XCP:before {
content: "\e932";
}
i.cc.XCP-alt:before {
content: "\e933";
}
i.cc.XEM:before {
content: "\e934";
}
i.cc.XEM-alt:before {
content: "\e935";
}
i.cc.XMR:before {
content: "\e936";
}
i.cc.XPM:before {
content: "\e937";
}
i.cc.XPM-alt:before {
content: "\e938";
}
i.cc.XRP:before {
content: "\e939";
}
i.cc.XRP-alt:before {
content: "\e93a";
}
i.cc.XVG:before {
content: "\e93b";
}
i.cc.XVG-alt:before {
content: "\e93c";
}
i.cc.YBC:before {
content: "\e93d";
}
i.cc.YBC-alt:before {
content: "\e93e";
}
i.cc.ZEIT:before {
content: "\e93f";
}
i.cc.ZEIT-alt:before {
content: "\e940";
}
i.cc.MAID:before {
content: "\e941";
}
i.cc.MAID-alt:before {
content: "\e942";
}
i.cc.MINT:before {
content: "\e943";
}
i.cc.MINT-alt:before {
content: "\e944";
}
i.cc.MONA:before {
content: "\e945";
}
i.cc.MONA-alt:before {
content: "\e946";
}
i.cc.MRC:before {
content: "\e947";
}
i.cc.MSC:before {
content: "\e948";
}
i.cc.MSC-alt:before {
content: "\e949";
}
i.cc.MTR:before {
content: "\e94a";
}
i.cc.MTR-alt:before {
content: "\e94b";
}
i.cc.MUE:before {
content: "\e94c";
}
i.cc.MUE-alt:before {
content: "\e94d";
}
i.cc.NBT:before {
content: "\e94e";
}
i.cc.NEOS:before {
content: "\e94f";
}
i.cc.NEOS-alt:before {
content: "\e950";
}
i.cc.NEU:before {
content: "\e951";
}
i.cc.NEU-alt:before {
content: "\e952";
}
i.cc.NLG:before {
content: "\e953";
}
i.cc.NLG-alt:before {
content: "\e954";
}
i.cc.NMC:before {
content: "\e955";
}
i.cc.NMC-alt:before {
content: "\e956";
}
i.cc.NOTE:before {
content: "\e957";
}
i.cc.NOTE-alt:before {
content: "\e958";
}
i.cc.NVC:before {
content: "\e959";
}
i.cc.NVC-alt:before {
content: "\e95a";
}
i.cc.NXT:before {
content: "\e95b";
}
i.cc.NXT-alt:before {
content: "\e95c";
}
i.cc.OK:before {
content: "\e95d";
}
i.cc.OK-alt:before {
content: "\e95e";
}
i.cc.OMNI:before {
content: "\e95f";
}
i.cc.OMNI-alt:before {
content: "\e960";
}
i.cc.OPAL:before {
content: "\e961";
}
i.cc.OPAL-alt:before {
content: "\e962";
}
i.cc.PIGGY:before {
content: "\e963";
}
i.cc.PIGGY-alt:before {
content: "\e964";
}
i.cc.PINK:before {
content: "\e965";
}
i.cc.PINK-alt:before {
content: "\e966";
}
i.cc.POT:before {
content: "\e967";
}
i.cc.POT-alt:before {
content: "\e968";
}
i.cc.PPC:before {
content: "\e969";
}
i.cc.PPC-alt:before {
content: "\e96a";
}
i.cc.QRK:before {
content: "\e96b";
}
i.cc.QRK-alt:before {
content: "\e96c";
}
i.cc.RBIES:before {
content: "\e96d";
}
i.cc.RBIES-alt:before {
content: "\e96e";
}
i.cc.RBT:before {
content: "\e96f";
}
i.cc.RBT-alt:before {
content: "\e970";
}
i.cc.RBY:before {
content: "\e971";
}
i.cc.RBY-alt:before {
content: "\e972";
}
i.cc.RDD:before {
content: "\e973";
}
i.cc.RDD-alt:before {
content: "\e974";
}
i.cc.RISE:before {
content: "\e975";
}
i.cc.RISE-alt:before {
content: "\e976";
}
i.cc.GDC:before {
content: "\e977";
}
i.cc.GDC-alt:before {
content: "\e978";
}
i.cc.GEMZ:before {
content: "\e979";
}
i.cc.GEMZ-alt:before {
content: "\e97a";
}
i.cc.GLD:before {
content: "\e97b";
}
i.cc.GLD-alt:before {
content: "\e97c";
}
i.cc.GRC:before {
content: "\e97d";
}
i.cc.GRC-alt:before {
content: "\e97e";
}
i.cc.GRS:before {
content: "\e97f";
}
i.cc.IFC:before {
content: "\e980";
}
i.cc.IFC-alt:before {
content: "\e981";
}
i.cc.IOC:before {
content: "\e982";
}
i.cc.IOC-alt:before {
content: "\e983";
}
i.cc.JBS:before {
content: "\e984";
}
i.cc.JBS-alt:before {
content: "\e985";
}
i.cc.KOBO:before {
content: "\e986";
}
i.cc.KORE:before {
content: "\e987";
}
i.cc.KORE-alt:before {
content: "\e988";
}
i.cc.LBC:before {
content: "\e989";
}
i.cc.LBC-alt:before {
content: "\e98a";
}
i.cc.LDOGE:before {
content: "\e98b";
}
i.cc.LDOGE-alt:before {
content: "\e98c";
}
i.cc.LISK:before {
content: "\e98d";
}
i.cc.LISK-alt:before {
content: "\e98e";
}
i.cc.LTC:before {
content: "\e98f";
}
i.cc.LTC-alt:before {
content: "\e990";
}
i.cc.ADC:before {
content: "\e991";
}
i.cc.ADC-alt:before {
content: "\e992";
}
i.cc.AEON:before {
content: "\e993";
}
i.cc.AEON-alt:before {
content: "\e994";
}
i.cc.AMP:before {
content: "\e995";
}
i.cc.AMP-alt:before {
content: "\e996";
}
i.cc.ANC:before {
content: "\e997";
}
i.cc.ANC-alt:before {
content: "\e998";
}
i.cc.ARCH:before {
content: "\e999";
}
i.cc.ARCH-alt:before {
content: "\e99a";
}
i.cc.BANX:before {
content: "\e99b";
}
i.cc.BANX-alt:before {
content: "\e99c";
}
i.cc.BAY:before {
content: "\e99d";
}
i.cc.BAY-alt:before {
content: "\e99e";
}
i.cc.BC:before {
content: "\e99f";
}
i.cc.BC-alt:before {
content: "\e9a0";
}
i.cc.BCN:before {
content: "\e9a1";
}
i.cc.BCN-alt:before {
content: "\e9a2";
}
i.cc.BSD:before {
content: "\e9a3";
}
i.cc.BSD-alt:before {
content: "\e9a4";
}
i.cc.BTA:before {
content: "\e9a5";
}
i.cc.BTC:before {
content: "\e9a6";
}
i.cc.BTC-alt:before {
content: "\e9a7";
}
i.cc.BTCD:before {
content: "\e9a8";
}
i.cc.BTCD-alt:before {
content: "\e9a9";
}
i.cc.BTS:before {
content: "\e9aa";
}
i.cc.BTS-alt:before {
content: "\e9ab";
}
i.cc.CLAM:before {
content: "\e9ac";
}
i.cc.CLAM-alt:before {
content: "\e9ad";
}
i.cc.CLOAK:before {
content: "\e9ae";
}
i.cc.CLOAK-alt:before {
content: "\e9af";
}
i.cc.DAO:before {
content: "\e9b0";
}
i.cc.DAO-alt:before {
content: "\e9b1";
}
i.cc.DASH:before {
content: "\e9b2";
}
i.cc.DASH-alt:before {
content: "\e9b3";
}
i.cc.DCR:before {
content: "\e9b4";
}
i.cc.DCR-alt:before {
content: "\e9b5";
}
i.cc.DGB:before {
content: "\e9b6";
}
i.cc.DGB-alt:before {
content: "\e9b7";
}
i.cc.DGD:before {
content: "\e9b8";
}
i.cc.DGX:before {
content: "\e9b9";
}
i.cc.DMD:before {
content: "\e9ba";
}
i.cc.DMD-alt:before {
content: "\e9bb";
}
i.cc.DOGE:before {
content: "\e9bc";
}
i.cc.DOGE-alt:before {
content: "\e9bd";
}
i.cc.EMC:before {
content: "\e9be";
}
i.cc.EMC-alt:before {
content: "\e9bf";
}
i.cc.ERC:before {
content: "\e9c0";
}
i.cc.ERC-alt:before {
content: "\e9c1";
}
i.cc.ETC:before {
content: "\e9c2";
}
i.cc.ETC-alt:before {
content: "\e9c3";
}
i.cc.ETH:before {
content: "\e9c4";
}
i.cc.ETH-alt:before {
content: "\e9c5";
}
i.cc.FC2:before {
content: "\e9c6";
}
i.cc.FC2-alt:before {
content: "\e9c7";
}
i.cc.FCT:before {
content: "\e9c8";
}
i.cc.FCT-alt:before {
content: "\e9c9";
}
i.cc.FRK:before {
content: "\e9ca";
}
i.cc.FRK-alt:before {
content: "\e9cb";
}
i.cc.FTC:before {
content: "\e9cc";
}
i.cc.FTC-alt:before {
content: "\e9cd";
}

View File

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More