From 1c859e461c6076220e2f514a261839c28406db54 Mon Sep 17 00:00:00 2001 From: kimjaehyeon0101 <47347352-kimjaehyeon0101@users.noreply.replit.com> Date: Wed, 15 Oct 2025 05:08:23 +0000 Subject: [PATCH] Update article page to display the correct media outlet header Modify the Article page component to dynamically fetch and display the header information of the associated media outlet, including its logo and name, by introducing a new API call to retrieve MediaOutlet data. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9a264234-c5d7-4dcc-adf3-a954b149b30d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/9a264234-c5d7-4dcc-adf3-a954b149b30d/uCJPlBt --- .replit | 4 ++ client/src/pages/Article.tsx | 83 +++++++++++++++++++++++++++--------- 2 files changed, 68 insertions(+), 19 deletions(-) diff --git a/.replit b/.replit index 8826cfc..1cda342 100644 --- a/.replit +++ b/.replit @@ -50,6 +50,10 @@ externalPort = 3000 localPort = 43777 externalPort = 4200 +[[ports]] +localPort = 45921 +externalPort = 6800 + [env] PORT = "5000" diff --git a/client/src/pages/Article.tsx b/client/src/pages/Article.tsx index adb0e94..00887b8 100644 --- a/client/src/pages/Article.tsx +++ b/client/src/pages/Article.tsx @@ -5,16 +5,18 @@ import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Input } from "@/components/ui/input"; -import { TrendingUp, TrendingDown, DollarSign, Clock } from "lucide-react"; +import { TrendingUp, TrendingDown, DollarSign, Clock, IdCard } from "lucide-react"; import { useToast } from "@/hooks/use-toast"; import { apiRequest, queryClient } from "@/lib/queryClient"; import Footer from "@/components/Footer"; -import type { Article, PredictionMarket } from "@shared/schema"; +import { useAuth } from "@/hooks/useAuth"; +import type { Article, PredictionMarket, MediaOutlet } from "@shared/schema"; export default function Article() { const [, params] = useRoute("/articles/:slug"); const [, setLocation] = useLocation(); const { toast } = useToast(); + const { user } = useAuth(); const [betAmounts, setBetAmounts] = useState>({}); const { data: article, isLoading: articleLoading } = useQuery
({ @@ -22,6 +24,11 @@ export default function Article() { enabled: !!params?.slug }); + const { data: outlet, isLoading: outletLoading } = useQuery({ + queryKey: ["/api/media-outlets", article?.mediaOutletId], + enabled: !!article?.mediaOutletId + }); + const { data: markets = [], isLoading: marketsLoading } = useQuery({ queryKey: ["/api/articles", params?.slug, "markets"], enabled: !!params?.slug @@ -106,20 +113,17 @@ export default function Article() { return parts; }; - if (articleLoading) { + if (articleLoading || outletLoading) { return (
-
- SAPIENS setLocation("/")} - /> +
+
+
+
+
@@ -158,14 +162,55 @@ export default function Article() {
-
- SAPIENS setLocation("/")} - /> +
+ {outlet?.imageUrl ? ( + {outlet.name} setLocation(`/media/${outlet.slug}`)} + data-testid="img-outlet-profile" + /> + ) : ( +
outlet && setLocation(`/media/${outlet.slug}`)} + data-testid="img-outlet-profile-fallback" + > + + {outlet?.name.charAt(0)} + +
+ )} +
setLocation("/")}> + SAPIENS + {outlet && ( +
+ + {outlet.name} + + +
+ )} +