Many fixes and adjustments to the upper right landing UI.

The user_text span now displays the currently selected account.
This commit is contained in:
Daniel Scalzi
2018-04-29 18:05:59 -04:00
parent ea758aee1f
commit 4106b2b069
6 changed files with 35 additions and 23 deletions

View File

@@ -21,7 +21,7 @@ const Mojang = require('./mojang.js')
*
* @param {string} username The account username (email if migrated).
* @param {string} password The account password.
* @returns {Promise.<Object>} Promise which resolves to the Mojang authentication response.
* @returns {Promise.<Object>} Promise which resolves the resolved authenticated account object.
*/
exports.addAccount = async function(username, password){
try{

View File

@@ -20,6 +20,7 @@ const launch_progress = document.getElementById('launch_progress')
const launch_progress_label = document.getElementById('launch_progress_label')
const launch_details_text = document.getElementById('launch_details_text')
const server_selection_button = document.getElementById('server_selection_button')
const user_text = document.getElementById('user_text')
/* Launch Progress Wrapper Functions */
@@ -103,6 +104,16 @@ document.getElementById('launch_button').addEventListener('click', function(e){
}
})
// Bind selected account
function updateSelectedAccount(authUser){
let username = 'No Account Selected'
if(authUser != null && authUser.username != null){
username = authUser.displayName
}
user_text.innerHTML = username
}
updateSelectedAccount(ConfigManager.getSelectedAccount())
// Bind selected server
function updateSelectedServer(serverName){
if(serverName == null){

View File

@@ -227,6 +227,7 @@ loginButton.addEventListener('click', () => {
loginLoading(true)
AuthManager.addAccount(loginUsername.value, loginPassword.value).then((value) => {
updateSelectedAccount(value)
loginButton.innerHTML = loginButton.innerHTML.replace('LOGGING IN', 'SUCCESS')
$('.circle-loader').toggleClass('load-complete')
$('.checkmark').toggle()