simple word cloud

This commit is contained in:
Joffrey JAFFEUX 2025-01-03 17:11:20 +01:00
parent 5b916dcf1c
commit e9e6d80eac
3 changed files with 13 additions and 11 deletions

View File

@ -27,7 +27,7 @@ module DiscourseRewind
ndoc DESC, ndoc DESC,
word word
LIMIT LIMIT
100 5
), lex AS ( ), lex AS (
SELECT SELECT
DISTINCT ON (lexeme) to_tsvector('english', word) as lexeme, DISTINCT ON (lexeme) to_tsvector('english', word) as lexeme,

View File

@ -2,8 +2,16 @@ import Component from "@glimmer/component";
export default class WordCloud extends Component { export default class WordCloud extends Component {
<template> <template>
<div class="rewind-report-page"> <div class="rewind-report-page -word-cloud">
Word cloud <h3 class="rewind-report-title">Most used words</h3>
<div class="rewind-report-container">
{{#each-in @report.data as |word count|}}
<div class="rewind-card">
<span>{{word}}</span>
<span>{{count}} times</span>
</div>
{{/each-in}}
</div>
</div> </div>
</template> </template>
} }

View File

@ -113,16 +113,10 @@ export default class Rewind extends Component {
<div class={{concatClass "rewind-report" report.identifier}}> <div class={{concatClass "rewind-report" report.identifier}}>
{{#if (eq report.identifier "reactions")}} {{#if (eq report.identifier "reactions")}}
<Reactions @report={{report}} /> <Reactions @report={{report}} />
<Reactions @report={{report}} /> {{else if (eq report.identifier "word-cloud")}}
<Reactions @report={{report}} /> <WordCloud @report={{report}} />
<Reactions @report={{report}} />
{{else if (eq report.identifier "activity-calendar")}} {{else if (eq report.identifier "activity-calendar")}}
<ActivityCalendar @report={{report}} /> <ActivityCalendar @report={{report}} />
<ActivityCalendar @report={{report}} />
<ActivityCalendar @report={{report}} />
<ActivityCalendar @report={{report}} />
{{/if}} {{/if}}
{{!-- {{else if (eq report.identifier "fbff")}} {{!-- {{else if (eq report.identifier "fbff")}}
<FBFF @report={{report}} /> <FBFF @report={{report}} />