Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(login): Set min size and increase size for phrase window #1992

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions ui/src/layouts/log_in/copy_seed_words.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ use std::time::Duration;
use arboard::Clipboard;
use common::{icons, language::get_local_text, state::State};
use dioxus::prelude::*;
use dioxus_desktop::{use_window, LogicalSize};
use dioxus_desktop::use_window;
use kit::elements::{button::Button, label::Label, Appearance};
use tokio::time::sleep;

use super::AuthPages;
use crate::get_app_style;
use crate::layouts::log_in::update_window_size;
use common::state::configuration::Configuration;
use common::{
sounds,
Expand All @@ -26,10 +27,7 @@ pub fn Layout(cx: Scope, page: UseState<AuthPages>, username: String, pin: Strin
let window = use_window(cx);

if !matches!(&*page.current(), AuthPages::Success(_)) {
window.set_inner_size(LogicalSize {
width: 500.0,
height: 480.0,
});
update_window_size(window, 500.0, 500.0);
}

let words = use_future(cx, (), |_| async move {
Expand Down
9 changes: 3 additions & 6 deletions ui/src/layouts/log_in/create_or_recover.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use common::{language::get_local_text, state::State};
use dioxus::prelude::*;
use dioxus_desktop::{use_window, LogicalSize};
use dioxus_desktop::use_window;
use kit::elements::{button::Button, label::Label};

use crate::get_app_style;
use crate::{get_app_style, layouts::log_in::update_window_size};

use super::AuthPages;

Expand All @@ -14,10 +14,7 @@ pub fn Layout(cx: Scope, page: UseState<AuthPages>) -> Element {
let window = use_window(cx);

if !matches!(&*page.current(), AuthPages::Success(_)) {
window.set_inner_size(LogicalSize {
width: 500.0,
height: 250.0,
});
update_window_size(window, 500.0, 250.0);
}
cx.render(rsx!(
style {get_app_style(&state.read())},
Expand Down
9 changes: 3 additions & 6 deletions ui/src/layouts/log_in/enter_seed_words.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use common::{
WARP_CMD_CH,
};
use dioxus::prelude::*;
use dioxus_desktop::{use_window, LogicalSize};
use dioxus_desktop::use_window;
use futures::{channel::oneshot, StreamExt};
use kit::elements::{
button::Button,
Expand All @@ -15,7 +15,7 @@ use kit::elements::{
Appearance,
};

use crate::get_app_style;
use crate::{get_app_style, layouts::log_in::update_window_size};

use super::AuthPages;

Expand Down Expand Up @@ -50,10 +50,7 @@ pub fn Layout(cx: Scope, pin: UseRef<String>, page: UseState<AuthPages>) -> Elem
let window = use_window(cx);

if !matches!(&*page.current(), AuthPages::Success(_)) {
window.set_inner_size(LogicalSize {
width: 500.0,
height: 480.0,
});
update_window_size(window, 500.0, 500.0);
}

let eval = use_eval(cx);
Expand Down
8 changes: 3 additions & 5 deletions ui/src/layouts/log_in/enter_username.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use common::icons::outline::Shape as Icon;
use common::language::get_local_text;
use dioxus::prelude::*;
use dioxus_desktop::{use_window, LogicalSize};
use dioxus_desktop::use_window;
use kit::elements::label::Label;
use kit::elements::{
button::Button,
input::{Input, Options, Validation},
};
use tracing::log;

use crate::layouts::log_in::update_window_size;
use crate::AuthPages;

pub const MIN_USERNAME_LEN: i32 = 4;
Expand All @@ -20,10 +21,7 @@ pub fn Layout(cx: Scope, page: UseState<AuthPages>, user_name: UseRef<String>) -
let window = use_window(cx);

if !matches!(&*page.current(), AuthPages::Success(_)) {
window.set_inner_size(LogicalSize {
width: 500.0,
height: 250.0,
});
update_window_size(window, 500.0, 250.0);
}

//let error = use_state(cx, String::new);
Expand Down
17 changes: 10 additions & 7 deletions ui/src/layouts/log_in/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod entry_point;
mod recover_account;

use dioxus::prelude::*;
use dioxus_desktop::{use_window, LogicalSize};
use dioxus_desktop::{use_window, DesktopService, LogicalSize};
use kit::components::topbar_controls::TopbarControls;
use kit::STYLE as UIKIT_STYLES;
use warp::multipass;
Expand Down Expand Up @@ -35,17 +35,13 @@ pub fn AuthGuard(cx: Scope, page: UseState<AuthPages>) -> Element {

let pin = use_ref(cx, String::new);
let user_name = use_ref(cx, String::new);
let desktop = use_window(cx);
let theme = "";

// make the window smaller while the user authenticates
let window = use_window(cx);

if !matches!(&*page.current(), AuthPages::Success(_)) {
window.set_inner_size(LogicalSize {
width: 500.0,
height: 350.0,
});
update_window_size(window, 500.0, 350.0);
}

cx.render(rsx! (
Expand All @@ -57,7 +53,7 @@ pub fn AuthGuard(cx: Scope, page: UseState<AuthPages>) -> Element {
id: "lockscreen-controls",
div {
class: "draggable-topbar",
onmousedown: move |_| { desktop.drag(); },
onmousedown: move |_| { window.drag(); },
},
TopbarControls {},
},
Expand All @@ -73,3 +69,10 @@ pub fn AuthGuard(cx: Scope, page: UseState<AuthPages>) -> Element {
}
))
}

// Sets both inner and min size for logins
pub fn update_window_size(window: &DesktopService, width: f64, height: f64) {
let size = LogicalSize { width, height };
window.set_min_inner_size(Some(size));
window.set_inner_size(size);
}
Loading