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