From 5f750e5ae5d420828d396f253db703926b0a16b3 Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 31 Oct 2024 18:42:54 +0500 Subject: [PATCH] fix(media-player): render no image if media is present --- .../App/SideBar/SelectedNodeView/Default/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/App/SideBar/SelectedNodeView/Default/index.tsx b/src/components/App/SideBar/SelectedNodeView/Default/index.tsx index ec98f330c..5949eb134 100644 --- a/src/components/App/SideBar/SelectedNodeView/Default/index.tsx +++ b/src/components/App/SideBar/SelectedNodeView/Default/index.tsx @@ -18,6 +18,7 @@ import { useAppStore } from '~/stores/useAppStore' import { useSelectedNode } from '~/stores/useGraphStore' import { colors } from '~/utils/colors' import { BoostAmt } from '../../../Helper/BoostAmt' +import { usePlayerStore } from '~/stores/usePlayerStore' export const Default = () => { const selectedNode = useSelectedNode() @@ -26,6 +27,8 @@ export const Default = () => { const [isPlaying, setIsPlaying] = useState(false) const [boostAmount, setBoostAmount] = useState(selectedNode?.properties?.boost || 0) + const { playingNode } = usePlayerStore((s) => s) + useEffect(() => { setBoostAmount(selectedNode?.properties?.boost || 0) }, [selectedNode]) @@ -76,7 +79,7 @@ export const Default = () => { return null } - const hasImage = !!selectedNode.properties?.image_url + const hasImage = !playingNode?.ref_id && !!selectedNode.properties?.image_url const hasAudio = !!selectedNode.properties?.audio_EN const customKeys = selectedNode.properties || {} const sourceLink = selectedNode.properties?.source_link @@ -155,7 +158,7 @@ const NodeDetail = ({ label, value, hasAudio, isPlaying, togglePlay }: Props) => const isLong = (value as string).length > 140 const searchTerm = useAppStore((s) => s.currentSearch) - if (!value || label === 'Audio EN' || label === 'Source Link') { + if (!value || label === 'Audio EN' || label === 'Source Link' || label === 'Image Url') { return null }