@@ -4,9 +4,10 @@ import { getSessionUser } from "@/components/get-session-user";
44import TagDetails from "@/components/tags/details" ;
55import TagLatestPosts from "@/components/tags/latest-posts" ;
66import TagPopularPosts from "@/components/tags/post" ;
7+ import TagFollowers from "@/components/tags/users" ;
78import { Separator } from "@/components/ui/separator" ;
89import postgres from "@/lib/postgres" ;
9- import { revalidatePath } from "next/cache " ;
10+ import { getFollowersByTag } from "@/lib/prisma/tags " ;
1011import { redirect } from "next/navigation" ;
1112
1213export default async function TagPage ( { params } : { params : { tagname : string } } ) {
@@ -38,7 +39,7 @@ export default async function TagPage({ params }: { params: { tagname: string }
3839 } ,
3940 savedUsers : true ,
4041 likes : true ,
41- _count : { select : { comments : true , likes : true , savedUsers : true } } ,
42+ _count : { select : { comments : true , likes : true , savedUsers : true , shares : true } } ,
4243 } ,
4344 orderBy : [
4445 { likes : { _count : 'desc' } } ,
@@ -65,7 +66,7 @@ export default async function TagPage({ params }: { params: { tagname: string }
6566 Followings : true ,
6667 }
6768 } ,
68- _count : { select : { comments : true , likes : true , savedUsers : true } } ,
69+ _count : { select : { comments : true , likes : true , savedUsers : true , shares : true } } ,
6970 savedUsers : true ,
7071 } ,
7172 orderBy : {
@@ -75,6 +76,8 @@ export default async function TagPage({ params }: { params: { tagname: string }
7576 } ) ;
7677 if ( ! tag ) redirect ( "/404" ) ;
7778 const session = await getSessionUser ( ) ;
79+
80+ const { followers } = await getFollowersByTag ( { id : tag . id , limit : 5 , session : session ?. id } ) ;
7881 return (
7982 < >
8083 < div className = "flex flex-col space-y-6 my-8" >
@@ -85,6 +88,14 @@ export default async function TagPage({ params }: { params: { tagname: string }
8588 < TagPopularPosts posts = { popularPosts } tag = { tag } session = { session } />
8689 </ >
8790 ) }
91+ {
92+ followers . length > 0 && (
93+ < >
94+ < Separator />
95+ < TagFollowers followers = { followers } tag = { tag } session = { session } />
96+ </ >
97+ )
98+ }
8899 {
89100 latestPosts . length > 0 && (
90101 < >
0 commit comments