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…
We relied on this component to make Categories + Latest view (default in our case) topic cards clickable. Since today’s update to the latest 3.1.0beta8 (now it shows as 3.2.0.beta1-dev), the component stopped working correctly.
Now the active state of the cursor remains as clickable, but topic area is not clickable. With browser’s console opened there’s an error, which may help developers to identify the problem:
Uncaught TypeError: this.router is undefined
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;
}
Hi @kinetiksoft - I haven’t been able to reproduce the problem on my end. The theme component seems to work well against the latest version of Discourse. Using the ‘preview on theme creator’ link in the OP here seems to work as well.
Could you share a link to a site with the problem? Perhaps there is clash with another theme/plugin.
Thanks @kinetiksoft! Looks like the problem happens when the theme component is used alongside the ‘categories + latest’ view (which you have configured as your homepage).
업데이트: 최근에는 사이트 설정에 아무런 변경 사항이 없었음에도 불구하고 이 문제가 다시 발생하지 않았습니다. 제가 이 문제를 확인했을 당시에는 페이지가 완전히 렌더링되기 전에 너무 빠르게 클릭한 것 같습니다. 이제 보고를 했으니, 의미 있는 정도로 재현할 수 있게 된다면 더 자세한 정보를 가지고 다시 찾아오겠습니다.