mirror of
https://ghfast.top/https://github.com/discourse/discourse-ai.git
synced 2026-05-25 00:54:32 +08:00
23 lines
576 B
JavaScript
23 lines
576 B
JavaScript
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
|
|
);
|
|
}
|
|
|
|
setPreference(value) {
|
|
this.preference = value;
|
|
localStorage.setItem("topicListLayout", value);
|
|
|
|
if (this.preference === "table-ai") {
|
|
localStorage.setItem("aiPreferred", true);
|
|
}
|
|
}
|
|
}
|