aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ChannelCard/ChannelCard.tsx
blob: 7a41c22adb864d790d6f2725fb065065bae04699 (plain) (blame)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import React from "react";
import Image from "next/image";
import Countdown from "../Countdown";

type ChannelCardProps = {
    channel_id: string;
    name: string;
    avatarUrl: string;
    subscriberCount: number;
    videoCount: number;
    viewCount: number;
    suborg?: string;
    nextMilestone: string;
    nextMilestoneDays: string;
    nextMilestoneDate: string;
    diff_1d?: number;
    diff_7d?: number;
    diff_30d?: number;
};

const ChannelCard: React.FC<ChannelCardProps> = ({
    channel_id,
    name,
    avatarUrl,
    subscriberCount,
    videoCount,
    viewCount,
    suborg,
    nextMilestone,
    nextMilestoneDays,
    nextMilestoneDate,
    diff_1d,
    diff_7d,
    diff_30d,
}) => {
    return (
        <div className="max-w-4xl w-full mb-4 mt-4 rounded-xl overflow-hidden shadow-lg bg-gradient-to-r from-gray-800 via-gray-900 to-gray-800 p-4 sm:p-8 hover:shadow-2xl transition-all duration-300">
            <div className="flex flex-col sm:flex-row items-center mb-6">
                <Image
                    src={avatarUrl}
                    alt={name}
                    width={80}
                    height={80}
                    className="rounded-full border-4 border-white"
                />
                <div className="mt-4 sm:mt-0 sm:ml-6 text-center sm:text-left">
                    <h3 className="text-xl sm:text-2xl font-bold text-white">
                        {name}
                    </h3>
                    {suborg && (
                        <p className="text-sm sm:text-md text-gray-400">
                            {suborg}
                        </p>
                    )}
                </div>
            </div>
            <div className="grid grid-cols-1 sm:grid-cols-3 gap-4 sm:gap-8 text-center mb-6">
                <div>
                    <p className="text-lg sm:text-xl font-bold text-white">
                        {subscriberCount.toLocaleString()}
                    </p>
                    <p className="text-xs sm:text-sm text-gray-400">
                        Subscribers
                    </p>
                </div>
                <div>
                    <p className="text-lg sm:text-xl font-bold text-white">
                        {videoCount.toLocaleString()}
                    </p>
                    <p className="text-xs sm:text-sm text-gray-400">Videos</p>
                </div>
                <div>
                    <p className="text-lg sm:text-xl font-bold text-white">
                        {viewCount.toLocaleString()}
                    </p>
                    <p className="text-xs sm:text-sm text-gray-400">Views</p>
                </div>
                {typeof diff_1d === "number" && (
                    <div>
                        <p className="text-lg sm:text-xl font-bold text-white">
                            {diff_1d > 0
                                ? `+${diff_1d.toLocaleString()}`
                                : diff_1d.toLocaleString()}
                        </p>
                        <p className="text-xs sm:text-sm text-gray-400">
                            24 Hour Change
                        </p>
                    </div>
                )}
                {typeof diff_7d === "number" && (
                    <div>
                        <p className="text-lg sm:text-xl font-bold text-white">
                            {diff_7d > 0
                                ? `+${diff_7d.toLocaleString()}`
                                : diff_7d.toLocaleString()}
                        </p>
                        <p className="text-xs sm:text-sm text-gray-400">
                            7 Day Change
                        </p>
                    </div>
                )}
                {typeof diff_30d === "number" && (
                    <div>
                        <p className="text-lg sm:text-xl font-bold text-white">
                            {diff_30d > 0
                                ? `+${diff_30d.toLocaleString()}`
                                : diff_30d.toLocaleString()}
                        </p>
                        <p className="text-xs sm:text-sm text-gray-400">
                            30 Day Change
                        </p>
                    </div>
                )}
            </div>
            <div className="bg-gray-700 rounded-lg text-center p-4 sm:p-0 mb-6">
                <p className="text-md sm:text-lg font-semibold text-white">
                    Next Milestone: {Number(nextMilestone).toLocaleString()}
                </p>
                <p className="text-xs sm:text-sm text-gray-300">
                    Estimated Date: {nextMilestoneDate}
                </p>
                <div className="flex justify-center sm:p-2">
                    <Countdown targetDate={nextMilestoneDate} />
                </div>
            </div>

            <button
                onClick={() =>
                    window.open(
                        `https://youtube.com/channel/${channel_id}`,
                        "_blank",
                    )
                }
                className="w-full bg-red-600 hover:bg-red-700 text-white font-bold py-3 px-6 rounded-lg transition-all duration-200"
            >
                View Channel on YouTube
            </button>
        </div>
    );
};

export default ChannelCard;
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage