@@ 18,13 18,16 @@ pub struct ConnectScreenData {
pub email: String,
pub password: String,
pub password_confirm: String,
pub error: String,
}
#[derive(Default)]
pub enum ConnectState {
#[default]
Login,
LoggingIn,
Register,
Registering,
}
pub fn ui(mut egui_context: ResMut<EguiContext>, mut data: ResMut<ConnectScreenData>) {
@@ 44,8 47,13 @@ pub fn ui(mut egui_context: ResMut<EguiContext>, mut data: ResMut<ConnectScreenD
ui.add(password(&mut data.password));
});
if !data.error.is_empty() {
ui.label(egui::RichText::new(&data.error).color(egui::Color32::RED));
}
ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| {
if ui.button("Login").clicked() {
data.error.clear();
// yoink
}
});
@@ 75,10 83,17 @@ pub fn ui(mut egui_context: ResMut<EguiContext>, mut data: ResMut<ConnectScreenD
ui.add(password(&mut data.password_confirm));
});
ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| {
if ui.button("Register").clicked() {
// yoink
}
if !data.error.is_empty() {
ui.label(egui::RichText::new(&data.error).color(egui::Color32::RED));
}
ui.add_enabled_ui(data.password == data.password_confirm, |ui| {
ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| {
if ui.button("Register").clicked() {
data.error.clear();
// yoink
}
});
});
ui.vertical_centered(|ui| {
@@ 88,6 103,9 @@ pub fn ui(mut egui_context: ResMut<EguiContext>, mut data: ResMut<ConnectScreenD
}
});
}
_ => {
ui.spinner();
}
}
},
);