commit baff14bbf0f3db9647e986b12e95be5e171941c0
parent 0cc64da1cae385de9fc9dc86b42b7bf646830617
Author: William Casarin <jb55@jb55.com>
Date: Tue, 15 Jul 2025 10:51:02 -0700
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>
Diffstat:
2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -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 => {
diff --git a/crates/notedeck_columns/src/ui/column/header.rs b/crates/notedeck_columns/src/ui/column/header.rs
@@ -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 {