import React, { useContext, useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import Link from 'next/link'; import Head from 'next/head' import { differenceInSeconds } from "date-fns"; import { useRouter } from 'next/router'; import { Layout, Menu, Popover } from 'antd'; import { SettingOutlined, HomeOutlined, LineChartOutlined, ToolOutlined, PlayCircleFilled, MinusSquareFilled, } from '@ant-design/icons'; import classNames from 'classnames'; import { upgradeVersionAvailable } from "../../utils/apis"; import { parseSecondsToDurationString } from '../../utils/format' import OwncastLogo from './logo'; import { ServerStatusContext } from '../../utils/server-status-context'; import adminStyles from '../../styles/styles.module.scss'; let performedUpgradeCheck = false; export default function MainLayout(props) { const { children } = props; const context = useContext(ServerStatusContext); const { online, broadcaster, versionNumber } = context || {}; const router = useRouter(); const { route } = router || {}; const { Header, Footer, Content, Sider } = Layout; const { SubMenu } = Menu; const streamDurationString = online ? parseSecondsToDurationString(differenceInSeconds(new Date(), new Date(broadcaster.time))) : ""; const content = (