Skip to content

Commit bad6e9e

Browse files
Show selected language names in the list
1 parent ba450f6 commit bad6e9e

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/app/(public)/repos/page.tsx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,27 @@ import { db } from '@/lib/db/connection';
1111
import { accountsTable, reportsTable } from '@/lib/db/migrations/schema';
1212
import { eq } from 'drizzle-orm';
1313
import type { RepoResponse, RepoData, RepoItem, SearchParams } from '@/types';
14+
import { capitalize } from '@/lib/utils';
1415

15-
export default async function ReposPage({ searchParams }: { searchParams: Promise<SearchParams> }) {
16+
export default async function ReposPage({
17+
searchParams
18+
}: {
19+
searchParams: Promise<SearchParams>;
20+
}) {
1621
const sp = await searchParams;
17-
const langs: string[] = Array.isArray(sp.l) ? sp.l : sp.l ? [String(sp.l)] : [];
22+
const langs: string[] = Array.isArray(sp.l)
23+
? sp.l
24+
: sp.l
25+
? [String(sp.l)]
26+
: [];
1827

1928
const reposRes = await getRepos(langs, sp);
2029
if (!reposRes) notFound();
2130

2231
const { repos, page } = reposRes;
32+
const languagesList = langs
33+
.map(lang => capitalize(decodeURIComponent(lang)))
34+
.join(', ');
2335

2436
return (
2537
<>
@@ -28,6 +40,19 @@ export default async function ReposPage({ searchParams }: { searchParams: Promis
2840
<div className="w-full overflow-x-hidden">
2941
<div className="container mx-auto px-4 pt-32 sm:pt-36 md:pt-40 pb-8">
3042
<div className="min-h-screen">
43+
<div className="text-center mb-8">
44+
<div className="max-w-4xl mx-auto">
45+
<h1 className="mb-6 text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-medium uppercase text-hacktoberfest-light break-words px-2">
46+
<span className="font-bold heading-text">
47+
{Intl.NumberFormat().format(repos.total_count)}
48+
</span>{' '}
49+
repositories for{' '}
50+
<span className="font-bold heading-text">
51+
{sp.q ? sp.q + ' in ' + languagesList : languagesList}
52+
</span>
53+
</h1>
54+
</div>
55+
</div>
3156
<Sorter />
3257
<StarsFilter />
3358
<div className="grid grid-cols-1 gap-6 px-2 sm:px-4 sm:grid-cols-2 lg:grid-cols-3">

0 commit comments

Comments
 (0)