1
0

feat: Integrate
All checks were successful
Remote Deploy / deploy (push) Successful in 36s

This commit is contained in:
2026-02-12 18:08:15 +01:00
parent cea8cdf4ee
commit e9ea35a064
13 changed files with 209 additions and 68 deletions

View File

@@ -0,0 +1,52 @@
"use client";
import { useTransition } from "react";
import { useRouter } from "next/navigation";
import { RefreshCw } from "lucide-react";
import { SubstitutionData } from "@/lib/types";
import { Button } from "@/components/ui/button";
interface UpdateStatusProps {
data: SubstitutionData | null;
}
export default function UpdateStatus({ data }: UpdateStatusProps) {
const router = useRouter();
const [isPending, startTransition] = useTransition();
if (!data) return null;
const handleRefresh = () => {
startTransition(() => {
router.refresh();
});
};
return (
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4 text-sm text-muted-foreground p-4 rounded-lg border">
<div>
<span className="font-medium">Poslední aktualizace:</span> {data.status.lastUpdated}
<span className="mx-2 hidden sm:inline"></span>
<br className="sm:hidden" />
<span>
Aktualizace každých{" "}
{data.status.currentUpdateSchedule < 60
? `${data.status.currentUpdateSchedule} min`
: `${data.status.currentUpdateSchedule / 60} hod`}
</span>
</div>
<Button
variant="outline"
size="sm"
onClick={handleRefresh}
disabled={isPending}
className="w-full sm:w-auto"
>
<RefreshCw
className={`h-4 w-4 mr-2 ${isPending ? "animate-spin" : ""}`}
/>
Aktualizovat
</Button>
</div>
);
}