Improved UI navigation

This commit is contained in:
MaciejkaG 2024-03-24 22:00:05 +01:00
parent 36b22037d4
commit 1ba265b9f5
2 changed files with 16 additions and 16 deletions

View File

@ -24,7 +24,6 @@ var nickname;
var myProfile; var myProfile;
socket.emit("my profile", (profile) => { socket.emit("my profile", (profile) => {
console.log(profile);
// General profile data // General profile data
let options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; let options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
$("#playerSince").html(new Date(profile.profile.account_creation).toLocaleDateString("pl-PL", options)); $("#playerSince").html(new Date(profile.profile.account_creation).toLocaleDateString("pl-PL", options));
@ -35,6 +34,7 @@ socket.emit("my profile", (profile) => {
$("#totalPlayed").html(profile.stats.alltime_matches); $("#totalPlayed").html(profile.stats.alltime_matches);
$("#winrate").html(`${profile.stats.winrate}%`); $("#winrate").html(`${profile.stats.winrate}%`);
// Match history
var matchHistory = profile.matchHistory; var matchHistory = profile.matchHistory;
var matchHistoryDOM = ""; var matchHistoryDOM = "";
@ -43,8 +43,6 @@ socket.emit("my profile", (profile) => {
for (let i = 0; i < matchHistory.length; i++) { for (let i = 0; i < matchHistory.length; i++) {
const match = matchHistory[i]; const match = matchHistory[i];
console.log();
let date = new Date(match.date).toLocaleDateString("pl-PL", options); let date = new Date(match.date).toLocaleDateString("pl-PL", options);
const minutes = Math.floor(match.duration / 60).toLocaleString('pl-PL', { minimumIntegerDigits: 2, useGrouping: false }); const minutes = Math.floor(match.duration / 60).toLocaleString('pl-PL', { minimumIntegerDigits: 2, useGrouping: false });

View File

@ -2,20 +2,22 @@ var activeView;
var returnLock = false; var returnLock = false;
function switchView(viewContainerId, useReplaceState=false) { function switchView(viewContainerId, useReplaceState=false) {
$(`.container`).css({ opacity: 0, animation: "OutAnim 0.2s 1 ease" }); if (!returnLock) {
setTimeout(() => { $(`.container`).css({ opacity: 0, animation: "OutAnim 0.2s 1 ease" });
$(`.container`).css("display", "none"); setTimeout(() => {
$(`.container#${viewContainerId}`).css({ display: "flex", opacity: 1, animation: "InAnim 0.2s 1 ease" }); $(`.container`).css("display", "none");
let path = $(`.container#${viewContainerId}`).data("path"); $(`.container#${viewContainerId}`).css({ display: "flex", opacity: 1, animation: "InAnim 0.2s 1 ease" });
let title = $(`.container#${viewContainerId}`).data("title"); let path = $(`.container#${viewContainerId}`).data("path");
if (useReplaceState) { let title = $(`.container#${viewContainerId}`).data("title");
history.replaceState(null, "", path ? path : "/"); if (useReplaceState) {
} else { history.replaceState(null, "", path ? path : "/");
history.pushState(null, title ? title : "Statki", path ? path : "/"); } else {
} history.pushState(null, title ? title : "Statki", path ? path : "/");
}
activeView = viewContainerId; activeView = viewContainerId;
}, 200); }, 200);
}
} }
function lockUI(doLock) { function lockUI(doLock) {