mirror of
https://git.kittycat.homes/zoe/reversi.git
synced 2024-08-15 03:27:19 +00:00
add login page
This commit is contained in:
parent
58303b3769
commit
0f930b18f4
3 changed files with 107 additions and 17 deletions
14
src/main.rs
14
src/main.rs
|
@ -28,17 +28,11 @@ fn rocket() -> _ {
|
|||
config.port = ARGS.port;
|
||||
rocket::custom(config)
|
||||
.attach(Template::fairing())
|
||||
.mount("/static", FileServer::from(relative!("static")))
|
||||
.mount("/", FileServer::from(relative!("static")))
|
||||
.mount("/", routes![join])
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to join a room for the according id, fails if someone with the same id has already joined
|
||||
**/
|
||||
#[get("/join/<room_id>/<name>")]
|
||||
async fn join(room_id: &str, name: &str) -> String {
|
||||
format!(
|
||||
"Hey, {}! You're joining '{}', please give us a second!",
|
||||
name, room_id
|
||||
)
|
||||
#[get("/?<roomname>")]
|
||||
fn join (roomname: &str) -> String {
|
||||
format!("You're joining {}", roomname)
|
||||
}
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="static/style.css"
|
||||
media="all"
|
||||
/>
|
||||
<link rel="stylesheet" type="text/css" href="/style.css" media="all" />
|
||||
<script src="/script.js" charset="utf-8" defer></script>
|
||||
<title>Reversi Online</title>
|
||||
<meta
|
||||
|
@ -19,5 +14,18 @@
|
|||
</head>
|
||||
</html>
|
||||
<body>
|
||||
<div id="board"></div>
|
||||
<div class="contentdiv">
|
||||
<form>
|
||||
<input
|
||||
type="text"
|
||||
name="roomname"
|
||||
maxlength="32"
|
||||
placeholder="room name"
|
||||
/>
|
||||
<button type="submit">let's go!</button>
|
||||
</form>
|
||||
</div>
|
||||
<footer>
|
||||
<span id="status">reversi</span>
|
||||
</footer>
|
||||
</body>
|
||||
|
|
|
@ -1 +1,89 @@
|
|||
@import url("https://fonts.googleapis.com/css2?family=Sen&display=swap");
|
||||
|
||||
:root {
|
||||
--background: #28282e;
|
||||
--text: #fff7e4;
|
||||
--accent2: #f98284;
|
||||
--accent1: #accce4;
|
||||
}
|
||||
|
||||
body,
|
||||
html {
|
||||
color: var(--text);
|
||||
background-color: var(--background);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::selection {
|
||||
color: var(--background);
|
||||
background-color: var(--accent2);
|
||||
}
|
||||
|
||||
footer {
|
||||
font-family: "Sen", sans-serif;
|
||||
background-color: var(--text);
|
||||
color: var(--background);
|
||||
position: sticky;
|
||||
overflow: visible;
|
||||
left: 0;
|
||||
display: flex;
|
||||
height: 10%;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
font-size: 1.6em;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 3em;
|
||||
}
|
||||
|
||||
.contentdiv {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-self: center;
|
||||
height: 90%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
button,
|
||||
.contentdiv * {
|
||||
line-height: 1.84em;
|
||||
border-radius: 0.48em;
|
||||
font-size: 1.84em;
|
||||
margin: 0.5em;
|
||||
text-align: center;
|
||||
font-family: "Sen", sans-serif;
|
||||
}
|
||||
|
||||
button,
|
||||
input {
|
||||
outline: none;
|
||||
padding: 2%;
|
||||
background-color: var(--background);
|
||||
color: var(--text);
|
||||
border: 0.12em solid var(--text);
|
||||
}
|
||||
|
||||
input {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover,
|
||||
button:focus,
|
||||
input:hover,
|
||||
input:focus {
|
||||
border-color: var(--accent1);
|
||||
color: var(--accent1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue