Compare commits
10 Commits
f24dcae19f
...
f8b9b5407b
| Author | SHA1 | Date | |
|---|---|---|---|
|
f8b9b5407b
|
|||
|
31a96558bf
|
|||
|
bba55bfc0e
|
|||
|
cfb643832b
|
|||
|
497c916d93
|
|||
|
8c07677a01
|
|||
|
677ac0241d
|
|||
|
d014848e71
|
|||
|
05d1952c84
|
|||
|
fae7507407
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -155,8 +155,5 @@ dist
|
||||
|
||||
# custom
|
||||
|
||||
# database
|
||||
database/data.db
|
||||
|
||||
#
|
||||
.idea
|
||||
BIN
database/data.db
Normal file
BIN
database/data.db
Normal file
Binary file not shown.
@@ -1,8 +1,42 @@
|
||||
.flex {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
|
||||
.loginSpacer {
|
||||
height: 33%;
|
||||
}
|
||||
|
||||
#menu {
|
||||
#login {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#content {
|
||||
height: 85%;
|
||||
width: 100%;
|
||||
padding: 5%;
|
||||
}
|
||||
|
||||
#menu {
|
||||
height: fit-content;
|
||||
width: 100%;
|
||||
padding: 5%;
|
||||
}
|
||||
#mainPage {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.screen {
|
||||
width: 95%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#taskButton {
|
||||
padding-left: 0;
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<script src="/frontend/index.js"></script>
|
||||
<div id="login" class="flex three" style="height: 100%">
|
||||
<div id="login" class="flex three">
|
||||
<div class="fourth two-fifth-1000"></div>
|
||||
<div class="flex one half fifth-1000" style="height: 100%">
|
||||
<div class="loginSpacer"></div>
|
||||
@@ -26,14 +26,20 @@
|
||||
</div>
|
||||
<div id="mainPage" style="display: none;">
|
||||
<div id="content">
|
||||
<div id="tasks"></div>
|
||||
<div id="history"></div>
|
||||
<div id="addTask"></div>
|
||||
<div id="tasks" class="screen" style="">Tasks</div>
|
||||
<div id="history" class="screen" style="display: none;">History</div>
|
||||
<div id="addTask" class="screen" style="display: none;">Add Task</div>
|
||||
</div>
|
||||
<div id="menu" class="flex three">
|
||||
<button class="third">Tasks</button>
|
||||
<button class="third">History</button>
|
||||
<button class="third">Add Task</button>
|
||||
<div id="menu" class="flex three demo">
|
||||
<div class="third" id="taskButton">
|
||||
<span class="button" onclick="switchScreen('task')">Tasks</span>
|
||||
</div>
|
||||
<div class="third" id="historyButton">
|
||||
<span class="button" onclick="switchScreen('history')">History</span>
|
||||
</div>
|
||||
<div class="third" id="addButton">
|
||||
<span class="button" onclick="switchScreen('add')" >Add Task</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
async function login() {
|
||||
// tell the user the app is loading
|
||||
document.getElementById("loginSubmit").value = "Loading";
|
||||
// this.preventDefault();
|
||||
// get login details
|
||||
let name = document.getElementById("name").value;
|
||||
@@ -18,9 +20,38 @@ async function login() {
|
||||
// else switch screen
|
||||
if (response.status !== 200) {
|
||||
document.getElementById("loginSubmit").classList.add("error");
|
||||
document.getElementById("loginSubmit").value = "Failed";
|
||||
return;
|
||||
} else {
|
||||
// switch screen
|
||||
document.getElementById("login").setAttribute("style", "display: none;");
|
||||
document.getElementById("mainPage").setAttribute("style", "");
|
||||
}
|
||||
|
||||
// store user data in session storage
|
||||
let data = await response.json();
|
||||
sessionStorage.setItem("name", data.name);
|
||||
sessionStorage.setItem("role", data.role);
|
||||
|
||||
// if role is admin, keep auto styling
|
||||
if (sessionStorage.getItem("role") !== "admin") {
|
||||
document.getElementById("addButton").setAttribute("style", "display: none;");
|
||||
document.getElementById("taskButton").classList.value = "half";
|
||||
document.getElementById("historyButton").classList.value = "half";
|
||||
document.getElementById("menu").classList.value = "flex two";
|
||||
}
|
||||
}
|
||||
|
||||
function switchScreen(button) {
|
||||
document.getElementById("tasks").setAttribute("style", "display: none;");
|
||||
document.getElementById("history").setAttribute("style", "display: none;");
|
||||
document.getElementById("addTask").setAttribute("style", "display: none;");
|
||||
|
||||
if (button === "task") {
|
||||
document.getElementById("tasks").setAttribute("style", "");
|
||||
} else if (button === "history") {
|
||||
document.getElementById("history").setAttribute("style", "");
|
||||
} else if (button === "add") {
|
||||
document.getElementById("addTask").setAttribute("style", "");
|
||||
}
|
||||
}
|
||||
6
go.mod
6
go.mod
@@ -2,7 +2,10 @@ module giacPoints
|
||||
|
||||
go 1.20
|
||||
|
||||
require github.com/gin-gonic/gin v1.9.1
|
||||
require (
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/mattn/go-sqlite3 v1.14.17
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/bytedance/sonic v1.9.1 // indirect
|
||||
@@ -19,7 +22,6 @@ require (
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.17 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
|
||||
|
||||
Reference in New Issue
Block a user