import React from "react" import { WithPlayerContext, Context } from "contexts/WithPlayerContext" import { Icons } from "components/Icons" import Marquee from "react-fast-marquee" import * as antd from "antd" import classnames from "classnames" import SeekBar from "components/Player/SeekBar" import Controls from "components/Player/Controls" import RGBStringToValues from "utils/rgbToValues" import LikeButton from "components/LikeButton" import "./index.less" function isOverflown(parent, element) { if (!parent || !element) { return false } const parentRect = parent.getBoundingClientRect() const elementRect = element.getBoundingClientRect() return elementRect.width > parentRect.width } const ServiceIndicator = (props) => { if (!props.service) { return null } switch (props.service) { case "tidal": { return
} default: { return null } } } const ExtraActions = (props) => { return
} />
} const Player = (props) => { const ctx = React.useContext(Context) const contentRef = React.useRef() const titleRef = React.useRef() const subtitleRef = React.useRef() const [topActionsVisible, setTopActionsVisible] = React.useState(false) const [titleOverflown, setTitleOverflown] = React.useState(false) const [subtitleOverflown, setSubtitleOverflown] = React.useState(false) const handleOnMouseInteraction = (e) => { if (e.type === "mouseenter") { setTopActionsVisible(true) } else { setTopActionsVisible(false) } } const { title, album, artist, liked, service, lyricsEnabled, cover_analysis, cover, } = ctx.track_manifest ?? {} const playing = ctx.playback_status === "playing" const stopped = ctx.playback_status === "stopped" const titleText = (!playing && stopped) ? "Stopped" : (title ?? "Untitled") const subtitleText = "" React.useEffect(() => { const titleIsOverflown = isOverflown(contentRef.current, titleRef.current) setTitleOverflown(titleIsOverflown) }, [title]) return
{ !ctx.control_locked && } shape="circle" /> } { lyricsEnabled && } shape="circle" onClick={() => app.location.push("/lyrics")} /> } {/* } > HyperDrive */} } shape="circle" onClick={() => app.cores.player.close()} />

{titleText}

{ titleOverflown &&

{titleText}

}

{artist ?? ""}

} const PlayerContextHandler = () => { return } export default PlayerContextHandler