Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Nov 14, 2023
1 parent 89be03b commit 394b3f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
17 changes: 10 additions & 7 deletions app/(main)/used_by/show.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"use client"
import { UsedRepoInfo } from "@/types"
import { fetcher } from "@/utils"
import {
Card,
Expand All @@ -22,7 +21,7 @@ export function Show() {
const router = useRouter()
const perPage = parseInt(searchParams.get("per_page") || "12")
const { data, error, isLoading } = useSWR<{
data: UsedRepoInfo[]
data: string[]
total: number
}>(`${host}/api/used_by?` + searchParams.toString(), fetcher)
if (error) {
Expand Down Expand Up @@ -55,15 +54,19 @@ export function Show() {
<div className="w-full pt-4 md:px-10 lg:px-[14%] flex gap-2 flex-col">
<div className="grid grid-cols-1 md:grid-cols-[repeat(auto-fill,minmax(400px,1fr))] gap-4">
{data!.data.map((repo) => (
<Card isPressable key={repo.name}>
<Card isPressable key={repo}>
<CardHeader className="pb-0">
<Link href={`https://github.com/${repo.name}`} isExternal className=" hover:underline">
{repo.name}
<Link
href={`https://github.com/${repo}`}
isExternal
className=" hover:underline"
>
{repo}
</Link>
</CardHeader>
<CardBody className="p-3">
<Link isExternal href={`/api?repo=${repo.name}`}>
<Image src={`${host}/api?repo=${repo.name}`} />
<Link isExternal href={`/api?repo=${repo}`}>
<Image src={`${host}/api?repo=${repo}`} />
</Link>
</CardBody>
</Card>
Expand Down
1 change: 1 addition & 0 deletions app/api/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export function usedBy(per_page: number, page: number) {
const res = repos.slice((page - 1) * per_page, page * per_page)
return {
data: res,
total: repos.length,
}
}

Expand Down

0 comments on commit 394b3f0

Please sign in to comment.