Show a border when scrolled in chat
This commit is contained in:
parent
c810af40d3
commit
818cbb2415
2 changed files with 24 additions and 15 deletions
|
@ -112,7 +112,7 @@ impl ChatPanel {
|
||||||
if event.visible_range.start < MESSAGE_LOADING_THRESHOLD {
|
if event.visible_range.start < MESSAGE_LOADING_THRESHOLD {
|
||||||
this.load_more_messages(cx);
|
this.load_more_messages(cx);
|
||||||
}
|
}
|
||||||
this.is_scrolled_to_bottom = event.visible_range.end == event.count;
|
this.is_scrolled_to_bottom = !event.is_scrolled;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let mut this = Self {
|
let mut this = Self {
|
||||||
|
@ -567,7 +567,7 @@ impl Render for ChatPanel {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.child(div().flex_grow().px_2().py_1().map(|this| {
|
.child(div().flex_grow().px_2().pt_1().map(|this| {
|
||||||
if self.active_chat.is_some() {
|
if self.active_chat.is_some() {
|
||||||
this.child(list(self.message_list.clone()).full())
|
this.child(list(self.message_list.clone()).full())
|
||||||
} else {
|
} else {
|
||||||
|
@ -597,19 +597,26 @@ impl Render for ChatPanel {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
.child(h_stack().p_2().map(|el| {
|
.child(
|
||||||
if self.active_chat.is_some() {
|
h_stack()
|
||||||
el.child(self.message_editor.clone())
|
.when(!self.is_scrolled_to_bottom, |el| {
|
||||||
} else {
|
el.border_t_1().border_color(cx.theme().colors().border)
|
||||||
el.child(
|
})
|
||||||
div()
|
.p_2()
|
||||||
.rounded_md()
|
.map(|el| {
|
||||||
.h_7()
|
if self.active_chat.is_some() {
|
||||||
.w_full()
|
el.child(self.message_editor.clone())
|
||||||
.bg(cx.theme().colors().editor_background),
|
} else {
|
||||||
)
|
el.child(
|
||||||
}
|
div()
|
||||||
}))
|
.rounded_md()
|
||||||
|
.h_7()
|
||||||
|
.w_full()
|
||||||
|
.bg(cx.theme().colors().editor_background),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
.into_any()
|
.into_any()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ pub enum ListAlignment {
|
||||||
pub struct ListScrollEvent {
|
pub struct ListScrollEvent {
|
||||||
pub visible_range: Range<usize>,
|
pub visible_range: Range<usize>,
|
||||||
pub count: usize,
|
pub count: usize,
|
||||||
|
pub is_scrolled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -253,6 +254,7 @@ impl StateInner {
|
||||||
&ListScrollEvent {
|
&ListScrollEvent {
|
||||||
visible_range,
|
visible_range,
|
||||||
count: self.items.summary().count,
|
count: self.items.summary().count,
|
||||||
|
is_scrolled: self.logical_scroll_top.is_some(),
|
||||||
},
|
},
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue