use crate::{
model::update,
view::settings::{SettingsWindow, Switch},
};
use bezel::{
gpui::{AnyElement, Context, div, prelude::*, px},
theme::Theme,
ui::{icons, widgets::Scaffolding},
};
impl SettingsWindow {
pub(super) fn developer_body(&self, cx: &Context<Self>) -> AnyElement {
div()
.flex()
.flex_col()
.gap(px(super::GROUP_GAP))
.children(self.notifier_row(cx))
.into_any_element()
}
fn notifier_row(&self, cx: &Context<Self>) -> Option<AnyElement> {
let updater = update::of(cx)?;
let theme = Theme::of(cx).clone();
let on = updater.read(cx).previewing();
Some(
theme
.group_box()
.child(
self.switch_row(
Switch::new(
"preview-notifier",
"Update notifier",
"Put the restart notice at the foot of the sidebar, where a release \
would.",
on,
)
.first(true)
.glyph(icons::development::CircleFadingArrowUp)
.truncate(),
cx,
move |_, cx| {
updater.update(cx, |updater, cx| updater.set_preview(!on, cx));
},
),
)
.into_any_element(),
)
}
}