Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Bug pagination in tags #129

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/app/(app)/(routes)/tags/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
import Tag from '@/components/Tag';
import ActiveTeams from '@/components/ActiveTeams';
import CustomLink from '@/components/Link';
import PopularTags from '@/components/PopularTags';
import Pagination from '@/components/list/Pagination';
import PublicDigestListItem from '@/components/teams/PublicDigestListItem';
import TeamAvatar from '@/components/teams/TeamAvatar';
import { getDiscoverDigests } from '@/services/database/digest';
import { getPopularTags, getTagBySlug } from '@/services/database/tag';
import { getRecentTeams } from '@/services/database/team';
import { Button } from '@tremor/react';
import Link from 'next/link';
import CustomLink from '@/components/Link';
import { notFound } from 'next/navigation';
import PopularTags from '@/components/PopularTags';
import ActiveTeams from '@/components/ActiveTeams';
export const dynamic = 'force-dynamic';

const PER_PAGE = 10;

const TagsPage = async ({
params,
searchParams,
}: {
params: {
slug: string;
};
searchParams?: { [key: string]: string | undefined };
}) => {
const { slug } = params;

const page = 1;
const page = Number(searchParams?.page || 1);

const tag = await getTagBySlug(slug);
if (!tag) return notFound();
const recentTeams = await getRecentTeams();
const { digests, digestsCount } = await getDiscoverDigests({
page,
perPage: 20,
perPage: PER_PAGE,
tagId: tag.id,
});
const popularTags = await getPopularTags();
Expand Down
18 changes: 15 additions & 3 deletions src/components/layout/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ import BrandIcon from './BrandIcon';

const Logo = (props: { className?: string; isWhite?: boolean }) => {
return (
<span className="flex items-center cursor-pointer gap-2">
<BrandIcon fill={props.isWhite ? 'white' : 'black'} />
<span className={clsx('flex items-center cursor-pointer gap-2')}>
<BrandIcon
fill={
process.env.NODE_ENV === 'development'
? 'red'
: props.isWhite
? 'white'
: 'black'
}
/>

<span
className={clsx(`text-xl font-[800] text-gray-900`, props.className)}
className={clsx(`text-xl font-[800] `, props.className, {
'text-red-600': process.env.NODE_ENV === 'development',
'text-gray-900': process.env.NODE_ENV !== 'development',
})}
>
digest.club
</span>
Expand Down
Loading