import { useState } from "react" import { RiCheckboxCircleFill } from "react-icons/ri" import { IoAdd } from "react-icons/io5" import { cn } from "@/lib/utils" import { ChannelInfo } from "@/types" import { isCertifiedUser } from "@/app/certification" import { DefaultAvatar } from "../default-avatar" export function ChannelCard({ channel, onClick, className = "", }: { channel: ChannelInfo onClick?: (channel: ChannelInfo) => void className?: string }) { const [channelThumbnail, setChannelThumbnail] = useState(channel.thumbnail) const handleBadChannelThumbnail = () => { try { if (channelThumbnail) { setChannelThumbnail("") } } catch (err) { } } const isCreateButton = !channel.id return ( //
{ if (onClick) { onClick(channel) } }} >
{isCreateButton ?
: channelThumbnail ? : }
{ isCreateButton ? "Create a channel" : channel.label }
{/*
by @{channel.datasetUser}
*/} {!isCreateButton &&
@{channel.datasetUser}
{isCertifiedUser(channel.datasetUser) ?
: null}
} {!isCreateButton &&
{0} videos
-
{channel.likes} likes
}
// ) }