persistence + proper disconnect

This commit is contained in:
2025-11-28 17:29:33 -05:00
parent 029d62cb53
commit 7557507f27
16 changed files with 413 additions and 67 deletions

View File

@@ -1,3 +1,5 @@
use crate::net::NetState;
use super::*;
pub fn login_screen(client: &mut Client) -> WidgetId {
@@ -5,13 +7,7 @@ pub fn login_screen(client: &mut Client) -> WidgetId {
ui, handle, data, ..
} = client;
let mut field = |name, hint_| {
text(name)
.editable(true)
.size(20)
.hint(hint(hint_))
.add(ui)
};
let mut field = |name, hint_| text(name).editable(true).size(20).hint(hint(hint_)).add(ui);
let ip = field(&data.ip, "ip");
let username = field(&data.username, "username");
// let password = field("password");
@@ -35,7 +31,8 @@ pub fn login_screen(client: &mut Client) -> WidgetId {
client.ui[id].color = color.darker(0.3);
let ip = client.ui[&ip_].content();
let username = client.ui[&username_].content();
connect(handle.clone(), ConnectInfo { ip, username });
let th = connect(handle.clone(), ConnectInfo { ip, username });
client.net = NetState::Connecting(th);
})
.height(40);
let modal = (