init external notifs column

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2024-11-02 21:39:47 -04:00
parent 503b7edeb5
commit 529b76094c
5 changed files with 185 additions and 29 deletions

View File

@@ -6,7 +6,10 @@ use crate::{
account_manager::AccountsRoute,
column::Columns,
timeline::{TimelineId, TimelineRoute},
ui::profile::preview::{get_note_users_displayname_string, get_profile_displayname_string},
ui::{
add_column::AddColumnRoute,
profile::preview::{get_note_users_displayname_string, get_profile_displayname_string},
},
};
/// App routing. These describe different places you can go inside Notedeck.
@@ -16,7 +19,7 @@ pub enum Route {
Accounts(AccountsRoute),
Relays,
ComposeNote,
AddColumn,
AddColumn(AddColumnRoute),
Profile(Pubkey),
Support,
}
@@ -97,7 +100,13 @@ impl Route {
AccountsRoute::AddAccount => "Add Account".to_owned(),
},
Route::ComposeNote => "Compose Note".to_owned(),
Route::AddColumn => "Add Column".to_owned(),
Route::AddColumn(c) => match c {
AddColumnRoute::Base => "Add Column".to_owned(),
AddColumnRoute::UndecidedNotification => "Add Notifications Column".to_owned(),
AddColumnRoute::ExternalNotification => {
"Add External Notifications Column".to_owned()
}
},
Route::Profile(pubkey) => {
format!("{}'s Profile", get_profile_displayname_string(ndb, pubkey))
}
@@ -142,7 +151,7 @@ impl<R: Clone> Router<R> {
self.routes.push(route);
}
// Route to R. Then when it is successfully placed, should call `remove_previous_route`
// Route to R. Then when it is successfully placed, should call `remove_previous_routes` to remove all previous routes
pub fn route_to_replaced(&mut self, route: R) {
self.navigating = true;
self.replacing = true;
@@ -167,14 +176,15 @@ impl<R: Clone> Router<R> {
self.routes.pop()
}
pub fn remove_previous_route(&mut self) -> Option<R> {
pub fn remove_previous_routes(&mut self) {
let num_routes = self.routes.len();
if num_routes <= 1 {
return None;
return;
}
self.returning = false;
self.replacing = false;
Some(self.routes.remove(num_routes - 2))
self.routes.drain(..num_routes - 1);
}
pub fn is_replacing(&self) -> bool {
@@ -208,7 +218,7 @@ impl fmt::Display for Route {
},
Route::ComposeNote => write!(f, "Compose Note"),
Route::AddColumn => write!(f, "Add Column"),
Route::AddColumn(_) => write!(f, "Add Column"),
Route::Profile(_) => write!(f, "Profile"),
Route::Support => write!(f, "Support"),
}