From ed6a1acce896fb165f2642aa13b609166d57a734 Mon Sep 17 00:00:00 2001 From: Cody Swartz Date: Fri, 23 Oct 2026 19:41:57 -0700 Subject: [PATCH] feat(address-book): add a toolbar button to open the web console (#16680) The web console is only reachable from the "More on web console" item in the menu beside the Tags heading, which is easy to miss and hidden when the tags panel is turned off. Add a button to the Address Book toolbar that opens the same URL and reuses the same tooltip text. It shows under the same conditions as the menu item: logged in, not in legacy address book mode, and write access to the current book. Signed-off-by: Cody Swartz Co-authored-by: Claude Opus 5.5 --- flutter/lib/common/widgets/peer_tab_page.dart | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index 4849f2783..2bda4b6bd 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -21,6 +21,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:pull_down_button/pull_down_button.dart'; +import 'package:url_launcher/url_launcher_string.dart'; import '../../common.dart'; import '../../models/platform_model.dart'; @@ -549,6 +550,28 @@ class _PeerTabPageState extends State }); } + Widget _openWebConsole() { + return _hoverAction( + context: context, + toolTip: translate('ab_web_console_tip'), + child: Icon( + Icons.open_in_new, + size: 18, + ), + onTap: () async { + final url = await bind.mainGetApiServer(); + if (await canLaunchUrlString(url)) { + launchUrlString(url); + } + }); + } + + bool _showWebConsole(PeerTabModel model) => + model.currentTab == PeerTabIndex.ab.index && + gFFI.userModel.isLogin && + !gFFI.abModel.legacyMode.value && + gFFI.abModel.current.canWrite(); + List _landscapeRightActions(BuildContext context) { final model = Provider.of(context); return [ @@ -566,6 +589,10 @@ class _PeerTabPageState extends State offstage: model.currentTab == PeerTabIndex.recent.index, child: PeerSortDropdown(), ), + Offstage( + offstage: !_showWebConsole(model), + child: _openWebConsole(), + ), Offstage( offstage: model.currentTab != PeerTabIndex.ab.index, child: _toggleTags(), @@ -630,6 +657,7 @@ class _PeerTabPageState extends State final List dynamicActions = [ if (model.currentTabCachedPeers.isNotEmpty) _createMultiSelection(), if (model.currentTab != PeerTabIndex.recent.index) PeerSortDropdown(), + if (_showWebConsole(model)) _openWebConsole(), if (model.currentTab == PeerTabIndex.ab.index) _toggleTags() ]; final rightWidth = availableWidth -