mirror of
https://ghfast.top/https://github.com/discourse/discourse-ai.git
synced 2026-07-16 11:36:23 +08:00
The sentiment analysis report page initially showcases sentiments via category/tag by doughnut visualizations. However, this isn't an optimal view for quickly scanning and comparing each result. This PR updates the overview to include a table visualization with horizontal bars to represent sentiment analysis instead of doughnuts. Doughnut visualizations are still maintained however when accessing the sentiment data in the drill down for individual entries. This approach is an intermediary step, as we will eventually add whole clustering and sizing visualization instead of a table. As such, no relevant tests are added in this PR.
30 lines
812 B
Text
30 lines
812 B
Text
import { concat } from "@ember/helper";
|
|
import { htmlSafe } from "@ember/template";
|
|
import { gt } from "truth-helpers";
|
|
import { i18n } from "discourse-i18n";
|
|
import DTooltip from "float-kit/components/d-tooltip";
|
|
|
|
const AiSentimentHorizontalBar = <template>
|
|
{{#if (gt @score 0)}}
|
|
<DTooltip
|
|
class={{concat "sentiment-horizontal-bar__" @type}}
|
|
style={{htmlSafe (concat "width: " @width "%")}}
|
|
>
|
|
<:trigger>
|
|
<span class="sentiment-horizontal-bar__count">
|
|
{{@score}}
|
|
</span>
|
|
</:trigger>
|
|
<:content>
|
|
{{i18n
|
|
(concat
|
|
"discourse_ai.sentiments.sentiment_analysis.filter_types." @type
|
|
)
|
|
}}:
|
|
{{@score}}
|
|
</:content>
|
|
</DTooltip>
|
|
{{/if}}
|
|
</template>;
|
|
|
|
export default AiSentimentHorizontalBar;
|