"use client" import { useState, useEffect } from "react" import Link from "next/link" import { use } from "react" import { ArrowLeft, CheckCircle, Clock, ExternalLink, MessageCircle, ThumbsUp, Users, FileText, CalendarDays, LineChart, AlertCircle } from "lucide-react" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Badge } from "@/components/ui/badge" import { Separator } from "@/components/ui/separator" import { Progress } from "@/components/ui/progress" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" // Mock data for a single contribution const mockContributions = [ { id: 1, title: "After-School Programs", description: "Create free after-school programs for K-8 students in public schools", category: "Education", votes: { yes: 312, no: 28 }, perspectives: 42, dateCreated: "2023-10-05", dateValidated: "2023-11-15", status: "Validated", resolutionId: 12, resolutionTitle: "Education and Community Health Improvements", metrics: { sentimentScore: 0.87, participationRate: 0.62, consensusSpeed: "Fast", implementationComplexity: "Medium", }, sourceInsight: { id: 3, title: "After-School Programs", description: "Create free after-school programs for K-8 students in public schools" }, relatedPerspectives: [ { id: 101, username: "parent87", content: "As a working parent, having free after-school programs would be life-changing for me and my children.", date: "2023-09-15", votes: 43, }, { id: 102, username: "educator22", content: "After-school programs provide crucial educational support and keep children engaged in positive activities.", date: "2023-09-18", votes: 38, }, { id: 103, username: "communityLeader", content: "These programs would reduce juvenile crime rates in neighborhoods where working parents can't be home until evening.", date: "2023-09-22", votes: 29, }, { id: 104, username: "budgetAnalyst", content: "The ROI is excellent - the cost of these programs is lower than dealing with the social issues that arise without them.", date: "2023-09-25", votes: 36, }, { id: 105, username: "socialWorker42", content: "Many families in underserved areas would greatly benefit from structured after-school care and enrichment.", date: "2023-09-28", votes: 41, }, ], }, { id: 2, title: "Community Health Clinics", description: "Establish walk-in clinics in underserved areas with sliding scale fees", category: "Healthcare", votes: { yes: 278, no: 42 }, perspectives: 36, dateCreated: "2023-11-10", dateValidated: "2023-12-03", status: "Validated", resolutionId: 12, resolutionTitle: "Education and Community Health Improvements", metrics: { sentimentScore: 0.82, participationRate: 0.58, consensusSpeed: "Medium", implementationComplexity: "High", }, sourceInsight: { id: 4, title: "Community Health Clinics", description: "Establish walk-in clinics in underserved areas with sliding scale fees" }, relatedPerspectives: [ // Perspectives data would go here ] }, // Other contributions would go here ] export default function ContributionPage({ params }: { params: Promise<{ id: string }> }) { // Properly handle the params with React.use() const { id } = use(params) const contributionId = parseInt(id) const [activeTab, setActiveTab] = useState("overview") // Find the contribution from mock data const contribution = mockContributions.find(c => c.id === contributionId) if (!contribution) { return (
The contribution you're looking for doesn't exist or has been removed.
{contribution.description}
Based On
{contribution.perspectives}
unique perspectives
Consensus Speed
{contribution.metrics.consensusSpeed}
relative to average
Perspectives Collection
Started: {new Date('2023-09-01').toLocaleDateString()}
Insight Generated
Date: {new Date(contribution.dateCreated).toLocaleDateString()}
Consensus Reached
Date: {new Date(contribution.dateValidated).toLocaleDateString()}
Included in Resolution
Resolution #{contribution.resolutionId}
{contribution.resolutionTitle}
This contribution has been assessed as having {contribution.metrics.implementationComplexity.toLowerCase()} implementation complexity based on required resources, timeline, and regulatory considerations.
{contribution.sourceInsight.title}
{contribution.sourceInsight.description}
{perspective.username}
{new Date(perspective.date).toLocaleDateString()}
Community upvotes
{perspective.content}
Positive Sentiment
{contribution.metrics.sentimentScore > 0.8 ? "Very Positive" : contribution.metrics.sentimentScore > 0.6 ? "Positive" : contribution.metrics.sentimentScore > 0.4 ? "Neutral" : "Mixed"}
AI analysis of perspective text shows strong support for this contribution.
Community Engagement
{contribution.metrics.participationRate > 0.7 ? "Exceptional" : contribution.metrics.participationRate > 0.5 ? "High" : contribution.metrics.participationRate > 0.3 ? "Moderate" : "Low"}
City-wide Relevance
This contribution has been flagged as having city-wide relevance with particular significance for underserved communities.