copilot.rs

 1use crate::{prelude::*, Button, Label, LabelColor, Modal};
 2
 3#[derive(Component)]
 4pub struct CopilotModal {
 5    id: ElementId,
 6}
 7
 8impl CopilotModal {
 9    pub fn new(id: impl Into<ElementId>) -> Self {
10        Self { id: id.into() }
11    }
12
13    fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
14        div().id(self.id.clone()).child(
15            Modal::new("some-id")
16                .title("Connect Copilot to Zed")
17                .child(Label::new("You can update your settings or sign out from the Copilot menu in the status bar.").color(LabelColor::Muted))
18                .primary_action(Button::new("Connect to Github").variant(ButtonVariant::Filled)),
19        )
20    }
21}
22
23#[cfg(feature = "stories")]
24pub use stories::*;
25
26#[cfg(feature = "stories")]
27mod stories {
28    use crate::Story;
29
30    use super::*;
31
32    #[derive(Component)]
33    pub struct CopilotModalStory;
34
35    impl CopilotModalStory {
36        fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
37            Story::container(cx)
38                .child(Story::title_for::<_, CopilotModal>(cx))
39                .child(Story::label(cx, "Default"))
40                .child(CopilotModal::new("copilot-modal"))
41        }
42    }
43}