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() {
|
2024-12-12 10:29:35 -05:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|