thread_element.rs

 1use gpui::{App, Entity, SharedString, Window, div, prelude::*};
 2
 3use crate::Thread;
 4
 5pub struct ThreadElement {
 6    thread: Entity<Thread>,
 7}
 8
 9impl ThreadElement {
10    pub fn new(thread: Entity<Thread>) -> Self {
11        Self { thread }
12    }
13
14    pub fn title(&self, cx: &App) -> SharedString {
15        self.thread.read(cx).title()
16    }
17
18    pub fn cancel(&self, window: &mut Window, cx: &mut Context<Self>) {
19        // todo!
20    }
21}
22
23impl Render for ThreadElement {
24    fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
25        div().child("agent 2")
26    }
27}