Skip to content

A platform for community discussion. Free, open, simple.

UX: in sidebar dropdown mode expose 'more' items (#21372)

Kris36c3a2422b9e
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.hbs
index 0419787e963..a67e9322731 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.hbs
+++ b/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.hbs
@@ -33,8 +33,17 @@
/>
{{/each}}
- <Sidebar::MoreSectionLinks
- @sectionLinks={{this.moreSectionLinks}}
- @secondarySectionLinks={{this.moreSecondarySectionLinks}}
- />
+ {{#if this.isDesktopDropdownMode}}
+ {{#each this.moreSectionLinks as |sectionLink|}}
+ <Sidebar::MoreSectionLink @sectionLink={{sectionLink}} />
+ {{/each}}
+ {{#each this.moreSecondarySectionLinks as |sectionLink|}}
+ <Sidebar::MoreSectionLink @sectionLink={{sectionLink}} />
+ {{/each}}
+ {{else}}
+ <Sidebar::MoreSectionLinks
+ @sectionLinks={{this.moreSectionLinks}}
+ @secondarySectionLinks={{this.moreSecondarySectionLinks}}
+ />
+ {{/if}}
</Sidebar::Section>
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.js b/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.js
index 3def2b04809..968b991b358 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.js
+++ b/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.js
@@ -12,6 +12,7 @@ export default class SidebarCommunitySection extends Component {
@service topicTrackingState;
@service currentUser;
@service appEvents;
+ @service site;
@service siteSettings;
@tracked sectionLinks;
@@ -77,6 +78,13 @@ export default class SidebarCommunitySection extends Component {
return [];
}
+ get isDesktopDropdownMode() {
+ const headerDropdownMode =
+ this.siteSettings.navigation_menu === "header dropdown";
+
+ return !this.site.mobileView && headerDropdownMode;
+ }
+
#initializeSectionLinks(sectionLinkClasses, { inMoreDrawer } = {}) {
return sectionLinkClasses.map((sectionLinkClass) => {
return this.#initializeSectionLink(sectionLinkClass, inMoreDrawer);
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
index 0367c0a47a6..1e57f780c42 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
@@ -51,6 +51,21 @@ acceptance(
"hides the sidebar dropdown"
);
});
+
+ test("'more' dropdown should display as regular list items in header dropdown mode", async function (assert) {
+ await visit("/");
+ await click(".hamburger-dropdown");
+
+ assert.ok(
+ exists("[data-link-name='admin']"),
+ "the admin link is not within the 'more' dropdown"
+ );
+
+ assert.notOk(
+ exists(".sidebar-more-section-links-details-summary"),
+ "the 'more' dropdown should not be present in header dropdown mode"
+ );
+ });
}
);