File size: 2,164 Bytes
b965e2b
 
1f122c3
 
 
b965e2b
 
1f122c3
 
f62b8d3
1f122c3
 
 
f62b8d3
1f122c3
 
b965e2b
 
 
 
 
 
 
 
 
 
 
1f122c3
 
 
 
 
f62b8d3
93f8352
f27679f
f62b8d3
93f8352
f27679f
f62b8d3
1f122c3
f62b8d3
 
 
 
 
 
 
1f122c3
 
93f8352
 
 
1f122c3
 
b965e2b
 
 
 
1f122c3
 
f62b8d3
f27679f
 
93f8352
1f122c3
93f8352
f27679f
 
 
 
 
 
93f8352
f27679f
 
93f8352
 
f27679f
93f8352
f27679f
1f122c3
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { useState } from "react"

import { cn } from "@/lib/utils"
import { ChannelInfo } from "@/types"

const defaultChannelThumbnail = "/huggingface-avatar.jpeg"

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 !== defaultChannelThumbnail) {
        setChannelThumbnail(defaultChannelThumbnail)
      }
    } catch (err) {
      
    }
  }

  return (
  <div
    className={cn(
      `flex flex-col`,
      `items-center justify-center`,
      `space-y-1`,
      `w-52 h-52`,
      `rounded-lg`,
      `hover:bg-neutral-800/30`,
      `text-neutral-100/80 hover:text-neutral-100/100`,
      `cursor-pointer`,
      className,
    )}
    onClick={() => {
      if (onClick) {
        onClick(channel)
      }
    }}
    >
      <div
        className={cn(
          `flex flex-col items-center justify-center`,
          `rounded-full overflow-hidden`,
          `w-26 h-26`
        )}
      >
        <img
          src={channelThumbnail}
          onError={handleBadChannelThumbnail}
        />
      </div>

      <div className={cn(
        `flex flex-col`,
         `items-center justify-center text-center`,
         `space-y-1`
      )}>
        <div className="text-center text-base font-medium text-zinc-100">{channel.label}</div>
        {/*<div className="text-center text-sm font-semibold">
          by <a href={
            `https://huggingface.co/${channel.datasetUser}`
          } target="_blank">@{channel.datasetUser}</a>
        </div>
        */}
        <div className="text-center text-xs font-medium">
          @{channel.datasetUser}
        </div>
        <div className="flex flex-row items-center justify-center text-neutral-400">
          <div className="text-center text-xs">{0} videos</div>
          <div className="px-1">-</div>
          <div className="text-center text-xs">{channel.likes} likes</div>
        </div>
      </div>
    </div>
  )
}