Files

42 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2024-12-20 18:56:02 +01:00
import Component from "@glimmer/component";
2025-01-10 14:26:35 -06:00
import { concat } from "@ember/helper";
2025-01-03 17:25:18 +01:00
import { get } from "@ember/object";
import { htmlSafe } from "@ember/template";
2025-01-13 13:12:12 +01:00
import icon from "discourse-common/helpers/d-icon";
import { i18n } from "discourse-i18n";
2024-12-20 18:56:02 +01:00
export default class BestPosts extends Component {
2025-01-10 14:26:35 -06:00
rank(idx) {
return idx + 1;
}
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">
<h2 class="rewind-report-title">{{i18n
"discourse_rewind.reports.best_posts.title"
[email protected]
}}</h2>
<div class="rewind-report-container">
{{#each @report.data as |post idx|}}
<div class={{concat "rewind-card" " rank-" (this.rank idx)}}>
<span class="best-posts -rank"></span>
<span class="best-posts -rank"></span>
<div class="best-posts__post">{{htmlSafe (get post "5")}}</div>
<div class="best-posts__metadata">
<span class="best-posts__likes">
{{icon "heart"}}{{htmlSafe (get post "2")}}</span>
<span class="best-posts__replies">
{{icon "comment"}}{{htmlSafe (get post "3")}}</span>
<a href="/t/{{get post '1'}}/{{get post '0'}}">{{i18n
"discourse_rewind.reports.best_posts.view_post"
}}</a>
</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>
}