improve new game form
This commit is contained in:
parent
4758ae1987
commit
85a1cfe6b8
@ -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%;
|
||||
}
|
||||
|
||||
@ -55,27 +55,29 @@ class InstanceCreateForm extends Component {
|
||||
const classes = `create-form ${disabled ? 'disabled' : ''}`;
|
||||
return (
|
||||
<div className={classes}>
|
||||
<label>instance name</label>
|
||||
<input
|
||||
className="login-input"
|
||||
type="text"
|
||||
disabled={disabled}
|
||||
value={this.state.name}
|
||||
placeholder="name"
|
||||
onChange={this.nameChange}
|
||||
/>
|
||||
<label htmlFor="playerSelect">players</label>
|
||||
<select id="playerSelect"
|
||||
disabled={disabled}
|
||||
value={this.state.players}
|
||||
onChange={this.playersChange}
|
||||
>
|
||||
<option value={1}>pve</option>
|
||||
<option value={2}>2</option>
|
||||
<option value={4}>4</option>
|
||||
<option value={8}>8</option>
|
||||
<option value={16}>16</option>
|
||||
</select>
|
||||
<form>
|
||||
<label>instance name</label>
|
||||
<input
|
||||
className="login-input"
|
||||
type="text"
|
||||
disabled={disabled}
|
||||
value={this.state.name}
|
||||
placeholder="name"
|
||||
onChange={this.nameChange}
|
||||
/>
|
||||
<label htmlFor="playerSelect">players</label>
|
||||
<select id="playerSelect"
|
||||
disabled={disabled}
|
||||
value={this.state.players}
|
||||
onChange={this.playersChange}
|
||||
>
|
||||
<option value={1}>pve</option>
|
||||
<option value={2}>2</option>
|
||||
<option value={4}>4</option>
|
||||
<option value={8}>8</option>
|
||||
<option value={16}>16</option>
|
||||
</select>
|
||||
</form>
|
||||
<button
|
||||
onClick={this.handleSubmit}
|
||||
disabled={disabled}
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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(),
|
||||
|
||||
@ -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");
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user