2024-07-10 22:11:18 +00:00
|
|
|
import { getAllStreamsForVtuber, getStreamCountForVtuber } from "@/app/lib/streams";
|
|
|
|
import { getVodsForVtuber } from "@/app/lib/vods";
|
2024-07-15 16:07:04 +00:00
|
|
|
import { IVtuber } from "@futureporn/types";
|
2024-01-20 16:16:14 +00:00
|
|
|
|
|
|
|
export interface IArchiveProgressProps {
|
|
|
|
vtuber: IVtuber;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default async function ArchiveProgress ({ vtuber }: IArchiveProgressProps) {
|
|
|
|
|
2024-02-27 15:52:43 +00:00
|
|
|
// // Check if totalStreams is not zero before calculating completedPercentage
|
|
|
|
// const completedPercentage = (totalStreams !== 0) ? Math.round(eligibleStreams / totalStreams * 100) : 0;
|
2024-06-13 05:17:44 +00:00
|
|
|
const goodStreams = await getStreamCountForVtuber(vtuber.id, ['good'])
|
|
|
|
const issueStreams = await getStreamCountForVtuber(vtuber.id, ['issue'])
|
|
|
|
const totalStreams = await getStreamCountForVtuber(vtuber.id)
|
|
|
|
const eligibleStreams = goodStreams+issueStreams
|
2024-07-04 21:20:29 +00:00
|
|
|
const completedPercentage = Math.floor((eligibleStreams / totalStreams) * 100)
|
2024-03-14 22:08:49 +00:00
|
|
|
return (
|
|
|
|
<div>
|
2024-06-13 02:54:44 +00:00
|
|
|
{/* <p>
|
|
|
|
{totalStreams} known streams<br />
|
2024-06-13 05:17:44 +00:00
|
|
|
{goodStreams} streams archived<br />
|
|
|
|
{issueStreams} streams with issues<br />
|
2024-06-13 02:54:44 +00:00
|
|
|
</p> */}
|
2024-05-27 22:20:58 +00:00
|
|
|
<p className="heading">{eligibleStreams}/{totalStreams} Streams Archived ({completedPercentage}%)</p>
|
|
|
|
<progress className="progress is-success" value={eligibleStreams} max={totalStreams}>{completedPercentage}%</progress>
|
2024-03-14 22:08:49 +00:00
|
|
|
</div>
|
|
|
|
)
|
2024-05-27 22:20:58 +00:00
|
|
|
// @todo
|
|
|
|
|
|
|
|
// return (
|
|
|
|
// <div>
|
|
|
|
// <i><p className="">{(vods) ? vods.data.length : 0} vods</p></i>
|
|
|
|
// </div>
|
|
|
|
// )
|
2024-01-20 16:16:14 +00:00
|
|
|
}
|