diff --git a/apps/desktop/src/dialogs/settings/mod.rs b/apps/desktop/src/dialogs/settings/mod.rs index 3310c7813..efc3548eb 100644 --- a/apps/desktop/src/dialogs/settings/mod.rs +++ b/apps/desktop/src/dialogs/settings/mod.rs @@ -630,6 +630,14 @@ impl SettingsHost for App { } } + fn open_navigation_layout_editor(&mut self, tx: &mut Tx) { + crate::shell::navigation::layout_editor::open(self, tx); + } + + fn migrate_new_navigation(&mut self) { + crate::shell::navigation::migrate::run(self); + } + fn on_settings_changed(&mut self) { crate::background_notice::sync_keep_running(self.settings.keep_service_running); if !self.window.id.is_empty() { diff --git a/apps/desktop/src/shell/navigation/customize.rs b/apps/desktop/src/shell/navigation/customize.rs index 16490b592..1f059f2ef 100644 --- a/apps/desktop/src/shell/navigation/customize.rs +++ b/apps/desktop/src/shell/navigation/customize.rs @@ -29,10 +29,9 @@ fn build_menu(s: &App, projects: &[NavProject], servers: &[NavServer]) -> Menu { group_sub = group_sub.item(Item::new(format!("navc:group:{}", g.name()), g.label()).checked(nav.group_by == g)); } - let cur_detail = if nav.row_details == RowDetails::Compact { RowDetails::Compact } else { RowDetails::Detailed }; let mut detail_sub = Menu::new(t!("navigation.setting.rowDetails.title")).min_width(172.0); - for d in RowDetails::CHOICES { - detail_sub = detail_sub.item(Item::new(format!("navc:detail:{}", d.name()), d.label()).checked(cur_detail == d)); + for d in RowDetails::ALL { + detail_sub = detail_sub.item(Item::new(format!("navc:detail:{}", d.name()), d.label()).checked(nav.row_details == d)); } let mut filter_sub = Menu::new(t!("navigation.customize.filter")).min_width(180.0); @@ -88,6 +87,10 @@ fn handle_pick(s: &mut App, picked: &str, tx: &mut Tx) { } if let Some(d) = rest.strip_prefix("detail:") { let next = RowDetails::parse(Some(d)); + if next == RowDetails::Custom { + super::layout_editor::open(s, tx); + return; + } s.change_settings(|x| x.new_navigation.row_details = next); return; } diff --git a/apps/desktop/src/shell/navigation/layout_editor.rs b/apps/desktop/src/shell/navigation/layout_editor.rs new file mode 100644 index 000000000..1b445bc4d --- /dev/null +++ b/apps/desktop/src/shell/navigation/layout_editor.rs @@ -0,0 +1,294 @@ +//! Row layout editor modal for New navigation's `Row details -> Custom` +//! (`packages/app/src/shell/navigation/layout-editor.tsx`, `opencode#67795`). + +use opencode_feature_settings::new_navigation::RowDetails; +use opencode_feature_settings::row_layout::{FormItem, ItemForm, Lane, RowItem, RowLayout}; +use opencode_i18n::t; +use opencode_ui::focus::FocusExt; +use opencode_kernel::AppOverlays as _; +use opencode_ui::palette::{Pal, kit}; +use opencode_ui::popup::{self, Item, Menu, MenuButton as _}; +use opencode_ui::widgets::{BODY, DialogSize, Fit, button, dialog_window, sized_modal}; +use rune::{Align, Color, Cx, El, TextStyle, Tx, col, el, icon, row, spacer, text}; +use rune_kit::ButtonVariant; +use rune_theme_opencode::icons as ic; + +use crate::App; +use crate::view::{UI, UI_MED, UI_SMALL}; + +pub const OVERLAY_ID: &str = "dialog.navigation_layout"; +const TITLE_FONT: TextStyle = TextStyle::new(15.0, 500.0).lh(20.0); +const LANE_HEAD: TextStyle = TextStyle::new(12.0, 500.0).lh(16.0); +const SUB_META: TextStyle = TextStyle::new(11.0, 440.0).lh(16.0); + +pub fn open(s: &mut App, tx: &mut Tx) { + let initial = s.settings.new_navigation.row_layout.clone().unwrap_or_default(); + super::state_mut(s).layout_editor = Some(initial); + s.on_overlay_opened(OVERLAY_ID, None); + tx.instant(); +} + +pub fn close(s: &mut App, tx: &mut Tx) { + super::state_mut(s).layout_editor = None; + s.on_overlay_closed(OVERLAY_ID); + tx.instant(); +} + +fn save(s: &mut App, tx: &mut Tx) { + let Some(layout) = super::state_mut(s).layout_editor.take() else { return }; + let normalized = layout.normalize(); + s.change_settings(|x| { + x.new_navigation.row_details = RowDetails::Custom; + x.new_navigation.row_layout = Some(normalized); + }); + s.on_overlay_closed(OVERLAY_ID); + tx.instant(); +} + +fn sample_item_el(p: &Pal, item: RowItem, layout: &RowLayout, title: &str, branch: &str, server: Option<&str>, age: &str, subagents: usize) -> Option { + match item { + RowItem::ProjectIcon => Some(el().size(14.0, 14.0).radius(3.0).fill(p.layer2)), + RowItem::Title => Some(text(title.to_owned()).font(UI_MED).color(p.text).grow(1.0).shrink().min_w(0.0).truncate()), + RowItem::Time => Some(text(age.to_owned()).font(SUB_META).color(p.faint)), + RowItem::ProjectName => Some(text("opencode".to_owned()).font(SUB_META).color(p.faint).truncate()), + RowItem::Branch => { + let mut r = row().gap(3.0).center_y().child(icon(&ic::BRANCH, 12.0).color(p.icon_muted)); + if layout.form(FormItem::Branch) == ItemForm::Name { + r = r.child(text(branch.to_owned()).font(SUB_META).color(p.faint).truncate()); + } + Some(r) + } + RowItem::Worktree => Some(text("opencode-sidebar".to_owned()).font(SUB_META).color(p.faint).truncate()), + RowItem::Server => { + let name = server?; + let mut r = row().gap(3.0).center_y().child(icon(&ic::SERVER, 12.0).color(p.icon_muted)); + if layout.form(FormItem::Server) == ItemForm::Name { + r = r.child(text(name.to_owned()).font(SUB_META).color(p.faint).truncate()); + } + Some(r) + } + RowItem::Subagents => (subagents > 0).then(|| text(format!("+{subagents}")).font(SUB_META).color(p.faint)), + } +} + +fn preview_row(p: &Pal, layout: &RowLayout, key: &'static str, title: &str, branch: &str, server: Option<&str>, age: &str, subagents: usize, dot: Option) -> El { + let mut c = col().key(key).w_full().px(8.0).py(5.0).gap(2.0).radius(6.0); + for (idx, lane) in [&layout.line1, &layout.line2].into_iter().enumerate() { + if lane.is_empty() { + continue; + } + let mut line = row().w_full().gap(6.0).center_y(); + if idx == 0 + && let Some(col) = dot + { + line = line.child(el().size(6.0, 6.0).radius(3.0).fill(col)); + } + for &item in lane { + if let Some(node) = sample_item_el(p, item, layout, title, branch, server, age, subagents) { + line = line.child(node); + } + } + c = c.child(line); + } + c +} + +fn build_item_menu(layout: &RowLayout, item: RowItem) -> Menu { + let lane = layout.lane_of(item); + let items = layout.lane(lane); + let pos = items.iter().position(|&x| x == item).unwrap_or(0); + let mut menu = Menu::new(t!("navigation.layout.itemOptions", item = item.label())) + .align(Align::Start) + .min_width(176.0) + .item(Item::new("nle:left", t!("navigation.layout.moveLeft")).enabled(pos > 0)) + .item(Item::new("nle:right", t!("navigation.layout.moveRight")).enabled(pos + 1 < items.len())) + .separator(); + for target in Lane::ALL { + if target == lane { + continue; + } + if item == RowItem::Title && target == Lane::Hidden { + continue; + } + let lbl = match target { + Lane::Line1 => t!("navigation.layout.moveTo.line1"), + Lane::Line2 => t!("navigation.layout.moveTo.line2"), + Lane::Hidden => t!("navigation.layout.moveTo.hidden"), + }; + menu = menu.item(Item::new(format!("nle:to:{}", target.name()), lbl)); + } + if let Some(fi) = item.form_item() { + let cur = layout.form(fi); + menu = menu + .separator() + .item(Item::new("nle:form:icon", t!("navigation.layout.form.icon")).checked(cur == ItemForm::Icon)) + .item(Item::new("nle:form:name", t!("navigation.layout.form.name")).checked(cur == ItemForm::Name)); + } + menu +} + +fn apply_item_menu(s: &mut App, item: RowItem, picked: &str) { + let Some(cur) = super::state(s).layout_editor.clone() else { return }; + let next = match picked { + "nle:left" => cur.nudge_item(item, -1), + "nle:right" => cur.nudge_item(item, 1), + "nle:to:line1" => cur.move_item(item, Lane::Line1, None), + "nle:to:line2" => cur.move_item(item, Lane::Line2, None), + "nle:to:hidden" => cur.move_item(item, Lane::Hidden, None), + "nle:form:icon" => item.form_item().map_or(cur.clone(), |fi| cur.set_form(fi, ItemForm::Icon)), + "nle:form:name" => item.form_item().map_or(cur.clone(), |fi| cur.set_form(fi, ItemForm::Name)), + _ => cur, + }; + super::state_mut(s).layout_editor = Some(next); +} + +fn lane_view(s: &App, p: &Pal, layout: &RowLayout, lane: Lane) -> El { + let items = layout.lane(lane); + let mut chips = row().w_full().gap(6.0).wrap().center_y(); + if items.is_empty() { + let msg = if lane == Lane::Hidden { + t!("navigation.layout.emptyLane") + } else { + t!("navigation.layout.emptyLine") + }; + chips = chips.child(text(msg).font(UI_SMALL).color(p.faint)); + } else { + for &item in items { + let anchor = format!("nle-chip-{}", item.name()); + let open = s.popup.open_at(&anchor); + let mut chip = row() + .key(anchor.clone()) + .role("button") + .label(item.label()) + .expanded(open) + .h(28.0) + .px(10.0) + .gap(6.0) + .center_y() + .radius(6.0) + .border(0.5, p.border_muted) + .fill(if open { p.pressed } else { p.layer1 }) + .hover(if open { p.pressed } else { p.hover }) + .press(p.pressed) + .focus_inset(p) + .menu_button(anchor.clone(), move |s: &mut App, tx: &mut Tx| { + let Some(cur) = super::state(s).layout_editor.clone() else { return }; + let menu = build_item_menu(&cur, item); + popup::open(s, menu, anchor.clone(), tx, move |s: &mut App, picked, tx| { + if let Some(id) = picked { + tx.instant(); + apply_item_menu(s, item, id); + } + }); + }) + .child(text(item.label()).font(UI_SMALL).color(p.text)); + if item == RowItem::Title { + chip = chip.child(text(t!("navigation.layout.required")).font(SUB_META).color(p.faint)); + } + chips = chips.child(chip); + } + } + col() + .key(format!("nle-lane-{}", lane.name())) + .w_full() + .gap(6.0) + .child(text(lane.label()).font(LANE_HEAD).color(p.muted)) + .child( + el() + .w_full() + .min_h(44.0) + .padding(8.0) + .radius(8.0) + .border(0.5, p.border_muted) + .fill(p.bg_deep) + .child(chips), + ) +} + +pub fn view(s: &App, p: &Pal, cx: &Cx) -> Vec { + let Some(layout) = super::state(s).layout_editor.as_ref() else { + return Vec::new(); + }; + let is_default = *layout == RowLayout::default(); + + let preview = col() + .key("navigation-layout-preview") + .w_full() + .padding(12.0) + .gap(4.0) + .radius(8.0) + .border(0.5, p.border_muted) + .fill(p.bg_deep) + .child(preview_row(p, layout, "nle-sample-1", t!("navigation.status.working"), "dev", None, "now", 2, Some(p.accent))) + .child(preview_row(p, layout, "nle-sample-2", t!("navigation.status.approval"), "sidebar-tests", None, "2m", 0, Some(p.v1_icon_warning))) + .child(preview_row(p, layout, "nle-sample-3", t!("navigation.status.unread"), "dev", Some("devbox"), "14m", 0, Some(p.bg_accent))) + .child(preview_row(p, layout, "nle-sample-4", t!("navigation.status.failed"), "redirects", None, "3h", 0, Some(p.danger))); + + let mut lanes = col().w_full().gap(12.0); + for lane in Lane::ALL { + lanes = lanes.child(lane_view(s, p, layout, lane)); + } + + let header = col() + .w_full() + .px(20.0) + .pt(16.0) + .pb(12.0) + .gap(4.0) + .child(text(t!("navigation.layout.title")).font(TITLE_FONT).color(p.text)) + .child(text(t!("navigation.layout.description")).font(BODY).color(p.muted)); + + let content = opencode_ui::scroller::scroller("nle-scroll").hidden( + col().w_full().grow(1.0).shrink().min_h(0.0), + col().w_full().px(20.0).pb(16.0).gap(16.0).child(preview).child(lanes), + ); + + let reset_btn = row() + .key("nle-reset") + .role("button") + .label_static(t!("navigation.layout.reset")) + .h(28.0) + .px(10.0) + .radius(6.0) + .center() + .hover(if is_default { Color::TRANSPARENT } else { p.hover }) + .focus_inset(p) + .on_press_tx(move |s: &mut App, tx: &mut Tx| { + if !is_default { + tx.instant(); + super::state_mut(s).layout_editor = Some(RowLayout::default()); + } + }) + .child(text(t!("navigation.layout.reset")).font(UI).color(if is_default { p.faint } else { p.muted })); + + let k = kit(p); + let cancel_btn = button(t!("common.cancel"), ButtonVariant::Ghost).on_press_tx(close).build(k).key("nle-cancel"); + let done_btn = button(t!("navigation.layout.done"), ButtonVariant::Submit).on_press_tx(save).build(k).key("nle-done"); + let footer = row() + .w_full() + .px(20.0) + .py(12.0) + .gap(8.0) + .center_y() + .border_sides([0.5, 0.0, 0.0, 0.0], p.border_muted) + .child(reset_btn) + .child(spacer()) + .child(cancel_btn) + .child(done_btn); + + let card = col() + .key("navigation-layout-dialog") + .role("dialog") + .label_static(t!("navigation.layout.title")) + .w_full() + .h_full() + .radius(12.0) + .fill(p.bg_base) + .border(0.5, p.border_muted) + .modal_tx(true, close) + .child(header) + .child(content) + .child(footer); + + sized_modal("navigation-layout-modal", p, DialogSize::XLarge, Fit::Fixed, dialog_window(cx, *s.zoom), card) +} diff --git a/apps/desktop/src/shell/navigation/list.rs b/apps/desktop/src/shell/navigation/list.rs index d565fd3f6..0d9c538b6 100644 --- a/apps/desktop/src/shell/navigation/list.rs +++ b/apps/desktop/src/shell/navigation/list.rs @@ -63,15 +63,9 @@ pub fn view(s: &App, p: &Pal) -> El { action_btn(p, "nav-new", &ic::EDIT, t!("command.session.new"), false) .on_press_tx(|s: &mut App, tx: &mut Tx| s.new_session(tx)), ) + // Under New navigation Sessions mode, Home hosts inline search (`homeSearch`, `opencode#67795`). .child( - action_btn(p, "nav-search", &ic::MAGNIFYING_GLASS, t!("navigation.search.placeholder"), false) - .on_press_tx(|s: &mut App, tx: &mut Tx| { - s.close_settings(); - s.open_session_search(tx); - }), - ) - .child( - action_btn(p, "nav-home", home_glyph, t!("home.title"), home_active) + action_btn(p, "nav-home", home_glyph, t!("navigation.allSessions"), home_active) .on_press_tx(|s: &mut App, tx: &mut Tx| { s.toggle_home(tx); }), @@ -420,7 +414,7 @@ fn inline_actions(p: &Pal, sr: &SessionRow, actions: &[RowAction]) -> Option return None; } let mut bar = row().gap(2.0).center_y().group_opacity(0.0, 1.0); - for &act in actions.iter().take(2) { + for &act in actions { let (srv, id, pinned, archived) = (sr.session.server.clone(), sr.session.id.clone(), sr.pinned, sr.archived); let (glyph, label) = match act { RowAction::Archive => (&ic::ARCHIVE, if archived { t!("navigation.rowAction.undo.archive") } else { t!("navigation.rowAction.archive") }), diff --git a/apps/desktop/src/shell/navigation/migrate.rs b/apps/desktop/src/shell/navigation/migrate.rs new file mode 100644 index 000000000..0a176586d --- /dev/null +++ b/apps/desktop/src/shell/navigation/migrate.rs @@ -0,0 +1,117 @@ +//! First-enable migration from legacy manual tab groups, pin folders, and Recent pins into +//! `navigation.groups` and `navigation.pins` (`packages/app/src/shell/navigation/migrate.ts`, +//! `opencode#67795`). Legacy pin folders remain intact so Consolidated still reads them. + +use std::collections::{HashMap, HashSet}; + +use opencode_kit::servers::ServerKey; + +use super::groups::{self, GroupsDoc, NavGroup, nav_key}; +use crate::App; +use crate::tabs::pins::{self, PinColor, PinItem, PinRef}; + +fn add_members(doc: &mut GroupsDoc, source: &[NavGroup], members: &[(String, String)]) -> bool { + let mut added: HashMap = HashMap::new(); + for (key, gid) in members.iter().rev() { + if !doc.membership.contains_key(key) { + added.insert(key.clone(), gid.clone()); + } + } + if added.is_empty() { + return false; + } + let used: HashSet<&str> = added.values().map(String::as_str).collect(); + let known: HashSet = doc.groups.iter().map(|g| g.id.clone()).collect(); + for g in source { + if used.contains(g.id.as_str()) && !known.contains(&g.id) { + doc.groups.push(g.clone()); + } + } + let ordered: HashSet = doc.order.iter().cloned().collect(); + let mut seen_order = HashSet::new(); + for (k, _) in members { + if added.contains_key(k) && !ordered.contains(k) && seen_order.insert(k.clone()) { + doc.order.push(k.clone()); + } + } + for (k, gid) in added { + doc.membership.insert(k, gid); + } + true +} + +/// Migrates manual tab groups, pin folders, and Recent pins on New navigation's first enable. +pub fn run(s: &mut App) { + let (tab_sources, tab_members) = { + let tg = &crate::tabs::groups::state(s).doc; + let ids: HashSet<&str> = tg.manual_groups.iter().map(|g| g.id.as_str()).collect(); + let sources: Vec = tg + .manual_groups + .iter() + .map(|g| NavGroup { + id: g.id.clone(), + name: g.name.clone(), + color: PinColor::parse(Some(g.color.name())).unwrap_or(PinColor::Gray), + }) + .collect(); + let mut members = Vec::new(); + for t in &s.tabs { + if t.is_draft() { + continue; + } + if let Some(gid) = tg.manual_assignments.get(&t.uid()) + && ids.contains(gid.as_str()) + { + members.push((nav_key(&t.server, &t.id), gid.clone())); + } + } + (sources, members) + }; + + let (folder_sources, folder_members) = { + let pdoc = &pins::state(s).doc; + let mut sources = Vec::new(); + let mut members = Vec::new(); + for item in &pdoc.items { + if let PinItem::Group(g) = item { + sources.push(NavGroup { id: g.id.clone(), name: g.name.clone(), color: g.color }); + for r in &g.sessions { + members.push((nav_key(&r.server, &r.session_id), g.id.clone())); + } + } + } + (sources, members) + }; + + let recent_pins: Vec = s + .project_state + .recent + .pins + .iter() + .filter_map(|k| { + let (srv, id) = crate::view::sidebar::state::split(k)?; + if srv.is_empty() || id.is_empty() { + return None; + } + Some(PinRef::new(ServerKey::new(srv), id.to_owned())) + }) + .collect(); + + if !recent_pins.is_empty() { + pins::update(s, |doc| { + let mut changed = false; + for r in recent_pins { + if doc.pin(r) { + changed = true; + } + } + changed + }); + } + + groups::update(s, |doc| { + let a = add_members(doc, &tab_sources, &tab_members); + let b = add_members(doc, &folder_sources, &folder_members); + a || b + }); +} diff --git a/apps/desktop/src/shell/navigation/mod.rs b/apps/desktop/src/shell/navigation/mod.rs index 92788c161..c046ba71d 100644 --- a/apps/desktop/src/shell/navigation/mod.rs +++ b/apps/desktop/src/shell/navigation/mod.rs @@ -1,15 +1,19 @@ -//! New navigation experiment runtime, manual groups, Sessions list, Customize menu, and Tabs -//! integration (`packages/app/src/shell/navigation/*`, `opencode#67793`). +//! New navigation experiment runtime, manual groups, migration, Row layout editor, Sessions +//! list, Customize menu, and Tabs integration (`packages/app/src/shell/navigation/*`, +//! `opencode#67793`, `opencode#67795`). pub mod customize; pub mod groups; +pub mod layout_editor; pub mod list; +pub mod migrate; pub mod tabs; pub mod view_model; use std::collections::{HashMap, HashSet}; -use opencode_kernel::{Feature, KernelBuilder, Slot}; +use opencode_feature_settings::row_layout::RowLayout; +use opencode_kernel::{Feature, KernelBuilder, OverlayRegistration, Slot}; use crate::App; @@ -21,6 +25,7 @@ pub struct NavState { pub collapsed: HashSet, pub expanded: HashMap, pub filters: view_model::Filters, + pub layout_editor: Option, } pub(crate) fn state(s: &App) -> &NavState { @@ -40,5 +45,13 @@ impl Feature for NewNavigationFeature { fn register(&self, builder: &mut KernelBuilder) { builder.register_slot(&NEW_NAV); + builder.register_overlay( + OverlayRegistration::::new(layout_editor::OVERLAY_ID) + .with_render(crate::overlays::layer::ACTION_DIALOG, |s, cx| { + let p = crate::palette::pal(s.dark(cx)); + layout_editor::view(s, p, cx) + }) + .with_dismiss(|s, tx| layout_editor::close(s, tx)), + ); } } diff --git a/apps/desktop/src/shell/navigation/tabs.rs b/apps/desktop/src/shell/navigation/tabs.rs index 9e741fdd9..749bb0624 100644 --- a/apps/desktop/src/shell/navigation/tabs.rs +++ b/apps/desktop/src/shell/navigation/tabs.rs @@ -136,7 +136,7 @@ pub fn vertical(s: &App, p: &Pal) -> El { body = body.child(tab_strip::section_strip(s, p, "nav-tabs-ungrouped", &ungrouped, false)); } else if doc.groups.is_empty() && pins::visible_items(s).is_empty() { body = body.child( - row().key("nav-tabs-empty").w_full().py(24.0).center().child(text(t!("navigation.empty.noTabs")).font(GROUP_HEAD).color(p.faint)), + row().key("nav-tabs-empty").w_full().py(24.0).center().child(text(t!("navigation.empty.title")).font(GROUP_HEAD).color(p.faint)), ); } opencode_ui::scroller::scroller("nav-tabs-scroll").hidden(col().w_full().grow(1.0).shrink().min_h(0.0), body) diff --git a/apps/desktop/src/shell/navigation/view_model.rs b/apps/desktop/src/shell/navigation/view_model.rs index 265c15e2c..4a663cf45 100644 --- a/apps/desktop/src/shell/navigation/view_model.rs +++ b/apps/desktop/src/shell/navigation/view_model.rs @@ -4,7 +4,7 @@ use std::cmp::Ordering; use std::collections::{HashMap, HashSet}; -use opencode_feature_settings::new_navigation::{GroupBy, NavigationSettings, RowsPerGroup, ShowCount}; +use opencode_feature_settings::new_navigation::{GroupBy, NavigationSettings, ShowCount}; use opencode_i18n::t; use opencode_kit::servers::ServerKey; @@ -242,18 +242,13 @@ pub struct ListView { pub filtered_out: bool, } -pub fn more_step(kind: SectionKind, settings: &NavigationSettings) -> usize { - if kind == SectionKind::Group { - return match settings.rows_per_group { - RowsPerGroup::N3 => 3, - RowsPerGroup::N5 => 5, - RowsPerGroup::N10 => 10, - RowsPerGroup::All => usize::MAX / 4, - }; - } +pub fn more_step(_kind: SectionKind, settings: &NavigationSettings) -> usize { match settings.show { + ShowCount::N5 => 5, + ShowCount::N10 => 10, ShowCount::N30 => 30, - _ => 10, + ShowCount::Week => 10, + ShowCount::All => usize::MAX / 4, } } @@ -419,11 +414,7 @@ pub fn project(input: &ViewInput, settings: &NavigationSettings) -> ListView { out.push(Entry { row: make_row(cur, depth), parent }); if let Some(kids) = children.get(&cur.key) { let mut sorted = kids.clone(); - if settings.group_by == GroupBy::Manual { - sorted.sort_by(cmp_manual); - } else { - sorted.sort_by(cmp_recent); - } + sorted.sort_by(cmp_recent); for child in sorted.into_iter().rev() { stack.push((child, depth + 1, Some(cur.key.clone()))); } @@ -477,13 +468,35 @@ pub fn project(input: &ViewInput, settings: &NavigationSettings) -> ListView { Spec { id: "pinned".into(), kind: SectionKind::Pinned, heading: Some(SectionHeading::Pinned), entries: pinned_entries }, ]; + // User-created manual groups always show first, regardless of GroupBy (`model.ts:12`, `opencode#67795`). + let group_ids: HashSet<&str> = input.groups.groups.iter().map(|g| g.id.as_str()).collect(); + for g in &input.groups.groups { + let mut members: Vec<&NavSession> = body_sessions + .iter() + .copied() + .filter(|s| input.groups.membership.get(&s.key).map(String::as_str) == Some(g.id.as_str())) + .collect(); + members.sort_by(cmp_manual); + specs.push(Spec { + id: format!("group:{}", g.id), + kind: SectionKind::Group, + heading: Some(SectionHeading::Group(g.clone())), + entries: members.into_iter().flat_map(&flatten).collect(), + }); + } + let ungrouped_sessions: Vec<&NavSession> = body_sessions + .iter() + .copied() + .filter(|s| input.groups.membership.get(&s.key).is_none_or(|gid| !group_ids.contains(gid.as_str()))) + .collect(); + match settings.group_by { GroupBy::None => { - specs.push(Spec { id: "main".into(), kind: SectionKind::Main, heading: None, entries: build_entries(body_sessions, cmp_recent) }); + specs.push(Spec { id: "main".into(), kind: SectionKind::Main, heading: None, entries: build_entries(ungrouped_sessions, cmp_recent) }); } GroupBy::Status => { let (mut attn, mut run, mut rec) = (Vec::new(), Vec::new(), Vec::new()); - for s in body_sessions { + for s in ungrouped_sessions { if requests.contains_key(&s.key) { attn.push(s); } else if status_of(s) == Status::Working { @@ -499,20 +512,9 @@ pub fn project(input: &ViewInput, settings: &NavigationSettings) -> ListView { specs.push(Spec { id: "status:running".into(), kind: SectionKind::Group, heading: Some(SectionHeading::Status(StatusBucket::Running)), entries: build_entries(run, cmp_started) }); specs.push(Spec { id: "status:recent".into(), kind: SectionKind::Group, heading: Some(SectionHeading::Status(StatusBucket::Recent)), entries: build_entries(rec, cmp_recent) }); } - GroupBy::Manual => { - let group_ids: HashSet<&str> = input.groups.groups.iter().map(|g| g.id.as_str()).collect(); - for g in &input.groups.groups { - let mut members: Vec<&NavSession> = body_sessions.iter().copied().filter(|s| input.groups.membership.get(&s.key).map(String::as_str) == Some(g.id.as_str())).collect(); - members.sort_by(cmp_manual); - specs.push(Spec { id: format!("group:{}", g.id), kind: SectionKind::Group, heading: Some(SectionHeading::Group(g.clone())), entries: members.into_iter().flat_map(&flatten).collect() }); - } - let mut ungrouped: Vec<&NavSession> = body_sessions.iter().copied().filter(|s| input.groups.membership.get(&s.key).is_none_or(|gid| !group_ids.contains(gid.as_str()))).collect(); - ungrouped.sort_by(cmp_manual); - specs.push(Spec { id: "main".into(), kind: SectionKind::Main, heading: None, entries: ungrouped.into_iter().flat_map(&flatten).collect() }); - } GroupBy::Project => { let mut buckets: HashMap)> = HashMap::new(); - for s in body_sessions { + for s in ungrouped_sessions { let (bid, rank, name) = match &s.project_id { Some(pid) => { let name = input.projects.iter().find(|p| p.server == s.server && p.id == *pid).map_or_else(|| s.project_name.clone(), |p| p.name.clone()); @@ -530,7 +532,7 @@ pub fn project(input: &ViewInput, settings: &NavigationSettings) -> ListView { } GroupBy::Server => { let mut buckets: HashMap)> = HashMap::new(); - for s in body_sessions { + for s in ungrouped_sessions { let rank = input.servers.iter().position(|srv| srv.key == s.server).unwrap_or(input.servers.len()); let name = input.servers.get(rank).map_or_else(|| s.server.as_str().to_owned(), |srv| srv.name.clone()); buckets.entry(format!("server:{}", s.server.as_str())).or_insert_with(|| (rank, name, Vec::new())).2.push(s); @@ -589,17 +591,9 @@ fn finish(item: Spec, input: &ViewInput, settings: &NavigationSettings) -> Secti fn limited(item: &Spec, input: &ViewInput, settings: &NavigationSettings) -> Vec { let extra = input.expanded.get(&item.id).copied().unwrap_or(0); let (count_limit, since_limit) = match item.kind { - SectionKind::Group => { - let base = match settings.rows_per_group { - RowsPerGroup::N3 => 3, - RowsPerGroup::N5 => 5, - RowsPerGroup::N10 => 10, - RowsPerGroup::All => usize::MAX / 2, - }; - (base.saturating_add(extra), i64::MIN) - } - SectionKind::Main => { + SectionKind::Group | SectionKind::Main => { let base = match settings.show { + ShowCount::N5 => 5, ShowCount::N10 => 10, ShowCount::N30 => 30, ShowCount::Week | ShowCount::All => usize::MAX / 2, diff --git a/apps/desktop/src/shell/view/home.rs b/apps/desktop/src/shell/view/home.rs index ee1432408..6f0f4bca0 100644 --- a/apps/desktop/src/shell/view/home.rs +++ b/apps/desktop/src/shell/view/home.rs @@ -65,7 +65,7 @@ pub(super) fn scoped(s: &App) -> bool { /// pick from the projects column does by pressing outside it. An inline search filters the list /// in place, so its query carries over to the new project. pub(super) fn picked(s: &mut App, tx: &mut Tx) { - if scoped(s) && !s.settings.navigation_prototype() && !s.search.text.is_empty() { + if scoped(s) && !s.settings.home_search() && !s.search.text.is_empty() { s.clear_home_search(false, tx); } } @@ -228,7 +228,7 @@ fn sessions_column(s: &App, p: &Pal, selected: Option<&model::Project>, tier: Ti list = list.child(el().key(format!("end-{title}")).w_full().h(23.0)); } } - let filtering = s.settings.navigation_prototype() && !s.search.text.trim().is_empty(); + let filtering = s.settings.home_search() && !s.search.text.trim().is_empty(); if count == 0 && filtering && !s.home_search_loading() { let query = s.search.text.trim(); list = list.child(text(t!("home.sessions.search.noResults", query = query)).key("home-search-empty").font(UI).color(p.muted).px(8.0).pt(24.0)); diff --git a/apps/desktop/src/shell/view/home/list.rs b/apps/desktop/src/shell/view/home/list.rs index 9ef0a8c4c..6344c588c 100644 --- a/apps/desktop/src/shell/view/home/list.rs +++ b/apps/desktop/src/shell/view/home/list.rs @@ -62,7 +62,7 @@ impl App { /// search has text, its matches grouped the same way (`search.ts`'s `groups`), preserving /// Flow automation folding and hover-held order (`ours.md` §5.8). pub(crate) fn home_groups(&self, selected: Option<&Project>) -> Vec> { - if self.settings.navigation_prototype() && !self.search.text.trim().is_empty() { + if self.settings.home_search() && !self.search.text.trim().is_empty() { return self.home_groups_in(self.home_search_results(selected)); } self.home_groups_in(self.home_roots(selected).collect()) diff --git a/apps/desktop/src/shell/view/home/projects.rs b/apps/desktop/src/shell/view/home/projects.rs index 7d7a24167..529b1f297 100644 --- a/apps/desktop/src/shell/view/home/projects.rs +++ b/apps/desktop/src/shell/view/home/projects.rs @@ -326,7 +326,7 @@ impl App { /// The focused server's name, when the picker names it in place of "All projects": under /// Consolidated, with several servers and no project chosen (`scopedServer`, opencode#66265). fn scoped_server(s: &App, selected: Option<&model::Project>) -> Option { - if selected.is_some() || !s.settings.navigation_prototype() { + if selected.is_some() || !s.settings.home_search() { return None; } let servers = &s.kernel.slots.get(&crate::projects::HOME_STATE).servers; diff --git a/apps/desktop/src/shell/view/home/search.rs b/apps/desktop/src/shell/view/home/search.rs index 12fb02fe5..65ba9fc75 100644 --- a/apps/desktop/src/shell/view/home/search.rs +++ b/apps/desktop/src/shell/view/home/search.rs @@ -44,7 +44,7 @@ pub(super) fn field(s: &App, p: &Pal, selected: Option<&model::Project>, width: }), ); if !s.search.text.is_empty() { - let (size, glyph) = if s.settings.navigation_prototype() { (24.0, 16.0) } else { (20.0, 20.0) }; + let (size, glyph) = if s.settings.home_search() { (24.0, 16.0) } else { (20.0, 20.0) }; field = field.child( row() .key("search-clear") diff --git a/apps/desktop/src/workspace/search/home_search.rs b/apps/desktop/src/workspace/search/home_search.rs index 6b27dda92..760afef4f 100644 --- a/apps/desktop/src/workspace/search/home_search.rs +++ b/apps/desktop/src/workspace/search/home_search.rs @@ -41,7 +41,7 @@ impl HomeSearchHost for App { } fn search_inline(&self) -> bool { - self.settings.navigation_prototype() + self.settings.home_search() } fn live_server(&self) -> Option { diff --git a/apps/desktop/src/workspace/search/switcher.rs b/apps/desktop/src/workspace/search/switcher.rs index 6d55ffdc2..3a6ae7898 100644 --- a/apps/desktop/src/workspace/search/switcher.rs +++ b/apps/desktop/src/workspace/search/switcher.rs @@ -335,7 +335,7 @@ impl App { /// Search sessions (⇧⌘F): opens the session palette, or under Consolidated opens Home with /// its inline search field focused (`titlebar.tsx`'s `session.search.dialog`). pub fn open_session_search(&mut self, tx: &mut Tx) { - if !self.settings.navigation_prototype() { + if !self.settings.home_search() { return open_session_search(self, tx); } if self.route != crate::Route::Home || self.settings_open() { diff --git a/crates/opencode-i18n/locales/official/en.json b/crates/opencode-i18n/locales/official/en.json index c3285e33c..f9d9bd4a1 100644 --- a/crates/opencode-i18n/locales/official/en.json +++ b/crates/opencode-i18n/locales/official/en.json @@ -135,6 +135,7 @@ "command.session.location.cycle": "Cycle session location", "command.session.new": "New session", "command.session.next": "Next session", + "command.session.next.attention": "Next needs you", "command.session.next.unseen": "Next unread session", "command.session.previous": "Previous session", "command.session.previous.unseen": "Previous unread session", @@ -552,6 +553,17 @@ "model.tooltip.reasoning": "Reasoning", "model.tooltip.reasoning.allowed": "Allows reasoning", "model.tooltip.reasoning.none": "No reasoning", + "navigation.allSessions": "All sessions", + "navigation.announce.archived": "Archived {{title}}.", + "navigation.announce.autoArchived.one": "Auto-archived {{count}} session with no activity for {{days}} days.", + "navigation.announce.autoArchived.other": "Auto-archived {{count}} sessions with no activity for {{days}} days.", + "navigation.announce.hidden": "Hid {{title}} until its next reply.", + "navigation.announce.markedRead": "Marked {{title}} read.", + "navigation.announce.markedUnread": "Marked {{title}} unread.", + "navigation.announce.pinned": "Pinned {{title}}.", + "navigation.announce.restored": "Restored {{title}}.", + "navigation.announce.unpinned": "Unpinned {{title}}.", + "navigation.archived.hidden": "Hidden until reply", "navigation.customize.clearFilters": "Clear filters", "navigation.customize.filter": "Filter", "navigation.customize.moreSettings": "More settings…", @@ -559,14 +571,41 @@ "navigation.customize.title": "Customize sessions", "navigation.empty.description": "Start a new session to see it here.", "navigation.empty.noMatch": "No sessions match", - "navigation.empty.noTabs": "No open tabs", "navigation.empty.title": "No sessions yet", "navigation.experiment.description": "Tabs or one customizable sessions list. Replaces the sidebar experiments below.", "navigation.experiment.title": "New navigation", "navigation.group.options": "Group options", "navigation.group.unpin": "Unpin group", - "navigation.page.description": "How you move between sessions", - "navigation.page.title": "Sidebar", + "navigation.layout.description": "Drag items between lines, or use an item's menu", + "navigation.layout.done": "Done", + "navigation.layout.emptyLane": "Drop items here", + "navigation.layout.emptyLine": "Empty lines don't show", + "navigation.layout.form.icon": "Icon only", + "navigation.layout.form.name": "Icon and name", + "navigation.layout.item.branch": "Branch", + "navigation.layout.item.projectIcon": "Project icon", + "navigation.layout.item.projectName": "Project name", + "navigation.layout.item.server": "Server", + "navigation.layout.item.subagents": "Running subagents", + "navigation.layout.item.time": "Time", + "navigation.layout.item.title": "Title", + "navigation.layout.item.worktree": "Worktree", + "navigation.layout.itemOptions": "{{item}} options", + "navigation.layout.lane.hidden": "Hidden", + "navigation.layout.lane.line1": "Line 1", + "navigation.layout.lane.line2": "Line 2", + "navigation.layout.moveLeft": "Move left", + "navigation.layout.moveRight": "Move right", + "navigation.layout.moveTo.hidden": "Move to Hidden", + "navigation.layout.moveTo.line1": "Move to Line 1", + "navigation.layout.moveTo.line2": "Move to Line 2", + "navigation.layout.moved": "Moved {{item}} to {{lane}}.", + "navigation.layout.preview": "Preview", + "navigation.layout.required": "Required", + "navigation.layout.reset": "Reset to default", + "navigation.layout.title": "Row layout", + "navigation.page.description": "Choose how you move between sessions", + "navigation.page.title": "Navigation", "navigation.rowAction.archive": "Archive", "navigation.rowAction.hideUntilReply": "Hide until reply", "navigation.rowAction.markRead": "Mark read", @@ -576,7 +615,6 @@ "navigation.rowAction.undo.pin": "Unpin", "navigation.running.one": "{{count}} running", "navigation.running.other": "{{count}} running", - "navigation.search.placeholder": "Search sessions", "navigation.section.archived": "Archived", "navigation.section.attention": "Needs you", "navigation.section.collapse": "Collapse {{name}}", @@ -586,52 +624,44 @@ "navigation.section.recent": "Recent", "navigation.section.running": "Running", "navigation.section.showMore": "Show more", - "navigation.setting.advanced.title": "Advanced", - "navigation.setting.archived.description": "List archived and hidden sessions at the end.", + "navigation.setting.archived.description": "Show archived and hidden sessions at the end of the list", "navigation.setting.archived.title": "Archived", "navigation.setting.autoArchive.30": "After 30 days", "navigation.setting.autoArchive.7": "After 7 days", - "navigation.setting.autoArchive.description": "Archive sessions with no activity.", + "navigation.setting.autoArchive.description": "Archive sessions with no recent activity. Open sessions are never archived", "navigation.setting.autoArchive.never": "Never", "navigation.setting.autoArchive.title": "Auto-archive", - "navigation.setting.groupBy.description": "Newest activity first. Manual keeps your order.", - "navigation.setting.groupBy.manual": "Manual", - "navigation.setting.groupBy.manualHint": "Use “Add to group” on a session to make one.", + "navigation.setting.groupBy.description": "Choose how sessions are grouped", "navigation.setting.groupBy.none": "Don't group", "navigation.setting.groupBy.project": "Project", "navigation.setting.groupBy.server": "Server", "navigation.setting.groupBy.status": "Status", "navigation.setting.groupBy.title": "Group by", - "navigation.setting.mode.description": "Tabs for open work, or one list of every session.", + "navigation.setting.mode.description": "Show sessions as tabs or as a list in the sidebar", "navigation.setting.mode.sessions": "Sessions", "navigation.setting.mode.tabs": "Tabs", - "navigation.setting.mode.title": "Navigation", - "navigation.setting.rowActions.description": "Up to two buttons on each row.", - "navigation.setting.rowActions.limit": "Up to two", + "navigation.setting.mode.title": "Layout", + "navigation.setting.rowActions.description": "Choose which actions appear when you hover a session", "navigation.setting.rowActions.none": "None", "navigation.setting.rowActions.title": "Row actions", "navigation.setting.rowDetails.compact": "Compact", "navigation.setting.rowDetails.custom": "Custom", - "navigation.setting.rowDetails.description": "Detailed adds project, branch and server.", + "navigation.setting.rowDetails.description": "Choose how much detail each session shows", "navigation.setting.rowDetails.detailed": "Detailed", + "navigation.setting.rowDetails.edit": "Edit layout", "navigation.setting.rowDetails.title": "Row details", - "navigation.setting.rowsPerGroup.10": "10", - "navigation.setting.rowsPerGroup.3": "3", - "navigation.setting.rowsPerGroup.5": "5", - "navigation.setting.rowsPerGroup.all": "All", - "navigation.setting.rowsPerGroup.description": "Before Show more. Sessions that need you always show.", - "navigation.setting.rowsPerGroup.title": "Rows per group", - "navigation.setting.runningAtBottom.description": "Pin running sessions to the bottom edge.", + "navigation.setting.runningAtBottom.description": "Keep running sessions at the bottom of the list", "navigation.setting.runningAtBottom.title": "Running at bottom", "navigation.setting.show.10": "10", "navigation.setting.show.30": "30", + "navigation.setting.show.5": "5", "navigation.setting.show.all": "All", - "navigation.setting.show.description": "When not grouped. Sessions that need you always show.", - "navigation.setting.show.title": "Show", + "navigation.setting.show.description": "Limit each group by count or by recent activity", + "navigation.setting.show.title": "Sessions to show", "navigation.setting.show.week": "Last 7 days", - "navigation.setting.subagents.description": "Off: their requests show on the parent.", + "navigation.setting.subagents.description": "Show subagent sessions under their parent", "navigation.setting.subagents.title": "Subagents", - "navigation.setting.tabPosition.description": "Group tabs from a tab's menu.", + "navigation.setting.tabPosition.description": "Choose where tabs appear", "navigation.setting.tabPosition.side": "Side", "navigation.setting.tabPosition.title": "Tab position", "navigation.setting.tabPosition.top": "Top", diff --git a/features/settings/src/host.rs b/features/settings/src/host.rs index 276b35ffa..af0cf6fe5 100644 --- a/features/settings/src/host.rs +++ b/features/settings/src/host.rs @@ -574,6 +574,11 @@ pub trait SettingsHost: opencode_kernel::AppEnv + opencode_kernel::AppFeedback + } /// Invoked after persisted settings change so sibling windows can sync live (`opencode#67759`). fn on_settings_changed(&mut self) {} + /// Opens the New navigation Row layout editor dialog (`settings-page.tsx:41-47`, `opencode#67795`). + fn open_navigation_layout_editor(&mut self, _tx: &mut Tx) {} + /// Migrates legacy tab groups, pin folders, and Recent pins into `navigation.groups` / + /// `navigation.pins` on New navigation's first enable (`experimental.tsx:29-65`, `opencode#67795`). + fn migrate_new_navigation(&mut self) {} /// Whether this window is a dedicated popped-out Settings window (`platform.settingsWindow`). fn is_settings_window(&self) -> bool { false diff --git a/features/settings/src/lib.rs b/features/settings/src/lib.rs index 4164eafc3..9a89425f6 100644 --- a/features/settings/src/lib.rs +++ b/features/settings/src/lib.rs @@ -15,6 +15,7 @@ mod interface_mode; mod mode_card; mod navigation_mode; pub mod new_navigation; +pub mod row_layout; pub mod jobs; pub mod pages; mod rows; @@ -417,7 +418,14 @@ impl Settings { /// Experimental › Organize vertical sidebar › Consolidated (`navigationPrototype`, `settings/model.tsx`). pub fn navigation_prototype(&self) -> bool { - self.sidebar_organize.effective() == Organize::Consolidated + !self.new_navigation_enabled() && self.sidebar_organize.effective() == Organize::Consolidated + } + + /// Search lives on Home and the sidebar has no Search button: Consolidated prototype, or New + /// navigation's Sessions mode (`settings/model.tsx:659`, `opencode#67795`). + pub fn home_search(&self) -> bool { + self.navigation_prototype() + || (self.new_navigation_enabled() && self.new_navigation.mode == crate::new_navigation::NavMode::Sessions) } /// The navigation prototype's List, else Tabs (`navigation`, `settings/model.tsx`). diff --git a/features/settings/src/new_navigation.rs b/features/settings/src/new_navigation.rs index 1477079ad..ddc65046f 100644 --- a/features/settings/src/new_navigation.rs +++ b/features/settings/src/new_navigation.rs @@ -5,11 +5,9 @@ use opencode_i18n::t; use serde_json::{Value, json}; use crate::prefs::{Navigation, Organize, TabGrouping}; +use crate::row_layout::RowLayout; use crate::types::TabLayout; -/// Maximum number of inline row action buttons (`MAX_ROW_ACTIONS = 2`). -pub const MAX_ROW_ACTIONS: usize = 2; - /// Whether this build offers the New navigation experiment (local, dev, and PR verification builds, /// matching `question_composer_available` in `prefs.rs` and `newNavigationAvailable` in `settings/model.tsx`). pub fn available() -> bool { @@ -70,11 +68,10 @@ pub enum GroupBy { Status, Project, Server, - Manual, } impl GroupBy { - pub const ALL: [Self; 5] = [Self::None, Self::Status, Self::Project, Self::Server, Self::Manual]; + pub const ALL: [Self; 4] = [Self::None, Self::Status, Self::Project, Self::Server]; pub fn name(self) -> &'static str { match self { @@ -82,7 +79,6 @@ impl GroupBy { Self::Status => "status", Self::Project => "project", Self::Server => "server", - Self::Manual => "manual", } } @@ -92,16 +88,15 @@ impl GroupBy { Self::Status => t!("navigation.setting.groupBy.status"), Self::Project => t!("navigation.setting.groupBy.project"), Self::Server => t!("navigation.setting.groupBy.server"), - Self::Manual => t!("navigation.setting.groupBy.manual"), } } + /// Parses persisted `groupBy`; legacy `"manual"` maps to `None` (`settings/model.tsx:416`). pub fn parse(v: Option<&str>) -> Self { match v { Some("status") => Self::Status, Some("project") => Self::Project, Some("server") => Self::Server, - Some("manual") => Self::Manual, _ => Self::None, } } @@ -116,7 +111,7 @@ pub enum RowDetails { } impl RowDetails { - pub const CHOICES: [Self; 2] = [Self::Compact, Self::Detailed]; + pub const ALL: [Self; 3] = [Self::Compact, Self::Detailed, Self::Custom]; pub fn name(self) -> &'static str { match self { Self::Compact => "compact", Self::Detailed => "detailed", Self::Custom => "custom" } @@ -137,39 +132,45 @@ impl RowDetails { #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub enum ShowCount { - N10, + N5, #[default] + N10, N30, Week, All, } impl ShowCount { - pub fn name(self) -> &'static str { - match self { Self::N10 => "10", Self::N30 => "30", Self::Week => "week", Self::All => "all" } - } + pub const ALL: [Self; 5] = [Self::N5, Self::N10, Self::N30, Self::Week, Self::All]; - pub fn parse(v: Option<&str>) -> Self { - match v { Some("10") => Self::N10, Some("week") => Self::Week, Some("all") => Self::All, _ => Self::N30 } + pub fn name(self) -> &'static str { + match self { + Self::N5 => "5", + Self::N10 => "10", + Self::N30 => "30", + Self::Week => "week", + Self::All => "all", + } } -} -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] -pub enum RowsPerGroup { - N3, - #[default] - N5, - N10, - All, -} - -impl RowsPerGroup { - pub fn name(self) -> &'static str { - match self { Self::N3 => "3", Self::N5 => "5", Self::N10 => "10", Self::All => "all" } + pub fn label(self) -> &'static str { + match self { + Self::N5 => t!("navigation.setting.show.5"), + Self::N10 => t!("navigation.setting.show.10"), + Self::N30 => t!("navigation.setting.show.30"), + Self::Week => t!("navigation.setting.show.week"), + Self::All => t!("navigation.setting.show.all"), + } } pub fn parse(v: Option<&str>) -> Self { - match v { Some("3") => Self::N3, Some("10") => Self::N10, Some("all") => Self::All, _ => Self::N5 } + match v { + Some("5") => Self::N5, + Some("30") => Self::N30, + Some("week") => Self::Week, + Some("all") => Self::All, + _ => Self::N10, + } } } @@ -193,6 +194,15 @@ impl RowAction { } } + pub fn label(self) -> &'static str { + match self { + Self::Archive => t!("navigation.rowAction.archive"), + Self::Pin => t!("navigation.rowAction.pin"), + Self::MarkRead => t!("navigation.rowAction.markRead"), + Self::HideUntilReply => t!("navigation.rowAction.hideUntilReply"), + } + } + pub fn parse(v: &str) -> Option { match v { "archive" => Some(Self::Archive), @@ -204,13 +214,20 @@ impl RowAction { } } -/// Normalizes row actions to canonical `ROW_ACTIONS` order, deduplicated and capped at `MAX_ROW_ACTIONS`. +/// Normalizes row actions to canonical `ROW_ACTIONS` order, deduplicated (`settings/model.tsx:420`). pub fn normalize_row_actions(actions: &[RowAction]) -> Vec { - RowAction::ALL - .into_iter() - .filter(|a| actions.contains(a)) - .take(MAX_ROW_ACTIONS) - .collect() + RowAction::ALL.into_iter().filter(|a| actions.contains(a)).collect() +} + +/// Toggles `action` in `list`, preserving canonical `ROW_ACTIONS` order (`row-actions.tsx:8-14`). +pub fn toggle_row_action(list: &[RowAction], action: RowAction, on: bool) -> Vec { + if list.contains(&action) == on { + return list.to_vec(); + } + if !on { + return list.iter().copied().filter(|&a| a != action).collect(); + } + RowAction::ALL.into_iter().filter(|&a| a == action || list.contains(&a)).collect() } #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] @@ -222,16 +239,26 @@ pub enum AutoArchive { } impl AutoArchive { + pub const ALL: [Self; 3] = [Self::Never, Self::Days7, Self::Days30]; + pub fn name(self) -> &'static str { match self { Self::Never => "never", Self::Days7 => "7", Self::Days30 => "30" } } + pub fn label(self) -> &'static str { + match self { + Self::Never => t!("navigation.setting.autoArchive.never"), + Self::Days7 => t!("navigation.setting.autoArchive.7"), + Self::Days30 => t!("navigation.setting.autoArchive.30"), + } + } + pub fn parse(v: Option<&str>) -> Self { match v { Some("7") => Self::Days7, Some("30") => Self::Days30, _ => Self::Never } } } -/// Persisted under `settings.v3` -> `navigation` (`NavigationSettings`, `contract.ts:87-109`). +/// Persisted under `settings.v3` -> `navigation` (`NavigationSettings`, `model.ts:81-109`). #[derive(Clone, Debug, PartialEq, Eq)] pub struct NavigationSettings { pub enabled: bool, @@ -240,8 +267,8 @@ pub struct NavigationSettings { pub tab_position: TabPosition, pub group_by: GroupBy, pub row_details: RowDetails, + pub row_layout: Option, pub show: ShowCount, - pub rows_per_group: RowsPerGroup, pub row_actions: Vec, pub subagents: bool, pub archived: bool, @@ -258,8 +285,8 @@ impl Default for NavigationSettings { tab_position: TabPosition::Side, group_by: GroupBy::None, row_details: RowDetails::Compact, - show: ShowCount::N30, - rows_per_group: RowsPerGroup::N5, + row_layout: None, + show: ShowCount::N10, row_actions: vec![RowAction::Archive], subagents: false, archived: false, @@ -270,9 +297,17 @@ impl Default for NavigationSettings { } impl NavigationSettings { + pub fn shown_layout(&self) -> Option { + match self.row_details { + RowDetails::Compact => None, + RowDetails::Detailed => Some(RowLayout::default()), + RowDetails::Custom => Some(self.row_layout.clone().unwrap_or_default()), + } + } + pub fn to_json(&self) -> Value { let actions: Vec<&str> = normalize_row_actions(&self.row_actions).into_iter().map(RowAction::name).collect(); - json!({ + let mut obj = json!({ "enabled": self.enabled, "seeded": self.seeded, "mode": self.mode.name(), @@ -280,13 +315,16 @@ impl NavigationSettings { "groupBy": self.group_by.name(), "rowDetails": self.row_details.name(), "show": self.show.name(), - "rowsPerGroup": self.rows_per_group.name(), "rowActions": actions, "subagents": self.subagents, "archived": self.archived, "runningAtBottom": self.running_at_bottom, "autoArchive": self.auto_archive.name(), - }) + }); + if let Some(layout) = &self.row_layout { + obj["rowLayout"] = layout.to_json(); + } + obj } pub fn from_json(v: &Value) -> Self { @@ -305,8 +343,8 @@ impl NavigationSettings { tab_position: TabPosition::parse(v["tabPosition"].as_str()), group_by: GroupBy::parse(v["groupBy"].as_str()), row_details: RowDetails::parse(v["rowDetails"].as_str()), + row_layout: RowLayout::from_json(&v["rowLayout"]), show: ShowCount::parse(v["show"].as_str()), - rows_per_group: RowsPerGroup::parse(v["rowsPerGroup"].as_str()), row_actions: actions, subagents: v["subagents"].as_bool().unwrap_or(d.subagents), archived: v["archived"].as_bool().unwrap_or(d.archived), diff --git a/features/settings/src/pages/experimental.rs b/features/settings/src/pages/experimental.rs index 5cc0e0019..7b424bb61 100644 --- a/features/settings/src/pages/experimental.rs +++ b/features/settings/src/pages/experimental.rs @@ -36,6 +36,9 @@ fn toggle_new_code_mode_timeline(s: &mut dyn SettingsHost) { fn toggle_new_navigation(s: &mut dyn SettingsHost, tx: &mut Tx) { let enable = !s.settings().new_navigation.enabled; + if enable && !s.settings().new_navigation.seeded { + s.migrate_new_navigation(); + } change_settings(s, |x| { if enable && !x.new_navigation.seeded { x.new_navigation = crate::new_navigation::seed( diff --git a/features/settings/src/pages/sidebar_nav.rs b/features/settings/src/pages/sidebar_nav.rs index ec2f98dc4..53370e62d 100644 --- a/features/settings/src/pages/sidebar_nav.rs +++ b/features/settings/src/pages/sidebar_nav.rs @@ -1,16 +1,21 @@ -//! Settings > Preferences > Sidebar section while the New navigation experiment is enabled -//! (`packages/app/src/shell/navigation/settings-page.tsx`, `opencode#67793`). +//! Settings > Preferences > Navigation section while the New navigation experiment is enabled +//! (`packages/app/src/shell/navigation/settings-page.tsx`, `opencode#67793`, `opencode#67795`). use opencode_i18n::t; +use opencode_ui::focus::FocusExt; use opencode_ui::palette::Pal; -use opencode_ui::popup::PopupHost; -use rune::{El, Tx, row}; +use opencode_ui::popup::{self, Item, Menu, MenuButton as _, PopupHost}; +use opencode_ui::style::UI_SMALL; +use rune::{Align, Color, El, Tx, icon, row, text}; +use rune_theme_opencode::icons as ic; use super::select; use crate::host::SettingsHost; use crate::mode_card::{GAP, Sketch, card}; -use crate::new_navigation::{GroupBy, NavMode, RowDetails, TabPosition}; -use crate::{change_settings, setting, setting_at}; +use crate::new_navigation::{ + AutoArchive, GroupBy, NavMode, RowAction, RowDetails, ShowCount, TabPosition, toggle_row_action, +}; +use crate::{change_settings, setting, setting_at, switch}; fn pick_mode(host: &mut dyn SettingsHost, mode: NavMode, tx: &mut Tx) { change_settings(host, |x| x.new_navigation.mode = mode); @@ -28,11 +33,67 @@ fn pick_group_by(host: &mut dyn SettingsHost, id: &str, _tx: &mut Tx) { change_settings(host, |x| x.new_navigation.group_by = g); } -fn pick_row_details(host: &mut dyn SettingsHost, id: &str, _tx: &mut Tx) { +fn pick_row_details(host: &mut dyn SettingsHost, id: &str, tx: &mut Tx) { let d = RowDetails::parse(Some(id)); + if d == RowDetails::Custom { + host.open_navigation_layout_editor(tx); + return; + } change_settings(host, |x| x.new_navigation.row_details = d); } +fn pick_show(host: &mut dyn SettingsHost, id: &str, _tx: &mut Tx) { + let v = ShowCount::parse(Some(id)); + change_settings(host, |x| x.new_navigation.show = v); +} + +fn pick_auto_archive(host: &mut dyn SettingsHost, id: &str, _tx: &mut Tx) { + let v = AutoArchive::parse(Some(id)); + change_settings(host, |x| x.new_navigation.auto_archive = v); +} + +fn row_actions_picker(s: &H, p: &Pal) -> El { + const ANCHOR: &str = "settings-navigation-row-actions"; + let list = &s.settings().new_navigation.row_actions; + let label = if list.is_empty() { + t!("navigation.setting.rowActions.none").to_owned() + } else { + list.iter().map(|a| a.label()).collect::>().join(", ") + }; + let open = s.popup().open_at(ANCHOR); + row() + .key(ANCHOR) + .role("button") + .label_static(t!("navigation.setting.rowActions.title")) + .expanded(open) + .h(28.0) + .px(10.0) + .gap(6.0) + .center_y() + .radius(6.0) + .fill(if open { p.pressed } else { p.layer1 }) + .hover(if open { p.pressed } else { p.hover }) + .press(p.pressed) + .focus_inset(p) + .menu_button(ANCHOR, |s: &mut H, tx: &mut Tx| { + let cur = s.settings().new_navigation.row_actions.clone(); + let mut menu = Menu::new(t!("navigation.setting.rowActions.title")).align(Align::End).min_width(180.0).gap(6.0); + for act in RowAction::ALL { + menu = menu.item(Item::new(act.name(), act.label()).checked(cur.contains(&act))); + } + popup::open(s, menu, ANCHOR, tx, |s: &mut H, picked, tx| { + let Some(act) = picked.and_then(RowAction::parse) else { return }; + tx.instant(); + let next_on = !s.settings().new_navigation.row_actions.contains(&act); + change_settings(s, |x| { + x.new_navigation.row_actions = toggle_row_action(&x.new_navigation.row_actions, act, next_on); + }); + }); + }) + .child(text(label).font(UI_SMALL).color(p.text).truncate()) + .child(icon(&ic::CHEVRON_DOWN, 14.0).color(p.icon_muted)) +} + /// Rows replacing legacy Interface mode in Settings > Preferences when New navigation is on. pub(crate) fn rows(s: &H, p: &Pal) -> Vec<(&'static str, El)> { let nav = &s.settings().new_navigation; @@ -85,13 +146,86 @@ pub(crate) fn rows(s: &H, p: &Pal) -> Vec setting(p, "settings-navigation-group-by", g_title, t!("navigation.setting.groupBy.description"), g_ctrl), )); let d_title = t!("navigation.setting.rowDetails.title"); - let d_opts = RowDetails::CHOICES.iter().map(|v| (v.name().to_owned(), v.label().to_owned())).collect(); - let d_cur = if nav.row_details == RowDetails::Compact { RowDetails::Compact } else { RowDetails::Detailed }; - let d_ctrl = select(s, p, "settings-navigation-row-details", d_title, d_opts, d_cur.name(), pick_row_details); + let d_opts = RowDetails::ALL.iter().map(|v| (v.name().to_owned(), v.label().to_owned())).collect(); + let d_select = select(s, p, "settings-navigation-row-details", d_title, d_opts, nav.row_details.name(), pick_row_details); + let edit_btn = (nav.row_details == RowDetails::Custom).then(|| { + row() + .key("settings-navigation-edit-layout") + .role("button") + .label_static(t!("navigation.setting.rowDetails.edit")) + .h(26.0) + .px(8.0) + .radius(6.0) + .center() + .fill(Color::TRANSPARENT) + .hover(p.hover) + .press(p.pressed) + .focus_inset(p) + .on_press_tx(|s: &mut H, tx: &mut Tx| s.open_navigation_layout_editor(tx)) + .child(text(t!("navigation.setting.rowDetails.edit")).font(UI_SMALL).color(p.muted)) + }); + let d_ctrl = row().gap(4.0).center_y().children(edit_btn).child(d_select); out.push(( "settings-navigation-row-details", setting(p, "settings-navigation-row-details", d_title, t!("navigation.setting.rowDetails.description"), d_ctrl), )); + let s_title = t!("navigation.setting.show.title"); + let s_opts = ShowCount::ALL.iter().map(|v| (v.name().to_owned(), v.label().to_owned())).collect(); + let s_ctrl = select(s, p, "settings-navigation-show", s_title, s_opts, nav.show.name(), pick_show); + out.push(( + "settings-navigation-show", + setting(p, "settings-navigation-show", s_title, t!("navigation.setting.show.description"), s_ctrl), + )); + out.push(( + "settings-navigation-row-actions", + setting( + p, + "settings-navigation-row-actions", + t!("navigation.setting.rowActions.title"), + t!("navigation.setting.rowActions.description"), + row_actions_picker(s, p), + ), + )); + out.push(( + "settings-navigation-subagents", + setting( + p, + "settings-navigation-subagents", + t!("navigation.setting.subagents.title"), + t!("navigation.setting.subagents.description"), + switch(p, "navigation-subagents-switch", nav.subagents) + .on_press(|s: &mut H| change_settings(s, |x| x.new_navigation.subagents = !x.new_navigation.subagents)), + ), + )); + out.push(( + "settings-navigation-archived", + setting( + p, + "settings-navigation-archived", + t!("navigation.setting.archived.title"), + t!("navigation.setting.archived.description"), + switch(p, "navigation-archived-switch", nav.archived) + .on_press(|s: &mut H| change_settings(s, |x| x.new_navigation.archived = !x.new_navigation.archived)), + ), + )); + out.push(( + "settings-navigation-runningAtBottom", + setting( + p, + "settings-navigation-runningAtBottom", + t!("navigation.setting.runningAtBottom.title"), + t!("navigation.setting.runningAtBottom.description"), + switch(p, "navigation-running-bottom-switch", nav.running_at_bottom) + .on_press(|s: &mut H| change_settings(s, |x| x.new_navigation.running_at_bottom = !x.new_navigation.running_at_bottom)), + ), + )); + let a_title = t!("navigation.setting.autoArchive.title"); + let a_opts = AutoArchive::ALL.iter().map(|v| (v.name().to_owned(), v.label().to_owned())).collect(); + let a_ctrl = select(s, p, "settings-navigation-auto-archive", a_title, a_opts, nav.auto_archive.name(), pick_auto_archive); + out.push(( + "settings-navigation-auto-archive", + setting(p, "settings-navigation-auto-archive", a_title, t!("navigation.setting.autoArchive.description"), a_ctrl), + )); } out } diff --git a/features/settings/src/row_layout.rs b/features/settings/src/row_layout.rs new file mode 100644 index 000000000..bacab19bc --- /dev/null +++ b/features/settings/src/row_layout.rs @@ -0,0 +1,282 @@ +//! Pure row-layout model and operations for New navigation's Detailed and Custom rows +//! (`packages/app/src/shell/navigation/{model,row-layout}.ts`, `opencode#67795`). + +use opencode_i18n::t; +use serde_json::{Value, json}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum RowItem { + ProjectIcon, + Title, + Time, + ProjectName, + Branch, + Worktree, + Server, + Subagents, +} + +impl RowItem { + pub const ALL: [Self; 8] = [ + Self::ProjectIcon, + Self::Title, + Self::Time, + Self::ProjectName, + Self::Branch, + Self::Worktree, + Self::Server, + Self::Subagents, + ]; + + pub fn name(self) -> &'static str { + match self { + Self::ProjectIcon => "projectIcon", + Self::Title => "title", + Self::Time => "time", + Self::ProjectName => "projectName", + Self::Branch => "branch", + Self::Worktree => "worktree", + Self::Server => "server", + Self::Subagents => "subagents", + } + } + + pub fn label(self) -> &'static str { + match self { + Self::ProjectIcon => t!("navigation.layout.item.projectIcon"), + Self::Title => t!("navigation.layout.item.title"), + Self::Time => t!("navigation.layout.item.time"), + Self::ProjectName => t!("navigation.layout.item.projectName"), + Self::Branch => t!("navigation.layout.item.branch"), + Self::Worktree => t!("navigation.layout.item.worktree"), + Self::Server => t!("navigation.layout.item.server"), + Self::Subagents => t!("navigation.layout.item.subagents"), + } + } + + pub fn parse(v: &str) -> Option { + match v { + "projectIcon" => Some(Self::ProjectIcon), + "title" => Some(Self::Title), + "time" => Some(Self::Time), + "projectName" => Some(Self::ProjectName), + "branch" => Some(Self::Branch), + "worktree" => Some(Self::Worktree), + "server" => Some(Self::Server), + "subagents" => Some(Self::Subagents), + _ => None, + } + } + + pub fn form_item(self) -> Option { + match self { + Self::Branch => Some(FormItem::Branch), + Self::Server => Some(FormItem::Server), + _ => None, + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Lane { + Line1, + Line2, + Hidden, +} + +impl Lane { + pub const ALL: [Self; 3] = [Self::Line1, Self::Line2, Self::Hidden]; + + pub fn name(self) -> &'static str { + match self { + Self::Line1 => "line1", + Self::Line2 => "line2", + Self::Hidden => "hidden", + } + } + + pub fn label(self) -> &'static str { + match self { + Self::Line1 => t!("navigation.layout.lane.line1"), + Self::Line2 => t!("navigation.layout.lane.line2"), + Self::Hidden => t!("navigation.layout.lane.hidden"), + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum FormItem { + Branch, + Server, +} + +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum ItemForm { + Icon, + #[default] + Name, +} + +impl ItemForm { + pub fn name(self) -> &'static str { + match self { + Self::Icon => "icon", + Self::Name => "name", + } + } + + pub fn parse(v: Option<&str>) -> Self { + match v { + Some("icon") => Self::Icon, + _ => Self::Name, + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct RowLayout { + pub line1: Vec, + pub line2: Vec, + pub hidden: Vec, + pub branch_form: ItemForm, + pub server_form: ItemForm, +} + +impl Default for RowLayout { + fn default() -> Self { + Self { + line1: vec![RowItem::ProjectIcon, RowItem::Title, RowItem::Time], + line2: vec![RowItem::ProjectName, RowItem::Branch, RowItem::Server], + hidden: vec![RowItem::Worktree, RowItem::Subagents], + branch_form: ItemForm::Name, + server_form: ItemForm::Name, + } + } +} + +impl RowLayout { + pub fn lane(&self, lane: Lane) -> &[RowItem] { + match lane { + Lane::Line1 => &self.line1, + Lane::Line2 => &self.line2, + Lane::Hidden => &self.hidden, + } + } + + fn lane_mut(&mut self, lane: Lane) -> &mut Vec { + match lane { + Lane::Line1 => &mut self.line1, + Lane::Line2 => &mut self.line2, + Lane::Hidden => &mut self.hidden, + } + } + + pub fn lane_of(&self, item: RowItem) -> Lane { + Lane::ALL.into_iter().find(|&l| self.lane(l).contains(&item)).unwrap_or(Lane::Hidden) + } + + pub fn form(&self, item: FormItem) -> ItemForm { + match item { + FormItem::Branch => self.branch_form, + FormItem::Server => self.server_form, + } + } + + pub fn set_form(&self, item: FormItem, form: ItemForm) -> Self { + let mut next = self.clone(); + match item { + FormItem::Branch => next.branch_form = form, + FormItem::Server => next.server_form = form, + } + next + } + + /// Moves `item` into `lane` at `index` (clamped) or at its end. Title never goes to Hidden. + pub fn move_item(&self, item: RowItem, lane: Lane, index: Option) -> Self { + if item == RowItem::Title && lane == Lane::Hidden { + return self.clone(); + } + let mut next = self.clone(); + for l in Lane::ALL { + next.lane_mut(l).retain(|&x| x != item); + } + let target = next.lane_mut(lane); + let at = index.map_or(target.len(), |i| i.min(target.len())); + target.insert(at, item); + next + } + + pub fn nudge_item(&self, item: RowItem, offset: isize) -> Self { + let lane = self.lane_of(item); + let Some(pos) = self.lane(lane).iter().position(|&x| x == item) else { return self.clone() }; + let to = pos as isize + offset; + if to < 0 || to as usize >= self.lane(lane).len() { + return self.clone(); + } + self.move_item(item, lane, Some(to as usize)) + } + + /// Drops repeated items (first wins), appends missing items to Hidden, and keeps Title out of Hidden. + pub fn normalize(self) -> Self { + let mut seen = Vec::with_capacity(RowItem::ALL.len()); + let mut dedup = |items: Vec| -> Vec { + let mut out = Vec::new(); + for item in items { + if !seen.contains(&item) { + seen.push(item); + out.push(item); + } + } + out + }; + let mut line1 = dedup(self.line1); + let line2 = dedup(self.line2); + let mut hidden = dedup(self.hidden); + for item in RowItem::ALL { + if !seen.contains(&item) { + hidden.push(item); + } + } + if let Some(pos) = hidden.iter().position(|&x| x == RowItem::Title) { + hidden.remove(pos); + line1.push(RowItem::Title); + } + Self { line1, line2, hidden, branch_form: self.branch_form, server_form: self.server_form } + } + + pub fn to_json(&self) -> Value { + let list = |xs: &[RowItem]| xs.iter().map(|i| i.name()).collect::>(); + json!({ + "line1": list(&self.line1), + "line2": list(&self.line2), + "hidden": list(&self.hidden), + "forms": { + "branch": self.branch_form.name(), + "server": self.server_form.name(), + }, + }) + } + + pub fn from_json(v: &Value) -> Option { + if !v.is_object() { + return None; + } + let parse_list = |arr: &Value| -> Vec { + arr.as_array() + .into_iter() + .flatten() + .filter_map(|x| RowItem::parse(x.as_str()?)) + .collect() + }; + Some( + Self { + line1: parse_list(&v["line1"]), + line2: parse_list(&v["line2"]), + hidden: parse_list(&v["hidden"]), + branch_form: ItemForm::parse(v["forms"]["branch"].as_str()), + server_form: ItemForm::parse(v["forms"]["server"].as_str()), + } + .normalize(), + ) + } +} diff --git a/features/settings/src/search/mod.rs b/features/settings/src/search/mod.rs index 6b2c5b990..53e7fee61 100644 --- a/features/settings/src/search/mod.rs +++ b/features/settings/src/search/mod.rs @@ -243,8 +243,14 @@ pub fn index(s: &dyn SettingsHost) -> Vec { if s.settings().new_navigation.mode == crate::new_navigation::NavMode::Tabs { add(Page::General, "settings-navigation-tab-position", key!("navigation.setting.tabPosition.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.tabPosition.description")), "top side tabs position"); } else { - add(Page::General, "settings-navigation-group-by", key!("navigation.setting.groupBy.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.groupBy.description")), "group status project server manual"); - add(Page::General, "settings-navigation-row-details", key!("navigation.setting.rowDetails.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.rowDetails.description")), "compact detailed row details"); + add(Page::General, "settings-navigation-group-by", key!("navigation.setting.groupBy.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.groupBy.description")), "group status project server"); + add(Page::General, "settings-navigation-row-details", key!("navigation.setting.rowDetails.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.rowDetails.description")), "compact detailed custom row details layout"); + add(Page::General, "settings-navigation-show", key!("navigation.setting.show.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.show.description")), "show count sessions week all"); + add(Page::General, "settings-navigation-row-actions", key!("navigation.setting.rowActions.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.rowActions.description")), "hover actions archive pin read hide"); + add(Page::General, "settings-navigation-subagents", key!("navigation.setting.subagents.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.subagents.description")), "subagents children nested"); + add(Page::General, "settings-navigation-archived", key!("navigation.setting.archived.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.archived.description")), "archived hidden sessions"); + add(Page::General, "settings-navigation-runningAtBottom", key!("navigation.setting.runningAtBottom.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.runningAtBottom.description")), "running working bottom shelf"); + add(Page::General, "settings-navigation-auto-archive", key!("navigation.setting.autoArchive.title"), Some(key!("navigation.page.title")), Some(key!("navigation.setting.autoArchive.description")), "auto archive days inactive"); } } if proto {