import { useRoute, useLocation } from "wouter"; import { FileText, Presentation, Info, Search, Settings, User, LogOut } from "lucide-react"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { useQuery } from "@tanstack/react-query"; import { useAuth } from "@/hooks/useAuth"; import { useState } from "react"; import type { MediaOutlet } from "@shared/schema"; import Footer from "@/components/Footer"; import SearchModal from "@/components/SearchModal"; const reportContent: Record = { 'chayan-asli': { htmlPath: '/attached_assets/chayan asli report_1759208054055.html', pptPath: '/attached_assets/chayan asli slides_1759213492580.pptx' }, 'krysh-parker': { htmlPath: '/attached_assets/krysh parker report_1759209671294.html', pptPath: '/attached_assets/krysh parker slides_1759209102236.pptx' } }; export default function Report() { const [, params] = useRoute("/media/:slug/report"); const [, setLocation] = useLocation(); const [enlargedImage, setEnlargedImage] = useState(null); const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); const { user, isAuthenticated } = useAuth(); const slug = params?.slug || ''; const content = reportContent[slug] || reportContent['chayan-asli']; const { data: outlet, isLoading: outletLoading } = useQuery({ queryKey: ["/api/media-outlets", slug], enabled: !!slug }); const handleLogout = async () => { try { const response = await fetch("/api/logout", { method: "POST", credentials: "include", }); if (response.ok) { window.location.href = "/"; } } catch (error) { console.error("Logout failed:", error); } }; const handleAdminPage = () => { if (user?.role === "admin" || user?.role === "superadmin") { setLocation("/admin"); } }; // Get full URL for PPT file const getFullPptUrl = () => { const baseUrl = window.location.origin; return `${baseUrl}${content.pptPath}`; }; // Remove margins and padding from iframe content const handleReportLoad = (e: React.SyntheticEvent) => { try { const iframe = e.currentTarget; const iframeDoc = iframe.contentDocument || iframe.contentWindow?.document; if (iframeDoc) { const style = iframeDoc.createElement('style'); style.textContent = ` html, body { margin: 0 !important; padding: 0 !important; } body > * { margin: 0 !important; } h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote { margin-top: 0 !important; } .report, .container, .page, .content { margin: 0 !important; padding: 8px !important; } @page { margin: 0 !important; } `; iframeDoc.head.appendChild(style); } } catch (e) { console.error('Could not inject styles into iframe:', e); } }; return (
{/* Header */}
{outletLoading ? ( <>
) : outlet ? ( <> {outlet.imageUrl ? ( {outlet.name} setEnlargedImage(outlet.imageUrl!)} data-testid="image-outlet-header-profile" /> ) : (
{outlet.name.charAt(0)}
)}
setLocation("/")}> SAPIENS
{outlet.name}

{outlet.description || "Media Outlet"}

) : ( SAPIENS setLocation("/")} data-testid="logo-sapiens" /> )}
setIsSearchModalOpen(true)} data-testid="search-container" >
{isAuthenticated && user ? ( <>
{user.firstName} {user.lastName}
) : ( )}
{/* Main Content */}
Report Slides