improve new game form

This commit is contained in:
ntr 2019-05-02 13:26:49 +10:00
parent 4758ae1987
commit 85a1cfe6b8
5 changed files with 56 additions and 30 deletions

View File

@ -309,27 +309,28 @@ header {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-items: flex-start;
border: 1px solid whitesmoke;
padding: 1em;
margin-bottom: 1.5em;
}
.create-form form {
margin: 0;
flex: 1 1 50%;
}
.create-form.disabled {
border: 1px solid #333;
color: #333;
}
.create-form select, .create-form input, .create-form label {
/*.create-form select, .create-form input, .create-form label {
margin: 0;
}
*/
.create-form button {
flex: 0 1 25%;
font-size: 1.5em;
display: block;
margin-bottom: 0;
}
/*
@ -869,7 +870,6 @@ CRYP DAMAGE
}
.menu-instance-list {
order: -1;
flex: unset;
width: 100%;
}

View File

@ -55,6 +55,7 @@ class InstanceCreateForm extends Component {
const classes = `create-form ${disabled ? 'disabled' : ''}`;
return (
<div className={classes}>
<form>
<label>instance name</label>
<input
className="login-input"
@ -76,6 +77,7 @@ class InstanceCreateForm extends Component {
<option value={8}>8</option>
<option value={16}>16</option>
</select>
</form>
<button
onClick={this.handleSubmit}
disabled={disabled}

View File

@ -26,7 +26,7 @@ function registerEvents(store) {
targets: 'img',
translateX: () => anime.random(-20, 20),
translateY: () => anime.random(-20, 20),
rotate: () => anime.random(-90, 90),
rotate: () => anime.random(-35, 35),
duration: () => anime.random(5000, 6000),
direction: 'alternate',
easing: 'linear',

View File

@ -60,7 +60,7 @@ impl Instance {
phase: InstancePhase::Lobby,
open: true,
max_players: 2,
max_rounds: 16,
max_rounds: 2,
name: String::new(),
password: None,
phase_end: Utc::now(),

View File

@ -9,6 +9,8 @@ use serde_cbor::{to_vec};
use std::env;
use std::thread::{spawn, sleep};
use std::time::Duration;
use std::any::Any;
use std::panic;
use r2d2::{Pool};
use r2d2::{PooledConnection};
@ -59,7 +61,29 @@ pub fn db_connection(url: String) -> Pool<PostgresConnectionManager> {
.expect("Failed to create pool.")
}
fn print_panic_payload(ctx: &str, payload: &(Any + Send + 'static)) {
let d = format!("{:?}", payload);
let s = if let Some(s) = payload.downcast_ref::<String>() {
&s
} else if let Some(s) = payload.downcast_ref::<&str>() {
s
} else {
// "PAYLOAD IS NOT A STRING"
d.as_str()
};
println!("{}: PANIC OCCURRED: {}", ctx, s);
}
pub fn start() {
panic::set_hook(Box::new(|panic_info| {
print_panic_payload("set_hook", panic_info.payload());
if let Some(location) = panic_info.location() {
println!("LOCATION: {}:{}", location.file(), location.line());
} else {
println!("NO LOCATION INFORMATION");
}
}));
let database_url = env::var("DATABASE_URL")
.expect("DATABASE_URL must be set");