import { useState } from "react" import { RiCheckboxCircleFill } from "react-icons/ri" import { IoAdd } from "react-icons/io5" import { cn } from "@/lib/utils/cn" import { ChannelInfo } from "@/types/general" import { isCertifiedUser } from "@/app/certification" import { DefaultAvatar } from "../default-avatar" import { formatLargeNumber } from "@/lib/formatters/formatLargeNumber" 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 &&
{formatLargeNumber(0)} videos
-
{formatLargeNumber(channel.likes)} likes
}
// ) }