commit 32caaee6421c323e150667dea527606cbf4370de
parent 1b31557b03af5bf07b520e0a578c83e7972dc842
Author: William Casarin <jb55@jb55.com>
Date: Mon, 9 Dec 2024 09:03:34 -0800
Revert "introduce decks_cache"
This was causing a crash when switching accounts
This reverts commit 69e93b0ebfef424d9ad5ee91faadb59ef06c2585.
Diffstat:
7 files changed, 82 insertions(+), 176 deletions(-)
diff --git a/src/accounts/mod.rs b/src/accounts/mod.rs
@@ -8,13 +8,12 @@ use uuid::Uuid;
use enostr::{ClientMessage, FilledKeypair, FullKeypair, Keypair, RelayPool};
use nostrdb::{Filter, Ndb, Note, NoteKey, Subscription, Transaction};
-use crate::app::get_active_columns_mut;
-use crate::decks::DecksCache;
use crate::{
+ column::Columns,
imgcache::ImageCache,
login_manager::AcquireKeyState,
muted::Muted,
- route::Route,
+ route::{Route, Router},
storage::{KeyStorageResponse, KeyStorageType},
ui::{
account_login_view::{AccountLoginResponse, AccountLoginView},
@@ -231,12 +230,13 @@ pub fn render_accounts_route(
ui: &mut egui::Ui,
ndb: &Ndb,
col: usize,
+ columns: &mut Columns,
img_cache: &mut ImageCache,
accounts: &mut Accounts,
- decks: &mut DecksCache,
login_state: &mut AcquireKeyState,
route: AccountsRoute,
) -> SingleUnkIdAction {
+ let router = columns.column_mut(col).router_mut();
let resp = match route {
AccountsRoute::Accounts => AccountsView::new(ndb, accounts, img_cache)
.ui(ui)
@@ -252,15 +252,12 @@ pub fn render_accounts_route(
if let Some(resp) = resp {
match resp {
AccountsRouteResponse::Accounts(response) => {
- process_accounts_view_response(accounts, decks, col, response);
+ process_accounts_view_response(accounts, response, router);
SingleUnkIdAction::no_action()
}
AccountsRouteResponse::AddAccount(response) => {
- let action = process_login_view_response(accounts, decks, response);
+ let action = process_login_view_response(accounts, response);
*login_state = Default::default();
- let router = get_active_columns_mut(accounts, decks)
- .column_mut(col)
- .router_mut();
router.go_back();
action
}
@@ -271,20 +268,16 @@ pub fn render_accounts_route(
}
pub fn process_accounts_view_response(
- accounts: &mut Accounts,
- decks: &mut DecksCache,
- col: usize,
+ manager: &mut Accounts,
response: AccountsViewResponse,
+ router: &mut Router<Route>,
) {
- let router = get_active_columns_mut(accounts, decks)
- .column_mut(col)
- .router_mut();
match response {
AccountsViewResponse::RemoveAccount(index) => {
- accounts.remove_account(index);
+ manager.remove_account(index);
}
AccountsViewResponse::SelectAccount(index) => {
- accounts.select_account(index);
+ manager.select_account(index);
}
AccountsViewResponse::RouteToLogin => {
router.route_to(Route::add_account());
@@ -626,18 +619,15 @@ fn get_selected_index(accounts: &[UserAccount], keystore: &KeyStorageType) -> Op
pub fn process_login_view_response(
manager: &mut Accounts,
- decks: &mut DecksCache,
response: AccountLoginResponse,
) -> SingleUnkIdAction {
- let (pubkey, login_action) = match response {
+ let login_action = match response {
AccountLoginResponse::CreateNew => {
- let kp = FullKeypair::generate().to_keypair();
- (kp.pubkey, manager.add_account(kp))
+ manager.add_account(FullKeypair::generate().to_keypair())
}
- AccountLoginResponse::LoginWith(keypair) => (keypair.pubkey, manager.add_account(keypair)),
+ AccountLoginResponse::LoginWith(keypair) => manager.add_account(keypair),
};
manager.select_account(login_action.switch_to_index);
- decks.add_deck_default(pubkey);
login_action.unk
}
diff --git a/src/app.rs b/src/app.rs
@@ -3,8 +3,7 @@ use crate::{
app_creation::setup_cc,
app_size_handler::AppSizeHandler,
args::Args,
- column::Columns,
- decks::{Decks, DecksCache},
+ column::{Column, Columns},
draft::Drafts,
filter::FilterState,
frame_history::FrameHistory,
@@ -13,12 +12,13 @@ use crate::{
notecache::NoteCache,
notes_holder::NotesHolderStorage,
profile::Profile,
+ route::Route,
storage::{self, DataPath, DataPathType, Directory, FileKeyStorage, KeyStorageType},
subscriptions::{SubKind, Subscriptions},
support::Support,
thread::Thread,
- timeline::{self, Timeline},
- ui::{self, DesktopSidePanel},
+ timeline::{self, Timeline, TimelineKind},
+ ui::{self, add_column::AddColumnRoute, DesktopSidePanel},
unknowns::UnknownIds,
view_state::ViewState,
Result,
@@ -30,7 +30,7 @@ use uuid::Uuid;
use egui::{Context, Frame, Style};
use egui_extras::{Size, StripBuilder};
-use nostrdb::{Config, Ndb, Transaction};
+use nostrdb::{Config, Filter, Ndb, Transaction};
use std::collections::HashMap;
use std::path::Path;
@@ -49,7 +49,7 @@ pub struct Damus {
pub note_cache: NoteCache,
pub pool: RelayPool,
- pub decks_cache: DecksCache,
+ pub columns: Columns,
pub ndb: Ndb,
pub view_state: ViewState,
pub unknown_ids: UnknownIds,
@@ -98,8 +98,7 @@ fn handle_key_events(input: &egui::InputState, _pixels_per_point: f32, columns:
fn try_process_event(damus: &mut Damus, ctx: &egui::Context) -> Result<()> {
let ppp = ctx.pixels_per_point();
- let current_columns = get_active_columns_mut(&damus.accounts, &mut damus.decks_cache);
- ctx.input(|i| handle_key_events(i, ppp, current_columns));
+ ctx.input(|i| handle_key_events(i, ppp, &mut damus.columns));
let ctx2 = ctx.clone();
let wakeup = move || {
@@ -125,7 +124,7 @@ fn try_process_event(damus: &mut Damus, ctx: &egui::Context) -> Result<()> {
timeline::send_initial_timeline_filters(
&damus.ndb,
damus.since_optimize,
- get_active_columns_mut(&damus.accounts, &mut damus.decks_cache),
+ &mut damus.columns,
&mut damus.subscriptions,
&mut damus.pool,
&ev.relay,
@@ -139,11 +138,10 @@ fn try_process_event(damus: &mut Damus, ctx: &egui::Context) -> Result<()> {
}
}
- let current_columns = get_active_columns_mut(&damus.accounts, &mut damus.decks_cache);
- let n_timelines = current_columns.timelines().len();
+ let n_timelines = damus.columns.timelines().len();
for timeline_ind in 0..n_timelines {
let is_ready = {
- let timeline = &mut current_columns.timelines[timeline_ind];
+ let timeline = &mut damus.columns.timelines[timeline_ind];
timeline::is_timeline_ready(
&damus.ndb,
&mut damus.pool,
@@ -158,7 +156,7 @@ fn try_process_event(damus: &mut Damus, ctx: &egui::Context) -> Result<()> {
if let Err(err) = Timeline::poll_notes_into_view(
timeline_ind,
- current_columns.timelines_mut(),
+ damus.columns.timelines_mut(),
&damus.ndb,
&txn,
&mut damus.unknown_ids,
@@ -211,7 +209,7 @@ fn update_damus(damus: &mut Damus, ctx: &egui::Context) {
if let Err(err) = timeline::setup_initial_nostrdb_subs(
&damus.ndb,
&mut damus.note_cache,
- &mut damus.decks_cache,
+ &mut damus.columns,
&damus.accounts.mutefun(),
) {
warn!("update_damus init: {err}");
@@ -259,7 +257,7 @@ fn handle_eose(damus: &mut Damus, subid: &str, relay_url: &str) -> Result<()> {
UnknownIds::update(
&txn,
&mut damus.unknown_ids,
- get_active_columns(&damus.accounts, &damus.decks_cache),
+ &damus.columns,
&damus.ndb,
&mut damus.note_cache,
);
@@ -276,10 +274,7 @@ fn handle_eose(damus: &mut Damus, subid: &str, relay_url: &str) -> Result<()> {
}
SubKind::FetchingContactList(timeline_uid) => {
- let timeline = if let Some(tl) =
- get_active_columns_mut(&damus.accounts, &mut damus.decks_cache)
- .find_timeline_mut(timeline_uid)
- {
+ let timeline = if let Some(tl) = damus.columns.find_timeline_mut(timeline_uid) {
tl
} else {
error!(
@@ -450,7 +445,7 @@ impl Damus {
.as_ref()
.map(|a| a.pubkey.bytes());
- let columns = if parsed_args.columns.is_empty() {
+ let mut columns = if parsed_args.columns.is_empty() {
if let Some(serializable_columns) = storage::load_columns(&path) {
info!("Using columns from disk");
serializable_columns.into_columns(&ndb, account)
@@ -473,35 +468,13 @@ impl Damus {
columns
};
- let mut decks_cache = {
- let mut decks_cache = DecksCache::default();
-
- let mut decks = Decks::default();
- *decks.active_mut().columns_mut() = columns;
-
- if let Some(acc) = account {
- decks_cache.add_decks(Pubkey::new(*acc), decks);
- }
-
- decks_cache
- };
-
let debug = parsed_args.debug;
- if get_active_columns(&accounts, &decks_cache)
- .columns()
- .is_empty()
- {
+ if columns.columns().is_empty() {
if accounts.get_accounts().is_empty() {
- set_demo(
- &path,
- &ndb,
- &mut accounts,
- &mut decks_cache,
- &mut unknown_ids,
- );
+ set_demo(&path, &ndb, &mut accounts, &mut columns, &mut unknown_ids);
} else {
- get_active_columns_mut(&accounts, &mut decks_cache).new_column_picker();
+ columns.new_column_picker();
}
}
@@ -520,6 +493,7 @@ impl Damus {
state: DamusState::Initializing,
img_cache: ImageCache::new(imgcache_dir),
note_cache: NoteCache::default(),
+ columns,
textmode: parsed_args.textmode,
ndb,
accounts,
@@ -528,7 +502,6 @@ impl Damus {
path,
app_rect_handler,
support,
- decks_cache,
}
}
@@ -561,11 +534,11 @@ impl Damus {
}
pub fn columns_mut(&mut self) -> &mut Columns {
- get_active_columns_mut(&self.accounts, &mut self.decks_cache)
+ &mut self.columns
}
pub fn columns(&self) -> &Columns {
- get_active_columns(&self.accounts, &self.decks_cache)
+ &self.columns
}
pub fn gen_subid(&self, kind: &SubKind) -> String {
@@ -577,7 +550,12 @@ impl Damus {
}
pub fn mock<P: AsRef<Path>>(data_path: P) -> Self {
- let decks_cache = DecksCache::default();
+ let mut columns = Columns::new();
+ let filter = Filter::from_json(include_str!("../queries/global.json")).unwrap();
+
+ let timeline = Timeline::new(TimelineKind::Universe, FilterState::ready(vec![filter]));
+
+ columns.add_new_timeline_column(timeline);
let path = DataPath::new(&data_path);
let imgcache_dir = path.path(DataPathType::Cache).join(ImageCache::rel_dir());
@@ -601,6 +579,7 @@ impl Damus {
pool: RelayPool::new(),
img_cache: ImageCache::new(imgcache_dir),
note_cache: NoteCache::default(),
+ columns,
textmode: false,
ndb: Ndb::new(
path.path(DataPathType::Db)
@@ -612,10 +591,10 @@ impl Damus {
accounts: Accounts::new(KeyStorageType::None, vec![]),
frame_history: FrameHistory::default(),
view_state: ViewState::default(),
+
path,
app_rect_handler,
support,
- decks_cache,
}
}
@@ -660,7 +639,7 @@ fn render_damus_mobile(ctx: &egui::Context, app: &mut Damus) {
//let routes = app.timelines[0].routes.clone();
main_panel(&ctx.style(), ui::is_narrow(ctx)).show(ctx, |ui| {
- if !app.columns().columns().is_empty()
+ if !app.columns.columns().is_empty()
&& nav::render_nav(0, app, ui).process_render_nav_response(app)
{
storage::save_columns(&app.path, app.columns().as_serializable_columns());
@@ -687,9 +666,7 @@ fn render_damus_desktop(ctx: &egui::Context, app: &mut Damus) {
puffin::profile_function!();
let screen_size = ctx.screen_rect().width();
- let calc_panel_width = (screen_size
- / get_active_columns(&app.accounts, &app.decks_cache).num_columns() as f32)
- - 30.0;
+ let calc_panel_width = (screen_size / app.columns.num_columns() as f32) - 30.0;
let min_width = 320.0;
let need_scroll = calc_panel_width < min_width;
let panel_sizes = if need_scroll {
@@ -713,10 +690,7 @@ fn render_damus_desktop(ctx: &egui::Context, app: &mut Damus) {
fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus) {
StripBuilder::new(ui)
.size(Size::exact(ui::side_panel::SIDE_PANEL_WIDTH))
- .sizes(
- sizes,
- get_active_columns(&app.accounts, &app.decks_cache).num_columns(),
- )
+ .sizes(sizes, app.columns.num_columns())
.clip(true)
.horizontal(|mut strip| {
strip.cell(|ui| {
@@ -725,14 +699,12 @@ fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus) {
&app.ndb,
&mut app.img_cache,
app.accounts.get_selected_account(),
- &app.decks_cache,
)
.show(ui);
- if side_panel.response.clicked() || side_panel.response.secondary_clicked() {
+ if side_panel.response.clicked() {
DesktopSidePanel::perform_action(
- &mut app.decks_cache,
- &app.accounts,
+ &mut app.columns,
&mut app.support,
side_panel.action,
);
@@ -746,9 +718,8 @@ fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus) {
);
});
- let num_cols = app.columns().num_columns();
- let mut responses = Vec::with_capacity(num_cols);
- for col_index in 0..num_cols {
+ let mut responses = Vec::with_capacity(app.columns.num_columns());
+ for col_index in 0..app.columns.num_columns() {
strip.cell(|ui| {
let rect = ui.available_rect_before_wrap();
responses.push(nav::render_nav(col_index, app, ui));
@@ -795,44 +766,13 @@ impl eframe::App for Damus {
}
}
-pub fn get_active_columns<'a>(accounts: &Accounts, decks_cache: &'a DecksCache) -> &'a Columns {
- get_decks(accounts, decks_cache).active().columns()
-}
-
-pub fn get_decks<'a>(accounts: &Accounts, decks_cache: &'a DecksCache) -> &'a Decks {
- let key = if let Some(acc) = accounts.get_selected_account() {
- &acc.pubkey
- } else {
- &decks_cache.fallback_pubkey
- };
- decks_cache.decks(key)
-}
-
-pub fn get_active_columns_mut<'a>(
- accounts: &Accounts,
- decks_cache: &'a mut DecksCache,
-) -> &'a mut Columns {
- get_decks_mut(accounts, decks_cache)
- .active_mut()
- .columns_mut()
-}
-
-pub fn get_decks_mut<'a>(accounts: &Accounts, decks_cache: &'a mut DecksCache) -> &'a mut Decks {
- if let Some(acc) = accounts.get_selected_account() {
- decks_cache.decks_mut(&acc.pubkey)
- } else {
- decks_cache.fallback_mut()
- }
-}
-
-pub fn set_demo(
+fn set_demo(
data_path: &DataPath,
ndb: &Ndb,
accounts: &mut Accounts,
- decks_cache: &mut DecksCache,
+ columns: &mut Columns,
unk_ids: &mut UnknownIds,
) {
- let columns = get_active_columns_mut(accounts, decks_cache);
let demo_pubkey =
Pubkey::from_hex("aa733081e4f0f79dd43023d8983265593f2b41a988671cfcef3f489b91ad93fe")
.unwrap();
@@ -844,13 +784,13 @@ pub fn set_demo(
accounts.select_account(0);
}
- columns.add_column(crate::column::Column::new(vec![
- crate::route::Route::AddColumn(ui::add_column::AddColumnRoute::Base),
- crate::route::Route::Accounts(AccountsRoute::Accounts),
+ columns.add_column(Column::new(vec![
+ Route::AddColumn(AddColumnRoute::Base),
+ Route::Accounts(AccountsRoute::Accounts),
]));
if let Some(timeline) =
- timeline::TimelineKind::contact_list(timeline::PubkeySource::Explicit(demo_pubkey))
+ TimelineKind::contact_list(timeline::PubkeySource::Explicit(demo_pubkey))
.into_timeline(ndb, Some(demo_pubkey.bytes()))
{
columns.add_new_timeline_column(timeline);
diff --git a/src/args.rs b/src/args.rs
@@ -306,15 +306,15 @@ mod tests {
let ctx = egui::Context::default();
let app = Damus::new(&ctx, &tmpdir, args);
- assert_eq!(app.columns().columns().len(), 2);
+ assert_eq!(app.columns.columns().len(), 2);
- let tl1 = app.columns().column(0).router().top().timeline_id();
- let tl2 = app.columns().column(1).router().top().timeline_id();
+ let tl1 = app.columns.column(0).router().top().timeline_id();
+ let tl2 = app.columns.column(1).router().top().timeline_id();
assert_eq!(tl1.is_some(), true);
assert_eq!(tl2.is_some(), true);
- let timelines = app.columns().timelines();
+ let timelines = app.columns.timelines();
assert!(timelines[0].kind.is_notifications());
assert!(timelines[1].kind.is_contacts());
diff --git a/src/nav.rs b/src/nav.rs
@@ -1,7 +1,6 @@
use crate::{
accounts::render_accounts_route,
actionbar::NoteAction,
- app::{get_active_columns, get_active_columns_mut},
notes_holder::NotesHolder,
profile::Profile,
relay_pool_manager::RelayPoolManager,
@@ -88,10 +87,7 @@ impl RenderNavResponse {
RenderNavAction::PostAction(post_action) => {
let txn = Transaction::new(&app.ndb).expect("txn");
let _ = post_action.execute(&app.ndb, &txn, &mut app.pool, &mut app.drafts);
- get_active_columns_mut(&app.accounts, &mut app.decks_cache)
- .column_mut(col)
- .router_mut()
- .go_back();
+ app.columns_mut().column_mut(col).router_mut().go_back();
}
RenderNavAction::NoteAction(note_action) => {
@@ -99,7 +95,7 @@ impl RenderNavResponse {
note_action.execute_and_process_result(
&app.ndb,
- get_active_columns_mut(&app.accounts, &mut app.decks_cache),
+ &mut app.columns,
col,
&mut app.threads,
&mut app.profiles,
@@ -180,7 +176,7 @@ fn render_nav_body(
match top {
Route::Timeline(tlr) => render_timeline_route(
&app.ndb,
- get_active_columns_mut(&app.accounts, &mut app.decks_cache),
+ &mut app.columns,
&mut app.drafts,
&mut app.img_cache,
&mut app.unknown_ids,
@@ -198,9 +194,9 @@ fn render_nav_body(
ui,
&app.ndb,
col,
+ &mut app.columns,
&mut app.img_cache,
&mut app.accounts,
- &mut app.decks_cache,
&mut app.view_state.login,
*amr,
);
@@ -245,7 +241,7 @@ fn render_nav_body(
#[must_use = "RenderNavResponse must be handled by calling .process_render_nav_response(..)"]
pub fn render_nav(col: usize, app: &mut Damus, ui: &mut egui::Ui) -> RenderNavResponse {
- let col_id = get_active_columns(&app.accounts, &app.decks_cache).get_column_id_at_index(col);
+ let col_id = app.columns.get_column_id_at_index(col);
// TODO(jb55): clean up this router_mut mess by using Router<R> in egui-nav directly
let nav_response = Nav::new(&app.columns().column(col).router().routes().clone())
@@ -256,7 +252,7 @@ pub fn render_nav(col: usize, app: &mut Damus, ui: &mut egui::Ui) -> RenderNavRe
NavUiType::Title => NavTitle::new(
&app.ndb,
&mut app.img_cache,
- get_active_columns_mut(&app.accounts, &mut app.decks_cache),
+ &app.columns,
app.accounts.get_selected_account().map(|a| &a.pubkey),
nav.routes(),
)
diff --git a/src/timeline/mod.rs b/src/timeline/mod.rs
@@ -1,6 +1,5 @@
use crate::{
column::Columns,
- decks::DecksCache,
error::{Error, FilterError},
filter::{self, FilterState, FilterStates},
muted::MuteFun,
@@ -602,16 +601,12 @@ pub fn copy_notes_into_timeline(
pub fn setup_initial_nostrdb_subs(
ndb: &Ndb,
note_cache: &mut NoteCache,
- decks_cache: &mut DecksCache,
+ columns: &mut Columns,
is_muted: &MuteFun,
) -> Result<()> {
- for decks in decks_cache.account_to_decks.values_mut() {
- for deck in decks.decks_mut() {
- for timeline in deck.columns_mut().timelines_mut() {
- if let Err(err) = setup_timeline_nostrdb_sub(ndb, note_cache, timeline, is_muted) {
- error!("setup_initial_nostrdb_subs: {err}");
- }
- }
+ for timeline in columns.timelines_mut() {
+ if let Err(err) = setup_timeline_nostrdb_sub(ndb, note_cache, timeline, is_muted) {
+ error!("setup_initial_nostrdb_subs: {err}");
}
}
diff --git a/src/ui/accounts.rs b/src/ui/accounts.rs
@@ -2,6 +2,7 @@ use crate::colors::PINK;
use crate::imgcache::ImageCache;
use crate::{
accounts::Accounts,
+ route::{Route, Router},
ui::{Preview, PreviewConfig, View},
Damus,
};
@@ -202,12 +203,15 @@ mod preview {
pub struct AccountsPreview {
app: Damus,
+ router: Router<Route>,
}
impl AccountsPreview {
fn new() -> Self {
let app = test_data::test_app();
- AccountsPreview { app }
+ let router = Router::new(vec![Route::accounts()]);
+
+ AccountsPreview { app, router }
}
}
@@ -220,12 +224,7 @@ mod preview {
.ui(ui)
.inner
{
- process_accounts_view_response(
- &mut self.app.accounts,
- &mut self.app.decks_cache,
- 0,
- response,
- );
+ process_accounts_view_response(self.app.accounts_mut(), response, &mut self.router);
}
}
}
diff --git a/src/ui/side_panel.rs b/src/ui/side_panel.rs
@@ -4,11 +4,9 @@ use egui::{
use tracing::info;
use crate::{
- accounts::{Accounts, AccountsRoute},
- app::get_active_columns_mut,
+ accounts::AccountsRoute,
app_style, colors,
- column::Column,
- decks::DecksCache,
+ column::{Column, Columns},
imgcache::ImageCache,
route::Route,
support::Support,
@@ -29,7 +27,6 @@ pub struct DesktopSidePanel<'a> {
ndb: &'a nostrdb::Ndb,
img_cache: &'a mut ImageCache,
selected_account: Option<&'a UserAccount>,
- decks_cache: &'a DecksCache,
}
impl View for DesktopSidePanel<'_> {
@@ -66,13 +63,11 @@ impl<'a> DesktopSidePanel<'a> {
ndb: &'a nostrdb::Ndb,
img_cache: &'a mut ImageCache,
selected_account: Option<&'a UserAccount>,
- decks_cache: &'a DecksCache,
) -> Self {
Self {
ndb,
img_cache,
selected_account,
- decks_cache,
}
}
@@ -205,13 +200,8 @@ impl<'a> DesktopSidePanel<'a> {
helper.take_animation_response()
}
- pub fn perform_action(
- decks_cache: &mut DecksCache,
- accounts: &Accounts,
- support: &mut Support,
- action: SidePanelAction,
- ) {
- let router = get_active_columns_mut(accounts, decks_cache).get_first_router();
+ pub fn perform_action(columns: &mut Columns, support: &mut Support, action: SidePanelAction) {
+ let router = columns.get_first_router();
match action {
SidePanelAction::Panel => {} // TODO
SidePanelAction::Account => {
@@ -242,7 +232,7 @@ impl<'a> DesktopSidePanel<'a> {
{
router.go_back();
} else {
- get_active_columns_mut(accounts, decks_cache).new_column_picker();
+ columns.new_column_picker();
}
}
SidePanelAction::ComposeNote => {
@@ -480,7 +470,6 @@ mod preview {
use egui_extras::{Size, StripBuilder};
use crate::{
- app::get_active_columns_mut,
test_data,
ui::{Preview, PreviewConfig},
};
@@ -494,8 +483,7 @@ mod preview {
impl DesktopSidePanelPreview {
fn new() -> Self {
let mut app = test_data::test_app();
- get_active_columns_mut(&app.accounts, &mut app.decks_cache)
- .add_column(Column::new(vec![Route::accounts()]));
+ app.columns.add_column(Column::new(vec![Route::accounts()]));
DesktopSidePanelPreview { app }
}
}
@@ -512,13 +500,11 @@ mod preview {
&self.app.ndb,
&mut self.app.img_cache,
self.app.accounts.get_selected_account(),
- &self.app.decks_cache,
);
let response = panel.show(ui);
DesktopSidePanel::perform_action(
- &mut self.app.decks_cache,
- &self.app.accounts,
+ &mut self.app.columns,
&mut self.app.support,
response.action,
);