import React, { useEffect, useRef, useState } from "react"; import { OlRoundStateButton, OlStateButton, OlLockStateButton } from "../components/olstatebutton"; import { faSkull, faCamera, faFlag, faLink, faUnlink, faBars, faVolumeHigh } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { EventsConsumer } from "../../eventscontext"; import { StateConsumer } from "../../statecontext"; import { OlDropdownItem, OlDropdown } from "../components/oldropdown"; import { OlLabelToggle } from "../components/ollabeltoggle"; import { getApp, IP, connectedToServer } from "../../olympusapp"; import { olButtonsVisibilityAirbase, olButtonsVisibilityAircraft, olButtonsVisibilityDcs, olButtonsVisibilityGroundunit, olButtonsVisibilityGroundunitSam, olButtonsVisibilityHelicopter, olButtonsVisibilityHuman, olButtonsVisibilityNavyunit, olButtonsVisibilityOlympus, } from "../components/olicons"; import { FaChevronLeft, FaChevronRight } from "react-icons/fa6"; export function Header() { const [scrolledLeft, setScrolledLeft] = useState(true); const [scrolledRight, setScrolledRight] = useState(false); const [audioEnabled, setAudioEnabled] = useState(false); /* Initialize the "scroll" position of the element */ var scrollRef = useRef(null); useEffect(() => { if (scrollRef.current) onScroll(scrollRef.current); }); function onScroll(el) { const sl = el.scrollLeft; const sr = el.scrollWidth - el.scrollLeft - el.clientWidth; sl < 1 && !scrolledLeft && setScrolledLeft(true); sl > 1 && scrolledLeft && setScrolledLeft(false); sr < 1 && !scrolledRight && setScrolledRight(true); sr > 1 && scrolledRight && setScrolledRight(false); } return ( {(appState) => ( {() => ( )} )} ); }