diff --git a/src/components/player/internals/StatusCircle.tsx b/src/components/player/internals/StatusCircle.tsx new file mode 100644 index 00000000..bd1f59b8 --- /dev/null +++ b/src/components/player/internals/StatusCircle.tsx @@ -0,0 +1,57 @@ +import { Icon, Icons } from "@/components/Icon"; + +interface StatusCircle { + type: "loading" | "done" | "error" | "pending" | "noresult"; +} + +interface StatusCircleLoading extends StatusCircle { + type: "loading"; + percentage: number; +} + +function statusIsLoading( + props: StatusCircle | StatusCircleLoading +): props is StatusCircleLoading { + return props.type === "loading"; +} + +export function StatusCircle(props: StatusCircle | StatusCircleLoading) { + let classes = ""; + if (props.type === "loading") classes = "text-video-scraping-loading"; + if (props.type === "noresult") + classes = "text-video-scraping-noresult text-opacity-50"; + if (props.type === "error") + classes = "text-video-scraping-error bg-video-scraping-error"; + + return ( +
{source.name}
-- status: {source.status} ({source.percentage}%) -
-reason: {source.reason}
+{source.name}
++ status: {source.status} ({source.percentage}%) +
+reason: {source.reason}
+