blob: 64771a9f2dc54d80773eb751c15cc5e20cb03888 [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',
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
PineaFana465f352023-02-05 16:45:01 +000058 const router = useRouter();
Skyler Grey59abe292022-12-05 01:27:02 +000059 const [season, setSeason] = React.useState({ season: "normal", filePath: "normal" });
60
61 useEffect(() => async () => {
PineaFana465f352023-02-05 16:45:01 +000062 // const params = router.query["theme"];
63 // console.log(router.query["theme"])
64 // if (params) {
65 // setSeason({season: params, filePath: "seasonal/" + params});
66 // return;
67 // }
68 let newSeason = await (await fetch("/api/season")).json();
69 // newSeason = {season: "trans", filePath: "seasonal/trans"}
70 setSeason({...newSeason });
71 console.log("theme is now " + newSeason.season)
72 }, [season.season, router])
Skyler Grey59abe292022-12-05 01:27:02 +000073
pineafanb7c79742022-11-06 18:08:36 +000074 const showSubBar = (element, timeout, positioning="left") => {
pineafanb18f0192022-10-27 22:08:36 +010075 setSubBar(true);
pineafanb7c79742022-11-06 18:08:36 +000076 if (positioning === "center") {
77 element = <div className={Styles.centeredSubBar}>{element}</div>
78 }
pineafanb18f0192022-10-27 22:08:36 +010079 setElement(element);
80 if (timeout) {
81 setTimeout(() => {
PineaFana465f352023-02-05 16:45:01 +000082 setSubBar(false);
pineafanb18f0192022-10-27 22:08:36 +010083 setTimeout(() => {
84 setElement(<></>);
85 }, 0.31 * 1000)
86 }, timeout * 1000)
87 }
88 }
pineafan7bd0ad62022-10-26 22:11:29 +010089
pineafanb18f0192022-10-27 22:08:36 +010090 const hideSubBar = () => {
91 setSubBar(false);
92 }
93
pineafanb7c79742022-11-06 18:08:36 +000094 const showMessage = (text, positioning="left") => {
95 showSubBar(<p className={Styles.message}>{text}</p>, 5, positioning);
pineafanb18f0192022-10-27 22:08:36 +010096 }
97
PineaFan93f540e2022-12-04 22:05:57 +000098 let Overlay = <></>;
99 switch (season.season) {
100 case "christmas": {
101 Overlay = <Christmas />;
102 break;
103 }
104 }
105
pineafanb18f0192022-10-27 22:08:36 +0100106 return <>
107 <ThemeProvider theme={theme}>
108 <NavBar
109 subBar={subBar}
110 setSubBar={setSubBar}
111 element={currentElement}
112 setElement={setElement}
113 showMessage={showMessage}
114 showSubBar={showSubBar}
Skyler Grey59abe292022-12-05 01:27:02 +0000115 season={season}
pineafanb18f0192022-10-27 22:08:36 +0100116 />
117 <Component
118 {...pageProps}
119 showSubBar={showSubBar}
120 hideSubBar={hideSubBar}
121 showMessage={showMessage}
PineaFan93f540e2022-12-04 22:05:57 +0000122 season={season}
pineafanb18f0192022-10-27 22:08:36 +0100123 />
PineaFan93f540e2022-12-04 22:05:57 +0000124 <div className={Styles.container} style={{
125 pointerEvents: "none",
PineaFana465f352023-02-05 16:45:01 +0000126 height: "1000vh"
PineaFan93f540e2022-12-04 22:05:57 +0000127 }}>{Overlay}</div>
pineafanb18f0192022-10-27 22:08:36 +0100128 <div className={Styles.container} />
129 </ThemeProvider>
130 </>
Samuel Shuert016ea022021-09-01 16:17:24 -0500131}
132
PineaFana465f352023-02-05 16:45:01 +0000133export default App;