chore: source formatting and spec allignment

This commit is contained in:
2026-07-18 14:20:23 +02:00
parent a594b99e90
commit 16a210c0ad
119 changed files with 8868 additions and 5250 deletions

View File

@@ -3,7 +3,7 @@ pub mod sidebar_filter;
pub mod tabs;
pub mod toast;
pub use navigation::{SidebarView, PanelTab, TaskSnapshot, OutputEntry};
pub use sidebar_filter::{PostFilter, MediaFilter, CalendarFilter, CalendarYear, CalendarMonth};
pub use navigation::{OutputEntry, PanelTab, SidebarView, TaskSnapshot};
pub use sidebar_filter::{CalendarFilter, CalendarMonth, CalendarYear, MediaFilter, PostFilter};
pub use tabs::{Tab, TabType};
pub use toast::{Toast, ToastLevel};

View File

@@ -92,24 +92,21 @@ mod tests {
#[test]
fn toggle_off_when_same_and_visible() {
let (view, visible) =
handle_activity_click(SidebarView::Posts, true, SidebarView::Posts);
let (view, visible) = handle_activity_click(SidebarView::Posts, true, SidebarView::Posts);
assert_eq!(view, SidebarView::Posts);
assert!(!visible);
}
#[test]
fn toggle_on_when_same_and_hidden() {
let (view, visible) =
handle_activity_click(SidebarView::Posts, false, SidebarView::Posts);
let (view, visible) = handle_activity_click(SidebarView::Posts, false, SidebarView::Posts);
assert_eq!(view, SidebarView::Posts);
assert!(visible);
}
#[test]
fn switch_view_when_different() {
let (view, visible) =
handle_activity_click(SidebarView::Posts, true, SidebarView::Media);
let (view, visible) = handle_activity_click(SidebarView::Posts, true, SidebarView::Media);
assert_eq!(view, SidebarView::Media);
assert!(visible);
}

View File

@@ -1,9 +1,9 @@
/// Sidebar filter state per sidebar_views.allium PostsView / MediaView.
///
/// Per ui_data_flow.allium SidebarFilterIsolation:
/// "Sidebar search/filter state is local to the sidebar component.
/// Filtering never affects: active tab, editor content, selectedPostId.
/// Only the visible list of items changes."
//! Sidebar filter state per sidebar_views.allium PostsView / MediaView.
//!
//! Per ui_data_flow.allium SidebarFilterIsolation:
//! "Sidebar search/filter state is local to the sidebar component.
//! Filtering never affects: active tab, editor content, selectedPostId.
//! Only the visible list of items changes."
/// Calendar year/month archive filter.
/// Per sidebar_views.allium CalendarFilter.

View File

@@ -122,21 +122,20 @@ pub fn open_tab(tabs: &mut Vec<Tab>, new_tab: Tab) -> usize {
}
// Singleton: only one instance allowed (catches id mismatch edge cases)
if new_tab.tab_type.is_singleton() {
if let Some(idx) = tabs.iter().position(|t| t.tab_type == new_tab.tab_type) {
return idx;
}
if new_tab.tab_type.is_singleton()
&& let Some(idx) = tabs.iter().position(|t| t.tab_type == new_tab.tab_type)
{
return idx;
}
// Transient replacement: replace existing transient of same type
if new_tab.is_transient {
if let Some(idx) = tabs
if new_tab.is_transient
&& let Some(idx) = tabs
.iter()
.position(|t| t.tab_type == new_tab.tab_type && t.is_transient)
{
tabs[idx] = new_tab;
return idx;
}
{
tabs[idx] = new_tab;
return idx;
}
tabs.push(new_tab);
@@ -159,7 +158,7 @@ pub fn close_tab(tabs: &mut Vec<Tab>, id: &str) -> Option<usize> {
}
/// Mark a transient tab as permanent (non-transient).
pub fn pin_tab(tabs: &mut Vec<Tab>, id: &str) {
pub fn pin_tab(tabs: &mut [Tab], id: &str) {
if let Some(tab) = tabs.iter_mut().find(|t| t.id == id) {
tab.is_transient = false;
}

View File

@@ -3,7 +3,6 @@
/// Toasts are ephemeral, auto-dismissing messages shown at the top of
/// the workspace. Each toast has a severity level, a message, and a
/// monotonically increasing id used for targeted dismissal.
use std::sync::atomic::{AtomicU64, Ordering};
static NEXT_TOAST_ID: AtomicU64 = AtomicU64::new(1);