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