import { useEffect, useRef } from "react"; import { ErrorBoundary } from "react-error-boundary"; import dynamic from "next/dynamic"; import Head from "next/head"; import { NextSeo } from "next-seo"; import Layout from "../components/Layout"; import Terminal from "../components/Terminal"; import { styled } from "../lib/styles/stitches.config"; import type { ReactElement, ComponentPropsWithoutRef, ElementRef } from "react"; // obviously, an interactive VNC display will not work even a little bit server-side const VNC = dynamic(() => import("../components/VNC"), { ssr: false }); // https://github.com/jakejarvis/y2k const SOCKET_PROXY = "wss://y2k.pipe.fail"; const Wallpaper = styled("main", { display: "flex", width: "100%", minHeight: "500px", padding: "1.5em 0", justifyContent: "center", alignItems: "center", backgroundRepeat: "repeat", backgroundPosition: "center", }); const RandomWallpaper = ({ ...rest }: ComponentPropsWithoutRef) => { const wallpaperRef = useRef>(null); // set a random retro Windows ME desktop tile for the entire content area useEffect(() => { const wallpaperUrl = `/static/images/y2k/tiles/tile_${Math.floor(20 * Math.random())}.png`; if (wallpaperRef.current) { wallpaperRef.current.style.backgroundImage = `url(${wallpaperUrl})`; } }, []); return ; }; const Y2K = () => { // print a fancy console message (in browser only) just for funsies useEffect(() => { console.log( ` %c🤓 %cHey there, fellow nerd!%c Looking for the magic behind this page? %cCheck out this post: https://jarv.is/notes/y2k-sandbox/ ...or the source code here: https://github.com/jakejarvis/y2k `, "font-size: 20px", "color: black; background: yellow; font-size: 20px", "font-size: 20px", "font-size: 15px" ); }, []); return ( <> {/* TODO: favicon doesn't change back to normal when navigating away from page */} Oh no, it looks like something's gone VERY wrong. Sorry about that! } > ); }; // disable layout's default styles so the wallpaper component can go edge-to-edge: Y2K.getLayout = (page: ReactElement) => { return ( {page} ); }; export default Y2K;