/* ============================================================ INDIC LEAGUE NEWS — Main feed (the home screen) Top nav + swipe card stack + bottom dock. Owns: sheet state, liked/saved sets, theme toggle, toast. ============================================================ */ function Feed({ articles, user, onLogout, theme, onToggleTheme }) { const [sheetOpen, setSheetOpen] = React.useState(false); const [sheetArticle, setSheetArticle] = React.useState(null); const [liked, setLiked] = React.useState(() => { const stored = window.IL_Util.Storage.get(window.IL_KEYS.liked, []); return new Set(Array.isArray(stored) ? stored : []); }); const [saved, setSaved] = React.useState(() => { const stored = window.IL_Util.Storage.get('il_saved', []); return new Set(Array.isArray(stored) ? stored : []); }); const [toast, setToast] = React.useState(null); const toastTimer = React.useRef(null); const showToast = (msg) => { if (!msg) { if (toastTimer.current) clearTimeout(toastTimer.current); setToast(null); return; } setToast(msg); if (toastTimer.current) clearTimeout(toastTimer.current); toastTimer.current = setTimeout(() => setToast(null), 1800); }; // Persist liked/saved React.useEffect(() => { window.IL_Util.Storage.set(window.IL_KEYS.liked, Array.from(liked)); }, [liked]); React.useEffect(() => { window.IL_Util.Storage.set('il_saved', Array.from(saved)); }, [saved]); const openArticle = (a) => { if (!a || a.is_sponsored) return; window.IL_Sounds && window.IL_Sounds.tap(); window.IL_Util && window.IL_Util.Haptics.light(); setSheetArticle(a); setSheetOpen(true); }; const closeSheet = () => { setSheetOpen(false); // delay clearing article so transition runs setTimeout(() => setSheetArticle(null), 400); }; const toggleLike = (a) => { setLiked(prev => { const next = new Set(prev); if (next.has(a.id)) { next.delete(a.id); showToast('Removed from liked'); } else { next.add(a.id); showToast('Saved to liked ♥'); } return next; }); }; const toggleSave = (a) => { setSaved(prev => { const next = new Set(prev); if (next.has(a.id)) { next.delete(a.id); showToast('Removed from saved'); } else { next.add(a.id); showToast('Saved'); } return next; }); }; const shareArticle = (a) => { showToast('Creating image…'); window.IL_Util.shareArticle(a, (msg) => { if (msg) showToast(msg); }); }; const onRead = (a) => { // Could increment TIL score; skipped for focused scope }; // Tab/dock state (for For-you vs others). Only For-you is wired. const [tab, setTab] = React.useState('home'); return (
{/* Top nav */}
INDIC LEAGUENEWS
{/* Main stage */}
{tab === 'home' && ( )} {tab === 'discover' && (

Discover

Topic browsing arrives in v1.1. For now, swipe the main feed — it already adapts to your topics.

)} {tab === 'saved' && ( toggleLike(a)} /> )} {tab === 'profile' && ( )}
{/* Bottom dock */} {/* Deep dive sheet */} {/* Toast */}
{toast}
); } function DockItem({ icon, label, active, onClick }) { return ( ); } function SavedList({ articles, ids, onOpen, onUnlike }) { const items = articles.filter(a => ids.has(a.id)); if (items.length === 0) { return (

Nothing liked yet

Tap the heart while reading to save stories here.

); } return (
{items.map(a => ( ))}
); } function ProfilePanel({ user, theme, onToggleTheme, onLogout, liked }) { const muted = window.IL_Sounds.isMuted(); const [muteState, setMuteState] = React.useState(muted); const pol = window.IL_Util.Storage.get(window.IL_KEYS.political, null); const topics = window.IL_Util.Storage.get(window.IL_KEYS.topics, []); return (
{/* Profile hero */}
{user ? user.name.split(' ').map(w => w[0]).join('').slice(0, 2) : }
{user ? user.name : 'Guest reader'}
{user ? user.email : 'Sign in to sync your perspective across devices'}
{/* TIL Score card */}
TIL Score
1,248
Top 12% of readers this week ↑
{/* Perspective */} {}} /> {/* Topics */}
{topics.length === 0 && None selected} {topics.map(id => { const t = window.IL_TOPICS.find(t => t.id === id); if (!t) return null; return ( {t.label} ); })}
{/* Settings */} { window.IL_Sounds.setMuted(!v); setMuteState(!v); }} /> {/* Account actions */} {user && ( )}
); } function SettingsSection({ title, children }) { return (
{title}
{children}
); } function SettingsRow({ label, value, rightHint, onClick }) { return ( ); } function ToggleRow({ icon, label, checked, onChange }) { return ( ); } Object.assign(window, { Feed });