diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f9ba7f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +node_modules +dist +.DS_Store +server/public +vite.config.ts.* +*.tar.gz \ No newline at end of file diff --git a/.replit b/.replit new file mode 100644 index 0000000..335d9dc --- /dev/null +++ b/.replit @@ -0,0 +1,46 @@ +modules = ["nodejs-20", "web", "postgresql-16"] +run = "npm run dev" +hidden = [".config", ".git", "generated-icon.png", "node_modules", "dist"] + +[nix] +channel = "stable-24_05" + +[deployment] +deploymentTarget = "autoscale" +build = ["npm", "run", "build"] +run = ["npm", "run", "start"] + +[[ports]] +localPort = 5000 +externalPort = 80 + +[[ports]] +localPort = 36839 +externalPort = 3000 + +[env] +PORT = "5000" + +[agent] +integrations = ["javascript_object_storage:1.0.0", "javascript_log_in_with_replit:1.0.0", "javascript_database:1.0.0"] + +[workflows] +runButton = "Project" + +[[workflows.workflow]] +name = "Project" +mode = "parallel" +author = "agent" + +[[workflows.workflow.tasks]] +task = "workflow.run" +args = "Start application" + +[[workflows.workflow]] +name = "Start application" +author = "agent" + +[[workflows.workflow.tasks]] +task = "shell.exec" +args = "npm run dev" +waitForPort = 5000 diff --git a/client/index.html b/client/index.html new file mode 100644 index 0000000..f15fa88 --- /dev/null +++ b/client/index.html @@ -0,0 +1,14 @@ + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/client/src/App.tsx b/client/src/App.tsx new file mode 100644 index 0000000..d3745a4 --- /dev/null +++ b/client/src/App.tsx @@ -0,0 +1,53 @@ +import { Switch, Route } from "wouter"; +import { queryClient } from "./lib/queryClient"; +import { QueryClientProvider } from "@tanstack/react-query"; +import { Toaster } from "@/components/ui/toaster"; +import { TooltipProvider } from "@/components/ui/tooltip"; +import { useAuth } from "@/hooks/useAuth"; +import Landing from "@/pages/Landing"; +import Home from "@/pages/Home"; +import MediaOutlet from "@/pages/MediaOutlet"; +import Article from "@/pages/Article"; +import AdminDashboard from "@/pages/AdminDashboard"; +import SuperAdminDashboard from "@/pages/SuperAdminDashboard"; +import Auctions from "@/pages/Auctions"; +import NotFound from "@/pages/not-found"; + +function Router() { + const { isAuthenticated, isLoading, user } = useAuth(); + + return ( + + {isLoading || !isAuthenticated ? ( + + ) : ( + <> + + + + + {user?.role === 'admin' && ( + + )} + {user?.role === 'superadmin' && ( + + )} + + )} + + + ); +} + +function App() { + return ( + + + + + + + ); +} + +export default App; diff --git a/client/src/components/ArticleCard.tsx b/client/src/components/ArticleCard.tsx new file mode 100644 index 0000000..19addc9 --- /dev/null +++ b/client/src/components/ArticleCard.tsx @@ -0,0 +1,122 @@ +import { Card, CardContent } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import type { Article, MediaOutlet } from "@shared/schema"; + +interface ArticleCardProps { + article: Article; + outlet: MediaOutlet; + viewMode?: "grid" | "list"; +} + +export default function ArticleCard({ article, outlet, viewMode = "grid" }: ArticleCardProps) { + const handleClick = () => { + window.location.href = `/articles/${article.slug}`; + }; + + const formatDate = (date: string | Date) => { + const d = new Date(date); + const now = new Date(); + const diffTime = Math.abs(now.getTime() - d.getTime()); + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); + + if (diffDays === 1) return "1 day ago"; + if (diffDays < 7) return `${diffDays} days ago`; + return d.toLocaleDateString(); + }; + + if (viewMode === "list") { + return ( + + +
+ {article.imageUrl && ( + {article.title} + )} +
+
+ {article.isPinned && ( + + + Pinned + + )} + {article.isFeatured && ( + + Featured + + )} +
+

{article.title}

+

{article.excerpt}

+
+
+ {formatDate(article.publishedAt!)} + {article.tags?.map((tag) => ( + + {tag} + + ))} +
+
+
+
+
+
+ ); + } + + return ( + + + {article.imageUrl && ( + {article.title} + )} +
+
+ {article.isPinned && ( + + + Pinned + + )} + {article.isFeatured && ( + + Featured + + )} +
+

{article.title}

+

{article.excerpt}

+
+ + {formatDate(article.publishedAt!)} + +
+ {article.tags?.slice(0, 2).map((tag) => ( + + {tag} + + ))} +
+
+
+
+
+ ); +} diff --git a/client/src/components/AuctionCard.tsx b/client/src/components/AuctionCard.tsx new file mode 100644 index 0000000..9f7a8d3 --- /dev/null +++ b/client/src/components/AuctionCard.tsx @@ -0,0 +1,84 @@ +import { Card, CardContent } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { Badge } from "@/components/ui/badge"; +import type { Auction } from "@shared/schema"; + +interface AuctionCardProps { + auction: Auction; +} + +export default function AuctionCard({ auction }: AuctionCardProps) { + const formatPrice = (price: string) => { + const num = parseFloat(price); + return `$${num.toLocaleString()}`; + }; + + const getTimeRemaining = (endDate: string | Date) => { + const end = new Date(endDate); + const now = new Date(); + const diff = end.getTime() - now.getTime(); + + if (diff <= 0) return "Ended"; + + const days = Math.floor(diff / (1000 * 60 * 60 * 24)); + const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); + + if (days > 0) return `${days}d ${hours}h`; + if (hours > 0) return `${hours}h ${minutes}m`; + return `${minutes}m`; + }; + + const getStatusBadge = () => { + const timeRemaining = getTimeRemaining(auction.endDate); + if (timeRemaining === "Ended") return { text: "Ended", variant: "secondary" as const }; + + const end = new Date(auction.endDate); + const now = new Date(); + const hoursLeft = (end.getTime() - now.getTime()) / (1000 * 60 * 60); + + if (hoursLeft <= 3) return { text: "Ending Soon", variant: "destructive" as const }; + return { text: "Active", variant: "default" as const }; + }; + + const status = getStatusBadge(); + + return ( + + +
+
+

{auction.title}

+

{auction.description}

+
+ {status.text} +
+ +
+
+ Current Bid: + {formatPrice(auction.currentBid || "0")} +
+
+ Quality Score: + {auction.qualityScore || 0}/100 +
+
+ Time Remaining: + + {getTimeRemaining(auction.endDate)} + +
+
+ + +
+
+ ); +} diff --git a/client/src/components/CategoryTabs.tsx b/client/src/components/CategoryTabs.tsx new file mode 100644 index 0000000..ab8afe9 --- /dev/null +++ b/client/src/components/CategoryTabs.tsx @@ -0,0 +1,40 @@ +import { Button } from "@/components/ui/button"; + +interface CategoryTabsProps { + selectedCategory: string; + onCategoryChange: (category: string) => void; +} + +const categories = [ + { id: "people", label: "People", icon: "fas fa-users", count: 24 }, + { id: "topics", label: "Topics", icon: "fas fa-hashtag", count: 20 }, + { id: "companies", label: "Companies", icon: "fas fa-building", count: 27 }, +]; + +export default function CategoryTabs({ selectedCategory, onCategoryChange }: CategoryTabsProps) { + return ( +
+
+ +
+
+ ); +} diff --git a/client/src/components/MediaOutletCard.tsx b/client/src/components/MediaOutletCard.tsx new file mode 100644 index 0000000..ba122c9 --- /dev/null +++ b/client/src/components/MediaOutletCard.tsx @@ -0,0 +1,118 @@ +import { Card, CardContent } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { useState } from "react"; +import ProfileModal from "./ProfileModal"; +import type { MediaOutlet } from "@shared/schema"; + +interface MediaOutletCardProps { + outlet: MediaOutlet; +} + +export default function MediaOutletCard({ outlet }: MediaOutletCardProps) { + const [showProfile, setShowProfile] = useState(false); + + const handleCardClick = () => { + window.location.href = `/media/${outlet.slug}`; + }; + + const handleInfoClick = (e: React.MouseEvent) => { + e.stopPropagation(); + setShowProfile(true); + }; + + const getOutletImage = () => { + if (outlet.imageUrl) return outlet.imageUrl; + + // Default images based on category + if (outlet.category === "people") { + return "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-4.0.3&w=64&h=64&fit=crop&crop=face"; + } else if (outlet.category === "companies") { + return null; // Use initial letter + } + return null; + }; + + const getOutletIcon = () => { + if (outlet.category === "topics") { + return outlet.name.toLowerCase().includes("crypto") ? "fas fa-coins" : + outlet.name.toLowerCase().includes("ai") ? "fas fa-brain" : + outlet.name.toLowerCase().includes("federal") ? "fas fa-university" : + "fas fa-hashtag"; + } + return "fas fa-building"; + }; + + const getTagColor = () => { + const tag = outlet.tags?.[0] || outlet.category; + const colors = { + "Tech Leader": "bg-primary/10 text-primary", + "CEO": "bg-accent/80 text-accent-foreground", + "Crypto": "bg-chart-1/20 text-chart-1", + "Politics": "bg-destructive/20 text-destructive", + "AI": "bg-chart-3/20 text-chart-3", + "Finance": "bg-chart-2/20 text-chart-2", + "Blockchain": "bg-chart-4/20 text-chart-4", + "Economy": "bg-chart-5/20 text-chart-5" + }; + return colors[tag as keyof typeof colors] || "bg-muted text-muted-foreground"; + }; + + return ( + <> + + +
+ {getOutletImage() ? ( + {outlet.name} + ) : ( +
+ {outlet.category === 'companies' ? ( + + {outlet.name.charAt(0)} + + ) : ( + + )} +
+ )} + +
+

{outlet.name}

+

+ {outlet.description} +

+
+ + {outlet.tags?.[0] || outlet.category} + + +
+
+
+
+
+ + setShowProfile(false)} + /> + + ); +} diff --git a/client/src/components/PredictionMarketCard.tsx b/client/src/components/PredictionMarketCard.tsx new file mode 100644 index 0000000..695d2de --- /dev/null +++ b/client/src/components/PredictionMarketCard.tsx @@ -0,0 +1,63 @@ +import { Card, CardContent } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import type { PredictionMarket } from "@shared/schema"; + +interface PredictionMarketCardProps { + market: PredictionMarket; +} + +export default function PredictionMarketCard({ market }: PredictionMarketCardProps) { + const formatVolume = (volume: string) => { + const num = parseFloat(volume); + if (num >= 1000000) return `$${(num / 1000000).toFixed(1)}M`; + if (num >= 1000) return `$${(num / 1000).toFixed(0)}K`; + return `$${num}`; + }; + + const formatDate = (date: string | Date) => { + return new Date(date).toLocaleDateString(); + }; + + const yesPrice = parseFloat(market.yesPrice || "0"); + const noPrice = parseFloat(market.noPrice || "0"); + + return ( + + +
+

{market.title}

+ + {yesPrice}% Yes + +
+
+ Volume: {formatVolume(market.volume || "0")} + Ends: {formatDate(market.endDate!)} +
+
+ + + +
+
+
+ ); +} diff --git a/client/src/components/ProfileModal.tsx b/client/src/components/ProfileModal.tsx new file mode 100644 index 0000000..733c4d1 --- /dev/null +++ b/client/src/components/ProfileModal.tsx @@ -0,0 +1,142 @@ +import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; +import { Button } from "@/components/ui/button"; +import type { MediaOutlet } from "@shared/schema"; + +interface ProfileModalProps { + outlet: MediaOutlet; + isOpen: boolean; + onClose: () => void; +} + +export default function ProfileModal({ outlet, isOpen, onClose }: ProfileModalProps) { + const getProfileContent = () => { + // Sample profile content - in a real app this would come from the database + const profiles: Record = { + "alex-karp": { + summary: [ + "Co-founder and CEO of Palantir Technologies, a leading data analytics company", + "Known for his outspoken views on artificial intelligence and data privacy", + "Advocate for Western democratic values in technology and business practices" + ], + background: "Alexander Karp is an American billionaire businessman who co-founded Palantir Technologies in 2003. He earned a PhD in philosophy from Stanford University and a JD from Stanford Law School. Before Palantir, he worked as an investor and consultant.", + highlights: [ + "Co-founded Palantir Technologies (2003)", + "Led company through IPO in 2020", + "Built partnerships with government agencies and enterprises", + "Advocate for responsible AI development" + ], + achievements: [ + "Built Palantir into a multi-billion dollar company", + "Recognized leader in big data and AI ethics", + "Frequent speaker on technology and society" + ] + } + }; + + return profiles[outlet.slug] || { + summary: [ + `Leading figure in the ${outlet.category} category`, + `Influential voice in their respective field`, + `Key contributor to industry developments` + ], + background: `${outlet.name} is a prominent entity in the ${outlet.category} space. ${outlet.description}`, + highlights: [ + "Industry leadership", + "Innovative contributions", + "Market influence", + "Thought leadership" + ], + achievements: [ + "Recognized expertise in their field", + "Significant market impact", + "Influential industry voice" + ] + }; + }; + + const profile = getProfileContent(); + + const getProfileImage = () => { + if (outlet.imageUrl) return outlet.imageUrl; + + // Default professional images + if (outlet.category === "people") { + return "https://images.unsplash.com/photo-1560250097-0b93528c311a?ixlib=rb-4.0.3&w=120&h=120&fit=crop&crop=face"; + } + return null; + }; + + return ( + + + + Profile Information + + +
+
+ {getProfileImage() ? ( + {`${outlet.name} window.open(getProfileImage()!, '_blank')} + data-testid="img-profile-large" + /> + ) : ( +
+ + {outlet.name.charAt(0)} + +
+ )} +

{outlet.name}

+

{outlet.description}

+
+ +
+

3-Line Summary

+
    + {profile.summary.map((line: string, index: number) => ( +
  • • {line}
  • + ))} +
+
+ +
+
+

Background

+

+ {profile.background} +

+
+ +
+

Key Highlights

+
    + {profile.highlights.map((highlight: string, index: number) => ( +
  • • {highlight}
  • + ))} +
+
+ +
+

Achievements

+
    + {profile.achievements.map((achievement: string, index: number) => ( +
  • • {achievement}
  • + ))} +
+
+
+ +
+ +
+
+
+
+ ); +} diff --git a/client/src/components/ui/accordion.tsx b/client/src/components/ui/accordion.tsx new file mode 100644 index 0000000..e6a723d --- /dev/null +++ b/client/src/components/ui/accordion.tsx @@ -0,0 +1,56 @@ +import * as React from "react" +import * as AccordionPrimitive from "@radix-ui/react-accordion" +import { ChevronDown } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Accordion = AccordionPrimitive.Root + +const AccordionItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AccordionItem.displayName = "AccordionItem" + +const AccordionTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + svg]:rotate-180", + className + )} + {...props} + > + {children} + + + +)) +AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName + +const AccordionContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + +
{children}
+
+)) + +AccordionContent.displayName = AccordionPrimitive.Content.displayName + +export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } diff --git a/client/src/components/ui/alert-dialog.tsx b/client/src/components/ui/alert-dialog.tsx new file mode 100644 index 0000000..8722561 --- /dev/null +++ b/client/src/components/ui/alert-dialog.tsx @@ -0,0 +1,139 @@ +import * as React from "react" +import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" + +import { cn } from "@/lib/utils" +import { buttonVariants } from "@/components/ui/button" + +const AlertDialog = AlertDialogPrimitive.Root + +const AlertDialogTrigger = AlertDialogPrimitive.Trigger + +const AlertDialogPortal = AlertDialogPrimitive.Portal + +const AlertDialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName + +const AlertDialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + + +)) +AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName + +const AlertDialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogHeader.displayName = "AlertDialogHeader" + +const AlertDialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogFooter.displayName = "AlertDialogFooter" + +const AlertDialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName + +const AlertDialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogDescription.displayName = + AlertDialogPrimitive.Description.displayName + +const AlertDialogAction = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName + +const AlertDialogCancel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName + +export { + AlertDialog, + AlertDialogPortal, + AlertDialogOverlay, + AlertDialogTrigger, + AlertDialogContent, + AlertDialogHeader, + AlertDialogFooter, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogAction, + AlertDialogCancel, +} diff --git a/client/src/components/ui/alert.tsx b/client/src/components/ui/alert.tsx new file mode 100644 index 0000000..41fa7e0 --- /dev/null +++ b/client/src/components/ui/alert.tsx @@ -0,0 +1,59 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const alertVariants = cva( + "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", + { + variants: { + variant: { + default: "bg-background text-foreground", + destructive: + "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +const Alert = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes & VariantProps +>(({ className, variant, ...props }, ref) => ( +
+)) +Alert.displayName = "Alert" + +const AlertTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +AlertTitle.displayName = "AlertTitle" + +const AlertDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +AlertDescription.displayName = "AlertDescription" + +export { Alert, AlertTitle, AlertDescription } diff --git a/client/src/components/ui/aspect-ratio.tsx b/client/src/components/ui/aspect-ratio.tsx new file mode 100644 index 0000000..c4abbf3 --- /dev/null +++ b/client/src/components/ui/aspect-ratio.tsx @@ -0,0 +1,5 @@ +import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" + +const AspectRatio = AspectRatioPrimitive.Root + +export { AspectRatio } diff --git a/client/src/components/ui/avatar.tsx b/client/src/components/ui/avatar.tsx new file mode 100644 index 0000000..51e507b --- /dev/null +++ b/client/src/components/ui/avatar.tsx @@ -0,0 +1,50 @@ +"use client" + +import * as React from "react" +import * as AvatarPrimitive from "@radix-ui/react-avatar" + +import { cn } from "@/lib/utils" + +const Avatar = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +Avatar.displayName = AvatarPrimitive.Root.displayName + +const AvatarImage = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AvatarImage.displayName = AvatarPrimitive.Image.displayName + +const AvatarFallback = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName + +export { Avatar, AvatarImage, AvatarFallback } diff --git a/client/src/components/ui/badge.tsx b/client/src/components/ui/badge.tsx new file mode 100644 index 0000000..f000e3e --- /dev/null +++ b/client/src/components/ui/badge.tsx @@ -0,0 +1,36 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const badgeVariants = cva( + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + { + variants: { + variant: { + default: + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", + secondary: + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + destructive: + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + outline: "text-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +export interface BadgeProps + extends React.HTMLAttributes, + VariantProps {} + +function Badge({ className, variant, ...props }: BadgeProps) { + return ( +
+ ) +} + +export { Badge, badgeVariants } diff --git a/client/src/components/ui/breadcrumb.tsx b/client/src/components/ui/breadcrumb.tsx new file mode 100644 index 0000000..60e6c96 --- /dev/null +++ b/client/src/components/ui/breadcrumb.tsx @@ -0,0 +1,115 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { ChevronRight, MoreHorizontal } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Breadcrumb = React.forwardRef< + HTMLElement, + React.ComponentPropsWithoutRef<"nav"> & { + separator?: React.ReactNode + } +>(({ ...props }, ref) =>