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'; |
pineafan | 7bd0ad6 | 2022-10-26 22:11:29 +0100 | [diff] [blame] | 4 | import React from 'react'; |
pineafan | ff3d452 | 2022-05-06 19:51:02 +0100 | [diff] [blame] | 5 | import Styles from '../styles/globals.module.css'; |
PineaFan | 93f540e | 2022-12-04 22:05:57 +0000 | [diff] [blame] | 6 | import { getSeason } from './api/season'; |
| 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 | b7c7974 | 2022-11-06 18:08:36 +0000 | [diff] [blame] | 58 | const showSubBar = (element, timeout, positioning="left") => { |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 59 | setSubBar(true); |
pineafan | b7c7974 | 2022-11-06 18:08:36 +0000 | [diff] [blame] | 60 | if (positioning === "center") { |
| 61 | element = <div className={Styles.centeredSubBar}>{element}</div> |
| 62 | } |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 63 | setElement(element); |
| 64 | if (timeout) { |
| 65 | setTimeout(() => { |
| 66 | setSubBar(false); |
| 67 | setTimeout(() => { |
| 68 | setElement(<></>); |
| 69 | }, 0.31 * 1000) |
| 70 | }, timeout * 1000) |
| 71 | } |
| 72 | } |
pineafan | 7bd0ad6 | 2022-10-26 22:11:29 +0100 | [diff] [blame] | 73 | |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 74 | const hideSubBar = () => { |
| 75 | setSubBar(false); |
| 76 | } |
| 77 | |
pineafan | b7c7974 | 2022-11-06 18:08:36 +0000 | [diff] [blame] | 78 | const showMessage = (text, positioning="left") => { |
| 79 | showSubBar(<p className={Styles.message}>{text}</p>, 5, positioning); |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 80 | } |
| 81 | |
PineaFan | 93f540e | 2022-12-04 22:05:57 +0000 | [diff] [blame] | 82 | const season = getSeason(); |
| 83 | let Overlay = <></>; |
| 84 | switch (season.season) { |
| 85 | case "christmas": { |
| 86 | Overlay = <Christmas />; |
| 87 | break; |
| 88 | } |
| 89 | } |
| 90 | |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 91 | 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} |
PineaFan | 93f540e | 2022-12-04 22:05:57 +0000 | [diff] [blame] | 106 | season={season} |
| 107 | randomSeed={new Date().getMinutes() / 60} // FIXME: Janky hack mate |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 108 | /> |
PineaFan | 93f540e | 2022-12-04 22:05:57 +0000 | [diff] [blame] | 109 | <div className={Styles.container} style={{ |
| 110 | pointerEvents: "none", |
| 111 | }}>{Overlay}</div> |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 112 | <div className={Styles.container} /> |
| 113 | </ThemeProvider> |
| 114 | </> |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 115 | } |
| 116 | |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 117 | export default App |