import React from "react"; import { ActionIcon } from "@mantine/core"; import { decodeEntities, formatTimestamp } from "../../utils/utils"; import classes from "./ChatVideoCard.module.css"; import { IconArrowUp, IconBrandYoutubeFilled, IconFile, IconMagnetFilled, IconPlayerPlayFilled, IconPlaylistAdd, IconTrash, } from "@tabler/icons-react"; const ChatVideoCard: React.FC<{ video: PlaylistVideo; index: number; controls?: boolean; onPlay?: (index: number) => void; onRemove?: (index: number) => void; onPlayNext?: (index: number) => void; onSetMedia?: (value: string) => void; onPlaylistAdd?: (value: string) => void; disabled?: boolean; }> = (props) => { const { video, index, controls, onPlay, onPlayNext, onRemove, onSetMedia, disabled, onPlaylistAdd, } = props; const handlePlayClick = React.useCallback( (e: any) => { if (onPlay) { onPlay(index); } }, [onPlay, index], ); const handlePlayNextClick = React.useCallback( (e: any) => { e.stopPropagation(); e.nativeEvent.stopImmediatePropagation(); if (onPlayNext) { onPlayNext(index); } }, [onPlayNext, index], ); const handleRemoveClick = React.useCallback( (e: any) => { e.stopPropagation(); e.nativeEvent.stopImmediatePropagation(); if (onRemove) { onRemove(index); } }, [onRemove, index], ); return (