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 +++ src/app/globals.css | 24 ---- src/app/layout.tsx | 9 +- src/app/page.tsx | 138 +++++---------------- src/pages/stats/[slug].tsx | 16 +++ 8 files changed, 197 insertions(+), 137 deletions(-) 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 create mode 100644 src/pages/stats/[slug].tsx (limited to 'src') 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 diff --git a/src/app/globals.css b/src/app/globals.css index fd81e88..b5c61c9 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1,27 +1,3 @@ @tailwind base; @tailwind components; @tailwind utilities; - -:root { - --foreground-rgb: 0, 0, 0; - --background-start-rgb: 214, 219, 220; - --background-end-rgb: 255, 255, 255; -} - -@media (prefers-color-scheme: dark) { - :root { - --foreground-rgb: 255, 255, 255; - --background-start-rgb: 0, 0, 0; - --background-end-rgb: 0, 0, 0; - } -} - -body { - color: rgb(var(--foreground-rgb)); - background: linear-gradient( - to bottom, - transparent, - rgb(var(--background-end-rgb)) - ) - rgb(var(--background-start-rgb)); -} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 40e027f..ae0349f 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,12 +1,13 @@ import type { Metadata } from 'next' import { Inter } from 'next/font/google' +import Footer from './_componenets/Footer/Footer' import './globals.css' const inter = Inter({ subsets: ['latin'] }) export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', + title: 'Nijitracker - Nijisanji Subscriber Tracker', + description: 'Nijitracker, historical subscriber data for members of Nijisanji', } export default function RootLayout({ @@ -16,7 +17,9 @@ export default function RootLayout({ }) { return ( - {children} + {children} +