|
@ -1,5 +1,12 @@ |
|
|
import React, { useEffect, useState } from 'react'; |
|
|
import React, { useEffect, useState } from 'react'; |
|
|
import { TitleHeader, DragRegion, WindowControl, WindowControlButton } from './styled'; |
|
|
import { |
|
|
|
|
|
TitleHeader, |
|
|
|
|
|
DragRegion, |
|
|
|
|
|
WindowControl, |
|
|
|
|
|
WindowControlButton, |
|
|
|
|
|
MacControl, |
|
|
|
|
|
MacControlButton, |
|
|
|
|
|
} from './styled'; |
|
|
import { useAppSelector } from '../../redux/hooks'; |
|
|
import { useAppSelector } from '../../redux/hooks'; |
|
|
import { getCurrentEntryList } from '../../shared/utils'; |
|
|
import { getCurrentEntryList } from '../../shared/utils'; |
|
|
import logo from '../../../assets/icon.png'; |
|
|
import logo from '../../../assets/icon.png'; |
|
@ -7,7 +14,11 @@ import logo from '../../../assets/icon.png'; |
|
|
const Titlebar = ({ font }: any) => { |
|
|
const Titlebar = ({ font }: any) => { |
|
|
const playQueue = useAppSelector((state) => state.playQueue); |
|
|
const playQueue = useAppSelector((state) => state.playQueue); |
|
|
const player = useAppSelector((state) => state.player); |
|
|
const player = useAppSelector((state) => state.player); |
|
|
|
|
|
const misc = useAppSelector((state) => state.misc); |
|
|
const [title, setTitle] = useState(document.title); |
|
|
const [title, setTitle] = useState(document.title); |
|
|
|
|
|
const [hoverMin, setHoverMin] = useState(false); |
|
|
|
|
|
const [hoverMax, setHoverMax] = useState(false); |
|
|
|
|
|
const [hoverClose, setHoverClose] = useState(false); |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
const currentEntryList = getCurrentEntryList(playQueue); |
|
|
const currentEntryList = getCurrentEntryList(playQueue); |
|
@ -27,6 +38,74 @@ const Titlebar = ({ font }: any) => { |
|
|
return ( |
|
|
return ( |
|
|
<TitleHeader id="titlebar" font={font}> |
|
|
<TitleHeader id="titlebar" font={font}> |
|
|
<DragRegion id="drag-region"> |
|
|
<DragRegion id="drag-region"> |
|
|
|
|
|
{misc.titleBar === 'mac' && ( |
|
|
|
|
|
<> |
|
|
|
|
|
<div id="window-title-wrapper-mac"> |
|
|
|
|
|
<span id="window-title-mac">{title}</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<MacControl id="window-controls"> |
|
|
|
|
|
<MacControlButton |
|
|
|
|
|
minButton |
|
|
|
|
|
className="button" |
|
|
|
|
|
id="min-button" |
|
|
|
|
|
onMouseOver={() => setHoverMin(true)} |
|
|
|
|
|
onMouseLeave={() => setHoverMin(false)} |
|
|
|
|
|
> |
|
|
|
|
|
<img |
|
|
|
|
|
className="icon" |
|
|
|
|
|
draggable="false" |
|
|
|
|
|
alt="" |
|
|
|
|
|
src={`img/icons/min-mac${hoverMin ? '-hover' : ''}.png`} |
|
|
|
|
|
/> |
|
|
|
|
|
</MacControlButton> |
|
|
|
|
|
<MacControlButton |
|
|
|
|
|
maxButton |
|
|
|
|
|
className="button" |
|
|
|
|
|
id="max-button" |
|
|
|
|
|
onMouseOver={() => setHoverMax(true)} |
|
|
|
|
|
onMouseLeave={() => setHoverMax(false)} |
|
|
|
|
|
> |
|
|
|
|
|
<img |
|
|
|
|
|
className="icon" |
|
|
|
|
|
draggable="false" |
|
|
|
|
|
alt="" |
|
|
|
|
|
src={`img/icons/max-mac${hoverMax ? '-hover' : ''}.png`} |
|
|
|
|
|
/> |
|
|
|
|
|
</MacControlButton> |
|
|
|
|
|
<MacControlButton |
|
|
|
|
|
restoreButton |
|
|
|
|
|
className="button" |
|
|
|
|
|
id="restore-button" |
|
|
|
|
|
onMouseOver={() => setHoverMax(true)} |
|
|
|
|
|
onMouseLeave={() => setHoverMax(false)} |
|
|
|
|
|
> |
|
|
|
|
|
<img |
|
|
|
|
|
className="icon" |
|
|
|
|
|
src={`img/icons/max-mac${hoverMax ? '-hover' : ''}.png`} |
|
|
|
|
|
draggable="false" |
|
|
|
|
|
alt="" |
|
|
|
|
|
/> |
|
|
|
|
|
</MacControlButton> |
|
|
|
|
|
<MacControlButton |
|
|
|
|
|
className="button" |
|
|
|
|
|
id="close-button" |
|
|
|
|
|
onMouseOver={() => setHoverClose(true)} |
|
|
|
|
|
onMouseLeave={() => setHoverClose(false)} |
|
|
|
|
|
> |
|
|
|
|
|
<img |
|
|
|
|
|
className="icon" |
|
|
|
|
|
src={`img/icons/close-mac${hoverClose ? '-hover' : ''}.png`} |
|
|
|
|
|
draggable="false" |
|
|
|
|
|
alt="" |
|
|
|
|
|
/> |
|
|
|
|
|
</MacControlButton> |
|
|
|
|
|
</MacControl> |
|
|
|
|
|
</> |
|
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|
{misc.titleBar === 'windows' && ( |
|
|
|
|
|
<> |
|
|
<div id="window-title-wrapper"> |
|
|
<div id="window-title-wrapper"> |
|
|
<span id="window-title"> |
|
|
<span id="window-title"> |
|
|
<img src={logo} height="20px" width="20px" alt="" style={{ marginRight: '5px' }} /> |
|
|
<img src={logo} height="20px" width="20px" alt="" style={{ marginRight: '5px' }} /> |
|
@ -67,6 +146,8 @@ const Titlebar = ({ font }: any) => { |
|
|
/> |
|
|
/> |
|
|
</WindowControlButton> |
|
|
</WindowControlButton> |
|
|
</WindowControl> |
|
|
</WindowControl> |
|
|
|
|
|
</> |
|
|
|
|
|
)} |
|
|
</DragRegion> |
|
|
</DragRegion> |
|
|
</TitleHeader> |
|
|
</TitleHeader> |
|
|
); |
|
|
); |
|
|