integrate profile view caching

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2024-10-14 12:53:11 -04:00
parent 705a4bdf05
commit 6ffe33e924
10 changed files with 94 additions and 80 deletions

View File

@@ -6,7 +6,7 @@ use crate::{
account_manager::AccountsRoute,
column::Columns,
timeline::{TimelineId, TimelineRoute},
ui::profile::preview::get_note_users_displayname_string,
ui::profile::preview::{get_note_users_displayname_string, get_profile_displayname_string},
};
/// App routing. These describe different places you can go inside Notedeck.
@@ -17,7 +17,7 @@ pub enum Route {
Relays,
ComposeNote,
AddColumn,
Profile(Pubkey, TimelineId),
Profile(Pubkey),
}
#[derive(Clone)]
@@ -97,11 +97,8 @@ impl Route {
},
Route::ComposeNote => "Compose Note".to_owned(),
Route::AddColumn => "Add Column".to_owned(),
Route::Profile(_, id) => {
let timeline = columns
.find_timeline(*id)
.expect("expected to find timeline");
timeline.kind.to_title(ndb)
Route::Profile(pubkey) => {
format!("{}'s Profile", get_profile_displayname_string(ndb, pubkey))
}
};
@@ -210,7 +207,7 @@ impl fmt::Display for Route {
Route::ComposeNote => write!(f, "Compose Note"),
Route::AddColumn => write!(f, "Add Column"),
Route::Profile(_, _) => write!(f, "Profile"),
Route::Profile(_) => write!(f, "Profile"),
}
}
}