Fix article navigation by updating navigation logic
Update ArticleCard component to use `useLocation` hook from wouter for client-side navigation, replacing the direct `window.location.href` assignment. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 069d4324-6c40-4355-955e-c714a50de1ea Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/069d4324-6c40-4355-955e-c714a50de1ea/pIEDxt1
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
|
import { useLocation } from "wouter";
|
||||||
import type { Article, MediaOutlet } from "@shared/schema";
|
import type { Article, MediaOutlet } from "@shared/schema";
|
||||||
|
|
||||||
interface ArticleCardProps {
|
interface ArticleCardProps {
|
||||||
@ -9,8 +10,10 @@ interface ArticleCardProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ArticleCard({ article, outlet, viewMode = "grid" }: ArticleCardProps) {
|
export default function ArticleCard({ article, outlet, viewMode = "grid" }: ArticleCardProps) {
|
||||||
|
const [, setLocation] = useLocation();
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
window.location.href = `/articles/${article.slug}`;
|
setLocation(`/articles/${article.slug}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDate = (date: string | Date) => {
|
const formatDate = (date: string | Date) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user