diff --git a/app/assets/javascripts/discourse/app/components/topic-list/featured-topic.gjs b/app/assets/javascripts/discourse/app/components/topic-list/featured-topic.gjs index 0f80da98f6b..d11fce1be2d 100644 --- a/app/assets/javascripts/discourse/app/components/topic-list/featured-topic.gjs +++ b/app/assets/javascripts/discourse/app/components/topic-list/featured-topic.gjs @@ -1,6 +1,5 @@ import { on } from "@ember/modifier"; import { htmlSafe } from "@ember/template"; -import TopicEntrance from "discourse/components/topic-list/topic-entrance"; import TopicPostBadges from "discourse/components/topic-post-badges"; import TopicStatus from "discourse/components/topic-status"; import formatAge from "discourse/helpers/format-age"; @@ -30,13 +29,11 @@ const FeaturedTopic = ; diff --git a/app/assets/javascripts/discourse/app/components/topic-list/posts-count-column.gjs b/app/assets/javascripts/discourse/app/components/topic-list/posts-count-column.gjs index 699a072416d..a822090efec 100644 --- a/app/assets/javascripts/discourse/app/components/topic-list/posts-count-column.gjs +++ b/app/assets/javascripts/discourse/app/components/topic-list/posts-count-column.gjs @@ -2,7 +2,6 @@ import Component from "@glimmer/component"; import { hash } from "@ember/helper"; import { service } from "@ember/service"; import PluginOutlet from "discourse/components/plugin-outlet"; -import TopicEntrance from "discourse/components/topic-list/topic-entrance"; import element from "discourse/helpers/element"; import number from "discourse/helpers/number"; import I18n from "discourse-i18n"; @@ -55,17 +54,13 @@ export default class PostsCountColumn extends Component { - + {{number @topic.replyCount noTitle="true"}} - + } diff --git a/app/assets/javascripts/discourse/app/components/topic-list/topic-entrance.gjs b/app/assets/javascripts/discourse/app/components/topic-list/topic-entrance.gjs deleted file mode 100644 index 329dc4153e4..00000000000 --- a/app/assets/javascripts/discourse/app/components/topic-list/topic-entrance.gjs +++ /dev/null @@ -1,111 +0,0 @@ -import Component from "@glimmer/component"; -import { fn } from "@ember/helper"; -import { on } from "@ember/modifier"; -import { action } from "@ember/object"; -import { service } from "@ember/service"; -import { htmlSafe } from "@ember/template"; -import DiscourseURL from "discourse/lib/url"; -import icon from "discourse-common/helpers/d-icon"; -import i18n from "discourse-common/helpers/i18n"; -import I18n from "discourse-i18n"; -import DMenu from "float-kit/components/d-menu"; - -function entranceDate(dt, showTime) { - const today = new Date(); - - if (dt.toDateString() === today.toDateString()) { - return moment(dt).format(I18n.t("dates.time")); - } - - if (dt.getYear() === today.getYear()) { - // No year - return moment(dt).format( - showTime - ? I18n.t("dates.long_date_without_year_with_linebreak") - : I18n.t("dates.long_no_year_no_time") - ); - } - - return moment(dt).format( - showTime - ? I18n.t("dates.long_date_with_year_with_linebreak") - : I18n.t("dates.long_date_with_year_without_time") - ); -} - -export default class TopicEntrance extends Component { - @service historyStore; - - get createdDate() { - return new Date(this.args.topic.created_at); - } - - get bumpedDate() { - return new Date(this.args.topic.bumped_at); - } - - get showTime() { - return ( - this.bumpedDate.getTime() - this.createdDate.getTime() < - 1000 * 60 * 60 * 24 * 2 - ); - } - - get topDate() { - return entranceDate(this.createdDate, this.showTime); - } - - get bottomDate() { - return entranceDate(this.bumpedDate, this.showTime); - } - - @action - jumpTo(destination) { - this.historyStore.set("lastTopicIdViewed", this.args.topic.id); - DiscourseURL.routeTo(destination); - } - - -} diff --git a/app/assets/stylesheets/common/base/_topic-list.scss b/app/assets/stylesheets/common/base/_topic-list.scss index 39c4ce2483b..a3a35b6861f 100644 --- a/app/assets/stylesheets/common/base/_topic-list.scss +++ b/app/assets/stylesheets/common/base/_topic-list.scss @@ -329,6 +329,7 @@ .badge-posts { font-weight: 700; color: inherit; + display: inline-block; padding: 15px 5px; } }