mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-25 11:14:25 +01:00
10
src/app.rs
10
src/app.rs
@@ -729,6 +729,11 @@ fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus) {
|
||||
);
|
||||
});
|
||||
|
||||
let mut save_cols = false;
|
||||
if let Some(action) = side_panel_action {
|
||||
save_cols = save_cols || action.process(app);
|
||||
}
|
||||
|
||||
let num_cols = app.columns().num_columns();
|
||||
let mut responses = Vec::with_capacity(num_cols);
|
||||
for col_index in 0..num_cols {
|
||||
@@ -747,11 +752,6 @@ fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus) {
|
||||
//strip.cell(|ui| timeline::timeline_view(ui, app, timeline_ind));
|
||||
}
|
||||
|
||||
let mut save_cols = false;
|
||||
if let Some(action) = side_panel_action {
|
||||
save_cols = save_cols || action.process(app);
|
||||
}
|
||||
|
||||
for response in responses {
|
||||
let save = response.process_render_nav_response(app);
|
||||
save_cols = save_cols || save;
|
||||
|
||||
@@ -4,7 +4,6 @@ use crate::{app_style::emoji_font_family, decks::Deck};
|
||||
pub struct DeckState {
|
||||
pub deck_name: String,
|
||||
pub selected_glyph: Option<char>,
|
||||
pub deleting: bool,
|
||||
pub selecting_glyph: bool,
|
||||
pub warn_no_title: bool,
|
||||
pub warn_no_icon: bool,
|
||||
@@ -42,7 +41,6 @@ impl Default for DeckState {
|
||||
Self {
|
||||
deck_name: Default::default(),
|
||||
selected_glyph: Default::default(),
|
||||
deleting: Default::default(),
|
||||
selecting_glyph: true,
|
||||
warn_no_icon: Default::default(),
|
||||
warn_no_title: Default::default(),
|
||||
|
||||
11
src/nav.rs
11
src/nav.rs
@@ -192,10 +192,6 @@ impl RenderNavResponse {
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(Route::EditDeck(index)) = r {
|
||||
SwitchingAction::Decks(DecksAction::Removing(index)).process(app);
|
||||
}
|
||||
|
||||
switching_occured = true;
|
||||
}
|
||||
|
||||
@@ -318,6 +314,7 @@ fn render_nav_body(
|
||||
resp
|
||||
}
|
||||
Route::EditDeck(index) => {
|
||||
let mut action = None;
|
||||
let cur_deck = get_decks_mut(&app.accounts, &mut app.decks_cache)
|
||||
.decks_mut()
|
||||
.get_mut(*index)
|
||||
@@ -338,7 +335,9 @@ fn render_nav_body(
|
||||
cur_deck.edit(configure_deck_response);
|
||||
}
|
||||
EditDeckResponse::Delete => {
|
||||
deck_state.deleting = true;
|
||||
action = Some(RenderNavAction::SwitchingAction(SwitchingAction::Decks(
|
||||
DecksAction::Removing(*index),
|
||||
)));
|
||||
}
|
||||
}
|
||||
get_active_columns_mut(&app.accounts, &mut app.decks_cache)
|
||||
@@ -346,7 +345,7 @@ fn render_nav_body(
|
||||
.go_back();
|
||||
}
|
||||
|
||||
None
|
||||
action
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,15 @@ use egui::{
|
||||
vec2, Color32, InnerResponse, Label, Layout, Margin, RichText, ScrollArea, Separator, Stroke,
|
||||
Widget,
|
||||
};
|
||||
use tracing::info;
|
||||
use tracing::{error, info};
|
||||
|
||||
use crate::{
|
||||
accounts::{Accounts, AccountsRoute},
|
||||
app::get_active_columns_mut,
|
||||
app_style,
|
||||
app_style::DECK_ICON_SIZE,
|
||||
app::{get_active_columns_mut, get_decks_mut},
|
||||
app_style::{self, DECK_ICON_SIZE},
|
||||
colors,
|
||||
column::Column,
|
||||
decks::DecksAction,
|
||||
decks::DecksCache,
|
||||
decks::{DecksAction, DecksCache},
|
||||
imgcache::ImageCache,
|
||||
nav::SwitchingAction,
|
||||
route::Route,
|
||||
@@ -331,7 +329,20 @@ impl<'a> DesktopSidePanel<'a> {
|
||||
if router.routes().iter().any(|&r| r == Route::EditDeck(index)) {
|
||||
router.go_back();
|
||||
} else {
|
||||
router.route_to(Route::EditDeck(index));
|
||||
switching_response = Some(crate::nav::SwitchingAction::Decks(
|
||||
DecksAction::Switch(index),
|
||||
));
|
||||
if let Some(edit_deck) = get_decks_mut(accounts, decks_cache)
|
||||
.decks_mut()
|
||||
.get_mut(index)
|
||||
{
|
||||
edit_deck
|
||||
.columns_mut()
|
||||
.get_first_router()
|
||||
.route_to(Route::EditDeck(index));
|
||||
} else {
|
||||
error!("Cannot push EditDeck route to index {}", index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user