@{post.author}
Desbloquea el acceso
Mi Negocio
Ingresos por cobrar
$0.00
* ElPrivado.me procesa tus pagos cada martes.
import React, { useState, useEffect } from 'react'; import { initializeApp } from 'firebase/app'; import { getAuth, onAuthStateChanged, signInAnonymously } from 'firebase/auth'; import { getFirestore, collection, onSnapshot, doc, setDoc, addDoc } from 'firebase/firestore'; import { User, Lock, Unlock, Camera, DollarSign, Heart, MessageSquare, Settings, Eye, PlusCircle, ShieldCheck, TrendingUp, Image as ImageIcon, Loader2 } from 'lucide-react'; /** * CONFIGURACIÓN PARA ELPRIVADO.ME * Reemplaza con tus credenciales de Firebase Console */ const firebaseConfig = { apiKey: "", // Se llena automáticamente en el entorno authDomain: "elprivado-me.firebaseapp.com", projectId: "elprivado-me", storageBucket: "elprivado-me.appspot.com", messagingSenderId: "123456789", appId: "1:123456789:web:abc123" }; const app = initializeApp(firebaseConfig); const auth = getAuth(app); const db = getFirestore(app); const appId = typeof __app_id !== 'undefined' ? __app_id : 'elprivado-me'; const App = () => { const [user, setUser] = useState(null); const [loading, setLoading] = useState(true); const [view, setView] = useState('feed'); const [posts, setPosts] = useState([]); const [isCreator, setIsCreator] = useState(false); // 1. Autenticación Inicial useEffect(() => { const initAuth = async () => { try { await signInAnonymously(auth); } catch (err) { console.error("Error en auth", err); } }; initAuth(); const unsubscribe = onAuthStateChanged(auth, (u) => { setUser(u); setLoading(false); }); return () => unsubscribe(); }, []); // 2. Cargar Posts desde Firestore (Datos reales) useEffect(() => { if (!user) return; const q = collection(db, 'artifacts', appId, 'public', 'data', 'posts'); const unsubscribe = onSnapshot(q, (snapshot) => { const postsData = snapshot.docs.map(doc => ({ id: doc.id, ...doc.data() })); setPosts(postsData); }, (error) => console.error("Error fetch posts", error)); return () => unsubscribe(); }, [user]); // 3. Lógica de Pago (Wompi Integration Mock) const handlePayment = async (post) => { const checkout = new window.WidgetCheckout({ currency: 'COP', amountInCents: post.price * 100, publicKey: 'pub_test_Q5yS9s9v6Z6D6V6B6N6M6', reference: `ELPRIVADO_${post.id}_${Date.now()}`, customerEmail: user.email || 'fan@elprivado.me', }); checkout.open((result) => { const transaction = result.transaction; if (transaction.status === 'APPROVED') { // Aquí guardaríamos en Firestore que este usuario ya tiene acceso console.log("Pago aprobado!"); } }); }; if (loading) return (
Ingresos por cobrar
* ElPrivado.me procesa tus pagos cada martes.