move get first router to Columns

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2024-10-01 12:59:00 -04:00
parent 57069ff7c0
commit 45223dbc25
2 changed files with 14 additions and 13 deletions

View File

@@ -6,7 +6,7 @@ use crate::{
colors,
column::{Column, Columns},
imgcache::ImageCache,
route::{Route, Router},
route::Route,
user_account::UserAccount,
Damus,
};
@@ -163,7 +163,7 @@ impl<'a> DesktopSidePanel<'a> {
}
pub fn perform_action(columns: &mut Columns, action: SidePanelAction) {
let router = get_first_router(columns);
let router = columns.get_first_router();
match action {
SidePanelAction::Panel => {} // TODO
SidePanelAction::Account => {
@@ -234,17 +234,6 @@ fn settings_button(dark_mode: bool) -> impl Widget {
}
}
fn get_first_router(columns: &mut Columns) -> &mut Router<Route> {
if columns.columns().is_empty() {
columns.new_column_picker();
}
columns
.columns_mut()
.get_mut(0)
.expect("There should be at least one column")
.router_mut()
}
fn add_column_button(dark_mode: bool) -> impl Widget {
let _ = dark_mode;
move |ui: &mut egui::Ui| {