blob: f09cb5748313d95e084b3053872d79396983247e [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';
Skyler Grey59abe292022-12-05 01:27:02 +00004import React, {useEffect} from 'react';
PineaFana465f352023-02-05 16:45:01 +00005import { useRouter } from 'next/router';
pineafanff3d4522022-05-06 19:51:02 +01006import Styles from '../styles/globals.module.css';
PineaFan93f540e2022-12-04 22:05:57 +00007import 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',
Skyler Greyb255e992023-03-06 10:46:08 +000018 highlight: '#78ECF2',
Skyler Turner16c08d32021-11-04 20:06:50 +000019 cardText: '#ffffff',
20 cardBackground: 'rgba(255, 255, 255, 0.65)',
21 cardBorder: '#C4C4C4',
22 cardFilter: 'rgba(0, 0, 0, 0)',
23 cardOverlay: '#00000080',
pineafane0283a82022-02-13 10:05:56 +000024 hint: '#E4E4E4',
25 panelColor: "#F0F0F0",
pineafan46270162022-02-13 12:06:17 +000026 fadeGradient: "rgba(240, 240, 240, 1)",
pineafan7bd0ad62022-10-26 22:11:29 +010027 offset: "2.5px",
pineafandf39fd42021-09-04 16:05:27 +010028
pineafanb18f0192022-10-27 22:08:36 +010029 borders: "#FFFFFF",
30 borderHint: "#E4E4E4",
31
Skyler Turner16c08d32021-11-04 20:06:50 +000032 modes: {
33 dark: {
34 text: '#ffffff',
pineafan74f16742022-11-07 21:57:55 +000035 background: '#000000',
Skyler Turner16c08d32021-11-04 20:06:50 +000036 primary: '#6576CC',
Skyler Greyb255e992023-03-06 10:46:08 +000037 highlight: '#78ECF2',
Skyler Turner16c08d32021-11-04 20:06:50 +000038 cardText: '#424242',
39 cardBackground: 'rgba(0, 0, 0, 0.65)',
40 cardBorder: '#424242',
pineafana841c762021-11-14 21:21:04 +000041 cardFilter: 'brightness(0.5)',
Skyler Turner16c08d32021-11-04 20:06:50 +000042 cardOverlay: '#42424280',
pineafane0283a82022-02-13 10:05:56 +000043 hint: '#242424',
pineafan46270162022-02-13 12:06:17 +000044 panelColor: "rgba(255, 255, 255, 0.05)",
45 fadeGradient: "rgba(48, 48, 48, 1)",
pineafanb18f0192022-10-27 22:08:36 +010046 offset: "-20px",
47
48 borders: "#000000",
49 borderHint: "#424242",
Skyler Turner16c08d32021-11-04 20:06:50 +000050 }
51 }
52 },
53};
54
Samuel Shuert016ea022021-09-01 16:17:24 -050055
pineafana5ce9102021-09-02 17:21:31 +010056function App({ Component, pageProps }) {
pineafanb18f0192022-10-27 22:08:36 +010057 const [subBar, setSubBar] = React.useState(false);
58 const [currentElement, setElement] = React.useState(<></>);
pineafan7bd0ad62022-10-26 22:11:29 +010059
PineaFana465f352023-02-05 16:45:01 +000060 const router = useRouter();
Skyler Grey59abe292022-12-05 01:27:02 +000061 const [season, setSeason] = React.useState({ season: "normal", filePath: "normal" });
62
63 useEffect(() => async () => {
Samuel Shuert0163f042023-02-23 13:10:19 -050064 const params = router.query["theme"];
65 if (params) {
PineaFanfa36f912023-02-06 16:58:36 +000066 setSeason({season: params, filePath: "seasonal/" + params});
Samuel Shuert0163f042023-02-23 13:10:19 -050067 return;
68 }
69 let newSeason = await (await fetch("/api/season")).json();
70 // newSeason = {season: "trans", filePath: "seasonal/trans"}
71 setSeason({...newSeason });
72 // const params = "aprilFools"
73 // setSeason({season: params, filePath: "seasonal/" + params});
PineaFana465f352023-02-05 16:45:01 +000074 }, [season.season, router])
Skyler Grey59abe292022-12-05 01:27:02 +000075
pineafanb7c79742022-11-06 18:08:36 +000076 const showSubBar = (element, timeout, positioning="left") => {
pineafanb18f0192022-10-27 22:08:36 +010077 setSubBar(true);
pineafanb7c79742022-11-06 18:08:36 +000078 if (positioning === "center") {
79 element = <div className={Styles.centeredSubBar}>{element}</div>
80 }
pineafanb18f0192022-10-27 22:08:36 +010081 setElement(element);
82 if (timeout) {
83 setTimeout(() => {
PineaFana465f352023-02-05 16:45:01 +000084 setSubBar(false);
pineafanb18f0192022-10-27 22:08:36 +010085 setTimeout(() => {
86 setElement(<></>);
87 }, 0.31 * 1000)
88 }, timeout * 1000)
89 }
90 }
pineafan7bd0ad62022-10-26 22:11:29 +010091
pineafanb18f0192022-10-27 22:08:36 +010092 const hideSubBar = () => {
93 setSubBar(false);
94 }
95
pineafanb7c79742022-11-06 18:08:36 +000096 const showMessage = (text, positioning="left") => {
97 showSubBar(<p className={Styles.message}>{text}</p>, 5, positioning);
pineafanb18f0192022-10-27 22:08:36 +010098 }
99
PineaFan93f540e2022-12-04 22:05:57 +0000100 let Overlay = <></>;
101 switch (season.season) {
102 case "christmas": {
103 Overlay = <Christmas />;
104 break;
105 }
106 }
107
pineafanb18f0192022-10-27 22:08:36 +0100108 return <>
109 <ThemeProvider theme={theme}>
110 <NavBar
111 subBar={subBar}
112 setSubBar={setSubBar}
113 element={currentElement}
114 setElement={setElement}
115 showMessage={showMessage}
116 showSubBar={showSubBar}
Skyler Grey59abe292022-12-05 01:27:02 +0000117 season={season}
pineafanb18f0192022-10-27 22:08:36 +0100118 />
119 <Component
120 {...pageProps}
121 showSubBar={showSubBar}
122 hideSubBar={hideSubBar}
123 showMessage={showMessage}
PineaFan93f540e2022-12-04 22:05:57 +0000124 season={season}
pineafanb18f0192022-10-27 22:08:36 +0100125 />
PineaFan93f540e2022-12-04 22:05:57 +0000126 <div className={Styles.container} style={{
127 pointerEvents: "none",
PineaFana465f352023-02-05 16:45:01 +0000128 height: "1000vh"
PineaFan93f540e2022-12-04 22:05:57 +0000129 }}>{Overlay}</div>
pineafanb18f0192022-10-27 22:08:36 +0100130 <div className={Styles.container} />
131 </ThemeProvider>
132 </>
Samuel Shuert016ea022021-09-01 16:17:24 -0500133}
134
PineaFana465f352023-02-05 16:45:01 +0000135export default App;