fp/packages/next/app/components/archive-progress.tsx

40 lines
1.5 KiB
TypeScript

import { getAllStreamsForVtuber, getStreamCountForVtuber } from "@/lib/streams";
import { getVodsForVtuber } from "@/lib/vods";
import { IVtuber } from "@/lib/vtubers";
export interface IArchiveProgressProps {
vtuber: IVtuber;
}
export default async function ArchiveProgress ({ vtuber }: IArchiveProgressProps) {
// const vods = await getVodsForVtuber(vtuber.id)
const streams = await getStreamCountForVtuber(vtuber.id);
// const goodStreams = await getAllStreamsForVtuber(vtuber.id, ['good']);
// const issueStreams = await getAllStreamsForVtuber(vtuber.id, ['issue']);
// const totalStreams = streams.length;
// const eligibleStreams = issueStreams.length+goodStreams.length;
// // Check if totalStreams is not zero before calculating completedPercentage
// const completedPercentage = (totalStreams !== 0) ? Math.round(eligibleStreams / totalStreams * 100) : 0;
const completedPercentage = 50
const totalStreams = 500
const eligibleStreams = 50
return (
<div>
<pre>
<code>
{JSON.stringify(streams, null, 2)}
</code>
</pre>
<p className="heading">{eligibleStreams}/{totalStreams} Streams Archived ({completedPercentage}%)</p>
<progress className="progress is-success" value={eligibleStreams} max={totalStreams}>{completedPercentage}%</progress>
</div>
)
// @todo
// return (
// <div>
// <i><p className="">{(vods) ? vods.data.length : 0} vods</p></i>
// </div>
// )
}