import Component from "@glimmer/component"; import { on } from "@ember/modifier"; import { action } from "@ember/object"; import { service } from "@ember/service"; import { and } from "truth-helpers"; import icon from "discourse/helpers/d-icon"; import { i18n } from "discourse-i18n"; export default class TopicStatusColumn extends Component { @service currentUser; @service siteSettings; get canAct() { return this.currentUser && !this.args.disableActions; } get statusClass() { let classes = ["topic-status-card"]; if (this.args.topic.bookmarked) { classes.push("--bookmark"); } else if (this.args.topic.closed && this.args.topic.archived) { classes.push("--locked --archived"); } else if (this.args.topic.closed) { classes.push("--locked"); } else if (this.args.topic.archived) { classes.push("--archived"); } else if (this.args.topic.is_warning) { classes.push("--warning"); } else if ( this.args.showPrivateMessageIcon && this.args.topic.isPrivateMessage ) { classes.push("--private-message"); } else if (this.args.topic.pinned) { classes.push("--pinned"); } else if (this.args.topic.unpinned) { classes.push("--unpinned"); } return classes.join(" "); } get heatMap() { return this.args.topic.views > this.siteSettings.topic_views_heat_medium; } @action togglePinned(event) { event.preventDefault(); this.args.topic.togglePinnedForUser(); } }