diff --git a/client/src/App.tsx b/client/src/App.tsx index 569749c..09e222c 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -15,28 +15,14 @@ import AuctionGuide from "@/pages/AuctionGuide"; import NotFound from "@/pages/not-found"; function Router() { - const { isAuthenticated, isLoading, user } = useAuth(); - - if (isLoading) { - return ( -
-
-
-

Loading...

-
-
- ); - } - - // Debug logging - console.log('Router render - isAuthenticated:', isAuthenticated, 'user:', user); + const { isAuthenticated, user } = useAuth(); return ( - - - + + + {/* Admin routes - only when authenticated */} diff --git a/client/src/components/MainContent.tsx b/client/src/components/MainContent.tsx new file mode 100644 index 0000000..310817f --- /dev/null +++ b/client/src/components/MainContent.tsx @@ -0,0 +1,140 @@ +import { useState } from "react"; +import { useQuery } from "@tanstack/react-query"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent } from "@/components/ui/card"; +import type { MediaOutlet } from "@shared/schema"; +import { useAuth } from "@/hooks/useAuth"; + +const categories = [ + { id: "people", name: "People", key: "People" }, + { id: "topics", name: "Topics", key: "Topics" }, + { id: "companies", name: "Companies", key: "Companies" } +]; + +export default function MainContent() { + const [selectedCategory, setSelectedCategory] = useState("People"); + const { user } = useAuth(); + + const { data: mediaOutlets = [], isLoading } = useQuery({ + queryKey: ["/api/media-outlets", selectedCategory], + queryFn: async () => { + const res = await fetch(`/api/media-outlets?category=${selectedCategory}`, { + credentials: "include", + }); + if (!res.ok) { + throw new Error(`${res.status}: ${res.statusText}`); + } + return res.json(); + }, + }); + + const { data: allOutlets = [] } = useQuery({ + queryKey: ["/api/media-outlets"], + queryFn: async () => { + const res = await fetch("/api/media-outlets", { + credentials: "include", + }); + if (!res.ok) { + throw new Error(`${res.status}: ${res.statusText}`); + } + return res.json(); + }, + }); + + // Count outlets by category + const getCategoryCount = (category: string) => { + return allOutlets.filter(outlet => + outlet.category.toLowerCase() === category.toLowerCase() + ).length; + }; + + return ( +
+ {/* Category Tabs */} +
+
+
+ {categories.map((category) => ( + + ))} +
+
+
+ + {/* Media Outlets Grid */} +
+ {isLoading ? ( +
+ {Array.from({ length: 12 }).map((_, i) => ( + + +
+
+
+
+
+
+
+
+
+ ))} +
+ ) : ( +
+ {mediaOutlets.map((outlet) => ( + + +
+
+ {outlet.imageUrl ? ( + {outlet.name} + ) : ( +
+ + {outlet.name.charAt(0)} + +
+ )} +
+
+

+ {outlet.name} +

+

+ {outlet.category === "people" && "Media Personality"} + {outlet.category === "topics" && "Industry Topic"} + {outlet.category === "companies" && "Technology Company"} +

+
+
+
+
+ ))} +
+ )} +
+
+ ); +} \ No newline at end of file diff --git a/client/src/pages/Home.tsx b/client/src/pages/Home.tsx index e67ad25..5126b6d 100644 --- a/client/src/pages/Home.tsx +++ b/client/src/pages/Home.tsx @@ -1,76 +1,57 @@ -import { useState } from "react"; -import { useQuery } from "@tanstack/react-query"; -import { Link } from "wouter"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { useAuth } from "@/hooks/useAuth"; -import CategoryTabs from "@/components/CategoryTabs"; -import MediaOutletCard from "@/components/MediaOutletCard"; -import AuctionCard from "@/components/AuctionCard"; -import type { MediaOutlet, Auction } from "@shared/schema"; -import { Search, Settings, Grid, List } from "lucide-react"; +import { Search, Settings } from "lucide-react"; +import MainContent from "@/components/MainContent"; export default function Home() { const { user } = useAuth(); - const [selectedCategory, setSelectedCategory] = useState("People"); - const [viewMode, setViewMode] = useState<"grid" | "list">("list"); - - const { data: mediaOutlets = [], isLoading: outletsLoading } = useQuery({ - queryKey: ["/api/media-outlets", selectedCategory], - queryFn: async () => { - const res = await fetch(`/api/media-outlets?category=${selectedCategory}`, { - credentials: "include", - }); - if (!res.ok) { - throw new Error(`${res.status}: ${res.statusText}`); - } - return res.json(); - }, - }); - - const { data: auctions = [], isLoading: auctionsLoading } = useQuery({ - queryKey: ["/api/auctions"], - }); const handleLogout = () => { window.location.href = "/api/logout"; }; return ( -
- {/* Clean Header */} -
-
+
+ {/* Header */} +
+
- {/* Logo and User */} -
- {user?.profileImageUrl ? ( - {user.firstName - ) : ( -
- {user?.firstName?.charAt(0) || 'U'} -
- )} -
- SAPIENS -
{user?.firstName || 'User'}
-
+
+ SAPIENS + Nostra
- {/* Actions */} -
- -
@@ -78,55 +59,8 @@ export default function Home() {
-
- {/* View Mode Toggle */} -
-

Latest Articles

-
- - -
-
- - {/* Media Outlets List */} -
- {outletsLoading ? ( - Array.from({ length: 6 }).map((_, i) => ( -
-
-
-
-
-
-
-
-
- )) - ) : ( - mediaOutlets.map((outlet) => ( - - )) - )} -
-
- - {/* Bottom Navigation */} - + {/* Main Content */} +
); -} +} \ No newline at end of file diff --git a/client/src/pages/Landing.tsx b/client/src/pages/Landing.tsx index a84e11b..27dc1aa 100644 --- a/client/src/pages/Landing.tsx +++ b/client/src/pages/Landing.tsx @@ -1,11 +1,12 @@ import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { Card, CardContent } from "@/components/ui/card"; import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { useToast } from "@/hooks/use-toast"; import { apiRequest, queryClient } from "@/lib/queryClient"; import { useMutation } from "@tanstack/react-query"; +import { Search, Settings } from "lucide-react"; +import MainContent from "@/components/MainContent"; export default function Landing() { const [showLoginModal, setShowLoginModal] = useState(false); @@ -79,116 +80,55 @@ export default function Landing() { }; return ( -
+
{/* Header */} -
+
-
+
SAPIENS + Nostra
+ -
- {/* Hero Section */} -
-
-

Media Intelligence & Prediction Markets

-

Access premium media outlets across People, Topics, and Companies. Participate in prediction markets and bid for exclusive editorial rights.

-
- - -
-
-
- - {/* Features Section */} -
-
-

Comprehensive Media Platform

-

Discover insights across three key categories

-
- -
- - -
- -
-

People

-

Follow insights from influential leaders across technology, finance, and politics.

-

24 Influential Figures

-
-
- - - -
- -
-

Topics

-

Stay updated on trending subjects from crypto to AI, regulation to innovation.

-

20 Key Topics

-
-
- - - -
- -
-

Companies

-

Track major corporations shaping the future of technology and finance.

-

27 Leading Companies

-
-
-
-
+ {/* Main Content */} + {/* Login Modal */}