Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
251c10d
Add integrations button to toolbar
Mar 19, 2019
ff1d369
Add icon and create rules for integrations icon
Mar 19, 2019
4a40607
Export loadWorkspace & loadBlocks functions and create common cleanBe…
Mar 19, 2019
b39b9e5
Create logic for cleanBeforeExport function
Mar 19, 2019
66b5514
Rename Save to SaveDialog, add LoadDialog + IntegrationsDialog
Mar 19, 2019
2597c22
Update import paths
Mar 19, 2019
2a97b7c
Create GoogleDriveIntegration component
Mar 19, 2019
cdcadb4
Create styling rules for load-dialog, save-dialog, integrations-dialog
Mar 19, 2019
6524861
Logout Google account on logout, add binds for toolbox buttons
Mar 19, 2019
43c4a7b
Rename class method
Mar 19, 2019
9aff001
Increase/decrease spacing for consistency
Mar 19, 2019
7c423f0
Re-order imports
Mar 19, 2019
2facd4d
Catch rejected promise, do nothing
Mar 20, 2019
e404cb3
Update observer event name
Mar 20, 2019
a2e3f40
Create styling rules for barspinner in button
Mar 20, 2019
6694d8c
Show barspinner when making requests to Google Drive
Mar 20, 2019
95a6201
Refactor closing dialogs when opening other dialogs
Mar 20, 2019
cb62b80
Linting cleanup + Fixes
Mar 20, 2019
acead10
Remove unused closeOtherDialogs prop
Mar 20, 2019
f43c549
Create common trackAndEmitError function, let rejected promises bubbl…
Mar 20, 2019
4130c91
Initially hide Google Drive features
Mar 21, 2019
1f00132
Create Google Drive integration logic
Mar 21, 2019
ed3147a
Change trackJs.console.error to trackJs.track for proper logging
Mar 21, 2019
1112771
Change trackJs.console.error to trackJs.track for proper logging
Mar 21, 2019
d221771
Assume user cancelled action when nothing was picked in FilePicker
Mar 21, 2019
a074881
Fix diversion
Mar 21, 2019
d51ef85
Reject if authorisation failed (restores button)
Mar 21, 2019
577b1c3
Make sure button is restored on cancel action
Mar 21, 2019
640cf5a
Sign out user from Google Drive if access to drive was revoked
Mar 22, 2019
c40d324
Show an error when user doesn't grant permission
Mar 22, 2019
85f7995
Update integrations icon to Google Drive icon
Mar 22, 2019
098863f
Merge branch 'dev' into google-drive-integration
Mar 25, 2019
396010c
Merge branch 'dev' into google-drive-integration
ashkanx Mar 25, 2019
504d924
index page responsive for all languages
Apr 4, 2019
3de52bd
Merge branch 'dev' of github.com:binary-com/binary-bot into language-…
Apr 4, 2019
9e016fb
deleted spaces
Apr 4, 2019
4d56108
Merge pull request #1398 from Khalidxx/language-responsive
ashkanx Apr 5, 2019
674d425
removed google+ from footer
Apr 5, 2019
a9f7e80
Emit bot.running event when entering position
Mar 21, 2019
dd30bfe
Ensure correct status indicator is showing
Mar 21, 2019
742a5d6
Ensure correct (stop) status indicator is showing
Mar 22, 2019
29203f3
Merge pull request #1341 from aaron-binary/bot-running-stopping-indic…
Apr 8, 2019
d03f637
Merge branch 'dev' into minus-google+
ashkanx Apr 8, 2019
5c0b3e0
Merge pull request #1402 from Khalidxx/minus-google+
ashkanx Apr 8, 2019
944de0f
Update strings
Apr 10, 2019
01d1477
Minor fixes + eslint
Apr 10, 2019
fb0d333
Cleanup
Apr 10, 2019
6f6a8ca
Update strings
Apr 10, 2019
a9bc13a
Catch uncaught error
Apr 10, 2019
3049868
Merge branch 'dev' into google-drive-integration
Apr 10, 2019
2107472
Delete bb.js
Apr 10, 2019
14f007d
Merge pull request #1339 from aaron-binary/google-drive-integration
ashkanx Apr 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/botPage/bot/TradeEngine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Ticks from './Ticks';
import rootReducer from './state/reducers';
import * as constants from './state/constants';
import { start } from './state/actions';
import { observer as globalObserver } from '../../../common/utils/observer';

const watchBefore = store =>
watchScope({
Expand All @@ -34,7 +35,7 @@ const watchDuring = store =>
});

