blob: d571c962e3f00cca765dc6d1156b5936b8e2e19b [file] [log] [blame]
pineafandf39fd42021-09-04 16:05:27 +01001import '../styles/globals.css';
2import NavBar from '../Components/NavBar';
Skyler Turner16c08d32021-11-04 20:06:50 +00003import { ThemeProvider } from 'theme-ui';
pineafan7bd0ad62022-10-26 22:11:29 +01004import React from 'react';
pineafanff3d4522022-05-06 19:51:02 +01005import Styles from '../styles/globals.module.css';
PineaFan93f540e2022-12-04 22:05:57 +00006import { getSeason } from './api/season';
7import Christmas from '../Components/overlays/christmas';
pineafandf39fd42021-09-04 16:05:27 +01008
Skyler Turner16c08d32021-11-04 20:06:50 +00009const theme = {
10 config: {
11 useColorSchemeMediaQuery: true,
12 initialColorModeName: 'light',
13 },
14 colors: {
15 text: '#424242',
16 background: '#ffffff',
17 primary: '#6576CC',
18 cardText: '#ffffff',
19 cardBackground: 'rgba(255, 255, 255, 0.65)',
20 cardBorder: '#C4C4C4',
21 cardFilter: 'rgba(0, 0, 0, 0)',
22 cardOverlay: '#00000080',
pineafane0283a82022-02-13 10:05:56 +000023 hint: '#E4E4E4',
24 panelColor: "#F0F0F0",
pineafan46270162022-02-13 12:06:17 +000025 fadeGradient: "rgba(240, 240, 240, 1)",
pineafan7bd0ad62022-10-26 22:11:29 +010026 offset: "2.5px",
pineafandf39fd42021-09-04 16:05:27 +010027
pineafanb18f0192022-10-27 22:08:36 +010028 borders: "#FFFFFF",
29 borderHint: "#E4E4E4",
30
Skyler Turner16c08d32021-11-04 20:06:50 +000031 modes: {
32 dark: {
33 text: '#ffffff',
pineafan74f16742022-11-07 21:57:55 +000034 background: '#000000',
Skyler Turner16c08d32021-11-04 20:06:50 +000035 primary: '#6576CC',
36 cardText: '#424242',
37 cardBackground: 'rgba(0, 0, 0, 0.65)',
38 cardBorder: '#424242',
pineafana841c762021-11-14 21:21:04 +000039 cardFilter: 'brightness(0.5)',
Skyler Turner16c08d32021-11-04 20:06:50 +000040 cardOverlay: '#42424280',
pineafane0283a82022-02-13 10:05:56 +000041 hint: '#242424',
pineafan46270162022-02-13 12:06:17 +000042 panelColor: "rgba(255, 255, 255, 0.05)",
43 fadeGradient: "rgba(48, 48, 48, 1)",
pineafanb18f0192022-10-27 22:08:36 +010044 offset: "-20px",
45
46 borders: "#000000",
47 borderHint: "#424242",
Skyler Turner16c08d32021-11-04 20:06:50 +000048 }
49 }
50 },
51};
52
Samuel Shuert016ea022021-09-01 16:17:24 -050053
pineafana5ce9102021-09-02 17:21:31 +010054function App({ Component, pageProps }) {
pineafanb18f0192022-10-27 22:08:36 +010055 const [subBar, setSubBar] = React.useState(false);
56 const [currentElement, setElement] = React.useState(<></>);
pineafan7bd0ad62022-10-26 22:11:29 +010057
pineafanb7c79742022-11-06 18:08:36 +000058 const showSubBar = (element, timeout, positioning="left") => {
pineafanb18f0192022-10-27 22:08:36 +010059 setSubBar(true);
pineafanb7c79742022-11-06 18:08:36 +000060 if (positioning === "center") {
61 element = <div className={Styles.centeredSubBar}>{element}</div>
62 }
pineafanb18f0192022-10-27 22:08:36 +010063 setElement(element);
64 if (timeout) {
65 setTimeout(() => {
66 setSubBar(false);
67 setTimeout(() => {
68 setElement(<></>);
69 }, 0.31 * 1000)
70 }, timeout * 1000)
71 }
72 }
pineafan7bd0ad62022-10-26 22:11:29 +010073
pineafanb18f0192022-10-27 22:08:36 +010074 const hideSubBar = () => {
75 setSubBar(false);
76 }
77
pineafanb7c79742022-11-06 18:08:36 +000078 const showMessage = (text, positioning="left") => {
79 showSubBar(<p className={Styles.message}>{text}</p>, 5, positioning);
pineafanb18f0192022-10-27 22:08:36 +010080 }
81
PineaFan93f540e2022-12-04 22:05:57 +000082 const season = getSeason();
83 let Overlay = <></>;
84 switch (season.season) {
85 case "christmas": {
86 Overlay = <Christmas />;
87 break;
88 }
89 }
90
pineafanb18f0192022-10-27 22:08:36 +010091 return <>
92 <ThemeProvider theme={theme}>
93 <NavBar
94 subBar={subBar}
95 setSubBar={setSubBar}
96 element={currentElement}
97 setElement={setElement}
98 showMessage={showMessage}
99 showSubBar={showSubBar}
100 />
101 <Component
102 {...pageProps}
103 showSubBar={showSubBar}
104 hideSubBar={hideSubBar}
105 showMessage={showMessage}
PineaFan93f540e2022-12-04 22:05:57 +0000106 season={season}
107 randomSeed={new Date().getMinutes() / 60} // FIXME: Janky hack mate
pineafanb18f0192022-10-27 22:08:36 +0100108 />
PineaFan93f540e2022-12-04 22:05:57 +0000109 <div className={Styles.container} style={{
110 pointerEvents: "none",
111 }}>{Overlay}</div>
pineafanb18f0192022-10-27 22:08:36 +0100112 <div className={Styles.container} />
113 </ThemeProvider>
114 </>
Samuel Shuert016ea022021-09-01 16:17:24 -0500115}
116
pineafana5ce9102021-09-02 17:21:31 +0100117export default App