diff --git a/client/Cargo.toml b/client/Cargo.toml
index bbdfba2..bb93d5c 100644
--- a/client/Cargo.toml
+++ b/client/Cargo.toml
@@ -14,7 +14,7 @@ console_error_panic_hook = "0.1"
console_log = "1"
log = "0.4"
-leptos-use = "0.14.0-beta"
+leptos-use = { version = "0.14.0-beta", features = ["use_media_query"] }
# leptos-use = { path = "../../leptos-use" }
# leptos-use = { git = "https://github.com/adoyle0/leptos-use.git", branch = "leptos-0.7" }
codee = "0.2"
diff --git a/client/index.html b/client/index.html
index e041162..acc2d73 100644
--- a/client/index.html
+++ b/client/index.html
@@ -1,6 +1,13 @@
+
diff --git a/client/src/components/auth.rs b/client/src/components/auth.rs
index b2af65d..8c065bd 100644
--- a/client/src/components/auth.rs
+++ b/client/src/components/auth.rs
@@ -12,7 +12,6 @@ pub fn Auth() -> impl IntoView {
let user_context = expect_context::>>();
let connected = move || websocket.ready_state.get() == ConnectionReadyState::Open;
let new_username = RwSignal::new(String::new());
- let show_auth = RwSignal::new(false);
Effect::new(move |_| {
user_context.with(|new_user| {
@@ -40,79 +39,71 @@ pub fn Auth() -> impl IntoView {
});
view! {
-
-
"Welcome " {move || username()}"!"
-
-
-
-
-
- "Disconnected." }>
-
-
-
- "Sign In"
-
-
-
-
- "You were already given a random name but if you'd like to change it this is the place."
-
-
- "Identities are saved once created so if you leave or get disconnected just enter your old name here to \"log back in\"."
-
-
- "Please don't steal each other's identities (yes, you can)."
-
-
-
+
+
+
+
+ "Disconnected." }>
+
+
+
+ "Sign In"
+
+
+
+
+ "You were already given a random name but if you'd like to change it this is the place."
+
+
+ "Identities are saved once created so if you leave or get disconnected just enter your old name here to \"log back in\"."
+
+
+ "Please don't steal each other's identities (yes, you can)."
+
+
+
-
-
-
-
-
+ }
+ }
+ >
+ "Submit"
+
+
+
+
+
}
}
diff --git a/client/src/components/browser.rs b/client/src/components/browser.rs
index 1dd10b5..e276b5f 100644
--- a/client/src/components/browser.rs
+++ b/client/src/components/browser.rs
@@ -24,20 +24,29 @@ pub fn Browser() -> impl IntoView {
// Browser stuff
let game_browser_context = expect_context::>>();
- let (join_id, set_join_id) = signal("".to_string());
- let (delete_id, set_delete_id) = signal("".to_string());
+ let join_id = RwSignal::new("".to_string());
+ let delete_id = RwSignal::new("".to_string());
+
+ let nav_context = expect_context::>();
Effect::new(move |_| {
- set_websocket_send(to_string(&GameJoinRequest { id: join_id() }).unwrap());
+ if join_id() != "" {
+ set_websocket_send(to_string(&GameJoinRequest { id: join_id() }).unwrap());
+ nav_context.set("game".to_string());
+ join_id.set("".to_string());
+ }
});
Effect::new(move |_| {
- set_websocket_send(
- to_string(&GameDeleteRequest {
- delete_game_id: delete_id(),
- })
- .unwrap(),
- );
+ if delete_id() != "" {
+ set_websocket_send(
+ to_string(&GameDeleteRequest {
+ delete_game_id: delete_id(),
+ })
+ .unwrap(),
+ );
+ delete_id.set("".to_string());
+ }
});
let show_create_game = RwSignal::new(false);
@@ -51,14 +60,11 @@ pub fn Browser() -> impl IntoView {
position=PopoverPosition::BottomStart
>
-
- "Game Browser"
-
-
+
"Yes, the delete button works. Please don't abuse it."
@@ -135,7 +141,7 @@ pub fn Browser() -> impl IntoView {
on_click={
let game_id = game.uuid.clone();
move |_| {
- set_join_id(game_id.clone());
+ join_id.set(game_id.clone());
}
}
>
@@ -146,7 +152,7 @@ pub fn Browser() -> impl IntoView {
size=ButtonSize::Small
icon=icondata::TiDeleteOutline
on_click=move |_| {
- set_delete_id(game.uuid.clone());
+ delete_id.set(game.uuid.clone());
}
>
"Delete"
diff --git a/client/src/components/browser/create_game.rs b/client/src/components/browser/create_game.rs
index 8c8fc99..9fdb26d 100644
--- a/client/src/components/browser/create_game.rs
+++ b/client/src/components/browser/create_game.rs
@@ -43,6 +43,8 @@ pub fn CreateGame() -> impl IntoView {
let toggle_show_packs = move |_| show_packs.set(!show_packs());
let drawer_context = expect_context::>();
+
+ let nav_context = expect_context::>();
let request_new_game = move |_| {
set_websocket_send(
to_string(&NewGameRequest {
@@ -53,6 +55,7 @@ pub fn CreateGame() -> impl IntoView {
);
input_game_name.set(String::new());
drawer_context.set(false);
+ nav_context.set("game".to_string());
};
view! {
diff --git a/client/src/components/chat.rs b/client/src/components/chat.rs
index cc7efc5..3e90c5b 100644
--- a/client/src/components/chat.rs
+++ b/client/src/components/chat.rs
@@ -79,7 +79,7 @@ pub fn Chat() -> impl IntoView {