1use gpui::{div, Div, EventEmitter, ParentElement, Render, SemanticVersion, ViewContext};
2use menu::Cancel;
3use workspace::notifications::NotificationEvent;
4
5pub struct UpdateNotification {
6 _version: SemanticVersion,
7}
8
9impl EventEmitter<NotificationEvent> for UpdateNotification {}
10
11impl Render for UpdateNotification {
12 type Element = Div;
13
14 fn render(&mut self, _cx: &mut gpui::ViewContext<Self>) -> Self::Element {
15 div().child("Updated zed!")
16 // let theme = theme::current(cx).clone();
17 // let theme = &theme.update_notification;
18
19 // let app_name = cx.global::<ReleaseChannel>().display_name();
20
21 // MouseEventHandler::new::<ViewReleaseNotes, _>(0, cx, |state, cx| {
22 // Flex::column()
23 // .with_child(
24 // Flex::row()
25 // .with_child(
26 // Text::new(
27 // format!("Updated to {app_name} {}", self.version),
28 // theme.message.text.clone(),
29 // )
30 // .contained()
31 // .with_style(theme.message.container)
32 // .aligned()
33 // .top()
34 // .left()
35 // .flex(1., true),
36 // )
37 // .with_child(
38 // MouseEventHandler::new::<Cancel, _>(0, cx, |state, _| {
39 // let style = theme.dismiss_button.style_for(state);
40 // Svg::new("icons/x.svg")
41 // .with_color(style.color)
42 // .constrained()
43 // .with_width(style.icon_width)
44 // .aligned()
45 // .contained()
46 // .with_style(style.container)
47 // .constrained()
48 // .with_width(style.button_width)
49 // .with_height(style.button_width)
50 // })
51 // .with_padding(Padding::uniform(5.))
52 // .on_click(MouseButton::Left, move |_, this, cx| {
53 // this.dismiss(&Default::default(), cx)
54 // })
55 // .aligned()
56 // .constrained()
57 // .with_height(cx.font_cache().line_height(theme.message.text.font_size))
58 // .aligned()
59 // .top()
60 // .flex_float(),
61 // ),
62 // )
63 // .with_child({
64 // let style = theme.action_message.style_for(state);
65 // Text::new("View the release notes", style.text.clone())
66 // .contained()
67 // .with_style(style.container)
68 // })
69 // .contained()
70 // })
71 // .with_cursor_style(CursorStyle::PointingHand)
72 // .on_click(MouseButton::Left, |_, _, cx| {
73 // crate::view_release_notes(&Default::default(), cx)
74 // })
75 // .into_any_named("update notification")
76 }
77}
78
79impl UpdateNotification {
80 pub fn new(version: SemanticVersion) -> Self {
81 Self { _version: version }
82 }
83
84 pub fn _dismiss(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {
85 cx.emit(NotificationEvent::Dismiss);
86 }
87}