import { useContext } from "react"; import styled from "styled-components"; import Link from "next/link"; import { faBackwardStep, faForwardStep, faPause, faPlay, faPlus, faXmark } from "@fortawesome/free-solid-svg-icons"; import { Column } from "@/components/box/Flex"; import { Solid } from "@/components/box/Solid"; import { IconTextButton } from "@/components/button/IconTextButton"; import { PlaylistTrackAddDialog } from "@/components/dialog/PlaylistTrackAddDialog"; import { Icon } from "@/components/icon/Icon"; import { ShareMenu } from "@/components/menu/ShareMenu"; import { Text } from "@/components/text/Text"; import { ConditionalWrapper } from "@/components/utils/ConditionalWrapper"; import { Performances } from "@/components/utils/Performances"; import { SongTitle } from "@/components/utils/SongTitle"; import { ProgressBar } from "@/components/video-player/ProgressBar"; import { VideoPlayerContext } from "@/components/video-player/VideoPlayer"; import { VolumeControl } from "@/components/video-player/VolumeControl"; import PlayerContext from "@/context/playerContext"; import theme from "@/theme"; const StyledPlayerBar = styled(Solid)` position: relative; display: grid; grid-template-columns: 1fr auto 1fr; grid-gap: 16px; align-items: center; padding: 10px 32px; transition: opacity 100ms; @media (max-width: ${theme.breakpoints.tabletMax}) { grid-template-columns: 1fr auto; padding: 8px 16px; } [data-fullscreen] & { position: fixed; inset: auto 0 0 0; background-color: rgba(46, 41, 58, 0.8); } [data-fullscreen] [data-relaxed] & { opacity: 0; transition: opacity 500ms; } `; const StyledPlayerBarControls = styled.div` display: flex; gap: 16px; @media (max-width: ${theme.breakpoints.tabletMax}) { & > :first-child, & > :last-child { display: none; } } `; const StyledPlayerBarControl = styled(IconTextButton)` font-size: 2rem; `; const StyledPlayerBarActions = styled.div` align-self: stretch; display: flex; gap: 16px; align-items: center; @media (max-width: ${theme.breakpoints.tabletMax}) { display: none; } `; const StyledVolumeControl = styled(VolumeControl)` margin-right: auto; `; export function VideoPlayerBar() { const context = useContext(VideoPlayerContext); if (!context) { throw new Error("VideoPlayerBar needs to be inside VideoPlayer!"); } const { video, entry, background, videoPagePath, previousVideoPath, playPreviousTrack, nextVideoPath, playNextTrack, isPlaying, togglePlay, videoUrl, audioUrl, } = context; const theme = entry.theme; const anime = theme.anime; const { clearWatchList } = useContext(PlayerContext); return ( - {theme.type} {theme.sequence || null} {theme.group && ` (${theme.group.name})`} from {anime.name} {!!theme.song?.performances?.length && ( Performed )} {previousVideoPath ? ( {children}} > playPreviousTrack(!background)} /> ) : ( )} ) } isCircle onClick={togglePlay} /> {nextVideoPath ? ( {children}} > playNextTrack(!background)} /> ) : ( )} Add to Playlist } /> clearWatchList()} /> ); }