Application Android et IOS pour l'amicale des élèves
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AprilFoolsManager.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // @flow
  2. /**
  3. * Singleton class used to manage themes
  4. */
  5. export default class AprilFoolsManager {
  6. static instance: AprilFoolsManager | null = null;
  7. aprilFoolsEnabled: boolean;
  8. static fakeMachineNumber = [
  9. "",
  10. "cos(ln(1))",
  11. "0,5⁻¹",
  12. "567/189",
  13. "√2×√8",
  14. "√50×sin(9π/4)",
  15. "⌈π+e⌉",
  16. "div(rot(B))+7",
  17. "4×cosh(0)+4",
  18. "8-(-i)²",
  19. "|5√2+5√2i|",
  20. "1×10¹+1×10⁰",
  21. "Re(√192e^(iπ/6))",
  22. ];
  23. constructor() {
  24. let today = new Date();
  25. this.aprilFoolsEnabled = (today.getDate() === 1 && today.getMonth() === 3);
  26. }
  27. /**
  28. * Get this class instance or create one if none is found
  29. * @returns {ThemeManager}
  30. */
  31. static getInstance(): AprilFoolsManager {
  32. return AprilFoolsManager.instance === null ?
  33. AprilFoolsManager.instance = new AprilFoolsManager() :
  34. AprilFoolsManager.instance;
  35. }
  36. static getFakeMenuItem(menu: Object) {
  37. menu[1]["dishes"].splice(4, 0, {name: "Coq au vin"});
  38. menu[1]["dishes"].splice(2, 0, {name: "Bat'Soupe"});
  39. menu[1]["dishes"].splice(1, 0, {name: "Pave de loup"});
  40. menu[1]["dishes"].splice(0, 0, {name: "Béranger à point"});
  41. menu[1]["dishes"].splice(0, 0, {name: "Pieds d'Arnaud"});
  42. return menu;
  43. }
  44. static getNewProxiwashDryerOrderedList(dryers: Array<Object>) {
  45. if (dryers !== undefined) {
  46. let second = dryers[1];
  47. dryers.splice(1, 1);
  48. dryers.push(second);
  49. }
  50. }
  51. static getNewProxiwashWasherOrderedList(washers: Array<Object>) {
  52. if (washers !== undefined) {
  53. let first = washers[0];
  54. let second = washers[1];
  55. let fifth = washers[4];
  56. let ninth = washers[8];
  57. washers.splice(8, 1, second);
  58. washers.splice(4, 1, ninth);
  59. washers.splice(1, 1, first);
  60. washers.splice(0, 1, fifth);
  61. // washers.push(fifth);
  62. }
  63. }
  64. static getProxiwashMachineDisplayNumber(number: number) {
  65. return AprilFoolsManager.fakeMachineNumber[number];
  66. }
  67. static getAprilFoolsTheme(currentTheme: Object) {
  68. return {
  69. ...currentTheme,
  70. colors: {
  71. ...currentTheme.colors,
  72. primary: '#00be45',
  73. accent: '#00be45',
  74. background: '#d02eee',
  75. tabIcon: "#380d43",
  76. card: "#eed639",
  77. surface: "#eed639",
  78. dividerBackground: '#c72ce4',
  79. textDisabled: '#b9b9b9',
  80. // Calendar/Agenda
  81. agendaBackgroundColor: '#c72ce4',
  82. agendaDayTextColor: '#6d6d6d',
  83. },
  84. };
  85. }
  86. isAprilFoolsEnabled() {
  87. return this.aprilFoolsEnabled;
  88. }
  89. };