chore: Changes UI design.

This commit is contained in:
greysoh 2024-04-28 21:22:30 -04:00
parent 118e4a8f09
commit 7bc190eabb
No known key found for this signature in database
GPG key ID: FE0F173B8FC01571
2 changed files with 11 additions and 12 deletions

View file

@ -6,7 +6,8 @@ use crate::ApplicationState;
pub fn main(state: &mut ApplicationState, api: &api::NextAPIClient, ctx: &eframe::egui::Context) { pub fn main(state: &mut ApplicationState, api: &api::NextAPIClient, ctx: &eframe::egui::Context) {
egui::Window::new("Log In").show(ctx, move |ui| { egui::Window::new("Log In").show(ctx, move |ui| {
ui.heading("Login"); ui.set_max_width(275.0);
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.label("Email: "); ui.label("Email: ");
ui.text_edit_singleline(&mut state.username); ui.text_edit_singleline(&mut state.username);
@ -24,7 +25,7 @@ pub fn main(state: &mut ApplicationState, api: &api::NextAPIClient, ctx: &eframe
match res.token { match res.token {
Some(x) => { Some(x) => {
let mut token = token_clone.lock().unwrap(); let mut token = token_clone.lock().unwrap();
*token = x; *token = x;
}, },
None => { None => {
let mut token = token_clone.lock().unwrap(); let mut token = token_clone.lock().unwrap();
@ -33,14 +34,5 @@ pub fn main(state: &mut ApplicationState, api: &api::NextAPIClient, ctx: &eframe
} }
})); }));
} }
match state.token.lock() {
Ok(x) => {
ui.label(format!("Token: {:?}", *x));
},
Err(_) => {
ui.label(format!("No token."));
}
}
}); });
} }

View file

@ -32,7 +32,14 @@ fn main() -> Result<(), eframe::Error> {
eframe::run_simple_native("NextNet GUI", options, move |ctx, _frame| { eframe::run_simple_native("NextNet GUI", options, move |ctx, _frame| {
egui::CentralPanel::default().show(ctx, |_ui| { egui::CentralPanel::default().show(ctx, |_ui| {
components::log_in::main(&mut app_state, &api, ctx); let token_clone = Arc::clone(&app_state.token);
let token = token_clone.lock().unwrap();
if *token == "".to_string() {
components::log_in::main(&mut app_state, &api, ctx);
} else {
// ...
}
}); });
}) })
} }