pineafan | df39fd4 | 2021-09-04 16:05:27 +0100 | [diff] [blame] | 1 | import '../styles/globals.css'; |
| 2 | import NavBar from '../Components/NavBar'; |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 3 | import { ThemeProvider } from 'theme-ui'; |
Skyler Grey | 59abe29 | 2022-12-05 01:27:02 +0000 | [diff] [blame] | 4 | import React, {useEffect} from 'react'; |
PineaFan | a465f35 | 2023-02-05 16:45:01 +0000 | [diff] [blame] | 5 | import { useRouter } from 'next/router'; |
pineafan | ff3d452 | 2022-05-06 19:51:02 +0100 | [diff] [blame] | 6 | import Styles from '../styles/globals.module.css'; |
PineaFan | 93f540e | 2022-12-04 22:05:57 +0000 | [diff] [blame] | 7 | import Christmas from '../Components/overlays/christmas'; |
pineafan | df39fd4 | 2021-09-04 16:05:27 +0100 | [diff] [blame] | 8 | |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 9 | const theme = { |
| 10 | config: { |
| 11 | useColorSchemeMediaQuery: true, |
| 12 | initialColorModeName: 'light', |
| 13 | }, |
| 14 | colors: { |
| 15 | text: '#424242', |
| 16 | background: '#ffffff', |
| 17 | primary: '#6576CC', |
Skyler Grey | b255e99 | 2023-03-06 10:46:08 +0000 | [diff] [blame] | 18 | highlight: '#78ECF2', |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 19 | cardText: '#ffffff', |
| 20 | cardBackground: 'rgba(255, 255, 255, 0.65)', |
| 21 | cardBorder: '#C4C4C4', |
| 22 | cardFilter: 'rgba(0, 0, 0, 0)', |
| 23 | cardOverlay: '#00000080', |
pineafan | e0283a8 | 2022-02-13 10:05:56 +0000 | [diff] [blame] | 24 | hint: '#E4E4E4', |
| 25 | panelColor: "#F0F0F0", |
pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 26 | fadeGradient: "rgba(240, 240, 240, 1)", |
pineafan | 7bd0ad6 | 2022-10-26 22:11:29 +0100 | [diff] [blame] | 27 | offset: "2.5px", |
pineafan | df39fd4 | 2021-09-04 16:05:27 +0100 | [diff] [blame] | 28 | |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 29 | borders: "#FFFFFF", |
| 30 | borderHint: "#E4E4E4", |
| 31 | |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 32 | modes: { |
| 33 | dark: { |
| 34 | text: '#ffffff', |
pineafan | 74f1674 | 2022-11-07 21:57:55 +0000 | [diff] [blame] | 35 | background: '#000000', |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 36 | primary: '#6576CC', |
Skyler Grey | b255e99 | 2023-03-06 10:46:08 +0000 | [diff] [blame] | 37 | highlight: '#78ECF2', |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 38 | cardText: '#424242', |
| 39 | cardBackground: 'rgba(0, 0, 0, 0.65)', |
| 40 | cardBorder: '#424242', |
pineafan | a841c76 | 2021-11-14 21:21:04 +0000 | [diff] [blame] | 41 | cardFilter: 'brightness(0.5)', |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 42 | cardOverlay: '#42424280', |
pineafan | e0283a8 | 2022-02-13 10:05:56 +0000 | [diff] [blame] | 43 | hint: '#242424', |
pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 44 | panelColor: "rgba(255, 255, 255, 0.05)", |
| 45 | fadeGradient: "rgba(48, 48, 48, 1)", |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 46 | offset: "-20px", |
| 47 | |
| 48 | borders: "#000000", |
| 49 | borderHint: "#424242", |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 50 | } |
| 51 | } |
| 52 | }, |
| 53 | }; |
| 54 | |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 55 | |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 56 | function App({ Component, pageProps }) { |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 57 | const [subBar, setSubBar] = React.useState(false); |
| 58 | const [currentElement, setElement] = React.useState(<></>); |
pineafan | 7bd0ad6 | 2022-10-26 22:11:29 +0100 | [diff] [blame] | 59 | |
PineaFan | a465f35 | 2023-02-05 16:45:01 +0000 | [diff] [blame] | 60 | const router = useRouter(); |
Skyler Grey | 59abe29 | 2022-12-05 01:27:02 +0000 | [diff] [blame] | 61 | const [season, setSeason] = React.useState({ season: "normal", filePath: "normal" }); |
| 62 | |
| 63 | useEffect(() => async () => { |
Samuel Shuert | 0163f04 | 2023-02-23 13:10:19 -0500 | [diff] [blame] | 64 | const params = router.query["theme"]; |
| 65 | if (params) { |
PineaFan | fa36f91 | 2023-02-06 16:58:36 +0000 | [diff] [blame] | 66 | setSeason({season: params, filePath: "seasonal/" + params}); |
Samuel Shuert | 0163f04 | 2023-02-23 13:10:19 -0500 | [diff] [blame] | 67 | 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}); |
PineaFan | a465f35 | 2023-02-05 16:45:01 +0000 | [diff] [blame] | 74 | }, [season.season, router]) |
Skyler Grey | 59abe29 | 2022-12-05 01:27:02 +0000 | [diff] [blame] | 75 | |
pineafan | b7c7974 | 2022-11-06 18:08:36 +0000 | [diff] [blame] | 76 | const showSubBar = (element, timeout, positioning="left") => { |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 77 | setSubBar(true); |
pineafan | b7c7974 | 2022-11-06 18:08:36 +0000 | [diff] [blame] | 78 | if (positioning === "center") { |
| 79 | element = <div className={Styles.centeredSubBar}>{element}</div> |
| 80 | } |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 81 | setElement(element); |
| 82 | if (timeout) { |
| 83 | setTimeout(() => { |
PineaFan | a465f35 | 2023-02-05 16:45:01 +0000 | [diff] [blame] | 84 | setSubBar(false); |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 85 | setTimeout(() => { |
| 86 | setElement(<></>); |
| 87 | }, 0.31 * 1000) |
| 88 | }, timeout * 1000) |
| 89 | } |
| 90 | } |
pineafan | 7bd0ad6 | 2022-10-26 22:11:29 +0100 | [diff] [blame] | 91 | |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 92 | const hideSubBar = () => { |
| 93 | setSubBar(false); |
| 94 | } |
| 95 | |
pineafan | b7c7974 | 2022-11-06 18:08:36 +0000 | [diff] [blame] | 96 | const showMessage = (text, positioning="left") => { |
| 97 | showSubBar(<p className={Styles.message}>{text}</p>, 5, positioning); |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 98 | } |
| 99 | |
PineaFan | 93f540e | 2022-12-04 22:05:57 +0000 | [diff] [blame] | 100 | let Overlay = <></>; |
| 101 | switch (season.season) { |
| 102 | case "christmas": { |
| 103 | Overlay = <Christmas />; |
| 104 | break; |
| 105 | } |
| 106 | } |
| 107 | |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 108 | 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 Grey | 59abe29 | 2022-12-05 01:27:02 +0000 | [diff] [blame] | 117 | season={season} |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 118 | /> |
| 119 | <Component |
| 120 | {...pageProps} |
| 121 | showSubBar={showSubBar} |
| 122 | hideSubBar={hideSubBar} |
| 123 | showMessage={showMessage} |
PineaFan | 93f540e | 2022-12-04 22:05:57 +0000 | [diff] [blame] | 124 | season={season} |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 125 | /> |
PineaFan | 93f540e | 2022-12-04 22:05:57 +0000 | [diff] [blame] | 126 | <div className={Styles.container} style={{ |
| 127 | pointerEvents: "none", |
PineaFan | a465f35 | 2023-02-05 16:45:01 +0000 | [diff] [blame] | 128 | height: "1000vh" |
PineaFan | 93f540e | 2022-12-04 22:05:57 +0000 | [diff] [blame] | 129 | }}>{Overlay}</div> |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 130 | <div className={Styles.container} /> |
| 131 | </ThemeProvider> |
| 132 | </> |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 133 | } |
| 134 | |
PineaFan | a465f35 | 2023-02-05 16:45:01 +0000 | [diff] [blame] | 135 | export default App; |