.
This commit is contained in:
@@ -10,7 +10,7 @@ use gpui::prelude::FluentBuilder;
|
||||
use gpui::{
|
||||
App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable, IntoElement,
|
||||
ParentElement, Render, SharedString, Styled, Subscription, Task, UniformListScrollHandle,
|
||||
Window, div, px, uniform_list,
|
||||
Window, div, px, relative, uniform_list,
|
||||
};
|
||||
use gpui_component::button::{Button, ButtonVariants};
|
||||
use gpui_component::dock::{Panel, PanelEvent};
|
||||
@@ -492,6 +492,7 @@ impl Render for Sidebar {
|
||||
|
||||
// Whether the find panel should be shown
|
||||
let show_find_panel = self.has_search || self.find_focused;
|
||||
let show_create_button = !self.selected_pkeys.read(cx).is_empty() && show_find_panel;
|
||||
|
||||
// Set button label based on total selected users
|
||||
let button_label = if self.selected_pkeys.read(cx).len() > 1 {
|
||||
@@ -504,9 +505,10 @@ impl Render for Sidebar {
|
||||
.image_cache(coop_cache("sidebar", IMAGE_CACHE_SIZE))
|
||||
.size_full()
|
||||
.gap_2()
|
||||
.bg(cx.theme().sidebar)
|
||||
.child(
|
||||
h_flex()
|
||||
.h(px(28.0))
|
||||
.h(px(32.0))
|
||||
.border_b_1()
|
||||
.border_color(cx.theme().border)
|
||||
.bg(cx.theme().tab_bar)
|
||||
@@ -557,7 +559,7 @@ impl Render for Sidebar {
|
||||
.when(!show_find_panel, |this| this.label("Inbox"))
|
||||
.tooltip("All ongoing conversations")
|
||||
.small()
|
||||
.ghost()
|
||||
.secondary()
|
||||
.flex_1()
|
||||
.selected(
|
||||
!show_find_panel && self.current_filter(&RoomKind::Ongoing, cx),
|
||||
@@ -605,19 +607,13 @@ impl Render for Sidebar {
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.text_center()
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.font_semibold()
|
||||
.child(SharedString::from("No conversations")),
|
||||
)
|
||||
.child(div().text_sm().font_semibold().child("No conversations"))
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child(SharedString::from(
|
||||
"Start a conversation with someone to get started.",
|
||||
)),
|
||||
.line_height(relative(1.2))
|
||||
.child("Start a conversation with someone to get started."),
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -665,12 +661,13 @@ impl Render for Sidebar {
|
||||
.flex_1()
|
||||
.child(
|
||||
h_flex()
|
||||
.px_1()
|
||||
.gap_0p5()
|
||||
.text_xs()
|
||||
.font_semibold()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child(Icon::new(CoopIcon::ChevronDown).small())
|
||||
.child(SharedString::from("Suggestions")),
|
||||
.child("Suggestions"),
|
||||
)
|
||||
.child(
|
||||
uniform_list(
|
||||
@@ -703,25 +700,18 @@ impl Render for Sidebar {
|
||||
.child(Scrollbar::vertical(&self.scroll_handle))
|
||||
}),
|
||||
)
|
||||
.when(!self.selected_pkeys.read(cx).is_empty(), |this| {
|
||||
.when(show_create_button, |this| {
|
||||
this.child(
|
||||
div()
|
||||
.absolute()
|
||||
.bottom_0()
|
||||
.left_0()
|
||||
.h_9()
|
||||
.w_full()
|
||||
.px_2()
|
||||
.child(
|
||||
Button::new("create")
|
||||
.label(button_label)
|
||||
.primary()
|
||||
.small()
|
||||
.shadow_lg()
|
||||
.on_click(cx.listener(move |this, _ev, window, cx| {
|
||||
this.create_room(window, cx);
|
||||
})),
|
||||
),
|
||||
div().absolute().bottom_2().left_0().w_full().px_2().child(
|
||||
Button::new("create")
|
||||
.label(button_label)
|
||||
.primary()
|
||||
.text_sm()
|
||||
.shadow_md()
|
||||
.on_click(cx.listener(move |this, _ev, window, cx| {
|
||||
this.create_room(window, cx);
|
||||
})),
|
||||
),
|
||||
)
|
||||
})
|
||||
.when(loading, |this| {
|
||||
|
||||
Reference in New Issue
Block a user