feat: build production-ready wtr weather PWA
This commit is contained in:
15
components/warnings/warnings-panel.tsx
Normal file
15
components/warnings/warnings-panel.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { useWarnings } from "@/hooks/use-warnings";
|
||||
import { WarningCard } from "@/components/warnings/warning-card";
|
||||
import { PageLoadingSkeleton } from "@/components/states/loading-skeleton";
|
||||
import { EmptyState } from "@/components/states/empty-state";
|
||||
import { ErrorState } from "@/components/states/error-state";
|
||||
|
||||
export function WarningsPanel() {
|
||||
const { data: warnings, isPending, isError, refetch } = useWarnings();
|
||||
if (isPending) return <PageLoadingSkeleton />;
|
||||
if (isError) return <ErrorState onRetry={() => refetch()} description="Nie udało się pobrać ostrzeżeń meteorologicznych ani hydrologicznych." />;
|
||||
if (!warnings?.length) return <EmptyState title="Brak aktywnych ostrzeżeń" description="IMGW nie publikuje obecnie ostrzeżeń meteorologicznych ani hydrologicznych." />;
|
||||
return <div className="grid gap-4 md:grid-cols-2 xl:grid-cols-3">{warnings.map((warning, index) => <WarningCard key={warning.id} warning={warning} index={index} />)}</div>;
|
||||
}
|
||||
Reference in New Issue
Block a user