Permalink
Browse files

home tab

  • Loading branch information...
Manuel-777 committed Jan 27, 2019
1 parent 10de702 commit 29459b530d52e5cf3f024e17f55f9c2c3e464905
@@ -488,12 +488,12 @@ ipc.on('request_course', function (event, arg) {
httpApi.httpGetCourse(arg);
});

ipc.on('request_tou_list', function () {
ipc.on('request_home', function () {
if (playerUsername == '') {
ipc_send("offline", 1);
}
else {
httpApi.httpTournamentList();
httpApi.httpHomeGet();
}
});

@@ -140,8 +140,8 @@ function httpBasic() {
if (_headers.method == 'share_draft') {
ipc_send("set_draft_link", parsedResult.url);
}
if (_headers.method == 'tou_list') {
ipc_send("set_tou_list", parsedResult.result);
if (_headers.method == 'home_get') {
ipc_send("set_home", parsedResult);
}
if (_headers.method == 'tou_get') {
ipc_send("tou_set", parsedResult.result);
@@ -344,10 +344,10 @@ function httpDraftShareLink(did, exp) {
httpAsync.push({'reqId': _id, 'method': 'share_draft', 'method_path': '/get_share_draft.php', 'id': did, 'expire': exp});
}

function httpTournamentList() {
function httpHomeGet() {
heartbeatClear();
var _id = makeId(6);
httpAsync.push({'reqId': _id, 'method': 'tou_list', 'method_path': '/tournament_list.php'});
httpAsync.push({'reqId': _id, 'method': 'home_get', 'method_path': '/get_home.php'});
}

function httpTournamentGet(tid) {
@@ -402,8 +402,8 @@ module.exports = {
httpDeleteData,
httpGetDatabase,
htttpGetStatus,
httpHomeGet,
httpDraftShareLink,
httpTournamentList,
httpTournamentGet,
httpTournamentJoin,
httpTournamentDrop,
@@ -29,7 +29,7 @@ let listInterval = [];
let touStates = {};

// Should separate these two into smaller functions
function open_tournaments_tab(arg, opentab = true) {
function open_home_tab(arg, opentab = true) {
let mainDiv = document.getElementById("ux_0");
mainDiv.classList.remove("flex_item");
mainDiv.innerHTML = '';
@@ -48,8 +48,8 @@ function open_tournaments_tab(arg, opentab = true) {

return false;
}
if (arg != null) {
tournaments_list = arg;
if (arg !== null) {
tournaments_list = arg.tournaments;
if (!opentab) return
}

@@ -65,7 +65,7 @@ function open_tournaments_tab(arg, opentab = true) {
fl.style.width = "fit-content";
mainDiv.appendChild(fl);

let title = createDivision(["tournament_title"], "Tournaments List:");
let title = createDivision(["tournament_title"], "Tournaments:");
mainDiv.appendChild(title);

let cont = createDivision(["tournament_list_cont"]);
@@ -744,7 +744,7 @@ function moveCard(_cardTile) {
}

module.exports = {
open_tournaments_tab: open_tournaments_tab,
open_home_tab: open_home_tab,
open_tournament: open_tournament,
set_tou_state: set_tou_state
}
@@ -369,7 +369,7 @@ span.top_nav_item_text {
opacity: 1;
margin: 16px auto;
background-repeat: no-repeat;
background-image: url(../images/cup.png);
background-image: url(../images/tab_home.png);
}

.sidebar_separator {
@@ -40,8 +40,8 @@
<div class="top_nav hidden">
<div class="top_nav_icons">
<div class="top_nav_separator"></div>
<div class="top_nav_item ith" style="width: 60px;"><div class="ith_icon"></div></div>
<div class="top_nav_item item_selected it0"><span class="top_nav_item_text">MY DECKS</span><div class="top_nav_icon icon_1"></div></div>
<div class="top_nav_item item_selected ith" style="width: 60px;"><div class="ith_icon"></div></div>
<div class="top_nav_item it0"><span class="top_nav_item_text">MY DECKS</span><div class="top_nav_icon icon_1"></div></div>
<div class="top_nav_item it1"><span class="top_nav_item_text">HISTORY</span><div class="top_nav_icon icon_2"></div></div>
<div class="top_nav_item it2"><span class="top_nav_item_text">EVENTS</span><div class="top_nav_icon icon_3"></div></div>
<div class="top_nav_item it3"><span class="top_nav_item_text">EXPLORE</span><div class="top_nav_icon icon_4"></div></div>
@@ -26,9 +26,9 @@ global
const electron = require('electron');
const remote = require('electron').remote;

const open_tournaments_tab = require('./tournaments').open_tournaments_tab;
const open_tournament = require('./tournaments').open_tournament;
const set_tou_state = require('./tournaments').set_tou_state;
const open_home_tab = require('./home').open_home_tab;
const open_tournament = require('./home').open_tournament;
const set_tou_state = require('./home').set_tou_state;
const open_deck = require('./deck_details').open_deck
const open_decks_tab = require('./decks').open_decks_tab;
const open_history_tab = require('./history').open_history_tab;
@@ -60,7 +60,7 @@ let cards = {};
let cardsNew = {};
let settings = null;
let updateState = {state: -1, available: false, progress: 0, speed: 0};
let sidebarActive = 0;//-1
let sidebarActive = -1
let filterEvent = 'All';

let draftPosition = 1;
@@ -152,7 +152,7 @@ ipc.on('auth', function (event, arg) {
ipc.on('set_discord_tag', (event, arg) => {
discordTag = arg;
if (sidebarActive == -1) {
ipc_send('request_tou_list', true);
ipc_send('request_home', true);
}
});

@@ -398,10 +398,11 @@ ipc.on('set_status', function (event, arg) {
});

//
ipc.on('set_tou_list', function (event, arg) {
ipc.on('set_home', function (event, arg) {
document.body.style.cursor = "auto";
if (sidebarActive == -1) {
open_tournaments_tab(arg);
console.log(arg);
open_home_tab(arg);
}
});

@@ -536,8 +537,8 @@ ipc.on('initialize', function () {
$('.top_username_id').html(userName.slice(-6));

$(".top_rank").css("background-position", (rankOffset*-48)+"px 0px").attr("title", rankTitle);
sidebarActive = 0;//-1;
//ipc_send('request_tou_list', true);
sidebarActive = -1;
ipc_send('request_home', true);
$('.top_nav').removeClass('hidden');
$('.overflow_ux').removeClass('hidden');
$('.message_center').css('display', 'none');
@@ -797,11 +798,11 @@ $(document).ready(function() {
$("#ux_0").html('<div class="loading_bar ux_loading"><div class="loading_color loading_w"></div><div class="loading_color loading_u"></div><div class="loading_color loading_b"></div><div class="loading_color loading_r"></div><div class="loading_color loading_g"></div></div>');

if (discordTag == null) {
open_tournaments_tab(null, true);
open_home_tab(null, true);
}
else {
document.body.style.cursor = "progress";
ipc_send('request_tou_list', true);
ipc_send('request_home', true);
}
}
}

0 comments on commit 29459b5

Please sign in to comment.