import { useEffect, useMemo, useRef } from "react" import Draggable from "./utils/draggable" import { FileImageOutlined, GithubOutlined, GitlabOutlined, LinkOutlined, AudioOutlined, VideoCameraOutlined, FileTextOutlined} from "@ant-design/icons" export function DraggableWidgetCard({name, img, url}){ const urlIcon = useMemo(() => { if (url){ const host = new URL(url).hostname.toLowerCase() if (host === "github.com"){ return }else if(host === "gitlab.com"){ return }else{ return } } }, [url]) useEffect(() => { }, []) return ( {name} {urlIcon} ) } export function DraggableAssetCard({file}){ const videoRef = useRef() useEffect(() => { function playOnMouseEnter(){ videoRef.current.play() } function pauseOnMouseEnter(){ videoRef.current.pause() videoRef.current.currentTime = 0 } if (videoRef.current){ videoRef.current.addEventListener("mouseenter", playOnMouseEnter) videoRef.current.addEventListener("mouseleave", pauseOnMouseEnter) } return () => { if (videoRef.current){ videoRef.current.removeEventListener("mouseenter", playOnMouseEnter) videoRef.current.removeEventListener("mouseleave", pauseOnMouseEnter) } } }, [videoRef]) return ( { file.fileType === "image" && } { file.fileType === "video" && Your browser does not support the video tag. } { file.fileType === "audio" && } { file.fileType === "others" && } {file.name} ) }