import Head from "next/head"; import Link from "next/link"; import React, { ErrorInfo } from "react"; import { Logo2 } from "../icons"; interface MenuItem { page: string; link: string; title: string; } const menu: MenuItem[] = [ { page: "search", link: "/", title: "Search", }, { page: "tools", link: "/tools", title: "Tools", }, { page: "about", link: "/about", title: "About", }, ]; /* Utilities */ const calculateLastUpdate = () => { let today = new Date().toISOString(); let yesterdayObj = new Date(); yesterdayObj.setDate(yesterdayObj.getDate() - 1); let yesterday = yesterdayObj.toISOString(); if (today.slice(11, 16) > "02:00") { return today.slice(0, 10); } else { return yesterday.slice(0, 10); } }; // Error catcher class ErrorBoundary extends React.Component< {}, { error: any; errorInfo: any } > { // https://reactjs.org/docs/error-boundaries.html constructor(props: {}) { super(props); this.state = { error: null, errorInfo: null }; } componentDidCatch(error: Error, errorInfo: ErrorInfo) { // Catch errors in any components below and re-render with error message this.setState({ error: error, errorInfo: errorInfo, }); // You can also log error messages to an error reporting service here } render() { if (this.state.errorInfo) { // Error path return (