Skip to content

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

UX: show tooltip for global nav section icon (#21974)

Krisd24693826512
diff --git a/app/assets/javascripts/discourse/app/components/d-tooltip.js b/app/assets/javascripts/discourse/app/components/d-tooltip.js
index ef42a9a090b..1e2e26ed559 100644
--- a/app/assets/javascripts/discourse/app/components/d-tooltip.js
+++ b/app/assets/javascripts/discourse/app/components/d-tooltip.js
@@ -6,6 +6,7 @@ import Ember from "ember";
export default class DiscourseTooltip extends Component {
tagName = "";
interactive = false;
+ placement = this.args?.placement || "bottom-start";
didInsertElement() {
this._super(...arguments);
@@ -36,7 +37,7 @@ export default class DiscourseTooltip extends Component {
trigger: this.capabilities.touch ? "click" : "mouseenter",
theme: "d-tooltip",
arrow: false,
- placement: "bottom-start",
+ placement: this.placement,
onTrigger: this.stopPropagation,
onUntrigger: this.stopPropagation,
});
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/common/custom-section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/common/custom-section.hbs
index b0e25bf2288..a54e645bc22 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/common/custom-section.hbs
+++ b/app/assets/javascripts/discourse/app/components/sidebar/common/custom-section.hbs
@@ -1,6 +1,7 @@
<Sidebar::Section
@sectionName={{this.section.slug}}
@headerLinkText={{this.section.decoratedTitle}}
+ @indicatePublic={{this.section.indicatePublic}}
@collapsable={{@collapsable}}
@headerActions={{this.section.headerActions}}
@headerActionsIcon={{this.section.headerActionIcon}}
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section-header.hbs b/app/assets/javascripts/discourse/app/components/sidebar/section-header.hbs
index 9a2dd84fa8b..07179ab69a9 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/section-header.hbs
+++ b/app/assets/javascripts/discourse/app/components/sidebar/section-header.hbs
@@ -9,7 +9,7 @@
{{yield}}
</DButton>
{{else}}
- <span class="sidebar-section-header" title={{i18n "sidebar.toggle_section"}}>
+ <span class="sidebar-section-header">
{{yield}}
</span>
{{/if}}
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/section.hbs
index 2f3baf8ebde..e8cc64fc055 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/section.hbs
+++ b/app/assets/javascripts/discourse/app/components/sidebar/section.hbs
@@ -19,6 +19,14 @@
<span class="sidebar-section-header-text">
{{@headerLinkText}}
</span>
+ {{#if @indicatePublic}}
+ <span class="sidebar-section-header-global-indicator">
+ {{d-icon "globe"}}
+ <DTooltip @placement="top">{{d-icon "shield-alt"}}
+ {{i18n "sidebar.sections.global_section"}}
+ </DTooltip>
+ </span>
+ {{/if}}
</Sidebar::SectionHeader>
{{#if this.isSingleHeaderAction}}
diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/section.js b/app/assets/javascripts/discourse/app/lib/sidebar/section.js
index 1f3b0c083a9..260b5ced77d 100644
--- a/app/assets/javascripts/discourse/app/lib/sidebar/section.js
+++ b/app/assets/javascripts/discourse/app/lib/sidebar/section.js
@@ -1,7 +1,5 @@
import I18n from "I18n";
import showModal from "discourse/lib/show-modal";
-import { iconHTML } from "discourse-common/lib/icon-library";
-import { htmlSafe } from "@ember/template";
import SectionLink from "discourse/lib/sidebar/section-link";
import { tracked } from "@glimmer/tracking";
import { setOwner } from "@ember/application";
@@ -28,9 +26,11 @@ export default class Section {
}
get decoratedTitle() {
- return this.section.public && this.currentUser?.staff
- ? htmlSafe(`${iconHTML("globe")} ${this.section.title}`)
- : this.section.title;
+ return this.section.title;
+ }
+
+ get indicatePublic() {
+ return this.section.public && this.currentUser?.staff;
}
get headerActions() {
diff --git a/app/assets/stylesheets/common/base/sidebar-custom-section.scss b/app/assets/stylesheets/common/base/sidebar-custom-section.scss
index e7df295a0f2..3c5e959aaa3 100644
--- a/app/assets/stylesheets/common/base/sidebar-custom-section.scss
+++ b/app/assets/stylesheets/common/base/sidebar-custom-section.scss
@@ -3,14 +3,7 @@
padding-bottom: 0;
}
.sidebar-section-header {
- position: relative;
- .d-icon-globe {
- position: absolute;
- left: -0.75em;
- align-self: stretch;
- width: 0.6em;
- height: 100%;
- }
+ display: flex;
}
.sidebar-section-link-prefix.icon {
diff --git a/app/assets/stylesheets/common/base/sidebar-section.scss b/app/assets/stylesheets/common/base/sidebar-section.scss
index e941a31aa29..98d8636852b 100644
--- a/app/assets/stylesheets/common/base/sidebar-section.scss
+++ b/app/assets/stylesheets/common/base/sidebar-section.scss
@@ -89,12 +89,19 @@
}
.sidebar-section-header-text {
- display: flex;
line-height: normal;
margin-right: 0.25em;
@include ellipsis;
}
+ .sidebar-section-header-global-indicator {
+ margin: 0 0.75em 0 0.25em;
+ font-size: var(--font-down-2);
+ .d-icon {
+ margin-top: -0.125em; // optical alignment
+ }
+ }
+
.sidebar-section-header-caret {
display: flex;
flex: 0 0 auto;
diff --git a/app/assets/stylesheets/desktop/menu-panel.scss b/app/assets/stylesheets/desktop/menu-panel.scss
index 007dd1a1497..31353191325 100644
--- a/app/assets/stylesheets/desktop/menu-panel.scss
+++ b/app/assets/stylesheets/desktop/menu-panel.scss
@@ -44,7 +44,6 @@
padding-bottom: 0.25em;
border-bottom: 1px solid var(--primary-low);
.d-icon-globe {
- font-size: var(--font-down-2);
color: var(--primary-medium);
}
}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 9761ad9c398..80718e71d33 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -4534,6 +4534,7 @@ en:
content: "Review"
title: "Flagged posts and other queued items"
pending_count: "%{count} pending"
+ global_section: "Global section, visible to everyone"
welcome_topic_banner:
title: "Create your Welcome Topic"