blob: 6c19e44830bffc823dffafac9c2d6719ad0ccc61 (
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
|
import React from "react";
import ChannelRow from "./SubscriberTableRow";
interface ChannelDataProp {
channel_name: string;
profile_pic: string;
subscribers: number;
sub_org: string;
video_count: number;
day_diff: number;
views: number;
diff_1d: number;
diff_7d: number;
diff_30d: number;
}
interface SubscriberDataTableProp {
channel_data: ChannelDataProp[];
timestamp: string;
}
const DataTable = ({ channel_data, timestamp }: SubscriberDataTableProp) => {
if (!channel_data) {
return null;
}
return (
<>
<div
className="text-center sm:mt-5"
style={{ fontFamily: "Quantico, sans-serif" }}
>
<h1 className="text-2xl font-bold text-gray-800">
Subscriber Count
</h1>
<p className="text-gray-500 text-sm">
Updated Hourly. Retrieved at: {timestamp}
</p>
</div>
<div className="px-2 sm:px-48 py-4 sm:py-8 relative rounded-l text-left overflow-auto">
<table className="w-full text-m sm:text-xl text-black bg-white">
<thead
className="text-m sm:text-lg text-white rounded-md"
style={{ backgroundColor: "black" }}
>
<tr>
<th
scope="col"
className="py-1 px-1 sm:px-3 hidden sm:table-cell"
>
RANK
</th>
<th scope="col" className="py-1 px-1 sm:px-3">
CHANNEL
</th>
<th
scope="col"
className="py-1 px-1 sm:px-3 hidden sm:table-cell"
>
GROUP
</th>
<th
scope="col"
className="py-1 px-1 sm:px-3 hidden sm:table-cell"
>
VIDEO COUNT
</th>
<th
scope="col"
className="py-1 px-1 sm:px-3 hidden sm:table-cell"
>
VIEW COUNT
</th>
<th scope="col" className="py-1 px-1 sm:px-3">
SUBSCRIBERS
</th>
<th scope="col" className="py-1 px-1 sm:px-3">
DIFF (24H)
</th>
</tr>
</thead>
<tbody>
{channel_data.map((channel, index) => (
<ChannelRow
key={index}
channel={channel}
index={index}
/>
))}
</tbody>
</table>
</div>
</>
);
};
export default DataTable;
export type { SubscriberDataTableProp };
export type { ChannelDataProp };
|