Files
discourse_theme_ran/javascripts/discourse/components/card/topic-status-column.gjs
T
Jordan Vidrine bee6e4e3c5 init (#69)
2025-03-20 09:43:40 -05:00

41 lines
896 B
Plaintext

import Component from "@glimmer/component";
import { service } from "@ember/service";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
export default class TopicStatusColumn extends Component {
@service siteSettings;
get heatMap() {
return this.args.topic.views > this.siteSettings.topic_views_heat_medium;
}
get badge() {
if (this.heatMap) {
return {
icon: "fire",
text: "topic_hot",
className: "--hot",
};
}
if (this.args.topic.pinned) {
return {
icon: "thumbtack",
text: "topic_pinned",
className: "--pinned",
};
}
return null;
}
<template>
{{#if this.badge}}
<span class="topic-status-card {{this.badge.className}}">{{icon
this.badge.icon
}}{{i18n (themePrefix this.badge.text)}}</span>
{{/if}}
</template>
}