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"
|
||||
}
|
||||
|
||||
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) {
|
||||
document.getElementById("player-name").innerHTML = name
|
||||
}
|
||||
|
@ -28,11 +28,17 @@ function showBlankLoginScreen(text) {
|
||||
setLoginError(text)
|
||||
}
|
||||
|
||||
function showTableList() {
|
||||
showTableListElements()
|
||||
hideLoginWindow()
|
||||
}
|
||||
|
||||
function showGame(tableId) {
|
||||
setTableId(tableId)
|
||||
const token = getSessionToken()
|
||||
if (token) {
|
||||
openSocket(token)
|
||||
hideTableListElements()
|
||||
// TODO: Show interface
|
||||
console.log("Show table " + tableId)
|
||||
} else {
|
||||
@ -55,7 +61,7 @@ function registerUser() {
|
||||
.then(function(token) {
|
||||
setSessionToken(token)
|
||||
setPlayerName(username)
|
||||
hideLoginWindow()
|
||||
showTableList()
|
||||
loadCurrentTable(token)
|
||||
}).catch(function(error) {
|
||||
setLoginError(error.message)
|
||||
@ -94,7 +100,7 @@ function loginUser() {
|
||||
.then(function(token) {
|
||||
setSessionToken(token)
|
||||
setPlayerName(username)
|
||||
hideLoginWindow()
|
||||
showTableList()
|
||||
loadCurrentTable(token)
|
||||
}).catch(function(error) {
|
||||
setLoginError(error.message)
|
||||
@ -122,7 +128,7 @@ function loadExistingSession() {
|
||||
resumeSessionRequest(token)
|
||||
.then(function(name) {
|
||||
setPlayerName(name)
|
||||
hideLoginWindow()
|
||||
showTableList()
|
||||
loadCurrentTable(token)
|
||||
}).catch(function(error) {
|
||||
showBlankLoginScreen(error.message)
|
||||
|
@ -15,7 +15,7 @@
|
||||
<div id="player-name"></div>
|
||||
<button id="logout-button" class="standard-button" onclick="logoutUser()">Log out</button>
|
||||
</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="checkbox" id="table-public-checkbox" name="public-table" checked="checked">
|
||||
<span id="table-public-label">Public</span>
|
||||
@ -26,11 +26,7 @@
|
||||
|
||||
<div id="table-list">
|
||||
</div>
|
||||
|
||||
<div class="table-list-window" id="table-window">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="signup-window" id="signup-window">
|
||||
<div class="signup-window-vertical-center">
|
||||
<div class="signup-window-inner">
|
||||
|
@ -112,7 +112,7 @@ body, html {
|
||||
grid-column: 2;
|
||||
}
|
||||
|
||||
.table-list-bar {
|
||||
#table-list-bar {
|
||||
position: absolute;
|
||||
width: 510px;
|
||||
height: 40px;
|
||||
|
Loading…
Reference in New Issue
Block a user