import { Button } from "@/components/ui/button";
import { PlugZap, CheckCircle2, Loader2, Wrench } from "lucide-react";
import { TidalIcon, QobuzIcon, AmazonIcon, AppleMusicIcon, DeezerIcon } from "./PlatformIcons";
import { useApiStatus } from "@/hooks/useApiStatus";
import { SPOTIFLAC_NEXT_SOURCES } from "@/lib/api-status";
function renderStatusIndicator(status: "checking" | "online" | "offline" | "idle") {
if (status === "online") {
return ;
}
if (status === "offline") {
return ;
}
return null;
}
function renderPlatformIcon(type: string) {
if (type === "tidal") {
return ;
}
if (type === "amazon") {
return ;
}
if (type === "deezer") {
return ;
}
if (type === "apple") {
return ;
}
return ;
}
export function ApiStatusTab() {
const { sources, statuses, nextStatuses, checkingSources, checkAllCurrent, checkAllNext } = useApiStatus();
const isCheckingCurrent = sources.some((source) => checkingSources[source.id] === true);
const isCheckingNext = SPOTIFLAC_NEXT_SOURCES.some((source) => nextStatuses[source.id] === "checking");
return (
SpotiFLAC
{sources.map((source) => {
const status = statuses[source.id] || "idle";
return (
{renderPlatformIcon(source.type)}
{source.name}
{renderStatusIndicator(status)}
);
})}
SpotiFLAC Next
{SPOTIFLAC_NEXT_SOURCES.map((source) => {
const status = nextStatuses[source.id] || "idle";
return (
{renderPlatformIcon(source.id)}
{source.name}
{renderStatusIndicator(status)}
);
})}
);
}