From 0eacd66b29db91e15607a0ac35e9de20cf497928 Mon Sep 17 00:00:00 2001 From: ARREY-ETTA BESSONG EKEP OBASI Date: Fri, 15 Dec 2023 18:33:41 +0100 Subject: [PATCH] feat: implemented expand functionality for miniplayer --- .../ActionsToolbar/PlayerControl/index.tsx | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/components/App/ActionsToolbar/PlayerControl/index.tsx b/src/components/App/ActionsToolbar/PlayerControl/index.tsx index 2fe8dcf04..6777ce25a 100644 --- a/src/components/App/ActionsToolbar/PlayerControl/index.tsx +++ b/src/components/App/ActionsToolbar/PlayerControl/index.tsx @@ -6,7 +6,7 @@ import PlayIcon from '~/components/Icons/PlayIcon' import { Avatar } from '~/components/common/Avatar' import { Flex } from '~/components/common/Flex' import { useAppStore } from '~/stores/useAppStore' -import { useSelectedNode } from '~/stores/useDataStore' +import { useDataStore, useSelectedNode } from '~/stores/useDataStore' import { usePlayerStore } from '~/stores/usePlayerStore' import { videoTimeToSeconds } from '~/utils' import { colors } from '~/utils/colors' @@ -16,7 +16,7 @@ export const PlayerControl = () => { const containerRef = useRef(null) const [scrollWidth, setScrollWidth] = useState(0) const selectedNode = useSelectedNode() - + const setSelectedNode = useDataStore((s) => s.setSelectedNode) const sidebarIsOpen = useAppStore((s) => s.sidebarIsOpen) const [isPlaying, setIsPlaying, playingTime, playingNode, miniPlayerIsVisible, setMiniPlayerIsVisible] = @@ -42,14 +42,19 @@ export const PlayerControl = () => { setScrollWidth(textWidth - containerWidth) }, []) - const onClose = () => { + const onClose = (e: React.MouseEvent) => { setMiniPlayerIsVisible(false) + e.stopPropagation() + } + + const openNodeDetails = () => { + setSelectedNode(playingNode) } const showPlayer = (sidebarIsOpen && selectedNode?.ref_id !== playingNode?.ref_id) || (playingNode && !sidebarIsOpen) return miniPlayerIsVisible && playingNode && showPlayer ? ( - + @@ -60,11 +65,17 @@ export const PlayerControl = () => {
{playingNode.show_title}
- setIsPlaying(!isPlaying)} size="small"> + { + setIsPlaying(!isPlaying) + e.stopPropagation() + }} + size="small" + > {!isPlaying ? : }
- onClose()}> + onClose(e)}>
@@ -84,6 +95,8 @@ const Wrapper = styled(Flex).attrs({ width: 320px; height: 72px; margin-top: 16px; + cursor: pointer; + z-index: 0; ` const Controls = styled(Flex).attrs({ @@ -116,6 +129,7 @@ const Info = styled(Flex).attrs({ const Close = styled(IconButton)` padding: 8px; color: ${colors.GRAY6}; + z-index: 100000; ` const Action = styled(IconButton)` @@ -124,6 +138,7 @@ const Action = styled(IconButton)` padding: 2px; margin-left: 8px; overflow: hidden; + z-index: 100000; } `