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
32 commits
Select commit Hold shift + click to select a range
57ac5f4
Merge dev
gokula-binary Dec 14, 2018
ac861d4
Merge dev
gokula-binary Dec 14, 2018
0dc23b2
Merge dev
gokula-binary Dec 14, 2018
3400bde
Merge dev
gokula-binary Dec 19, 2018
091f2e8
Merge dev
gokula-binary Dec 19, 2018
2c964b3
Merge pull request #1076 from binary-com/beta
ashkanx Jan 4, 2019
a0817ae
Merge Dev
gokula-binary Jan 29, 2019
905ba1f
Merge branch 'master' into dev
Feb 1, 2019
d0c1c7c
Add show/hide header svgs
Feb 5, 2019
7a19ba8
Add Login + Account List in toolbox when header hidden
Feb 5, 2019
3d3493e
Set width to fix inconsistency
Feb 5, 2019
1261fe7
Add rules for toolbox Account List + Login
Feb 5, 2019
c07ec11
Add icons for toggling header
Feb 5, 2019
a8c8278
Add support for toolbox dropdown
Feb 5, 2019
33c8a6f
Update tour selector
Feb 5, 2019
c4ccc47
Reveal header as user progresses through tour
Feb 5, 2019
a57beae
Add logic for showing/hiding header and bind some events to new toolb…
Feb 5, 2019
7a9e2cd
Revert fixing HTML, address in future
Feb 5, 2019
4a74ec2
Remove some conditions before sending bot.init emit
Feb 5, 2019
c55575f
Modify default context menu by hooking Blockly fn
Feb 5, 2019
65a9c30
Open Elev.io widget when 'Help' is clicked
Feb 5, 2019
43f423b
Add disable some eslint rules
Feb 5, 2019
4aa5f51
Merge pull request #1178 from aaron-binary/default-chart-fix
ashkanx Feb 5, 2019
77fb2bc
Merge pull request #1180 from aaron-binary/modify-context-menu
ashkanx Feb 5, 2019
bc05696
Refactor
Feb 7, 2019
26a53af
Hide toggleHeaderButton when progressing through tour
Feb 7, 2019
f8b6481
Add spacing for toolbox-login, and toolbox-account-list
Feb 7, 2019
a4bc081
Move clearUndo() to correct place
Feb 7, 2019
7b4ba4c
Don't record duration changes in redo/undo
Feb 7, 2019
7656643
Merge pull request #1174 from aaron-binary/fullscreen
ashkanx Feb 7, 2019
89697e5
Merge branch 'dev' into duration-stuck-on-loading
ashkanx Feb 7, 2019
8d40ef8
Merge pull request #1186 from aaron-binary/duration-stuck-on-loading
ashkanx Feb 7, 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
30 changes: 24 additions & 6 deletions src/botPage/view/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ const getActiveToken = (tokenList, activeToken) => {

const updateTokenList = () => {
const tokenList = getTokenList();
const loginButton = $('#login');
const accountList = $('#account-list');
const loginButton = $('#login, #toolbox-login');
const accountList = $('#account-list, #toolbox-account-list');
if (tokenList.length === 0) {
loginButton.show();
accountList.hide();

$('.account-id')
.removeAttr('value')
.text('');
Expand All @@ -190,7 +191,6 @@ const updateTokenList = () => {
} else {
loginButton.hide();
accountList.show();

const activeToken = getActiveToken(tokenList, getStorage(AppConstants.STORAGE_ACTIVE_TOKEN));
updateLogo(activeToken.token);
addBalanceForToken(activeToken.token);
Expand All @@ -200,7 +200,6 @@ const updateTokenList = () => {
}
tokenList.forEach(tokenInfo => {
const prefix = isVirtual(tokenInfo) ? 'Virtual Account' : `${tokenInfo.loginInfo.currency} Account`;

if (tokenInfo === activeToken) {
$('.account-id')
.attr('value', `${tokenInfo.token}`)
Expand Down Expand Up @@ -277,6 +276,7 @@ export default class View {
applyToolboxPermissions();
renderReactComponents();
if (!getTokenList().length) updateLogo();
this.showHeader(getStorage('showHeader') !== 'false');
resolve();
});
});
Expand Down Expand Up @@ -468,11 +468,13 @@ export default class View {

$('#showSummary').click(showSummary);

$('#toggleHeaderButton').click(() => this.showHeader($('#header').is(':hidden')));

$('#loadXml').click(() => {
$('#files').click();
});

$('#logout').click(() => {
$('#logout, #toolbox-logout').click(() => {
setBeforeUnload(true);
logout();
hideRealityCheck();
Expand Down Expand Up @@ -573,7 +575,7 @@ export default class View {
.catch(() => {});
});

$('#login')
$('#login, #toolbox-login')
.bind('click.login', () => {
setBeforeUnload(true);
document.location = getOAuthURL();
Expand Down Expand Up @@ -636,6 +638,22 @@ export default class View {
}
});
}
showHeader = show => {
const $header = $('#header');
const $topbarAccount = $('#toolbox-account');
const $toggleHeaderButton = $('.icon-hide-header');
if (show) {
$header.show(0);
$topbarAccount.hide(0);
$toggleHeaderButton.removeClass('enabled');
} else {
$header.hide(0);
$topbarAccount.show(0);
$toggleHeaderButton.addClass('enabled');
}
setStorage('showHeader', show);
window.dispatchEvent(new Event('resize'));
};
}

function initRealityCheck(stopCallback) {
Expand Down
3 changes: 1 addition & 2 deletions src/botPage/view/blockly/blocks/trade/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ const decorateTrade = ev => {
}
if ([Blockly.Events.CHANGE, Blockly.Events.MOVE, Blockly.Events.CREATE].includes(ev.type)) {
const symbol = trade.getFieldValue('SYMBOL_LIST');

if (symbol && (ev.group === 'reset' || ev.type !== Blockly.Events.CREATE)) {
if (symbol) {
globalObserver.emit('bot.init', symbol);
}

Expand Down
5 changes: 5 additions & 0 deletions src/botPage/view/blockly/blocks/trade/tradeOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ export default () => {
const tradeType = getTradeType(this);

const prevSelectedDuration = durationTypeList.getValue();

Blockly.Events.recordUndo = false;
this.setFieldValue(translate('Loading...'), 'DURATIONTYPE_LIST');
Blockly.Events.recordUndo = true;

getAvailableDurations(symbol, tradeType).then(durations => {
Blockly.Events.recordUndo = false;
// Prevent UI flickering by only updating field if options have changed
// eslint-disable-next-line no-underscore-dangle
if (JSON.stringify(durationTypeList.menuGenerator_) !== JSON.stringify(durations)) {
Expand All @@ -56,6 +60,7 @@ export default () => {
} else {
this.setFieldValue(translate('Not available'), 'DURATIONTYPE_LIST');
}
Blockly.Events.recordUndo = true;
});
}
}
Expand Down
42 changes: 41 additions & 1 deletion src/botPage/view/blockly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ export default class _Blockly {
this.blocksXmlStr = Blockly.Xml.domToPrettyText(main);
Blockly.Xml.domToWorkspace(main.getElementsByTagName('xml')[0], workspace);
this.zoomOnPlusMinus();
Blockly.mainWorkspace.clearUndo();
disposeBlocksWithLoaders();
setTimeout(() => {
setBeforeUnload(true);
Blockly.mainWorkspace.cleanUp();
Blockly.mainWorkspace.clearUndo();
}, 0);
resolve();
});
Expand Down Expand Up @@ -417,3 +417,43 @@ while(true) {
}
/* eslint-enable */
}

// Hooks to override default Blockly behaviour
/* eslint-disable no-unused-expressions */
const originalContextMenuFn = Blockly.ContextMenu.show;
Blockly.ContextMenu.show = (e, menuOptions, rtl) => {
// Rename 'Clean up blocks'
menuOptions.some(option => {
if (option.text === Blockly.Msg.CLEAN_UP) {
option.text = translate('Rearrange vertically'); // eslint-disable-line no-param-reassign
return true;
}
return false;
}) &&
/* Remove delete all blocks, but only when 'Clean up blocks' is available (i.e. workspace)
* This allows users to still delete root blocks containing blocks
*/
menuOptions.some((option, i) => {
if (
option.text === Blockly.Msg.DELETE_BLOCK ||
option.text.replace(/[0-9]+/, '%1') === Blockly.Msg.DELETE_X_BLOCKS
) {
menuOptions.splice(i, 1);
return true;
}
return false;
});
// Open the Elev.io widget when clicking 'Help'
// eslint-disable-next-line no-underscore-dangle
if (window._elev) {
menuOptions.some(option => {
if (option.text === Blockly.Msg.HELP) {
option.callback = () => window._elev.open(); // eslint-disable-line no-param-reassign, no-underscore-dangle
return true;
}
return false;
});
}
originalContextMenuFn(e, menuOptions, rtl);
};
/* eslint-enable */
24 changes: 22 additions & 2 deletions src/botPage/view/tour/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const setDoneCheck = () => {
const doNotAskCheck = document.getElementById('do-not-ask-me-again');
if (doNotAskCheck && doNotAskCheck.checked) {
setDone('welcomeFinished');
return true;
}
return false;
};

class Tour extends PureComponent {
Expand All @@ -26,6 +28,9 @@ class Tour extends PureComponent {
setDoneCheck();
setStorage('closedTourPopup', Date.now());
this.joyride.stop();
if ($('#toggleHeaderButton').is(':hidden')) {
$('#toggleHeaderButton').show();
}
},
};
}
Expand All @@ -45,8 +50,23 @@ class Tour extends PureComponent {
element.scrollIntoView();
}
}
if (data.index === 0 && data.type === 'step:after') {
setDoneCheck();
const $toggleHeaderButton = $('#toggleHeaderButton');
if (data.type === 'step:after') {
// Reveal header if user hid it so tour is working properly
const hasSupressedTour = data.index === 0 && setDoneCheck();
if (!hasSupressedTour) {
if ($('#header').is(':hidden')) {
$toggleHeaderButton.click();
}
if (data.index < welcome.length - 1) {
$toggleHeaderButton.hide();
} else {
$toggleHeaderButton.show();
}
}
}
if (data.action === 'close' && $toggleHeaderButton.is(':hidden')) {
$toggleHeaderButton.show();
}
};
const shouldShowTourPopup = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/botPage/view/tour/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const steps = [
text : `<p>
${translate('Login before starting your bot. Always test your strategies with the virtual account.')}
</p>`,
selector: '.right-header',
selector: '.intro-login-logout',
position: 'left',
},
{
Expand Down
16 changes: 12 additions & 4 deletions src/common/binary-ui/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ function navMenuListener() {
event.stopPropagation();
hide_menu($('.top-nav-menu li ul'));
hide_menu($('#language_select, #select_language'));
var $el = $('#all-accounts, #all-accounts-top');
let $el;
if ($(this).is('#toolbox-main-account')) {
$el = $('#toolbox-all-accounts');
hide_menu($('#all-accounts'));
} else {
$el = $('#all-accounts');
hide_menu($('#toolbox-all-accounts'));
}

if ($el.css('opacity') == 1) {
hide_menu($el);
} else {
Expand All @@ -34,7 +42,7 @@ function navMenuListener() {
function topNavMenuListener() {
$('.top-nav-menu > li').on('click', function(event) {
event.stopPropagation();
hide_menu($('#all-accounts, #all-accounts-top'));
hide_menu($('#all-accounts, #toolbox-all-accounts'));
hide_menu($('#language_select, #select_language'));
var childMenu = $(this).find(' > ul'),
$el = $('.top-nav-menu li ul');
Expand All @@ -61,7 +69,7 @@ function topNavMenuListener() {

function documentListener() {
$(document).on('click', function() {
hide_menu($('#all-accounts, #all-accounts-top'));
hide_menu($('#all-accounts, #toolbox-all-accounts'));
hide_menu($('.top-nav-menu li ul'));
hide_menu($('#language_select, #select_language'));
});
Expand All @@ -71,7 +79,7 @@ function langListener() {
$('.languages').on('click', function(event) {
event.stopPropagation();
hide_menu($('.top-nav-menu li ul'));
hide_menu($('#all-accounts, #all-accounts-top'));
hide_menu($('#all-accounts, #toolbox-all-accounts'));
var $el = $('#language_select, #select_language');
if ($el.css('opacity') == 1) {
hide_menu($el);
Expand Down
11 changes: 10 additions & 1 deletion static/css/_fontello.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,13 @@
.icon-trading-view:before { content: '\e810'; } /* '' */
.icon-info:before { content: '\f129'; } /* '' */
.icon-sort:before { content: '\f160'; } /* '' */
.icon-chart-line:before { content: '\f201'; } /* '' */
.icon-chart-line:before { content: '\f201'; } /* '' */
.icon-hide-header {
&:before {
content: ' ';
}
background: url("../image/expand_less.svg") no-repeat center;
&.enabled {
background: url("../image/expand_more.svg") no-repeat center;
}
}
55 changes: 55 additions & 0 deletions static/css/_toolbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
border-bottom: 1px solid $brand-dark-gray;
padding: 2px 3px;
z-index: 0;
overflow: auto;

#runButton[disabled], #runButton[disabled]:hover {
@include toolbox-runButton-disabled;
Expand Down Expand Up @@ -55,3 +56,57 @@
width: 2px;
}
}

#toolbox-login {
margin-top: 1px;
margin-right: 20px;
}

#toolbox-account {
display: table;
height: 40px;
}

#toolbox-account-list {
position: relative;
user-select: none;
display: table-cell;
vertical-align: middle;
padding-right: 20px;
&>a {
color: $black;
&:hover, &:visited {
text-decoration: none;
}
}
}

#toolbox-main-account {
display: inline;
padding-inline-start: 0;
&>li {
display: inline;
margin: 0 2px;
}
&>li:not(:first-child):not(:last-child):before {
content: '\2022';
margin-right: 7px;
}
&>.nav-caret {
display: inline-block;
}
}

#toolbox-all-accounts {
border: 0;
z-index: 100;
margin-top: -1px;
background: none;
right: 20px;
& li {
height: 100%;
& a {
margin-top: 0;
}
}
}
8 changes: 8 additions & 0 deletions static/css/bot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ body {
display: table;
}

#all-accounts.main-nav, #toolbox-all-accounts.main-nav {
>li {
>ul {
width: 165px;
}
}
}

.left-header {
float: left;
}
Expand Down
1 change: 1 addition & 0 deletions static/image/expand_less.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/image/expand_more.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading