import React from "react"; import {NavLink} from "react-router-dom"; import {Dropdown, Menu} from "semantic-ui-react"; import {Media, SettingsContext, ThemeContext} from "../contexts/contexts"; import Icon from "semantic-ui-react/dist/commonjs/elements/Icon"; import {CPUTemperatureIcon, DarkModeToggle, HotspotStatusIcon, NAME, SystemLoadIcon} from "./Common"; import {ShareButton} from "./Share"; import {useWROLMode} from "../hooks/customHooks"; import {SearchIconButton} from "./Search"; const links = [ {text: 'Videos', to: '/videos', key: 'videos'}, {text: 'Archive', to: '/archive', key: 'archive'}, {text: 'Map', to: '/map', key: 'map'}, {text: 'Zim', to: '/zim', key: 'zim'}, {text: 'Files', to: '/files', key: 'files'}, { text: 'More', key: 'more', links: [ {text: 'Inventory', to: '/inventory', key: 'inventory'}, {to: '/more/otp', text: 'One Time Pad', end: true}, {to: '/more/vin', text: 'VIN Decoder', end: true}, {to: '/more/calculators', text: 'Calculators', end: true}, {to: '/more/statistics', text: 'Statistics', end: true}, ] }, ]; const help = {to: '/help', text: 'Help', key: 'help'}; const admin = {to: '/admin', text: 'Admin', key: 'admin'}; const rightLinks = [help, admin]; const collapsedLinks = links.concat([help, admin]); function DropdownLinks({link}) { return {link.links.map(l => )} } function MenuLink({link}) { // Wrapper around NavLink to handle Navlink/Dropdown change. if (link.links) { return } else { const end = link.end ? {end: true} : {end: undefined}; return {link.text} } } function NavIconWrapper(props) { return
{props.children}
} export function NavBar() { const wrolModeEnabled = useWROLMode(); const {settings} = React.useContext(SettingsContext); const wrolpiIcon = WROLPi Home Icon; const name = {NAME || wrolpiIcon}; const topNavText = wrolModeEnabled ? <>{name}  : name; const {i} = React.useContext(ThemeContext); const navColor = settings && settings.nav_color ? settings.nav_color : 'violet'; const homeLink = {topNavText} ; // Display the temperature icon first because it can cause the system to throttle. const warningIcon = }/> const icons = {warningIcon} ; return <> {homeLink} {icons} {collapsedLinks.map(i => )} {homeLink} {links.map(i => )} {icons} {rightLinks.map(i => )} }