import { useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { useRoute } from "wouter"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import ArticleCard from "@/components/ArticleCard"; import type { MediaOutlet, Article } from "@shared/schema"; export default function MediaOutlet() { const [, params] = useRoute("/media/:slug"); const [viewMode, setViewMode] = useState<"grid" | "list">("grid"); const { data: outlet, isLoading: outletLoading } = useQuery({ queryKey: ["/api/media-outlets", params?.slug], enabled: !!params?.slug }); const { data: articles = [], isLoading: articlesLoading } = useQuery({ queryKey: ["/api/media-outlets", outlet?.id, "articles"], enabled: !!outlet?.id }); if (outletLoading) { return (
{Array.from({ length: 6 }).map((_, i) => (
))}
); } if (!outlet) { return (

Media Outlet Not Found

The media outlet you're looking for doesn't exist.

); } return (
{/* Header */}
S
SAPIENS
{/* Outlet Header */}
{outlet.imageUrl ? ( {outlet.name} ) : (
{outlet.name.charAt(0)}
)}

{outlet.name}

{outlet.description}

{outlet.category} {outlet.tags?.map((tag) => ( {tag} ))}
{/* Articles Section */}

Latest Articles

{articlesLoading ? (
{Array.from({ length: 6 }).map((_, i) => (
))}
) : articles.length > 0 ? (
{articles.map((article) => ( ))}
) : (

No Articles Yet

This media outlet doesn't have any published articles yet. Check back later!

)}
); }