From 9c1a95e3ff4eab47cd904a290b675f6a5025fc25 Mon Sep 17 00:00:00 2001 From: Guusvanmeerveld Date: Tue, 22 Mar 2022 00:05:10 +0100 Subject: [PATCH] Added functionality to trending page --- package.json | 3 +- src/components/Navbar/index.tsx | 2 +- src/components/Video/Grid.tsx | 2 +- src/components/Video/index.tsx | 46 ++++++++++++++---- src/interfaces/channel.ts | 45 +++++++++++++++++ src/interfaces/video.ts | 42 +++++++++++++++- src/pages/_app.tsx | 18 +++++-- src/pages/trending.tsx | 39 ++++++++------- src/utils/conversions.ts | 26 ++++++++++ src/utils/index.ts | 14 ++++++ tsconfig.json | 2 + yarn.lock | 85 ++++++++++++++++++++++++++++++++- 12 files changed, 287 insertions(+), 37 deletions(-) create mode 100644 src/interfaces/channel.ts create mode 100644 src/utils/conversions.ts create mode 100644 src/utils/index.ts diff --git a/package.json b/package.json index f05e88e..f8dbfcf 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "next": "^12.1.0", "next-seo": "^5.1.0", "react": "^17.0.2", - "react-dom": "^17.0.2" + "react-dom": "^17.0.2", + "react-query": "^3.34.16" }, "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^3.2.0", diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx index 744bb76..32c3927 100644 --- a/src/components/Navbar/index.tsx +++ b/src/components/Navbar/index.tsx @@ -65,7 +65,7 @@ const Navbar: FC = () => { pages={pages} /> - + = ({ videos }) => { {videos.map((video) => ( diff --git a/src/components/Video/index.tsx b/src/components/Video/index.tsx index ffc322e..1decaa5 100644 --- a/src/components/Video/index.tsx +++ b/src/components/Video/index.tsx @@ -1,33 +1,59 @@ +import Link from "next/link"; import { useRouter } from "next/router"; import { FC } from "react"; +import { useQuery } from "react-query"; + +import Avatar from "@mui/material/Avatar"; +import Box from "@mui/material/Box"; import Card from "@mui/material/Card"; import CardActionArea from "@mui/material/CardActionArea"; import CardContent from "@mui/material/CardContent"; import CardMedia from "@mui/material/CardMedia"; +import Tooltip from "@mui/material/Tooltip"; import Typography from "@mui/material/Typography"; -import { Video } from "@interfaces/video"; +import { abbreviateNumber } from "@src/utils"; + +import { Channel, Quality } from "@interfaces/channel"; +import { Video as VideoModel } from "@interfaces/video"; -const Video: FC