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;
|
|
|
|
|
|
2020-03-10 16:01:24 +01:00
|
|
|
|
static fakeMachineNumber = [
|
|
|
|
|
"",
|
2020-03-10 17:29:34 +01:00
|
|
|
|
"cos(ln(1))",
|
|
|
|
|
"0,5⁻¹",
|
|
|
|
|
"567/189",
|
|
|
|
|
"√2×√8",
|
|
|
|
|
"√50×sin(9π/4)",
|
|
|
|
|
"⌈π+e⌉",
|
|
|
|
|
"div(rot(B))+7",
|
|
|
|
|
"4×sinh(0)+4",
|
|
|
|
|
"8-(-i)²",
|
|
|
|
|
"|5√2+5√2i|",
|
|
|
|
|
"1×10¹+1×10⁰",
|
|
|
|
|
"Re(√192e^(iπ/6))",
|
2020-03-10 16:01:24 +01:00
|
|
|
|
];
|
|
|
|
|
|
2020-03-08 12:50:18 +01:00
|
|
|
|
constructor() {
|
|
|
|
|
let today = new Date();
|
2020-03-10 17:29:34 +01:00
|
|
|
|
this.aprilFoolsEnabled = (today.getDate() === 10 && today.getMonth() === 2); // TODO changer date !
|
2020-03-08 12:50:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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) {
|
2020-03-10 16:01:24 +01:00
|
|
|
|
menu[1]["dishes"].splice(4, 0, {name: "Coq au vin"});
|
|
|
|
|
menu[1]["dishes"].splice(2, 0, {name: "Bat'Soupe"});
|
2020-03-09 22:02:09 +01:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-10 16:01:24 +01:00
|
|
|
|
static getNewProxiwashDryerOrderedList(dryers: Array<Object>) {
|
|
|
|
|
if (dryers !== undefined) {
|
|
|
|
|
let second = dryers[1];
|
|
|
|
|
dryers.splice(1, 1);
|
|
|
|
|
dryers.push(second);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getNewProxiwashWasherOrderedList(washers: Array<Object>) {
|
|
|
|
|
if (washers !== undefined) {
|
|
|
|
|
let first = washers[0];
|
|
|
|
|
let second = washers[1];
|
|
|
|
|
let fifth = washers[4];
|
|
|
|
|
let ninth = washers[8];
|
|
|
|
|
washers.splice(8, 1, second);
|
|
|
|
|
washers.splice(4, 1, ninth);
|
|
|
|
|
washers.splice(1, 1, first);
|
|
|
|
|
washers.splice(0, 1, fifth);
|
|
|
|
|
// washers.push(fifth);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getProxiwashMachineDisplayNumber(number: number) {
|
|
|
|
|
return AprilFoolsManager.fakeMachineNumber[number];
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-09 22:02:09 +01:00
|
|
|
|
static getAprilFoolsTheme(currentTheme: Object) {
|
2020-03-08 13:29:43 +01:00
|
|
|
|
return {
|
|
|
|
|
...currentTheme,
|
|
|
|
|
colors: {
|
|
|
|
|
...currentTheme.colors,
|
2020-03-09 19:18:10 +01:00
|
|
|
|
primary: '#00be45',
|
|
|
|
|
accent: '#00be45',
|
2020-03-09 22:02:09 +01:00
|
|
|
|
background: '#d02eee',
|
|
|
|
|
tabIcon: "#380d43",
|
|
|
|
|
card: "#eed639",
|
|
|
|
|
surface: "#eed639",
|
|
|
|
|
dividerBackground: '#c72ce4',
|
2020-03-08 13:29:43 +01:00
|
|
|
|
textDisabled: '#b9b9b9',
|
|
|
|
|
|
|
|
|
|
// Calendar/Agenda
|
2020-03-09 22:02:09 +01:00
|
|
|
|
agendaBackgroundColor: '#c72ce4',
|
2020-03-08 13:29:43 +01:00
|
|
|
|
agendaDayTextColor: '#6d6d6d',
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-08 12:50:18 +01:00
|
|
|
|
isAprilFoolsEnabled() {
|
|
|
|
|
return this.aprilFoolsEnabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|