diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header.gjs
new file mode 100644
index 00000000000..9f9edbac507
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header.gjs
@@ -0,0 +1,26 @@
+const Header =
+
+ {{#each @columns as |entry|}}
+
+ {{/each}}
+
+;
+
+export default Header;
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/activity-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/activity-cell.gjs
new file mode 100644
index 00000000000..a20e98f6ac8
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/activity-cell.gjs
@@ -0,0 +1,15 @@
+import SortableColumn from "./sortable-column";
+
+const ActivityCell =
+
+;
+
+export default ActivityCell;
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/bulk-select-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/bulk-select-cell.gjs
new file mode 100644
index 00000000000..cdb07a28462
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/bulk-select-cell.gjs
@@ -0,0 +1,19 @@
+import { on } from "@ember/modifier";
+import icon from "discourse-common/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+
+const BulkSelectCell =
+
+ {{#if @canBulkSelect}}
+
+ {{/if}}
+ |
+;
+
+export default BulkSelectCell;
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/likes-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/likes-cell.gjs
new file mode 100644
index 00000000000..be2cb9db447
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/likes-cell.gjs
@@ -0,0 +1,15 @@
+import SortableColumn from "./sortable-column";
+
+const LikesCell =
+
+;
+
+export default LikesCell;
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/op-likes-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/op-likes-cell.gjs
new file mode 100644
index 00000000000..2bc28487695
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/op-likes-cell.gjs
@@ -0,0 +1,15 @@
+import SortableColumn from "./sortable-column";
+
+const OpLikesCell =
+
+;
+
+export default OpLikesCell;
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/posters-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/posters-cell.gjs
new file mode 100644
index 00000000000..c5b97c9617c
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/posters-cell.gjs
@@ -0,0 +1,16 @@
+import { i18n } from "discourse-i18n";
+import SortableColumn from "./sortable-column";
+
+const PostersCell =
+
+;
+
+export default PostersCell;
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/replies-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/replies-cell.gjs
new file mode 100644
index 00000000000..86d0d3444bf
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/replies-cell.gjs
@@ -0,0 +1,15 @@
+import SortableColumn from "./sortable-column";
+
+const RepliesCell =
+
+;
+
+export default RepliesCell;
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/topic-list-header-column.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/sortable-column.gjs
similarity index 97%
rename from app/assets/javascripts/discourse/app/components/topic-list/topic-list-header-column.gjs
rename to app/assets/javascripts/discourse/app/components/topic-list/header/sortable-column.gjs
index 0eee21115ef..093886a5800 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/topic-list-header-column.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/sortable-column.gjs
@@ -10,7 +10,7 @@ import concatClass from "discourse/helpers/concat-class";
import icon from "discourse-common/helpers/d-icon";
import { i18n } from "discourse-i18n";
-export default class TopicListHeaderColumn extends Component {
+export default class SortableColumn extends Component {
@service router;
get localizedName() {
@@ -49,7 +49,8 @@ export default class TopicListHeaderColumn extends Component {
}
@action
- onClick() {
+ onClick(event) {
+ event.preventDefault();
this.args.changeSort(this.args.order);
}
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/topic-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/topic-cell.gjs
new file mode 100644
index 00000000000..ef804db872e
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/topic-cell.gjs
@@ -0,0 +1,24 @@
+import SortableColumn from "./sortable-column";
+
+const TopicCell =
+
+;
+
+export default TopicCell;
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/views-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/views-cell.gjs
new file mode 100644
index 00000000000..32797a9cf5a
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/views-cell.gjs
@@ -0,0 +1,15 @@
+import SortableColumn from "./sortable-column";
+
+const ViewsCell =
+
+;
+
+export default ViewsCell;
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/topic-list-item.gjs b/app/assets/javascripts/discourse/app/components/topic-list/item.gjs
similarity index 77%
rename from app/assets/javascripts/discourse/app/components/topic-list/topic-list-item.gjs
rename to app/assets/javascripts/discourse/app/components/topic-list/item.gjs
index 9ed104e5f9b..9efb65984c7 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/topic-list-item.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-list/item.gjs
@@ -6,13 +6,9 @@ import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { next } from "@ember/runloop";
import { service } from "@ember/service";
import { modifier } from "ember-modifier";
-import { eq, gt } from "truth-helpers";
+import { eq } from "truth-helpers";
import PluginOutlet from "discourse/components/plugin-outlet";
-import ActivityColumn from "discourse/components/topic-list/activity-column";
import PostCountOrBadges from "discourse/components/topic-list/post-count-or-badges";
-import PostersColumn from "discourse/components/topic-list/posters-column";
-import PostsCountColumn from "discourse/components/topic-list/posts-count-column";
-import TopicCell from "discourse/components/topic-list/topic-cell";
import TopicExcerpt from "discourse/components/topic-list/topic-excerpt";
import TopicLink from "discourse/components/topic-list/topic-link";
import TopicStatus from "discourse/components/topic-status";
@@ -22,14 +18,12 @@ import categoryLink from "discourse/helpers/category-link";
import concatClass from "discourse/helpers/concat-class";
import discourseTags from "discourse/helpers/discourse-tags";
import formatDate from "discourse/helpers/format-date";
-import number from "discourse/helpers/number";
import topicFeaturedLink from "discourse/helpers/topic-featured-link";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import DiscourseURL from "discourse/lib/url";
-import icon from "discourse-common/helpers/d-icon";
import { i18n } from "discourse-i18n";
-export default class TopicListItem extends Component {
+export default class Item extends Component {
@service historyStore;
@service site;
@service siteSettings;
@@ -119,13 +113,11 @@ export default class TopicListItem extends Component {
if (e.target.checked) {
this.args.selected.addObject(this.args.topic);
- if (this.args.lastCheckedElementId && e.shiftKey) {
- const bulkSelects = Array.from(
- document.querySelectorAll("input.bulk-select")
- );
+ if (this.args.bulkSelectHelper.lastCheckedElementId && e.shiftKey) {
+ const bulkSelects = [...document.querySelectorAll("input.bulk-select")];
const from = bulkSelects.indexOf(e.target);
const to = bulkSelects.findIndex(
- (el) => el.id === this.args.lastCheckedElementId
+ (el) => el.id === this.args.bulkSelectHelper.lastCheckedElementId
);
const start = Math.min(from, to);
const end = Math.max(from, to);
@@ -136,10 +128,10 @@ export default class TopicListItem extends Component {
.forEach((checkbox) => checkbox.click());
}
- this.args.updateLastCheckedElementId(e.target.id);
+ this.args.bulkSelectHelper.lastCheckedElementId = e.target.id;
} else {
this.args.selected.removeObject(this.args.topic);
- this.args.updateLastCheckedElementId(null);
+ this.args.bulkSelectHelper.lastCheckedElementId = null;
}
}
@@ -223,78 +215,20 @@ export default class TopicListItem extends Component {
@outletArgs={{hash topic=@topic}}
/>
{{#if this.site.desktopView}}
- {{! TODO: column DAG "topic-list-before-columns" }}
-
- {{#if @bulkSelectEnabled}}
-
-
- |
- {{/if}}
-
-
-
-
-
- {{#if @showPosters}}
-
- {{/if}}
-
-
-
- {{#if @showLikes}}
-
- {{#if (gt @topic.like_count 0)}}
-
- {{number @topic.like_count}}
- {{icon "heart"}}
-
- {{/if}}
- |
- {{/if}}
-
- {{#if @showOpLikes}}
-
- {{#if (gt @topic.op_like_count 0)}}
-
- {{number @topic.op_like_count}}
- {{icon "heart"}}
-
- {{/if}}
- |
- {{/if}}
-
-
-
- {{number @topic.views numberKey="views_long"}}
- |
-
-
-
- {{! TODO: column DAG "topic-list-after-columns" }}
+ {{/each}}
{{else}}
- {{! TODO: column DAG "topic-list-before-columns" }}
-
{{#if @bulkSelectEnabled}}
|