"use client"; import { LoadingButton } from "@/components/loading-button"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { useVersionUpdater } from "@/hooks/use-version-updater"; import { LuCheckCheck, LuCircleAlert, LuClock, LuRefreshCw, } from "react-icons/lu"; export function VersionUpdateSettings() { const { isUpdating, lastUpdateTime, timeUntilNextUpdate, updateProgress, triggerManualUpdate, formatTimeUntilUpdate, formatLastUpdateTime, } = useVersionUpdater(); return ( Background Version Updates Browser versions are automatically checked every 3 hours in the background. New versions are cached and ready when you need them. {/* Current Status */}
Last Update
{formatLastUpdateTime(lastUpdateTime)}
Next Update
{timeUntilNextUpdate <= 0 ? "Now" : `In ${formatTimeUntilUpdate(timeUntilNextUpdate)}`}
{/* Progress indicator */} {isUpdating && updateProgress && ( Updating Browser Versions {updateProgress.current_browser ? ( <> Checking {updateProgress.current_browser} ( {updateProgress.completed_browsers}/ {updateProgress.total_browsers})
{updateProgress.new_versions_found} new versions found so far ) : ( "Starting version update..." )}
)} {/* Manual update button */}
Manual Update
Check for new browser versions now
{ void triggerManualUpdate(); }} variant="outline" size="sm" disabled={isUpdating} > {isUpdating ? "Updating..." : "Check Now"}
{/* Information about background updates */} How it works • Version information is checked automatically every 3 hours
• New versions are added to the cache without removing old ones
• When creating profiles or changing versions, you'll see how many new versions were found
• This keeps the app responsive while ensuring you have the latest information
); }