application-amicale/utils/AprilFoolsManager.js

61 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-03-08 12:50:18 +01:00
// @flow
/**
* Singleton class used to manage themes
*/
export default class AprilFoolsManager {
static instance: AprilFoolsManager | null = null;
aprilFoolsEnabled: boolean;
constructor() {
let today = new Date();
this.aprilFoolsEnabled = (today.getDate() === 1 && today.getMonth() === 3);
}
/**
* Get this class instance or create one if none is found
* @returns {ThemeManager}
*/
static getInstance(): AprilFoolsManager {
return AprilFoolsManager.instance === null ?
AprilFoolsManager.instance = new AprilFoolsManager() :
AprilFoolsManager.instance;
}
static getFakeMenuItem(menu: Object) {
menu[1]["dishes"].splice(2, 0, {name: "Coq au vin"});
menu[1]["dishes"].splice(1, 0, {name: "Pave de loup"});
menu[1]["dishes"].splice(0, 0, {name: "Béranger à point"});
menu[1]["dishes"].splice(0, 0, {name: "Pieds d'Arnaud"});
2020-03-08 12:50:18 +01:00
return menu;
}
static getAprilFoolsTheme(currentTheme: Object) {
return {
...currentTheme,
colors: {
...currentTheme.colors,
2020-03-09 19:18:10 +01:00
primary: '#00be45',
accent: '#00be45',
background: '#d02eee',
tabIcon: "#380d43",
card: "#eed639",
surface: "#eed639",
dividerBackground: '#c72ce4',
textDisabled: '#b9b9b9',
// Calendar/Agenda
agendaBackgroundColor: '#c72ce4',
agendaDayTextColor: '#6d6d6d',
},
};
}
2020-03-08 12:50:18 +01:00
isAprilFoolsEnabled() {
return this.aprilFoolsEnabled;
}
};