Files

47 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2024-12-20 18:56:02 +01:00
import Component from "@glimmer/component";
2025-01-03 17:25:18 +01:00
import { htmlSafe } from "@ember/template";
2025-12-01 10:08:30 +10:00
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
2025-01-13 13:12:12 +01:00
import { i18n } from "discourse-i18n";
2024-12-20 18:56:02 +01:00
export default class BestPosts extends Component {
2025-12-01 10:08:30 +10:00
rankClass(idx) {
return `rank-${idx + 1}`;
2025-01-10 14:26:35 -06:00
}
2024-12-20 18:56:02 +01:00
<template>
2025-01-13 13:12:12 +01:00
{{#if @report.data.length}}
<div class="rewind-report-page --best-posts">
2025-12-01 10:08:30 +10:00
<h2 class="rewind-report-title">
{{i18n
2025-01-13 13:12:12 +01:00
"discourse_rewind.reports.best_posts.title"
[email protected]
2025-12-01 10:08:30 +10:00
}}
</h2>
2025-01-13 13:12:12 +01:00
<div class="rewind-report-container">
{{#each @report.data as |post idx|}}
2025-12-01 10:08:30 +10:00
<div class={{concatClass "rewind-card" (this.rankClass idx)}}>
<span class="best-posts --rank"></span>
<span class="best-posts --rank"></span>
<div class="best-posts__post">
<p>{{htmlSafe post.excerpt}}</p>
</div>
2025-01-13 13:12:12 +01:00
<div class="best-posts__metadata">
<span class="best-posts__likes">
{{icon "heart"}}{{post.like_count}}
</span>
2025-01-13 13:12:12 +01:00
<span class="best-posts__replies">
{{icon "comment"}}{{post.reply_count}}
</span>
<a href="/t/{{post.topic_id}}/{{post.post_number}}">
{{i18n "discourse_rewind.reports.best_posts.view_post"}}
</a>
2025-01-13 13:12:12 +01:00
</div>
2025-01-06 11:53:18 -06:00
</div>
2025-01-13 13:12:12 +01:00
{{/each}}
</div>
2025-01-03 17:25:18 +01:00
</div>
2025-01-13 13:12:12 +01:00
{{/if}}
2024-12-20 18:56:02 +01:00
</template>
}