import { useEffect, useMemo, useRef } from "react" import Draggable from "./draggable/dnd/draggableDnd" import { GithubOutlined, GitlabOutlined, LinkOutlined, AudioOutlined, FileTextOutlined, DeleteFilled, DeleteOutlined, GlobalOutlined} from "@ant-design/icons" import DraggableWrapper from "./draggable/draggable" import { Button } from "antd" export function SidebarWidgetCard({ name, img, url, license, 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 (
{name}
{name}
{urlIcon} {license?.name &&
{ license.url ? {license.name} :
{license.name}
}
}
) } export function SidebarOverlayWidgetCard({ name, img, url, license, 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 ( <> {/* */}
{name}
{name}
{urlIcon} {license?.name &&
{ license.url ? {license.name} :
{license.name}
}
}
{/*
*/} ) } export function DraggableAssetCard({file, onDelete}){ 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" && }
false} draggable="false" className="tw-text-sm tw-text-back tw-pointer-events-none">{file.name}
onDelete(file)} >
) }