Skip to content

Commit

Permalink
fix(media-player): render no image if media is present
Browse files Browse the repository at this point in the history
  • Loading branch information
MahtabBukhari committed Oct 31, 2024
1 parent a1a314c commit 5f750e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/App/SideBar/SelectedNodeView/Default/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -26,6 +27,8 @@ export const Default = () => {
const [isPlaying, setIsPlaying] = useState(false)
const [boostAmount, setBoostAmount] = useState<number>(selectedNode?.properties?.boost || 0)

const { playingNode } = usePlayerStore((s) => s)

useEffect(() => {
setBoostAmount(selectedNode?.properties?.boost || 0)
}, [selectedNode])
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 5f750e5

Please sign in to comment.