Skip to content

Commit

Permalink
ui: hook up relay management view
Browse files Browse the repository at this point in the history
Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Sep 17, 2024
1 parent fce82b2 commit 6bc4fb6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,9 @@ fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus, columns: usiz
columns[0].router_mut()
};

DesktopSidePanel::perform_action(router, side_panel.action);
if side_panel.response.clicked() {
DesktopSidePanel::perform_action(router, side_panel.action);
}

// vertical sidebar line
ui.painter().vline(
Expand Down
4 changes: 4 additions & 0 deletions src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ impl Route {
}
}

pub fn relays() -> Self {
Route::Relays
}

pub fn thread(thread_root: NoteId) -> Self {
Route::Timeline(TimelineRoute::Thread(thread_root))
}
Expand Down
13 changes: 12 additions & 1 deletion src/ui/side_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,18 @@ impl<'a> DesktopSidePanel<'a> {
router.route_to(Route::accounts());
}
}
SidePanelAction::Settings => {} // TODO
SidePanelAction::Settings => {
if router
.routes()
.iter()
.any(|&r| r == Route::Relays)
{
// return if we are already routing to accounts
router.go_back();
} else {
router.route_to(Route::relays());
}
}
SidePanelAction::Columns => (), // TODO
}
}
Expand Down

0 comments on commit 6bc4fb6

Please sign in to comment.