get scroll id for Route
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -9,21 +9,22 @@ use crate::{
|
|||||||
route::{Route, Router, SingletonRouter},
|
route::{Route, Router, SingletonRouter},
|
||||||
timeline::{
|
timeline::{
|
||||||
route::{render_thread_route, render_timeline_route},
|
route::{render_thread_route, render_timeline_route},
|
||||||
TimelineCache,
|
TimelineCache, TimelineKind,
|
||||||
},
|
},
|
||||||
ui::{
|
ui::{
|
||||||
self,
|
self,
|
||||||
add_column::render_add_column_routes,
|
add_column::{render_add_column_routes, AddColumnView},
|
||||||
column::NavTitle,
|
column::NavTitle,
|
||||||
configure_deck::ConfigureDeckView,
|
configure_deck::ConfigureDeckView,
|
||||||
edit_deck::{EditDeckResponse, EditDeckView},
|
edit_deck::{EditDeckResponse, EditDeckView},
|
||||||
note::{custom_zap::CustomZapView, NewPostAction, PostAction, PostType},
|
note::{custom_zap::CustomZapView, NewPostAction, PostAction, PostType, QuoteRepostView},
|
||||||
profile::EditProfileView,
|
profile::EditProfileView,
|
||||||
search::{FocusState, SearchView},
|
search::{FocusState, SearchView},
|
||||||
settings::{SettingsAction, ShowNoteClientOptions},
|
settings::{SettingsAction, ShowNoteClientOptions},
|
||||||
support::SupportView,
|
support::SupportView,
|
||||||
wallet::{get_default_zap_state, WalletAction, WalletState, WalletView},
|
wallet::{get_default_zap_state, WalletAction, WalletState, WalletView},
|
||||||
RelayView, SettingsView,
|
AccountsView, PostReplyView, PostView, ProfileView, RelayView, SettingsView, ThreadView,
|
||||||
|
TimelineView,
|
||||||
},
|
},
|
||||||
Damus,
|
Damus,
|
||||||
};
|
};
|
||||||
@@ -997,3 +998,52 @@ pub fn render_nav(
|
|||||||
|
|
||||||
RenderNavResponse::new(col, NotedeckNavResponse::Nav(Box::new(nav_response)))
|
RenderNavResponse::new(col, NotedeckNavResponse::Nav(Box::new(nav_response)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_scroll_id(
|
||||||
|
top: &Route,
|
||||||
|
depth: usize,
|
||||||
|
timeline_cache: &TimelineCache,
|
||||||
|
col: usize,
|
||||||
|
) -> Option<egui::Id> {
|
||||||
|
match top {
|
||||||
|
Route::Timeline(timeline_kind) => match timeline_kind {
|
||||||
|
TimelineKind::List(_)
|
||||||
|
| TimelineKind::Search(_)
|
||||||
|
| TimelineKind::Algo(_)
|
||||||
|
| TimelineKind::Notifications(_)
|
||||||
|
| TimelineKind::Universe
|
||||||
|
| TimelineKind::Hashtag(_)
|
||||||
|
| TimelineKind::Generic(_) => {
|
||||||
|
TimelineView::scroll_id(timeline_cache, timeline_kind, col)
|
||||||
|
}
|
||||||
|
TimelineKind::Profile(pubkey) => {
|
||||||
|
if depth > 1 {
|
||||||
|
Some(ProfileView::scroll_id(col, pubkey))
|
||||||
|
} else {
|
||||||
|
TimelineView::scroll_id(timeline_cache, timeline_kind, col)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Route::Thread(thread_selection) => Some(ThreadView::scroll_id(
|
||||||
|
thread_selection.selected_or_root(),
|
||||||
|
col,
|
||||||
|
)),
|
||||||
|
Route::Accounts(accounts_route) => match accounts_route {
|
||||||
|
crate::accounts::AccountsRoute::Accounts => Some(AccountsView::scroll_id()),
|
||||||
|
crate::accounts::AccountsRoute::AddAccount => None,
|
||||||
|
},
|
||||||
|
Route::Reply(note_id) => Some(PostReplyView::scroll_id(col, note_id.bytes())),
|
||||||
|
Route::Quote(note_id) => Some(QuoteRepostView::scroll_id(col, note_id.bytes())),
|
||||||
|
Route::Relays => Some(RelayView::scroll_id()),
|
||||||
|
Route::ComposeNote => Some(PostView::scroll_id()),
|
||||||
|
Route::AddColumn(add_column_route) => Some(AddColumnView::scroll_id(add_column_route)),
|
||||||
|
Route::EditProfile(_) => Some(EditProfileView::scroll_id()),
|
||||||
|
Route::Support => None,
|
||||||
|
Route::NewDeck => Some(ConfigureDeckView::scroll_id()),
|
||||||
|
Route::Search => Some(SearchView::scroll_id()),
|
||||||
|
Route::EditDeck(_) => None,
|
||||||
|
Route::Wallet(_) => None,
|
||||||
|
Route::CustomizeZapAmount(_) => None,
|
||||||
|
Route::Settings => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user