refactor(settings): remove the Updates page until an updater exists
This commit is contained in:
@@ -76,11 +76,6 @@ const NAV_GROUPS: &[NavGroup] = &[
|
||||
label: "POWER",
|
||||
items: &[
|
||||
NavItem { icon: IconName::Asterisk, label: "Plugins", route: "ely://settings/plugins" },
|
||||
NavItem {
|
||||
icon: IconName::LoaderCircle,
|
||||
label: "Updates",
|
||||
route: "ely://settings/updates",
|
||||
},
|
||||
NavItem {
|
||||
icon: IconName::Inspector,
|
||||
label: "Advanced",
|
||||
|
||||
@@ -34,7 +34,6 @@ mod sync;
|
||||
mod sync_controls;
|
||||
mod tab_context;
|
||||
mod task_manager;
|
||||
mod updates;
|
||||
|
||||
use ely_browser_core::BrowserSnapshot;
|
||||
use ely_design_system::colors;
|
||||
@@ -137,10 +136,6 @@ impl ElyShell {
|
||||
let content = self.render_sync_page(snapshot, cx);
|
||||
render_settings_shell(snapshot, url, content, cx)
|
||||
}
|
||||
url @ "ely://settings/updates" => {
|
||||
let content = self.render_updates_page(snapshot, cx);
|
||||
render_settings_shell(snapshot, url, content, cx)
|
||||
}
|
||||
"ely://sync/status" => {
|
||||
let content = self.render_sync_page(snapshot, cx);
|
||||
render_settings_shell(snapshot, "ely://settings/sync", content, cx)
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
use ely_browser_core::BrowserSnapshot;
|
||||
use ely_design_system::colors;
|
||||
use ely_domain::UpdatePolicy;
|
||||
use gpui::{AnyElement, IntoElement, ParentElement, Styled, div, px, rgb};
|
||||
use gpui_component::{
|
||||
IconName, Selectable, Sizable, StyledExt,
|
||||
button::{Button, ButtonVariants},
|
||||
};
|
||||
|
||||
use super::{ElyShell, render_canvas_surface};
|
||||
|
||||
impl ElyShell {
|
||||
pub(super) fn render_updates_page(
|
||||
&mut self,
|
||||
snapshot: &BrowserSnapshot,
|
||||
cx: &mut gpui::Context<Self>,
|
||||
) -> AnyElement {
|
||||
render_canvas_surface(
|
||||
div()
|
||||
.size_full()
|
||||
.p_8()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_5()
|
||||
.child(render_updates_header(cx))
|
||||
.child(render_update_policy_rows(snapshot.update_policy, cx)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn render_updates_header(cx: &mut gpui::Context<ElyShell>) -> AnyElement {
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.gap_4()
|
||||
.child(div().text_size(px(26.0)).text_color(rgb(colors::ink())).child("Updates"))
|
||||
.child(
|
||||
Button::new("reset-update-settings")
|
||||
.ghost()
|
||||
.xsmall()
|
||||
.icon(IconName::Undo2)
|
||||
.label("Reset")
|
||||
.tooltip("Restore Update Defaults")
|
||||
.on_click(cx.listener(|shell, _, _, cx| {
|
||||
shell.reset_update_settings(cx);
|
||||
})),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn render_update_policy_rows(
|
||||
active_policy: UpdatePolicy,
|
||||
cx: &mut gpui::Context<ElyShell>,
|
||||
) -> AnyElement {
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.border_t_1()
|
||||
.border_color(rgb(colors::hairline()))
|
||||
.children(
|
||||
UpdatePolicy::ALL
|
||||
.iter()
|
||||
.copied()
|
||||
.enumerate()
|
||||
.map(|(index, policy)| render_update_policy_row(index, policy, active_policy, cx)),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn render_update_policy_row(
|
||||
index: usize,
|
||||
policy: UpdatePolicy,
|
||||
active_policy: UpdatePolicy,
|
||||
cx: &mut gpui::Context<ElyShell>,
|
||||
) -> AnyElement {
|
||||
let selected = policy == active_policy;
|
||||
|
||||
div()
|
||||
.py_3()
|
||||
.border_b_1()
|
||||
.border_color(rgb(colors::hairline()))
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.gap_4()
|
||||
.child(
|
||||
div()
|
||||
.min_w_0()
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_3()
|
||||
.child(
|
||||
div().text_color(rgb(policy_icon_color(selected))).child(policy_icon(selected)),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.min_w_0()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_1()
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.font_semibold()
|
||||
.truncate()
|
||||
.text_color(rgb(colors::ink()))
|
||||
.child(policy.name()),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.truncate()
|
||||
.text_color(rgb(colors::muted()))
|
||||
.child(policy.detail()),
|
||||
),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
Button::new(("update-policy", index))
|
||||
.ghost()
|
||||
.xsmall()
|
||||
.selected(selected)
|
||||
.label(policy_button_label(selected))
|
||||
.tooltip(policy.name())
|
||||
.on_click(cx.listener(move |shell, _, _, cx| {
|
||||
shell.set_update_policy(policy, cx);
|
||||
})),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn policy_icon(selected: bool) -> IconName {
|
||||
if selected { IconName::CircleCheck } else { IconName::LoaderCircle }
|
||||
}
|
||||
|
||||
fn policy_icon_color(selected: bool) -> u32 {
|
||||
if selected { colors::primary() } else { colors::muted_soft() }
|
||||
}
|
||||
|
||||
fn policy_button_label(selected: bool) -> &'static str {
|
||||
if selected { "Active" } else { "Select" }
|
||||
}
|
||||
@@ -2,7 +2,7 @@ use ely_browser_core::SyncEngine;
|
||||
use ely_domain::{
|
||||
ArchivePolicy, DEFAULT_TRANSLUCENCY_PCT, DiagnosticsReportingPolicy, DownloadPolicy,
|
||||
FavoriteLimit, HistoryRecordingPolicy, NewTabDestination, ProfileId, ProfileSyncPolicy,
|
||||
SearchEngine, SyncObjectKind, SyncObjectPolicy, ThemeMode, UpdatePolicy, WallpaperTheme,
|
||||
SearchEngine, SyncObjectKind, SyncObjectPolicy, ThemeMode, WallpaperTheme,
|
||||
};
|
||||
use gpui::Context;
|
||||
use gpui_component::slider::SliderValue;
|
||||
@@ -323,24 +323,6 @@ impl ElyShell {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn set_update_policy(
|
||||
&mut self,
|
||||
update_policy: UpdatePolicy,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
if let ShellState::Ready(core) = &mut self.state {
|
||||
core.set_update_policy(update_policy);
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn reset_update_settings(&mut self, cx: &mut Context<Self>) {
|
||||
if let ShellState::Ready(core) = &mut self.state {
|
||||
core.reset_update_settings();
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn archive_idle_tabs_now(&mut self, cx: &mut Context<Self>) {
|
||||
if let ShellState::Ready(core) = &mut self.state
|
||||
&& core.archive_idle_tabs(std::time::SystemTime::now()).is_ok()
|
||||
|
||||
Reference in New Issue
Block a user