From ff76fefdad2b3d7a8c2516daea441ad897b4ff64 Mon Sep 17 00:00:00 2001 From: Kevin Boos Date: Sun, 29 Dec 2024 17:16:26 -0800 Subject: [PATCH] Improve login screen: allow scrolling, better layout Also, don't perform an early check for UserID validity, since we also want to allow the user to entire a partial UserID (with just the local part) that we can then auto-append the homeserver URL to in the backend before submitting the login request. --- src/login/login_screen.rs | 117 +++++++++++++++++++++++++------------- 1 file changed, 78 insertions(+), 39 deletions(-) diff --git a/src/login/login_screen.rs b/src/login/login_screen.rs index 9b19dfa3..f6d0f018 100644 --- a/src/login/login_screen.rs +++ b/src/login/login_screen.rs @@ -1,7 +1,7 @@ use std::ops::Not; use makepad_widgets::*; -use matrix_sdk::ruma::{api::client::session::get_login_types::v3::IdentityProvider, UserId}; +use matrix_sdk::ruma::api::client::session::get_login_types::v3::IdentityProvider; use crate::sliding_sync::{submit_async_request, LoginByPassword, LoginRequest, MatrixRequest}; @@ -10,6 +10,7 @@ live_design! { use link::shaders::*; use link::widgets::*; + use crate::shared::helpers::*; use crate::shared::styles::*; use crate::shared::icon_button::*; @@ -106,16 +107,18 @@ live_design! { width: Fit, height: Fit, cursor: Hand, - visible: false, - padding: 10.0, + visible: true, + padding: 10, + // margin: 10, + margin: { left: 15.5, right: 15.5, top: 10, bottom: 10} draw_bg: { - border_width: 1.0, + border_width: 0.5, border_color: (#6c6c6c), color: (COLOR_PRIMARY) } } SsoImage = { - width: 21, height: 21 + width: 30, height: 30, draw_bg:{ uniform mask: 0.0 fn pixel(self) -> vec4 { @@ -127,7 +130,7 @@ live_design! { } } - pub LoginScreen = {{LoginScreen}} { + pub LoginScreen = {{LoginScreen}} { width: Fill, height: Fill show_bg: true, draw_bg: { @@ -173,39 +176,63 @@ live_design! { empty_message: "Password" draw_text: { text_style: { is_secret: true } } } + { - width: Fit, height: Fit, + width: 250, height: Fit, + align: {x: 0.5} flow: Right, - homeserver_input = { - width: 220, height: 40 - margin: {bottom: -10} - empty_message: "matrix.org" - draw_text: { - text_style: {font_size: 9.0} + { + width: 215, height: Fit, + flow: Down, + + homeserver_input = { + width: 215, height: 30, + empty_message: "matrix.org" + draw_text: { + text_style: {font_size: 10.0} + } } + + { + width: 215, + height: Fit, + flow: Right, + padding: {top: 3, left: 2, right: 2} + spacing: 0.0, + align: {x: 0.5, y: 0.5} // center horizontally and vertically + + left_line = { + draw_bg: { color: #C8C8C8 } + } + +