import { useEffect } from 'react' import { Link, useSearchParams } from 'react-router-dom' import { motion } from 'framer-motion' import { ImageOff, MapPin, Zap } from 'lucide-react' import { Spinner, Tag } from '../components/ui' import { useApi } from '../hooks/useApi' const FILTERS = [ { value: '', label: 'All projects' }, { value: 'residential', label: 'Residential' }, { value: 'commercial', label: 'Commercial' }, ] const PAGE_SIZE = 12 export function ProjectCard({ p, i = 0 }) { return (
{p.featured_image ? ( {p.title} ) : (
)} {p.category}

{p.title}

{p.capacity_kw && {p.capacity_kw} kW} {p.location && {p.location}}
) } export default function ProjectsPage() { const [params, setParams] = useSearchParams() const category = params.get('category') || '' const page = Math.max(1, Number(params.get('page')) || 1) const { data, loading, error, reload } = useApi('/projects', { params: { page, page_size: PAGE_SIZE, ...(category ? { category } : {}) }, }) const pages = data ? Math.max(1, Math.ceil(data.total / PAGE_SIZE)) : 1 useEffect(() => { document.title = 'Our Projects — Saura Shakti' }, []) const setFilter = (value) => setParams(value ? { category: value } : {}) return (
Completed installations

Our Solar Projects

Rooftop and on-grid systems installed by the Saura Shakti team for homes and businesses.

{FILTERS.map((f) => ( ))}
{loading && !data ? (
) : error ? (

{error}

) : data.items.length === 0 ? (

No projects published yet.

Check back soon — new installations are added regularly.

) : ( <> {pages > 1 && ( )} )}
) }