/* The watchScope function is called randomly and resets the prevTick
* which leads to the same problem we try to solve. So prevTick is isolated
* which leads to the same problem we try to solve. So prevTick is isolated
*/
let prevTick;
const watchScope = ({ store, stopScope, passScope, passFlag }) => {
Expand Down Expand Up @@ -90,6 +91,8 @@ export default class TradeEngine extends Balance(Purchase(Sell(OpenContract(Prop
throw createError('NotInitialized', translate('Bot.init is not called'));
}

globalObserver.emit('bot.running');

this.tradeOptions = expectTradeOptions(tradeOptions);

this.store.dispatch(start());
Expand Down
5 changes: 5 additions & 0 deletions src/botPage/common/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ const config = {
},
bbResult : [[translate('upper'), '1'], [translate('middle'), '0'], [translate('lower'), '2']],
macdFields: [[translate('Histogram'), '0'], [translate('MACD'), '1'], [translate('Signal'), '2']],
gd : {
cid: '646610722767-7ivdbunktgtnumj23en9gkecbgtf2ur7.apps.googleusercontent.com',
aid: 'binarybot-237009',
api: 'AIzaSyBieTeLip_lVQZUimIuJypU1kJyqOvQRgc',
},
};

export async function updateConfigCurrencies() {
Expand Down
9 changes: 9 additions & 0 deletions src/botPage/view/Dialogs/Dialog.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import DialogComponent from './DialogComponent';
import { observer as globalObserver } from '../../../common/utils/observer';

export default class Dialog {
constructor(id, title, content, options = {}) {
Expand All @@ -13,8 +14,16 @@ export default class Dialog {
}
open() {
$(`#${this.componentId}`).dialog('open');
globalObserver.emit('dialog.opened', this.componentId);
}
close() {
$(`#${this.componentId}`).dialog('close');
}
registerCloseOnOtherDialog() {
globalObserver.register('dialog.opened', dialogId => {
if (dialogId !== this.componentId) {
this.close();
}
});
}
}
29 changes: 29 additions & 0 deletions src/botPage/view/Dialogs/IntegrationsDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import Dialog from './Dialog';
import GoogleDriveIntegration from '../react-components/Integrations/GoogleDriveIntegration';
import * as style from '../style';
import { translate } from '../../../common/i18n';

const IntegrationsContent = () => (
<div id="integrations-dialog" className="dialog-content" style={style.content}>
<GoogleDriveIntegration />
</div>
);

export default class IntegrationsDialog extends Dialog {
constructor() {
const closeDialog = () => {
this.close();
};
super(
'integrations-dialog',
translate('Google Drive Integration'),
<IntegrationsContent closeDialog={closeDialog} />,
{
width : 500,
height: 'auto',
}
);
this.registerCloseOnOtherDialog();
}
}
95 changes: 95 additions & 0 deletions src/botPage/view/Dialogs/LoadDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import Dialog from './Dialog';
import * as style from '../style';
import { translate } from '../../../common/i18n';
import googleDrive from '../../../common/integrations/GoogleDrive';
import { showSpinnerInButton, removeSpinnerInButton } from '../../../common/utils/tools';

class LoadContent extends PureComponent {
constructor() {
super();
this.state = { loadType: 'local' };
}

onChange(event) {
this.setState({ loadType: event.target.value });
}

submit() {
if (this.state.loadType === 'google-drive') {
const initialButtonText = $(this.submitButton).text();
showSpinnerInButton($(this.submitButton));
googleDrive
.createFilePicker()
.then(() => {
this.props.closeDialog();
removeSpinnerInButton($(this.submitButton), initialButtonText);
})
.catch(() => {
removeSpinnerInButton($(this.submitButton), initialButtonText);
});
} else {
$('#files').click();
this.props.closeDialog();
}
}

render() {
return (
<form
id="load-dialog"
action="javascript:;" // eslint-disable-line no-script-url
className="dialog-content"
style={style.content}
onSubmit={() => this.submit()}
>
<div className="center-text input-row">
<span className="integration-option">
<input
type="radio"
id="load-local"
name="load-option"
value="local"
defaultChecked={true}
onChange={e => this.onChange(e)}
/>
<label htmlFor="load-local">{translate('My computer')}</label>
</span>
<span className="integration-option invisible">
<input
type="radio"
id="load-google-drive"
name="load-option"
value="google-drive"
onChange={e => this.onChange(e)}
/>
<label htmlFor="load-google-drive">Google Drive</label>
</span>
</div>
<div className="center-text input-row last">
<button
id="load-strategy"
type="submit"
ref={el => {
this.submitButton = el;
}}
>
{translate('Load')}
</button>
</div>
</form>
);
}
static props: { closeDialog: PropTypes.func };
}

export default class LoadDialog extends Dialog {
constructor() {
const closeDialog = () => {
this.close();
};
super('load-dialog', translate('Load blocks'), <LoadContent closeDialog={closeDialog} />, style.dialogLayout);
this.registerCloseOnOtherDialog();
}
}
95 changes: 0 additions & 95 deletions src/botPage/view/Dialogs/Save.js

This file was deleted.

Loading