From bdb8369ae9b56d63acfcd045850dfba95dcecd0e Mon Sep 17 00:00:00 2001 From: kimjaehyeon0101 <47347352-kimjaehyeon0101@users.noreply.replit.com> Date: Wed, 15 Oct 2025 07:38:50 +0000 Subject: [PATCH] Update the website header to match media outlets and expand search bar Enhance UI for article pages by synchronizing headers with media outlets and increasing the search bar's length. Add search and user authentication modal components. 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/IfFFLfD --- client/src/pages/Article.tsx | 135 ++++++++++++++++++++++++++----- client/src/pages/MediaOutlet.tsx | 2 +- 2 files changed, 115 insertions(+), 22 deletions(-) diff --git a/client/src/pages/Article.tsx b/client/src/pages/Article.tsx index 33b1a70..4847429 100644 --- a/client/src/pages/Article.tsx +++ b/client/src/pages/Article.tsx @@ -5,19 +5,23 @@ 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, IdCard } from "lucide-react"; +import { TrendingUp, TrendingDown, DollarSign, Clock, IdCard, Search, User, LogOut, Settings } from "lucide-react"; import { useToast } from "@/hooks/use-toast"; import { apiRequest, queryClient } from "@/lib/queryClient"; import Footer from "@/components/Footer"; import { useAuth } from "@/hooks/useAuth"; +import LoginModal from "@/components/LoginModal"; +import SearchModal from "@/components/SearchModal"; 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 { user, isAuthenticated } = useAuth(); const [betAmounts, setBetAmounts] = useState>({}); + const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); + const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const { data: articleData, isLoading: articleLoading } = useQuery
({ queryKey: ["/api/articles", params?.slug], @@ -32,6 +36,34 @@ export default function Article() { enabled: !!params?.slug }); + const handleLogout = async () => { + try { + const response = await fetch("/api/logout", { + method: "POST", + credentials: "include", + }); + + if (response.ok) { + toast({ + title: "Logout Successful", + description: "You have been successfully logged out.", + }); + + queryClient.invalidateQueries({ queryKey: ["/api/auth/user"] }); + } + } catch (error) { + toast({ + title: "Logout Error", + description: "An error occurred during logout.", + variant: "destructive", + }); + } + }; + + const handleAdminPage = () => { + setLocation("/admin"); + }; + const placeBetMutation = useMutation({ mutationFn: async ({ marketId, side, amount }: { marketId: string; side: "yes" | "no"; amount: number }) => { return apiRequest("POST", `/api/prediction-markets/${marketId}/bets`, { side, amount }); @@ -160,29 +192,25 @@ export default function Article() {
-
+
{outlet?.imageUrl ? ( {outlet.name} setLocation(`/media/${outlet.slug}`)} - data-testid="img-outlet-profile" + data-testid="image-outlet-header-profile" /> ) : ( -
outlet && setLocation(`/media/${outlet.slug}`)} - data-testid="img-outlet-profile-fallback" - > - +
+ {outlet?.name.charAt(0)}
)} {outlet && (
- + {outlet.name}
-
- SAPIENS setLocation("/")} - data-testid="logo-sapiens" - /> + +
+
setIsSearchModalOpen(true)} + data-testid="search-container" + > + +
+ search in + SAPIENS +
+
+ + {isAuthenticated && user ? ( + <> + + +
+ + + {user.firstName} {user.lastName} + +
+ + + + ) : ( + + )} + +
@@ -368,6 +451,16 @@ export default function Article() { + {/* Modals */} + setIsLoginModalOpen(false)} + /> + setIsSearchModalOpen(false)} + /> + {/* Footer */}
diff --git a/client/src/pages/MediaOutlet.tsx b/client/src/pages/MediaOutlet.tsx index 745b83c..7bc977f 100644 --- a/client/src/pages/MediaOutlet.tsx +++ b/client/src/pages/MediaOutlet.tsx @@ -235,7 +235,7 @@ export default function MediaOutlet() { data-testid="search-container" > -
+
search in