Untitled

Anonymous
Plain Text
09/05/2025 11:52 AM
6.4 KB
15
Indexable
Never
import React, { useEffect, useMemo, useState } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { Camera, List, Map, Plane, Plus, MapPin, Compass, Clock, Image as ImageIcon } from "lucide-react";

// --- Main App --- export default function SkyspotApp() { const [tab, setTab] = useState("nearby"); const [pos, setPos] = useState({ lat: 23.5880, lon: 58.3829, ok: false }); const [flights, setFlights] = useState([]); const [error, setError] = useState(""); const [logging, setLogging] = useState(null); const [logItems, setLogItems] = useState([]);

return ( <div className="min-h-screen w-full bg-gradient-to-b from-sky-900 via-slate-950 to-slate-950 text-slate-100 flex flex-col font-sans"> <header className="sticky top-0 z-10 backdrop-blur bg-sky-950/70 border-b border-sky-800"> <div className="max-w-3xl mx-auto flex items-center justify-between px-4 py-3"> <div className="flex items-center gap-2"> <div className="p-2 bg-sky-600 rounded-full shadow-lg"> <Plane className="h-6 w-6 text-white" /> </div> <h1 className="font-bold text-xl tracking-tight text-sky-200 drop-shadow">Skyspot</h1> </div> <div className="text-xs opacity-80 flex items-center gap-2 text-sky-300"> <MapPin className="h-4 w-4" /> {pos.ok ? ( <span>lat {pos.lat.toFixed(3)}, lon {pos.lon.toFixed(3)}</span> ) : ( <span>Using default: Muscat</span> )} </div> </div> </header>

<main className="flex-1 max-w-3xl mx-auto w-full p-4 space-y-4">
    {/* Tab navigation with branding tint */}
        <nav className="grid grid-cols-3 gap-2 bg-sky-900/50 p-1 rounded-2xl border border-sky-700">
              {[
                        { id: "nearby", label: "Nearby", icon: <List className="h-4 w-4" /> },
                                { id: "map", label: "Map", icon: <Map className="h-4 w-4" /> },
                                        { id: "log", label: "My Log", icon: <ImageIcon className="h-4 w-4" /> },
              ].map((t) => (
                        <button
                                  key={t.id}
                                            onClick={() => setTab(t.id)}
                                                      className={`flex items-center justify-center gap-2 py-2 rounded-xl transition ${
                                                                    tab === t.id ? "bg-sky-700 text-white" : "bg-transparent hover:bg-sky-800 text-sky-200"
                                                      }`}
                                                              >
                                                                        {t.icon}
                                                                                  <span className="text-sm font-medium">{t.label}</span>
                                                                                          </button>
              ))}
                  </nav>

                      {/* Placeholder content */}
                          <section>
                                <AnimatePresence mode="wait">
                                        {tab === "nearby" && (
                                                      <motion.div key="nearby" initial={{ opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -8 }}>
                                                                  <div className="rounded-2xl border border-sky-800 bg-sky-900/40 p-6 text-center">
                                                                                <p className="text-sky-200">Nearby flights will appear here ✈️</p>
                                                                                            </div>
                                                                                                      </motion.div>
                                        )}

                                                {tab === "map" && (
                                                              <motion.div key="map" initial={{ opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -8 }}>
                                                                          <div className="rounded-2xl border border-sky-800 bg-sky-900/40 p-6 text-center">
                                                                                        <p className="text-sky-200">Map radar view coming soon 🗺️</p>
                                                                                                    </div>
                                                                                                              </motion.div>
                                                )}

                                                        {tab === "log" && (
                                                                      <motion.div key="log" initial={{ opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -8 }}>
                                                                                  <div className="rounded-2xl border border-sky-800 bg-sky-900/40 p-6 text-center">
                                                                                                <p className="text-sky-200">Your spotting log will show here 📸</p>
                                                                                                            </div>
                                                                                                                      </motion.div>
                                                        )}
                                                              </AnimatePresence>
                                                                  </section>
                                                                    </main>

                                                                      <footer className="max-w-3xl mx-auto w-full px-4 pb-6 text-center text-xs text-sky-400">
                                                                          © {new Date().getFullYear()} Skyspot • Aviation spotting made simple
                                                                            </footer>
                                                                            </div>

); }


                                                        )}
                                                )}
                                        )}
                                                      }}
              ))
              ]})}
Editor is loading...
Leave a Comment