import React, { useState, useMemo, useRef, useEffect } from 'react'; import ReactDOM from 'react-dom/client'; import { GoogleGenAI } from "@google/genai"; // --- Services --- const ai = new GoogleGenAI({ apiKey: process.env.API_KEY || '' }); const getGeminiResponse = async (history: { role: string; content: string }[]) => { try { const response = await ai.models.generateContent({ model: 'gemini-3-flash-preview', contents: history.map(h => ({ role: h.role === 'user' ? 'user' : 'model', parts: [{ text: h.content }] })), config: { systemInstruction: `You are Sunvolts AI, representing SUNVOLTS LIFE TECHNOLOGIES, a Kerala-based lithium-ion battery manufacturer. You are an expert on the Defender Series inverters and LiFePO4 battery systems. Our systems offer 8000+ cycles, IP54 rating, and touch screen interfaces. Be professional, helpful, and concise. Use Kerala grid context where appropriate.`, temperature: 0.7, }, }); return response.text; } catch (error) { console.error(error); return "Support is currently busy. Please contact us via phone."; } }; // --- Components --- const Navbar = () => { const [isOpen, setIsOpen] = useState(false); return ( ); }; const Hero = () => (
Advanced Kerala Engineering

Powering Your Life
Efficiently.

Kerala's leading manufacturer of high-density Lithium-Ion storage and Defender Series inverters. Sustainable energy, engineered for the future.

Explore Products Load Calculator
Battery System

8000+

Cycles Life

); const Products = () => { const [selected, setSelected] = useState(null); const items = [ { id: 1, name: '51.2V 200Ah', type: 'Touch Screen Series', energy: '10.24kWh', img: 'https://images.unsplash.com/photo-1548611635-b6e78bb0d502?auto=format&fit=crop&q=80&w=800', specs: { 'Product Model': '51.2V 200Ah', 'Rated Voltage': '51.2V', 'Rated Capacity': '200Ah', 'Rated Energy': '10240Wh', 'Cycle Life': '>8000 cycles', 'Display': 'Touch Screen', 'Dimensions': '720 * 525 * 255 mm', 'Weight': '98 KG' } }, { id: 2, name: '51.2V 300Ah', type: 'Elite Touch Series', energy: '15.36kWh', img: 'https://images.unsplash.com/photo-1592833159155-c62df1b65634?auto=format&fit=crop&q=80&w=800', specs: { 'Product Model': '51.2V 300Ah', 'Rated Voltage': '51.2V', 'Rated Capacity': '300Ah', 'Rated Energy': '15360Wh', 'Cycle Life': '>8000 cycles', 'Display': 'Touch Screen', 'Dimensions': '850 * 525 * 255 mm', 'Weight': '125 KG' } }, { id: 3, name: '51.2V 300Ah (B)', type: 'Button Style Series', energy: '15.36kWh', img: 'https://images.unsplash.com/photo-1620714223084-8fcacc6dfd8d?auto=format&fit=crop&q=80&w=800', specs: { 'Product Model': '51.2V 300Ah (Button)', 'Rated Voltage': '51.2V', 'Rated Capacity': '300Ah', 'Rated Energy': '15360Wh', 'Cycle Life': '>8000 cycles', 'Dimensions': '919.5 * 525 * 255 mm', 'Weight': '125 KG' } } ]; return (

Product Catalog

{items.map(p => (
{p.name}
{p.energy}
{p.type}

{p.name}

))}
{selected && (

Technical Parameters

{Object.entries(selected.specs).map(([k, v], i) => (
{k} {v as string}
))}
)}
); }; const Features = () => { const feats = [ { icon: 'fa-hand-pointer', title: 'Easy Access', desc: 'LCD touch screen and remote web portal.' }, { icon: 'fa-microchip', title: 'BMS Optimization', desc: 'Smart battery energy management.' }, { icon: 'fa-mobile-screen', title: 'Remote Monitoring', desc: 'Control via smartphone or PC.' }, { icon: 'fa-expand-arrows-alt', title: 'Expansion', desc: 'Greater output power support.' }, { icon: 'fa-shield-halved', title: 'Superior Safety', desc: 'Sleep-class silence and multi-protection.' }, { icon: 'fa-globe', title: '9 Languages', desc: 'Global compatibility for local needs.' } ]; return (
{feats.map((f, i) => (

{f.title}

{f.desc}

))}
); }; const LoadCalculator = () => { const [load, setLoad] = useState(500); const [hours, setHours] = useState(4); const batteryAh = useMemo(() => Math.ceil(((load * hours) / 12) * 1.2), [load, hours]); return (

Load Calculator

Total Expected Load (Watts) {load}W
setLoad(parseInt(e.target.value))} className="w-full h-2 bg-white/10 rounded-full accent-amber-500 appearance-none cursor-pointer" />
Required Backup Time (Hours) {hours}h
setHours(parseInt(e.target.value))} className="w-full h-2 bg-white/10 rounded-full accent-amber-500 appearance-none cursor-pointer" />

Recommended Battery

{batteryAh} Ah (Lithium)

Recommended Inverter

{Math.ceil(load * 1.5 / 100) * 100 / 1000} KVA

); }; const Footer = () => ( ); const ChatAssistant = () => { const [isOpen, setIsOpen] = useState(false); const [messages, setMessages] = useState([{ role: 'assistant', content: "Hello! I'm Sunvolts AI. How can I help with your power solution today?" }]); const [input, setInput] = useState(''); const [loading, setLoading] = useState(false); const scrollRef = useRef(null); useEffect(() => { scrollRef.current?.scrollTo(0, scrollRef.current.scrollHeight); }, [messages]); const send = async () => { if (!input.trim() || loading) return; const userMsg = { role: 'user', content: input }; setMessages(p => [...p, userMsg]); setInput(''); setLoading(true); const resp = await getGeminiResponse([...messages, userMsg]); setMessages(p => [...p, { role: 'assistant', content: resp || "Disconnected." }]); setLoading(false); }; return (
{isOpen ? (
Sunvolts AI
{messages.map((m, i) => (
{m.content}
))} {loading &&
Sunvolts AI is thinking...
}
setInput(e.target.value)} onKeyPress={e => e.key === 'Enter' && send()} placeholder="Ask anything..." className="flex-1 bg-slate-100 rounded-2xl px-5 text-sm outline-none focus:ring-2 focus:ring-amber-500" />
) : ( )}
); }; const App = () => (
); // --- Mounting --- const root = ReactDOM.createRoot(document.getElementById('root')!); root.render();