mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-18 09:04:21 +01:00
ui/column: include pfp in back response
We were missing the pfp in the back response Fixes: https://github.com/damus-io/notedeck/issues/923 Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -323,6 +323,14 @@ pub enum RouterType {
|
||||
Stack,
|
||||
}
|
||||
|
||||
fn go_back(stack: &mut Router<Route>, sheet: &mut SingletonRouter<Route>) {
|
||||
if sheet.route().is_some() {
|
||||
sheet.go_back();
|
||||
} else {
|
||||
stack.go_back();
|
||||
}
|
||||
}
|
||||
|
||||
impl RouterAction {
|
||||
pub fn process(
|
||||
self,
|
||||
@@ -331,16 +339,24 @@ impl RouterAction {
|
||||
) -> Option<ProcessNavResult> {
|
||||
match self {
|
||||
RouterAction::GoBack => {
|
||||
if sheet_router.route().is_some() {
|
||||
sheet_router.go_back();
|
||||
} else {
|
||||
stack_router.go_back();
|
||||
}
|
||||
go_back(stack_router, sheet_router);
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
RouterAction::PfpClicked => Some(ProcessNavResult::PfpClicked),
|
||||
RouterAction::PfpClicked => {
|
||||
if stack_router.routes().len() == 1 {
|
||||
// if we're at the top level and we click a profile pic,
|
||||
// bubble it up so that it can be handled by the chrome
|
||||
// to open the sidebar
|
||||
Some(ProcessNavResult::PfpClicked)
|
||||
} else {
|
||||
// Otherwise just execute a back action
|
||||
go_back(stack_router, sheet_router);
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
RouterAction::RouteTo(route, router_type) => match router_type {
|
||||
RouterType::Sheet => {
|
||||
|
||||
@@ -129,8 +129,7 @@ impl<'a> NavTitle<'a> {
|
||||
|
||||
// NOTE(jb55): include graphic in back label as well because why
|
||||
// not it looks cool
|
||||
self.title_pfp(ui, prev, 32.0);
|
||||
|
||||
let pfp_resp = self.title_pfp(ui, prev, 32.0);
|
||||
let column_title = prev.title();
|
||||
|
||||
let back_resp = match &column_title {
|
||||
@@ -143,7 +142,11 @@ impl<'a> NavTitle<'a> {
|
||||
}
|
||||
};
|
||||
|
||||
back_resp.union(chev_resp)
|
||||
if let Some(pfp_resp) = pfp_resp {
|
||||
back_resp.union(chev_resp).union(pfp_resp)
|
||||
} else {
|
||||
back_resp.union(chev_resp)
|
||||
}
|
||||
}
|
||||
|
||||
fn back_label(title: &str, color: egui::Color32) -> egui::Label {
|
||||
|
||||
Reference in New Issue
Block a user