BlueGit

ict rusty-teams

feat(chat): new chat empty state like Teams

- "You're starting a new conversation" with hint before anyone is picked
- To field placeholder "Enter name or email"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-09 · 3 weeks ago

Hash
899330102818c99bc91ed045985723bd43c4baf5
Parent
aece8a9f
1 file changed +31 −2
crates/app/src/views/new_chat.rs +31 −2
@@ -28,6 +28,10 @@ const POPUP_ROW_HEIGHT: f32 = 44.;
28 28 const CHIP_NAME_MAX_WIDTH: f32 = 180.;
29 29 const FIELD_MIN_HEIGHT: f32 = 36.;
30 30 const FIELD_PADDING: f32 = 8.;
31 const EMPTY_ICON_SIZE: f32 = 72.;
32 const NEW_CONVERSATION_TITLE: &str = "You're starting a new conversation";
33 const NEW_CONVERSATION_HINT: &str = "Type your first message below.";
34 const TO_PLACEHOLDER: &str = "Enter name or email";
31 35 const DEFAULT_PLACEHOLDER: &str = "Type a message";
32 36
33 37 #[derive(Debug, Clone, PartialEq, Eq)]
@@ -181,7 +185,7 @@ impl EventEmitter<NewChatEvent> for NewChatDraft {}
181 185
182 186 impl NewChatDraft {
183 187 pub fn new(app: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
184 let query = cx.new(|cx| InputState::new(window, cx).placeholder("Name or email"));
188 let query = cx.new(|cx| InputState::new(window, cx).placeholder(TO_PLACEHOLDER));
185 189 let name = cx.new(|cx| InputState::new(window, cx).placeholder("Group name (optional)"));
186 190 let subscriptions = vec![
187 191 cx.subscribe_in(&query, window, Self::on_query_event),
@@ -693,7 +697,32 @@ impl NewChatDraft {
693 697 .justify_center()
694 698 .gap(px(8.));
695 699 match self.chips.as_slice() {
696 [] => column.into_any_element(),
700 [] => column
701 .child(
702 div()
703 .size(px(EMPTY_ICON_SIZE))
704 .flex()
705 .items_center()
706 .justify_center()
707 .rounded_full()
708 .bg(theme::surface_raised())
709 .child(icon(IconName::MessageSquare, 32., theme::accent_text())),
710 )
711 .child(
712 div()
713 .pt(px(8.))
714 .text_size(px(15.))
715 .font_weight(FontWeight::SEMIBOLD)
716 .text_color(theme::text())
717 .child(NEW_CONVERSATION_TITLE),
718 )
719 .child(
720 div()
721 .text_size(px(13.))
722 .text_color(theme::text_muted())
723 .child(NEW_CONVERSATION_HINT),
724 )
725 .into_any_element(),
697 726 [chip] => column
698 727 .child(person_avatar(
699 728 directory,
@@ -28,6 +28,10 @@ const POPUP_ROW_HEIGHT: f32 = 44.;
28const CHIP_NAME_MAX_WIDTH: f32 = 180.;
28const CHIP_NAME_MAX_WIDTH: f32 = 180.;
29const FIELD_MIN_HEIGHT: f32 = 36.;
29const FIELD_MIN_HEIGHT: f32 = 36.;
30const FIELD_PADDING: f32 = 8.;
30const FIELD_PADDING: f32 = 8.;
31const EMPTY_ICON_SIZE: f32 = 72.;
32const NEW_CONVERSATION_TITLE: &str = "You're starting a new conversation";
33const NEW_CONVERSATION_HINT: &str = "Type your first message below.";
34const TO_PLACEHOLDER: &str = "Enter name or email";
31const DEFAULT_PLACEHOLDER: &str = "Type a message";
35const DEFAULT_PLACEHOLDER: &str = "Type a message";
32
36
33#[derive(Debug, Clone, PartialEq, Eq)]
37#[derive(Debug, Clone, PartialEq, Eq)]
@@ -181,7 +185,7 @@ impl EventEmitter<NewChatEvent> for NewChatDraft {}
181
185
182impl NewChatDraft {
186impl NewChatDraft {
183 pub fn new(app: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
187 pub fn new(app: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
184 let query = cx.new(|cx| InputState::new(window, cx).placeholder("Name or email"));
188 let query = cx.new(|cx| InputState::new(window, cx).placeholder(TO_PLACEHOLDER));
185 let name = cx.new(|cx| InputState::new(window, cx).placeholder("Group name (optional)"));
189 let name = cx.new(|cx| InputState::new(window, cx).placeholder("Group name (optional)"));
186 let subscriptions = vec![
190 let subscriptions = vec![
187 cx.subscribe_in(&query, window, Self::on_query_event),
191 cx.subscribe_in(&query, window, Self::on_query_event),
@@ -693,7 +697,32 @@ impl NewChatDraft {
693 .justify_center()
697 .justify_center()
694 .gap(px(8.));
698 .gap(px(8.));
695 match self.chips.as_slice() {
699 match self.chips.as_slice() {
696 [] => column.into_any_element(),
700 [] => column
701 .child(
702 div()
703 .size(px(EMPTY_ICON_SIZE))
704 .flex()
705 .items_center()
706 .justify_center()
707 .rounded_full()
708 .bg(theme::surface_raised())
709 .child(icon(IconName::MessageSquare, 32., theme::accent_text())),
710 )
711 .child(
712 div()
713 .pt(px(8.))
714 .text_size(px(15.))
715 .font_weight(FontWeight::SEMIBOLD)
716 .text_color(theme::text())
717 .child(NEW_CONVERSATION_TITLE),
718 )
719 .child(
720 div()
721 .text_size(px(13.))
722 .text_color(theme::text_muted())
723 .child(NEW_CONVERSATION_HINT),
724 )
725 .into_any_element(),
697 [chip] => column
726 [chip] => column
698 .child(person_avatar(
727 .child(person_avatar(
699 directory,
728 directory,