Skip to content

Commit

Permalink
UX: add links to sentiment to admin sidebar (#1158)
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomerobot authored Feb 28, 2025
1 parent eccfbad commit 5368b0c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="sentiment section">
<div class="period-section">
<div class="section-title">
<h2>
<h2 id="sentiment-heading">
{{i18n "discourse_ai.sentiments.dashboard.title"}}
</h2>

Expand Down
21 changes: 21 additions & 0 deletions assets/javascripts/initializers/ai-sentiment-admin-nav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { apiInitializer } from "discourse/lib/api";

export default apiInitializer("1.15.0", (api) => {
const settings = api.container.lookup("service:site-settings");

if (settings.ai_sentiment_enabled) {
api.addAdminSidebarSectionLink("reports", {
name: "sentiment_overview",
href: "/admin/dashboard/sentiment#sentiment-heading",
label: "discourse_ai.sentiments.sidebar.overview",
icon: "chart-column",
});
api.addAdminSidebarSectionLink("reports", {
name: "sentiment_analysis",
route: "adminReports.show",
routeModels: ["sentiment_analysis"],
label: "discourse_ai.sentiments.sidebar.analysis",
icon: "chart-pie",
});
}
});
3 changes: 3 additions & 0 deletions config/locales/client.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,9 @@ en:
sentiments:
dashboard:
title: "Sentiment"
sidebar:
overview: "Sentiment overview"
analysis: "Sentiment analysis"
sentiment_analysis:
filter_types:
all: "All"
Expand Down
1 change: 1 addition & 0 deletions plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def self.public_asset_path(name)
end

plugin_icons = %w[
chart-column
spell-check
language
images
Expand Down

0 comments on commit 5368b0c

Please sign in to comment.