-
Notifications
You must be signed in to change notification settings - Fork 521
Conversation
@kellybinary please fix the conflicts |
@@ -1,9 +1,9 @@ | |||
<span class="language-select"> | |||
<!-- <span class="language-select"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary Never keep the previous code in comments, git will take care of backing up codes.
</div> | ||
</a> | ||
</div> | ||
<head> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary
👍 for fixing the indentation.
It's always a good idea to pull the most recent changes from upstream before you make a PR. Because sometimes changes from other collaborators will cause merge conflicts.
If you don't have the upstream origin add it like this:
git remote add upstream https://github.com/binary-com/binary-bot.git
Then you will be able to perform git pull
git pull upstream master
Sometimes there'll be merge conflicts, you need to look thoroughly into the code to find out what has changed and keep the desired changes.
Test again to see if everything is as expected and then add the changes and commit them to complete the merge process.
<th><span data-i18n-text="Buy Price"></span></th> | ||
<th><span data-i18n-text="Final Price"></span></th> | ||
<th><span data-i18n-text="Profit/Loss"></span></th> | ||
<th data-i18n-text="No. of runs"></th> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary 👍 for fixing the other parts of the code, better to make a separate commit for this fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aminmarashi i didn't add this tho. it was already there, probably fetched from the beta branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary So better to revert. Let's keep the change set as concise as possible.
en, | ||
ach, | ||
} | ||
zh_tw: zhTw, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary We use 2 spaces for each tab, not 4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aminmarashi noted. i will fix it.
@@ -0,0 +1,14 @@ | |||
import $ from 'jquery' | |||
|
|||
export default class LanguageDropdown { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇 for using ES6.
This function can be moved inside the translator constructor and be used instead of the event listener like this:
$('ul#select_language li')
.click(function onClick() {
const lang = $(this).attr('class')
document.location.search = `l=${lang}`
})
....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In es6 encapsulation is the default behavior, therefore you don't need to define classes to ensure encapsulation. You could simply write:
export () => {
$('ul#select_language li')
.click(function onClick() {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄 you're right, needed to wrap it in another click event as such:
.click(function onClick() {
$('ul#select_language li')
.click(function onClick() {
const lang = $(this).attr('class')
document.location.search = `l=${lang}`
})
})
}) | ||
const lang = this.getLanguage() | ||
$('#language').val(lang) | ||
$('.language').text(languageDisplayName[lang]); | ||
$(document.getElementsByClassName(lang)[0]).hide(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorter version thanks to es6:
$(`.${lang}`)
.hide()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lovely shorter version!
document.location.search = `l=${value}` | ||
}) | ||
$.each(languageDisplayName, (key, value) => { // populate language dropdown | ||
$('#select_language').append(`<li class=${key}>${value}</li>`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
$('.language').on('change_language', (event, value) => { | ||
document.location.search = `l=${value}` | ||
}) | ||
$.each(languageDisplayName, (key, value) => { // populate language dropdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better not to use jquery each sth js is able to do:
for (const key of Object.keys(languageDisplayName)) {
const value = languageDisplayName[key]
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted 👍
@ashkanx Should we do the same for the ugly tour dropdown? |
Yes. I think it's better to make it look like the other one. |
$('#language').change(e => { | ||
document.location.search = `l=${e.target.value}` | ||
}) | ||
$('.language') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<th><span data-i18n-text="Buy Price"></span></th> | ||
<th><span data-i18n-text="Final Price"></span></th> | ||
<th><span data-i18n-text="Profit/Loss"></span></th> | ||
<th data-i18n-text="No. of runs"></th> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All done, good job!
} | ||
}; | ||
|
||
const languageDisplayName = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary Is there any reason to do this in js? Why not simply define these in html?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! we no longer need this.
<th><span data-i18n-text="Buy Price"></span></th> | ||
<th><span data-i18n-text="Final Price"></span></th> | ||
<th><span data-i18n-text="Profit/Loss"></span></th> | ||
<th data-i18n-text="No. of runs"></th> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary So better to revert. Let's keep the change set as concise as possible.
@@ -1,3 +1,5 @@ | |||
**/mock/*.js | |||
**/translations/*.js | |||
**/calls.js | |||
src/common/language_dropdown.js | |||
src/common/translator.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary Not a good idea to ignore one of the main modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary Bump ^
$('#language').change(e => { | ||
document.location.search = `l=${e.target.value}` | ||
}) | ||
$('.language') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kellybinary How about this:
const lang = this.getLanguage()
$('#select_language li:not(:first)')
.click((e) => {
const newLang = $(e.target).attr('class')
document.location.search = `l=${newLang}`
})
$('.language')
.text($(`.${lang}`)
.hide().text())
@@ -30,14 +30,38 @@ const supportedLanguages = { | |||
fr, | |||
en, | |||
ach, | |||
} | |||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use semicolons in Binary Bot js files. So let's keep them out of this! 😄
@@ -41,7 +41,7 @@ | |||
</div> | |||
{{> loading }} | |||
<div id="topbar"> | |||
<div class="right-header"> | |||
<div class="wrapper"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's prefer right-header
over wrapper
. I will make the changes first thing tomorrow.
update language dropdown and header.