From a9abaf408d5afe812f5eef33a01cb767ea9c266b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Saquetim?= <1108771+megothss@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:47:34 -0300 Subject: [PATCH] DEV: Auto expand active sections and scroll active link into view (#28237) --- .../app/components/sidebar/api-panels.gjs | 6 +- .../app/components/sidebar/api-section.gjs | 10 +- .../app/components/sidebar/api-sections.gjs | 52 ++++- .../app/components/sidebar/section-link.gjs | 25 +++ .../app/components/sidebar/section.gjs | 46 +++++ .../app/lib/sidebar/admin-sidebar.js | 4 +- .../lib/sidebar/base-custom-sidebar-panel.js | 8 + .../base-custom-sidebar-section-link.js | 5 + .../discourse/app/services/sidebar-state.js | 5 + .../acceptance/sidebar-plugin-api-test.js | 189 ++++++++++++++++++ 10 files changed, 343 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/sidebar/api-panels.gjs b/app/assets/javascripts/discourse/app/components/sidebar/api-panels.gjs index 61562707abb..8f1059002e7 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/api-panels.gjs +++ b/app/assets/javascripts/discourse/app/components/sidebar/api-panels.gjs @@ -11,7 +11,11 @@ export default class SidebarApiPanels extends Component { } diff --git a/app/assets/javascripts/discourse/app/components/sidebar/api-section.gjs b/app/assets/javascripts/discourse/app/components/sidebar/api-section.gjs index 3cc7fa9a059..2b5d117cd5d 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/api-section.gjs +++ b/app/assets/javascripts/discourse/app/components/sidebar/api-section.gjs @@ -1,3 +1,4 @@ +import { and, eq } from "truth-helpers"; import Section from "./section"; import SectionLink from "./section-link"; @@ -14,6 +15,9 @@ const SidebarApiSection =