Skip to content

Commit

Permalink
Merge pull request #129 from premieroctet/fix/124-bug-pagination-in-tags
Browse files Browse the repository at this point in the history
Fix: Bug pagination in tags
  • Loading branch information
quentingrchr authored Jun 14, 2024
2 parents 7d61453 + 748ca83 commit ab7a696
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
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

0 comments on commit ab7a696

Please sign in to comment.