diff --git a/public/solar_banner.png b/public/solar_banner.png new file mode 100644 index 0000000..93ca4da Binary files /dev/null and b/public/solar_banner.png differ diff --git a/public/wind_banner.png b/public/wind_banner.png new file mode 100644 index 0000000..aea4e4b Binary files /dev/null and b/public/wind_banner.png differ diff --git a/src/lib/database.ts b/src/lib/database.ts index 7c80e2f..25cbd9a 100644 --- a/src/lib/database.ts +++ b/src/lib/database.ts @@ -24,7 +24,7 @@ export const installerService = { .order('rating', { ascending: false }); if (filters?.energyType && filters.energyType !== 'all') { - query = query.contains('energy_type', [filters.energyType]); + query = query.eq('energy_type', filters.energyType); } if (filters?.location) { diff --git a/src/pages/InstallateurFinden.tsx b/src/pages/InstallateurFinden.tsx index d39f6b7..c25c370 100644 --- a/src/pages/InstallateurFinden.tsx +++ b/src/pages/InstallateurFinden.tsx @@ -37,7 +37,23 @@ const InstallateurFinden = () => { }; const data = await installerService.getInstallers(filters); - setInstallers(data || []); + + // If no installers found, automatically seed the database + if (!data || data.length === 0) { + console.log('No installers found, seeding database...'); + try { + await cleanAndReseedDatabase(); + // Try to load installers again after seeding + const reseededData = await installerService.getInstallers(filters); + setInstallers(reseededData || []); + } catch (seedError) { + console.error('Error seeding database:', seedError); + setError('Datenbank wird initialisiert. Bitte versuchen Sie es in wenigen Sekunden erneut.'); + setInstallers([]); + } + } else { + setInstallers(data); + } // Track search event if (searchTerm || energyType !== "all" || location) { @@ -244,6 +260,65 @@ const InstallateurFinden = () => { + {/* Debug Section - Only show in development */} + {process.env.NODE_ENV === 'development' && ( + + + Debug Tools (Development Only) + + +
+ + + + +
+
+
+ )} + + {error && ( + + +
+ +

Fehler beim Laden

+

{error}

+
+ + {process.env.NODE_ENV === 'development' && ( + + )} +
+
+
+
+ )} + + {/* Loading State */} + {loading && ( + + +
+
+

Installateure werden geladen...

+
+
+
+ )} + {/* Results */}

diff --git a/src/pages/Solar.tsx b/src/pages/Solar.tsx index 46d2587..d8cee84 100644 --- a/src/pages/Solar.tsx +++ b/src/pages/Solar.tsx @@ -5,7 +5,6 @@ import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Sun, Zap, TrendingUp, Shield, ArrowRight } from "lucide-react"; import { Link } from "react-router-dom"; -import solarImage from "@/assets/solar-installation.jpg"; const Solar = () => { const benefits = [ @@ -39,8 +38,8 @@ const Solar = () => {

Solar Installation
diff --git a/src/pages/Wind.tsx b/src/pages/Wind.tsx index 67142b7..cb41596 100644 --- a/src/pages/Wind.tsx +++ b/src/pages/Wind.tsx @@ -5,7 +5,6 @@ import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Wind, Zap, TrendingUp, Shield, ArrowRight } from "lucide-react"; import { Link } from "react-router-dom"; -import windImage from "@/assets/wind-turbines.jpg"; const WindPage = () => { const benefits = [ @@ -39,9 +38,9 @@ const WindPage = () => {
Wind Turbines