migrate input

This commit is contained in:
2026-09-17 16:12:31 +07:00
parent 7118565b4d
commit 75a25a9a9d
27 changed files with 219 additions and 7016 deletions
+4 -5
View File
@@ -15,7 +15,7 @@ use theme::ActiveTheme;
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants};
use ui::dock::{Panel, PanelEvent};
use ui::input::{Input, InputState};
use ui::input::{Input, InputState, Textarea, TextareaState};
use ui::notification::Notification;
use ui::{Disableable, IconName, Sizable, StyledExt, WindowExtension, h_flex, v_flex};
@@ -38,7 +38,7 @@ pub struct ProfilePanel {
avatar_input: Entity<InputState>,
/// User's bio multi line input
bio_input: Entity<InputState>,
bio_input: Entity<TextareaState>,
/// User's website url text input
website_input: Entity<InputState>,
@@ -64,8 +64,7 @@ impl ProfilePanel {
// Use multi-line input for bio
let bio_input = cx.new(|cx| {
InputState::new(window, cx)
.multi_line(true)
TextareaState::new(window, cx)
.auto_grow(3, 8)
.placeholder("A short introduce about you.")
});
@@ -367,7 +366,7 @@ impl Render for ProfilePanel {
.text_color(cx.theme().text_muted)
.child(SharedString::from("A short introduction about you:")),
)
.child(Input::new(&self.bio_input).small()),
.child(Textarea::new(&self.bio_input).small()),
)
.child(
v_flex()
+14 -11
View File
@@ -257,10 +257,10 @@ impl Sidebar {
}
/// Set the finding status
fn set_finding(&mut self, status: bool, _window: &mut Window, cx: &mut Context<Self>) {
fn set_finding(&mut self, status: bool, window: &mut Window, cx: &mut Context<Self>) {
// Disable the input to prevent duplicate requests
self.find_input.update(cx, |this, cx| {
this.set_loading(status, cx);
this.set_loading(status, window, cx);
});
// Set the search status
self.finding = status;
@@ -530,15 +530,18 @@ impl Render for Sidebar {
.small()
.text_xs()
.disabled(loading)
.when(!self.find_input.read(cx).loading, |this| {
this.suffix(
Button::new("find-icon")
.icon(IconName::Search)
.tooltip("Press Enter to search")
.transparent()
.small(),
)
}),
.when(
!self.find_input.read(cx).presentation().is_loading(),
|this| {
this.suffix(
Button::new("find-icon")
.icon(IconName::Search)
.tooltip("Press Enter to search")
.transparent()
.small(),
)
},
),
),
)
.child(