From adc88dbdf3274d4d0cf15b5f2cf7b0bbb939bfe0 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 18 Nov 2023 21:21:22 -0800 Subject: v3: re-write frontend using next js --- src/app/_componenets/Footer/Footer.tsx | 27 +++++++++ .../SubscriberTable/SubscriberTable.tsx | 67 ++++++++++++++++++++++ .../SubscriberTable/SubscriberTableRow.tsx | 35 +++++++++++ src/app/_componenets/TitleBar/TitleBar.tsx | 18 ++++++ 4 files changed, 147 insertions(+) create mode 100644 src/app/_componenets/Footer/Footer.tsx create mode 100644 src/app/_componenets/SubscriberTable/SubscriberTable.tsx create mode 100644 src/app/_componenets/SubscriberTable/SubscriberTableRow.tsx create mode 100644 src/app/_componenets/TitleBar/TitleBar.tsx (limited to 'src/app/_componenets') diff --git a/src/app/_componenets/Footer/Footer.tsx b/src/app/_componenets/Footer/Footer.tsx new file mode 100644 index 0000000..f23c677 --- /dev/null +++ b/src/app/_componenets/Footer/Footer.tsx @@ -0,0 +1,27 @@ + +import React from 'react'; + +const Footer = () => { + return ( + + ); +}; + +export default Footer; diff --git a/src/app/_componenets/SubscriberTable/SubscriberTable.tsx b/src/app/_componenets/SubscriberTable/SubscriberTable.tsx new file mode 100644 index 0000000..a538bdd --- /dev/null +++ b/src/app/_componenets/SubscriberTable/SubscriberTable.tsx @@ -0,0 +1,67 @@ +import React from "react"; +import Image from "next/image"; +import ChannelRow from "./SubscriberTableRow"; + +interface ChannelDataProp { + channel_name: string; + profile_pic: string; + subscribers: number; + sub_org: string; + video_count: number; + day_diff: number; +} + +interface SubscriberDataTableProp { + channel_data: ChannelDataProp[]; + timestamp: string; +} + +const DataTable = ({ channel_data, timestamp }: SubscriberDataTableProp) => { + if (!channel_data) { + return null; + } + +return ( + <> +
+

Subscriber Count

+

Last Updated: {timestamp}

+
+
+ + + + + + + + + + + + + {channel_data.map((channel, index) => ( + + ))} + +
+ RANK + + CHANNEL + + GROUP + + VIDEO COUNT + + SUBSCRIBERS + + DIFF (24H) +
+
+ +); +}; + +export default DataTable; +export type { SubscriberDataTableProp }; +export type { ChannelDataProp }; diff --git a/src/app/_componenets/SubscriberTable/SubscriberTableRow.tsx b/src/app/_componenets/SubscriberTable/SubscriberTableRow.tsx new file mode 100644 index 0000000..619a5b8 --- /dev/null +++ b/src/app/_componenets/SubscriberTable/SubscriberTableRow.tsx @@ -0,0 +1,35 @@ +"use client" +import React from 'react'; +import Image from 'next/image'; +import { ChannelDataProp } from './SubscriberTable'; + +interface ChannelRowProps { + channel: ChannelDataProp; + index: number; +} + +const ChannelRow: React.FC = ({ channel, index }) => ( + + {index + 1} + + {channel.channel_name} + + {channel.channel_name} + + + {channel.sub_org} + {channel.video_count} + {Number(channel.subscribers).toLocaleString()} + + {channel.day_diff > 0 ? `+${Number(channel.day_diff).toLocaleString()}` : Number(channel.day_diff).toLocaleString()} + + +); + +export default ChannelRow; \ No newline at end of file diff --git a/src/app/_componenets/TitleBar/TitleBar.tsx b/src/app/_componenets/TitleBar/TitleBar.tsx new file mode 100644 index 0000000..27bebfc --- /dev/null +++ b/src/app/_componenets/TitleBar/TitleBar.tsx @@ -0,0 +1,18 @@ +import React from 'react'; +import Image from 'next/image'; + +interface TitleBarProps { + title: string; +} + +const TitleBar: React.FC = ({ title }) => { + return ( +
+
+ {title} +
+
+ ); +}; + +export default TitleBar; \ No newline at end of file -- cgit v1.2.3