mirror of
https://github.com/discourse/discourse-rewind.git
synced 2025-07-07 06:12:22 +00:00
Merge branch 'main' of https://github.com/jjaffeux/discourse-rewind into main
This commit is contained in:
commit
d0f813207b
@ -10,7 +10,7 @@ module DiscourseRewind
|
||||
.where(deleted_at: nil)
|
||||
.where("post_number > 1")
|
||||
.order("like_count DESC NULLS LAST")
|
||||
.limit(5)
|
||||
.limit(3)
|
||||
.pluck(:id, :topic_id, :like_count, :reply_count, :raw, :cooked)
|
||||
|
||||
{ data: best_posts, identifier: "best-posts" }
|
||||
|
@ -9,7 +9,7 @@ module DiscourseRewind
|
||||
.references(:topic)
|
||||
.where(topic: { deleted_at: nil, created_at: date, user_id: user.id })
|
||||
.order("yearly_score DESC NULLS LAST")
|
||||
.limit(5)
|
||||
.limit(3)
|
||||
.pluck(:topic_id, :title, :excerpt, :yearly_score)
|
||||
.map do |topic_id, title, excerpt, yearly_score|
|
||||
{ topic_id: topic_id, title: title, excerpt: excerpt, yearly_score: yearly_score }
|
||||
|
@ -27,7 +27,7 @@ module DiscourseRewind
|
||||
ndoc DESC,
|
||||
word
|
||||
LIMIT
|
||||
100
|
||||
5
|
||||
), lex AS (
|
||||
SELECT
|
||||
DISTINCT ON (lexeme) to_tsvector('english', word) as lexeme,
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { action } from "@ember/object";
|
||||
import { and, eq } from "truth-helpers";
|
||||
import concatClass from "discourse/helpers/concat-class";
|
||||
|
||||
const ROWS = 7;
|
||||
@ -8,8 +7,6 @@ const COLS = 53;
|
||||
|
||||
export default class ActivityCalendar extends Component {
|
||||
get rowsArray() {
|
||||
console.log(this.args.report.data);
|
||||
|
||||
const data = this.args.report.data;
|
||||
let rowsArray = [];
|
||||
|
||||
|
@ -1,9 +1,22 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { get } from "@ember/object";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
|
||||
export default class BestPosts extends Component {
|
||||
<template>
|
||||
<div class="rewind-report-page">
|
||||
Best posts
|
||||
<div class="rewind-report-page -best-posts">
|
||||
<h3 class="rewind-report-title">Your 3 best posts</h3>
|
||||
<div class="rewind-report-container">
|
||||
{{#each @report.data as |post|}}
|
||||
<div class="rewind-card">
|
||||
<div class="best-posts__post">{{htmlSafe (get post "5")}}</div>
|
||||
<span class="best-posts__likes">Likes:
|
||||
{{htmlSafe (get post "2")}}</span>
|
||||
<span class="best-posts__replies">Replies:
|
||||
{{htmlSafe (get post "3")}}</span>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
}
|
||||
|
@ -1,9 +1,23 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { concat } from "@ember/helper";
|
||||
|
||||
export default class BestTopics extends Component {
|
||||
<template>
|
||||
<div class="rewind-report-page">
|
||||
BestTopics
|
||||
<div class="rewind-report-page -best-topics">
|
||||
<h3 class="rewind-report-title">Your 3 best topics</h3>
|
||||
<div class="rewind-report-container">
|
||||
{{log @report.data}}
|
||||
{{#each @report.data as |topic|}}
|
||||
<div class="rewind-card">
|
||||
<a
|
||||
href={{concat "/t/-/" topic.topic_id}}
|
||||
class="best-topics__title"
|
||||
>
|
||||
{{topic.title}}
|
||||
</a>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
}
|
||||
|
@ -2,8 +2,16 @@ import Component from "@glimmer/component";
|
||||
|
||||
export default class WordCloud extends Component {
|
||||
<template>
|
||||
<div class="rewind-report-page">
|
||||
Word cloud
|
||||
<div class="rewind-report-page -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>
|
||||
</template>
|
||||
}
|
||||
|
@ -113,16 +113,14 @@ export default class Rewind extends Component {
|
||||
<div class={{concatClass "rewind-report" report.identifier}}>
|
||||
{{#if (eq report.identifier "reactions")}}
|
||||
<Reactions @report={{report}} />
|
||||
<Reactions @report={{report}} />
|
||||
<Reactions @report={{report}} />
|
||||
<Reactions @report={{report}} />
|
||||
|
||||
{{else if (eq report.identifier "word-cloud")}}
|
||||
<WordCloud @report={{report}} />
|
||||
{{else if (eq report.identifier "best-posts")}}
|
||||
<BestPosts @report={{report}} />
|
||||
{{else if (eq report.identifier "best-topics")}}
|
||||
<BestTopics @report={{report}} />
|
||||
{{else if (eq report.identifier "activity-calendar")}}
|
||||
<ActivityCalendar @report={{report}} />
|
||||
<ActivityCalendar @report={{report}} />
|
||||
<ActivityCalendar @report={{report}} />
|
||||
<ActivityCalendar @report={{report}} />
|
||||
|
||||
{{/if}}
|
||||
{{!-- {{else if (eq report.identifier "fbff")}}
|
||||
<FBFF @report={{report}} />
|
||||
|
6
assets/stylesheets/common/best-posts.scss
Normal file
6
assets/stylesheets/common/best-posts.scss
Normal file
@ -0,0 +1,6 @@
|
||||
.-best-posts {
|
||||
.rewind-report-container {
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
}
|
6
assets/stylesheets/common/best-topics.scss
Normal file
6
assets/stylesheets/common/best-topics.scss
Normal file
@ -0,0 +1,6 @@
|
||||
.-best-topics {
|
||||
.rewind-report-container {
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
}
|
@ -4,4 +4,6 @@
|
||||
@import "post-received-reactions";
|
||||
@import "post-used-reactions";
|
||||
@import "activity-calendar";
|
||||
@import "best-posts";
|
||||
@import "best-topics";
|
||||
@import "blobs";
|
||||
|
Loading…
x
Reference in New Issue
Block a user