import { useEffect, useMemo, useRef } from "react" import Draggable from "./utils/draggableDnd" import { FileImageOutlined, GithubOutlined, GitlabOutlined, LinkOutlined, AudioOutlined, VideoCameraOutlined, FileTextOutlined} from "@ant-design/icons" import DraggableWrapper from "./draggable/draggable" import { useDragContext } from "./draggable/draggableContext" export function SidebarWidgetCard({ name, img, url, widgetClass, innerRef}){ 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]) return ( // // ) } 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.name} } { file.fileType === "video" && } { file.fileType === "audio" && } { file.fileType === "others" && }
{file.name}
) }