diff --git a/.eslintrc.json b/.eslintrc.json index 3722418..ff03b56 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,7 @@ { - "extends": ["next/core-web-vitals", "next/typescript"] + "extends": ["next/core-web-vitals", "next/typescript"], + "rules": { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": "off" + } } diff --git a/app/about/page.tsx b/app/about/page.tsx index 9a0965f..dfaff78 100644 --- a/app/about/page.tsx +++ b/app/about/page.tsx @@ -1,6 +1,6 @@ import { Button } from "@/components/ui/button" import { Card, CardContent } from "@/components/ui/card" -import { Github, Heart } from "lucide-react" +import { Github } from "lucide-react" import Link from "next/link" export default function AboutPage() { @@ -18,7 +18,7 @@ export default function AboutPage() { <p className="leading-7"> The Civic Issue Finder helps connect developers, designers, and civic innovators with open source projects that make a difference in communities. Inspired by - Code for America's original civic issue finder, this tool aggregates GitHub issues + Code for America's original civic issue finder, this tool aggregates GitHub issues from civic tech projects to help you find ways to contribute. </p> @@ -46,7 +46,7 @@ export default function AboutPage() { </p> <ol className="list-decimal pl-6 space-y-2"> <li>Read the issue description and project guidelines</li> - <li>Join the project's community (Discord, Slack, or discussions)</li> + <li>Join the project's community (Discord, Slack, or discussions)</li> <li>Comment on the issue to express your interest</li> <li>Fork the repository and start contributing!</li> </ol> @@ -91,7 +91,7 @@ export default function AboutPage() { <div className="text-center text-muted-foreground"> <p className="flex items-center justify-center gap-2"> - Inspired from(now deprecated) Code for America's original Civic Issue Finder + Inspired from (now deprecated) Code for America's original Civic Issue Finder </p> </div> </div> diff --git a/app/api/issues/route.ts b/app/api/issues/route.ts index af6bc46..3405e08 100644 --- a/app/api/issues/route.ts +++ b/app/api/issues/route.ts @@ -11,6 +11,7 @@ export async function GET(request: Request) { const data = await fetchGitHubIssues(page, per_page, language); return NextResponse.json(data); } catch (error) { + console.error(error); return NextResponse.json( { error: 'Failed to fetch issues' }, { status: 500 } diff --git a/app/api/problems/route.ts b/app/api/problems/route.ts index 2f56a05..70109f4 100644 --- a/app/api/problems/route.ts +++ b/app/api/problems/route.ts @@ -7,31 +7,7 @@ const base = new Airtable({ endpointUrl: 'https://api.airtable.com', }).base(process.env.AIRTABLE_BASE_ID!); -interface AirtableRecord { - id: string; - fields: { - Department?: string; - 'Problem Statement'?: string; - Status?: string; - Year?: number; - 'Github URL'?: string; - 'Deployment URL'?: string; - Type?: string; - Published?: boolean; - }; -} -interface Project { - id: string; - department: string; - problemStatement: string; - status: string; - year: number; - githubUrl?: string; - deploymentUrl?: string; - type: string; - isPublished: boolean; -} export async function GET(request: Request) { const { searchParams } = new URL(request.url); diff --git a/app/embed/page.tsx b/app/embed/page.tsx deleted file mode 100644 index 3e8b906..0000000 --- a/app/embed/page.tsx +++ /dev/null @@ -1,14 +0,0 @@ -"use client" -import { IssuesList } from "@/components/IssuesList" -import { useSearchParams } from 'next/navigation' - -export default function EmbedPage() { - const searchParams = useSearchParams() - const theme = searchParams.get('theme') === 'dark' ? 'dark' : 'light' - - return ( - <div className="p-2"> - <IssuesList minimal={true} theme={theme} /> - </div> - ) -} \ No newline at end of file diff --git a/app/page.tsx b/app/page.tsx index 4b252db..2c8f6aa 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,19 +1,11 @@ "use client" +import { Suspense } from 'react' import { IssueCard } from "@/components/IssueCard" import { Button } from "@/components/ui/button" import { Skeleton } from "@/components/ui/skeleton" -import { ChevronLeft, ChevronRight, Loader2 } from "lucide-react" -import { useEffect, useState } from "react" -import { useSearchParams, useRouter } from 'next/navigation' -import type { GitHubIssue } from "@/lib/github" -import { LanguageFilter } from "@/components/LanguageFilter" import { Card, CardHeader, CardContent, CardFooter } from "@/components/ui/card" -interface IssuesResponse { - items: GitHubIssue[]; - total_count: number; -} - +// Move this to a separate client component function IssueCardSkeleton() { return ( <Card className="flex flex-col h-full"> @@ -42,7 +34,19 @@ function IssueCardSkeleton() { ) } -export default function Home() { +// Client component with all the hooks +import { useSearchParams, useRouter } from 'next/navigation' +import { useEffect, useState } from "react" +import { ChevronLeft, ChevronRight, Loader2 } from "lucide-react" +import type { GitHubIssue } from "@/lib/github" +import { LanguageFilter } from "@/components/LanguageFilter" + +interface IssuesResponse { + items: GitHubIssue[]; + total_count: number; +} + +function HomeContent() { const [issues, setIssues] = useState<IssuesResponse>({ items: [], total_count: 0 }); const [isLoading, setIsLoading] = useState(true); const searchParams = useSearchParams(); @@ -142,3 +146,12 @@ export default function Home() { </div> ); } + +// Server component +export default function HomePage() { + return ( + <Suspense fallback={<div>Loading...</div>}> + <HomeContent /> + </Suspense> + ) +} diff --git a/app/problems/page.tsx b/app/problems/page.tsx index be33731..c7ad416 100644 --- a/app/problems/page.tsx +++ b/app/problems/page.tsx @@ -1,5 +1,5 @@ "use client" -import { ProjectCard } from "@/components/ProblemCard" +import { ProjectCard } from "@/components/ProjectCard" import { Skeleton } from "@/components/ui/skeleton" import { AlertCircle, Loader2 } from "lucide-react" import { useEffect, useState } from "react" diff --git a/components/ProblemCard.tsx b/components/ProjectCard.tsx similarity index 100% rename from components/ProblemCard.tsx rename to components/ProjectCard.tsx diff --git a/lib/rate-limit.ts b/lib/rate-limit.ts index a424a0a..9c902bc 100644 --- a/lib/rate-limit.ts +++ b/lib/rate-limit.ts @@ -7,6 +7,7 @@ const ratelimit = new LRUCache({ }) export async function rateLimit(request: Request) { + console.log(request.headers) const ip = headers().get('x-forwarded-for') ?? 'anonymous' const tokenCount = ratelimit.get(ip) as number || 0