FIX: Thumbnails in VodsDashboard

This commit is contained in:
EvanLin3141
2025-03-05 16:32:12 +00:00
parent 741a6f605b
commit 5c0e4a006f
2 changed files with 36 additions and 25 deletions

View File

@@ -1,16 +1,27 @@
import React from "react";
import ListRow from "../Layout/ListRow";
import { VodType } from "../../types/VodType";
import { useNavigate } from "react-router-dom";
interface VodsDashboardProps {
vods: VodType[];
}
const VodsDashboard: React.FC<VodsDashboardProps> = ({ vods }) => {
const handleVodClick = (vodUrl: string) => {
window.open(vodUrl, "_blank");
const navigate = useNavigate();
const handleVodClick = (vodId: string) => {
if (vods.length > 0) {
navigate(`/stream/${vods[0].username}/vods/${vodId}`);
}
};
// Ensure each VOD has a hardcoded thumbnail path
const thumbnails = vods.map((vod) => ({
...vod,
thumbnail: `/vods/${vod.username}/${vod.vod_id}.png`,
}));
return (
<div className="w-full">
<h2 className="text-3xl font-bold text-white mb-6">Past Broadcasts</h2>
@@ -23,7 +34,7 @@ const VodsDashboard: React.FC<VodsDashboardProps> = ({ vods }) => {
<ListRow
type="vod"
variant="vodDashboard"
items={vods}
items={thumbnails} // Use modified VODs with hardcoded thumbnail
wrap={false}
onItemClick={handleVodClick}
extraClasses="bg-black/50"

View File

@@ -50,7 +50,7 @@ const Vods: React.FC = () => {
<div className="mt-[3em] w-screen flex justify-center">
<div
id="vods-container"
className="w-[96vw] bg-slate-50/35 rounded-lg p-4 overflow-x-auto whitespace-nowrap scrollbar-hide"
className="w-[96vw] bg-slate-50/35 rounded-lg p-4 overflow-x-auto whitespace-nowrap scrollbar-hide pb-7"
>
<h1 className="text-2xl font-bold text-center mb-4">{username}'s VODs</h1>