diff --git a/src/app/results/Channel.tsx b/src/app/results/Channel.tsx
index bf3e28e..aa4d407 100644
--- a/src/app/results/Channel.tsx
+++ b/src/app/results/Channel.tsx
@@ -23,14 +23,17 @@ export const Channel: Component<{ data: ChannelProps }> = ({ data }) => {
src={data.thumbnail}
alt={data.name}
as={NextImage}
+ className="rounded-full"
unoptimized
/>
-
+
{data.name}
-
Subscribers: {formatViewCount(data.subscribers)}
- Videos: {formatViewCount(data.videos)}
+ {formatViewCount(data.subscribers)} subscribers
+ {data.videos !== 0 && (
+ {formatViewCount(data.videos)} videos
+ )}
{data.description}
diff --git a/src/app/results/Video.tsx b/src/app/results/Video.tsx
index 9081bdd..d7d117e 100644
--- a/src/app/results/Video.tsx
+++ b/src/app/results/Video.tsx
@@ -5,10 +5,15 @@ import { Image } from "@nextui-org/image";
import NextImage from "next/image";
import { useMemo } from "react";
-import Link from "next/link";
+import formatViewCount from "@/utils/formatViewCount";
+import formatUploadedTime from "@/utils/formatUploadedTime";
+import { Link } from "@nextui-org/link";
+import NextLink from "next/link";
+import formatDuration from "@/utils/formatDuration";
export const Video: Component<{ data: VideoProps }> = ({ data }) => {
const url = `/watch?v=${data.id}`;
+ const channelUrl = `/channel/${data.author.id}`;
const videoSize = 200;
const aspectRatio = 16 / 9;
@@ -18,25 +23,57 @@ export const Video: Component<{ data: VideoProps }> = ({ data }) => {
}, [videoSize]);
return (
-
+
-
+
+
+
+ {formatDuration(data.duration)}
+
+ {data.live && (
+
+ LIVE
+
+ )}
+
+
{data.title}
+
+
{formatViewCount(data.views)} views
+ {formatUploadedTime(data.uploaded)}
+
+
+ {data.author.avatar && (
+
+ )}
+
{data.author.name}
+
+
{data.description}
-
+
);
};
diff --git a/src/client/adapters/piped/transformer.ts b/src/client/adapters/piped/transformer.ts
index 21c6c0d..b06df70 100644
--- a/src/client/adapters/piped/transformer.ts
+++ b/src/client/adapters/piped/transformer.ts
@@ -32,7 +32,11 @@ export default class Transformer {
title: data.title,
description: "",
live: false,
- author: { id: channelId, name: data.uploaderName }
+ author: {
+ id: channelId,
+ name: data.uploaderName,
+ avatar: data.uploaderAvatar
+ }
};
}
diff --git a/src/client/typings/video.ts b/src/client/typings/video.ts
index 81c3859..dce2bd7 100644
--- a/src/client/typings/video.ts
+++ b/src/client/typings/video.ts
@@ -4,6 +4,7 @@ export interface Video {
author: {
name: string;
id: string;
+ avatar?: string;
};
thumbnail: string;
description: string;
diff --git a/src/components/Search.tsx b/src/components/Search.tsx
index ed7e2b2..da1700c 100644
--- a/src/components/Search.tsx
+++ b/src/components/Search.tsx
@@ -23,13 +23,16 @@ export const Search: Component<{ initialQueryValue?: string }> = ({
const { isLoading, error, data } = useQuery({
queryKey: ["search", "suggestions", searchQueryDebounced],
- queryFn: () => client.getSearchSuggestions(searchQueryDebounced),
- enabled: searchQueryDebounced.length !== 0
+ queryFn: () => {
+ if (searchQueryDebounced.length === 0) return [];
+
+ return client.getSearchSuggestions(searchQueryDebounced);
+ }
});
- const handleSubmit = useCallback(() => {
- router.push(`/results?search_query=${searchQuery}`);
- }, [searchQuery]);
+ const submit = useCallback((query: string) => {
+ router.push(`/results?search_query=${query}`);
+ }, []);
const suggestions = useMemo(
() =>
@@ -41,21 +44,26 @@ export const Search: Component<{ initialQueryValue?: string }> = ({
);
return (
-