mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Convert topic-post-badges to glimmer/gjs (#26760)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { service } from "@ember/service";
|
||||
import i18n from "discourse-common/helpers/i18n";
|
||||
|
||||
export default class TopicPostBadges extends Component {
|
||||
@service currentUser;
|
||||
|
||||
get displayUnreadPosts() {
|
||||
return this.args.newPosts || this.args.unreadPosts;
|
||||
}
|
||||
|
||||
get newDotText() {
|
||||
return this.currentUser?.trust_level > 0
|
||||
? " "
|
||||
: i18n("filters.new.lower_title");
|
||||
}
|
||||
|
||||
<template>
|
||||
<span class="topic-post-badges">
|
||||
{{~#if this.displayUnreadPosts~}}
|
||||
<a
|
||||
href={{@url}}
|
||||
title={{i18n "topic.unread_posts" count=this.displayUnreadPosts}}
|
||||
class="badge badge-notification unread-posts"
|
||||
>{{this.displayUnreadPosts}}</a>
|
||||
{{/if~}}
|
||||
|
||||
{{~#if @unseen~}}
|
||||
<a
|
||||
href={{@url}}
|
||||
title={{i18n "topic.new"}}
|
||||
class="badge badge-notification new-topic"
|
||||
>{{this.newDotText}}</a>
|
||||
{{/if~}}
|
||||
</span>
|
||||
</template>
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{{~#if this.displayUnreadPosts}} <a
|
||||
href={{this.url}}
|
||||
title={{i18n "topic.unread_posts" count=this.displayUnreadPosts}}
|
||||
class="badge badge-notification unread-posts"
|
||||
>{{this.displayUnreadPosts}}</a>
|
||||
{{/if~}}
|
||||
{{~#if this.unseen}} <a
|
||||
href={{this.url}}
|
||||
title={{i18n "topic.new"}}
|
||||
class="badge badge-notification new-topic"
|
||||
>{{this.newDotText}}</a>
|
||||
{{/if~}}
|
||||
@@ -1,22 +0,0 @@
|
||||
import Component from "@ember/component";
|
||||
import { or } from "@ember/object/computed";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "span",
|
||||
classNameBindings: [":topic-post-badges"],
|
||||
newDotText: null,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.set(
|
||||
"newDotText",
|
||||
this.currentUser && this.currentUser.trust_level > 0
|
||||
? " "
|
||||
: I18n.t("filters.new.lower_title")
|
||||
);
|
||||
},
|
||||
|
||||
displayUnreadPosts: or("newPosts", "unreadPosts"),
|
||||
});
|
||||
Reference in New Issue
Block a user