import { useEffect, useState } from "react"; import { Cloud, Loader2 } from "lucide-react"; import PageHeader from "../components/PageHeader"; import FormField, { TextInput } from "../components/FormField"; import IntegrationForm from "../components/IntegrationForm"; import { getIntegration, type Integration } from "../api"; export default function WeatherSettings() { const [integration, setIntegration] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(""); useEffect(() => { loadIntegration(); }, []); const loadIntegration = async () => { try { const data = await getIntegration("weather"); setIntegration(data); } catch (err: any) { setError(err.message); } finally { setLoading(false); } }; if (loading) { return (
); } if (error || !integration) { return (

{error || "Integration nicht gefunden"}

); } return (
{(config, setConfig) => ( <> setConfig("primary_location", v)} placeholder="z.B. Berlin oder 52.52,13.405" /> setConfig("secondary_location", v)} placeholder="z.B. München oder 48.137,11.576" /> )}
); }