commit 1914fafc68331cd9f5e532ef55e86a125caa64d0
parent 10d45d6cc3b15fa2b8baed526efea281033b2f8c
Author: kernelkind <kernelkind@gmail.com>
Date: Thu, 9 Jan 2025 12:51:30 -0500
integrate column moving
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/crates/notedeck_columns/src/column.rs b/crates/notedeck_columns/src/column.rs
@@ -238,6 +238,6 @@ pub enum IntermediaryRoute {
}
pub enum ColumnsAction {
- // Switch(usize), TODO: could use for keyboard selection
+ Switch(usize, usize), // from Switch.0 to Switch.1,
Remove(usize),
}
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -72,6 +72,9 @@ impl SwitchingAction {
ColumnsAction::Remove(index) => {
get_active_columns_mut(ctx.accounts, decks_cache).delete_column(index)
}
+ ColumnsAction::Switch(from, to) => {
+ get_active_columns_mut(ctx.accounts, decks_cache).move_col(from, to);
+ }
},
SwitchingAction::Decks(decks_action) => match *decks_action {
DecksAction::Switch(index) => {
diff --git a/crates/notedeck_columns/src/ui/column/header.rs b/crates/notedeck_columns/src/ui/column/header.rs
@@ -1,7 +1,9 @@
+use crate::colors;
+use crate::column::ColumnsAction;
+use crate::nav::RenderNavAction;
+use crate::nav::SwitchingAction;
use crate::{
- colors,
column::Columns,
- nav::RenderNavAction,
route::Route,
timeline::{ColumnTitle, TimelineId, TimelineKind, TimelineRoute},
ui::{
@@ -10,7 +12,8 @@ use crate::{
},
};
-use egui::{Margin, RichText, Stroke, UiBuilder};
+use egui::Margin;
+use egui::{RichText, Stroke, UiBuilder};
use enostr::Pubkey;
use nostrdb::{Ndb, Transaction};
use notedeck::{ImageCache, NotedeckTextStyle};
@@ -88,10 +91,9 @@ impl<'a> NavTitle<'a> {
TitleResponse::RemoveColumn => Some(RenderNavAction::RemoveColumn),
TitleResponse::MoveColumn(to_index) => {
let from = self.col_id;
- None // TODO:
- // Some(RenderNavAction::SwitchingAction(SwitchingAction::Columns(
- // ColumnsAction::Switch(from, to_index),
- // )))
+ Some(RenderNavAction::SwitchingAction(SwitchingAction::Columns(
+ ColumnsAction::Switch(from, to_index),
+ )))
}
}
} else if back_button_resp.map_or(false, |r| r.clicked()) {