Begin interface for table
This commit is contained in:
parent
4b0ca1a2ef
commit
153f50294d
@ -10,6 +10,16 @@ function showLoginWindow() {
|
|||||||
document.getElementById("signup-window").style.display = "table"
|
document.getElementById("signup-window").style.display = "table"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hideTableListElements() {
|
||||||
|
document.getElementById("table-list-bar").style.display = "none"
|
||||||
|
document.getElementById("table-list").style.display = "none"
|
||||||
|
}
|
||||||
|
|
||||||
|
function showTableListElements() {
|
||||||
|
document.getElementById("table-list-bar").style.display = "grid"
|
||||||
|
document.getElementById("table-list").style.display = "inherit"
|
||||||
|
}
|
||||||
|
|
||||||
function setPlayerName(name) {
|
function setPlayerName(name) {
|
||||||
document.getElementById("player-name").innerHTML = name
|
document.getElementById("player-name").innerHTML = name
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,17 @@ function showBlankLoginScreen(text) {
|
|||||||
setLoginError(text)
|
setLoginError(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showTableList() {
|
||||||
|
showTableListElements()
|
||||||
|
hideLoginWindow()
|
||||||
|
}
|
||||||
|
|
||||||
function showGame(tableId) {
|
function showGame(tableId) {
|
||||||
setTableId(tableId)
|
setTableId(tableId)
|
||||||
const token = getSessionToken()
|
const token = getSessionToken()
|
||||||
if (token) {
|
if (token) {
|
||||||
openSocket(token)
|
openSocket(token)
|
||||||
|
hideTableListElements()
|
||||||
// TODO: Show interface
|
// TODO: Show interface
|
||||||
console.log("Show table " + tableId)
|
console.log("Show table " + tableId)
|
||||||
} else {
|
} else {
|
||||||
@ -55,7 +61,7 @@ function registerUser() {
|
|||||||
.then(function(token) {
|
.then(function(token) {
|
||||||
setSessionToken(token)
|
setSessionToken(token)
|
||||||
setPlayerName(username)
|
setPlayerName(username)
|
||||||
hideLoginWindow()
|
showTableList()
|
||||||
loadCurrentTable(token)
|
loadCurrentTable(token)
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
setLoginError(error.message)
|
setLoginError(error.message)
|
||||||
@ -94,7 +100,7 @@ function loginUser() {
|
|||||||
.then(function(token) {
|
.then(function(token) {
|
||||||
setSessionToken(token)
|
setSessionToken(token)
|
||||||
setPlayerName(username)
|
setPlayerName(username)
|
||||||
hideLoginWindow()
|
showTableList()
|
||||||
loadCurrentTable(token)
|
loadCurrentTable(token)
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
setLoginError(error.message)
|
setLoginError(error.message)
|
||||||
@ -122,7 +128,7 @@ function loadExistingSession() {
|
|||||||
resumeSessionRequest(token)
|
resumeSessionRequest(token)
|
||||||
.then(function(name) {
|
.then(function(name) {
|
||||||
setPlayerName(name)
|
setPlayerName(name)
|
||||||
hideLoginWindow()
|
showTableList()
|
||||||
loadCurrentTable(token)
|
loadCurrentTable(token)
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
showBlankLoginScreen(error.message)
|
showBlankLoginScreen(error.message)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<div id="player-name"></div>
|
<div id="player-name"></div>
|
||||||
<button id="logout-button" class="standard-button" onclick="logoutUser()">Log out</button>
|
<button id="logout-button" class="standard-button" onclick="logoutUser()">Log out</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-list-bar">
|
<div id="table-list-bar">
|
||||||
<input type="text" id="table-name-field" name="tablename" placeholder="Create new table..." required>
|
<input type="text" id="table-name-field" name="tablename" placeholder="Create new table..." required>
|
||||||
<input type="checkbox" id="table-public-checkbox" name="public-table" checked="checked">
|
<input type="checkbox" id="table-public-checkbox" name="public-table" checked="checked">
|
||||||
<span id="table-public-label">Public</span>
|
<span id="table-public-label">Public</span>
|
||||||
@ -26,11 +26,7 @@
|
|||||||
|
|
||||||
<div id="table-list">
|
<div id="table-list">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-list-window" id="table-window">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="signup-window" id="signup-window">
|
<div class="signup-window" id="signup-window">
|
||||||
<div class="signup-window-vertical-center">
|
<div class="signup-window-vertical-center">
|
||||||
<div class="signup-window-inner">
|
<div class="signup-window-inner">
|
||||||
|
@ -112,7 +112,7 @@ body, html {
|
|||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-list-bar {
|
#table-list-bar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 510px;
|
width: 510px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
Loading…
Reference in New Issue
Block a user