From ffae32d1954457286a344645fd348757243947ce Mon Sep 17 00:00:00 2001 From: kimjaehyeon0101 <47347352-kimjaehyeon0101@users.noreply.replit.com> Date: Tue, 30 Sep 2025 06:21:01 +0000 Subject: [PATCH] Add media outlet header to comprehensive report view Integrates the media outlet's header information, including its logo and name, into the Comprehensive Report page. The header is now sticky and displays dynamically based on the current report's media outlet. Includes new navigation and utility icons in the header, along with search modal functionality and user authentication hooks. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 0fb68265-c270-4198-9584-3d9be9bddb41 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/0fb68265-c270-4198-9584-3d9be9bddb41/16cZmxV --- client/src/components/MainContent.tsx | 7 - client/src/pages/Report.tsx | 196 +++++++++++++++++++++++++- 2 files changed, 190 insertions(+), 13 deletions(-) diff --git a/client/src/components/MainContent.tsx b/client/src/components/MainContent.tsx index 03a5765..c32a837 100644 --- a/client/src/components/MainContent.tsx +++ b/client/src/components/MainContent.tsx @@ -53,13 +53,6 @@ export default function MainContent() { acc[article.mediaOutletId] = (acc[article.mediaOutletId] || 0) + 1; return acc; }, {} as Record); - - console.log('📊 Article Count Debug:', { - totalArticles: allArticles.length, - totalOutlets: allOutlets.length, - articleCountByOutlet, - outletsWithArticles: Object.keys(articleCountByOutlet).length - }); // Group outlets by category and sort const getOutletsByCategory = (category: string) => { diff --git a/client/src/pages/Report.tsx b/client/src/pages/Report.tsx index abe0ae0..ecd4aca 100644 --- a/client/src/pages/Report.tsx +++ b/client/src/pages/Report.tsx @@ -1,8 +1,16 @@ -import { useRoute } from "wouter"; -import { FileText, Presentation } from "lucide-react"; +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': { @@ -17,9 +25,38 @@ const reportContent: Record = { 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 = () => { @@ -63,10 +100,151 @@ export default function Report() { return (
{/* Header */} -
-
-
-

Comprehensive Report

+
+
+
+
+ {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} + +
+ + + + ) : ( + + )} + + +
@@ -121,6 +299,12 @@ export default function Report() {
); }