A platform for community discussion. Free, open, simple.
DEV: Remove topic-entrance from the glimmer topic list (#28942)
Jarek Radosz3eada7b572a4
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.gjsindex 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 = <template>@url={{@topic.lastUnreadUrl}}/>- <TopicEntrance @topic={{@topic}}>- <a- {{on "click" onTimestampClick}}- href={{@topic.lastPostUrl}}- class="last-posted-at"- >{{formatAge @topic.last_posted_at}}</a>- </TopicEntrance>+ <a+ {{on "click" onTimestampClick}}+ href={{@topic.lastPostUrl}}+ class="last-posted-at"+ >{{formatAge @topic.last_posted_at}}</a></div></template>;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.gjsindex 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 {<this.wrapperElementclass="num posts-map posts {{this.likesHeat}} topic-list-data">- <TopicEntrance- @topic={{@topic}}- @title={{this.title}}- @triggerClass="btn-link posts-map badge-posts {{this.likesHeat}}"- >+ <a href={{@topic.firstPostUrl}} class="badge-posts"><PluginOutlet@name="topic-list-before-reply-count"@outletArgs={{hash topic=@topic}}/>{{number @topic.replyCount noTitle="true"}}- </TopicEntrance>+ </a></this.wrapperElement></template>}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.gjsdeleted file mode 100644index 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);- }-- <template>- <DMenu- @title={{@title}}- @ariaLabel={{@title}}- @placement="center"- @autofocus={{true}}- @triggerClass={{@triggerClass}}- >- <:trigger>- {{yield}}- </:trigger>-- <:content>- <div id="topic-entrance" class="--glimmer">- <button- {{on "click" (fn this.jumpTo @topic.url)}}- aria-label={{i18n- "topic_entrance.sr_jump_top_button"- date=this.topDate- }}- title={{i18n "topic_entrance.jump_top_button_title"}}- class="btn btn-default full jump-top"- >- {{icon "backward-step"}}- {{htmlSafe this.topDate}}- </button>-- <button- {{on "click" (fn this.jumpTo @topic.lastPostUrl)}}- aria-label={{i18n- "topic_entrance.sr_jump_bottom_button"- date=this.bottomDate- }}- title={{i18n "topic_entrance.jump_bottom_button_title"}}- class="btn btn-default full jump-bottom"- >- {{htmlSafe this.bottomDate}}- {{icon "forward-step"}}- </button>- </div>- </:content>- </DMenu>- </template>-}diff --git a/app/assets/stylesheets/common/base/_topic-list.scss b/app/assets/stylesheets/common/base/_topic-list.scssindex 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;}}