That is a very helpful component! Should be from user experience point of view built into Discourse, but that is my opinion.
Anyways, I’m stuck in trying to make the same logic work for Categories. I wanted to do it with api.modifyClass but seem to miss the crucial part. Can you please help me?
I have this setting for my desktop page:
Basically the red box on the left should be clickable:
If you want to experiment and fork this component, you are welcome to do so
As a starting point to get a category to be clickable, I would suggest looking through the code in this component that does so by modifying the topic-list-item component inside Discourse core.
You could try creating a new file within this same folder which targets one of the many types of category layouts included in our components, making sure to target the same category page style you have selected on your forum.
Some of these are listed in their locations below…
function navigateToTopic(topic, href) {
if (this.siteSettings.page_loading_indicator !== "slider") {
// With the slider, it feels nicer for the header to update once the rest of the topic content loads,
// so skip setting it early.
this.appEvents.trigger("header:update-topic", topic);
}
this.session.set("lastTopicIdViewed", {
topicId: topic.id,
historyUuid: this.router.location.getState?.().uuid
});
_url.default.routeTo(href || topic.get("url"));
return false;
}