import React, { useMemo, useCallback } from 'react'; import { ContentPiece, ContentPillar, Platform } from '../../types'; import { PlatformIcons } from './PlatformIcons'; import { StatusBadge } from './StatusBadge'; import { Image as ImageIcon, Video, Instagram } from 'lucide-react'; interface GridViewProps { pieces: ContentPiece[]; pillars: ContentPillar[]; onPieceClick: (piece: ContentPiece) => void; platform: Platform; onPlatformChange: (platform: Platform) => void; } /** * Visual grid view inspired by Later/Instagram feed planner. * Shows content as a 3-column grid preview mimicking how it will look on a social feed. */ export const GridView: React.FC = ({ pieces, pillars, onPieceClick, platform, onPlatformChange, }) => { // Filter pieces that target the selected platform and are scheduled/published const gridPieces = useMemo(() => { return pieces .filter(p => p.platforms.includes(platform)) .sort((a, b) => { // Sort by scheduled date, most recent first const dateA = a.scheduledDate || a.createdAt; const dateB = b.scheduledDate || b.createdAt; return dateB.localeCompare(dateA); }); }, [pieces, platform]); const columns = platform === 'tiktok' || platform === 'youtube' ? 2 : 3; return (
{/* Platform selector */}
Vista de Feed:
{(['instagram', 'tiktok', 'facebook', 'linkedin'] as Platform[]).map(p => { const isActive = platform === p; return ( ); })}
{/* Feed preview container */}
{/* Fake profile header */}

@mi_marca

{gridPieces.length} publicaciones

{/* Grid */} {gridPieces.length > 0 ? (
{gridPieces.map(piece => { const pillar = pillars.find(p => p.id === piece.pillarId); return ( ); })}
) : (

No hay contenido para {platform}

Crea piezas de contenido y asígnalas a esta plataforma

)}
); };