discourse-ai/assets/javascripts/discourse/services/gists.js

24 lines
576 B
JavaScript
Raw Normal View History

2024-11-19 15:33:34 -05:00
import { tracked } from "@glimmer/tracking";
import Service, { service } from "@ember/service";
export default class Gists extends Service {
@service router;
@tracked preference = localStorage.getItem("topicListLayout");
get shouldShow() {
return this.router.currentRoute.attributes?.list?.topics?.some(
(topic) => topic.ai_topic_gist
);
2024-11-19 15:33:34 -05:00
}
setPreference(value) {
this.preference = value;
localStorage.setItem("topicListLayout", value);
if (this.preference === "table-ai") {
localStorage.setItem("aiPreferred", true);
}
}
}