2024-07-22 11:56:35 -05:00
|
|
|
import { UserConfig } from "../imports/api/userConfig";
|
2022-08-15 18:07:39 -05:00
|
|
|
|
|
|
|
|
Template.MainLayout.onCreated(function() {
|
2024-07-22 11:56:35 -05:00
|
|
|
this.subscribe("UserConfigPrefs");
|
2022-08-15 18:07:39 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.MainLayout.onRendered(function() {
|
2024-07-22 11:56:35 -05:00
|
|
|
this.autorun(() => {
|
|
|
|
|
let myId = Meteor.userId();
|
|
|
|
|
let myprefs = UserConfig.findOne({ user: myId });
|
|
|
|
|
if (typeof myprefs != 'undefined') {
|
2024-07-25 10:25:56 -05:00
|
|
|
if (myprefs.darkMode == "light") {
|
2024-07-22 11:56:35 -05:00
|
|
|
console.log("Found theme as light");
|
|
|
|
|
// Session.set("myTheme", "light");
|
|
|
|
|
document.documentElement.setAttribute('theme', "light");
|
|
|
|
|
} else {
|
|
|
|
|
console.log("Found theme as dark");
|
|
|
|
|
// Session.set("myTheme", "dark");
|
|
|
|
|
document.documentElement.setAttribute('theme', "dark");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.log("User Prefs appear undefined.");
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-08-15 18:07:39 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.MainLayout.helpers({
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.MainLayout.events({
|
|
|
|
|
|
|
|
|
|
});
|