Skip to content

Commit f21c258

Browse files
committed
feat: update author page
1 parent 496f15e commit f21c258

File tree

2 files changed

+25
-46
lines changed
  • apps/web
    • @/molecules/follower/user-profile
    • app/[lang]/(public-fullwidth)/author/[authorId]

2 files changed

+25
-46
lines changed

apps/web/@/molecules/follower/user-profile/index.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ export type UserProfileProps = {
1414
}
1515

1616
export async function UserProfile({ authorId }: UserProfileProps) {
17-
const rawAuthor = await fetch(
18-
`${process.env.NEXT_PUBLIC_FRONTEND_URL}${generatePath(APP_APIS.protected.user.GET, {
19-
userId: authorId,
20-
})}`,
21-
{
22-
method: "GET",
23-
cache: "no-cache",
24-
headers: {
25-
"Content-Type": "application/json",
26-
},
27-
}
28-
)
17+
// const rawAuthor = await fetch(
18+
// `${process.env.NEXT_PUBLIC_FRONTEND_URL}${generatePath(APP_APIS.protected.user.GET, {
19+
// userId: authorId,
20+
// })}`,
21+
// {
22+
// method: "GET",
23+
// cache: "no-cache",
24+
// headers: {
25+
// "Content-Type": "application/json",
26+
// },
27+
// }
28+
// )
2929
const author: TUserItem = await rawAuthor?.json()
3030
const t = await getTranslations()
3131

apps/web/app/[lang]/(public-fullwidth)/author/[authorId]/page.tsx

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,24 @@
1-
import { getPosts } from "database"
2-
3-
import { DEFAULT_PAGE_LIMIT } from "@/constants"
41
import UserProfile from "@/molecules/follower/user-profile"
5-
import ListSummary from "@/molecules/list-summary"
6-
import NoItemFounded from "@/molecules/no-item-founded"
7-
import TagPagination from "@/molecules/pagination"
8-
import PostItem from "@/molecules/posts/post-item"
2+
import PostList from "@/molecules/posts/post-list"
93

10-
export const metadata = {
11-
title: "Tags",
12-
description: "A list of tags used in the blog posts",
4+
export const generateMetadata = async ({ params, searchParams }) => {
5+
return {
6+
title: "Author",
7+
description: "",
8+
}
139
}
1410

1511
export default async function Page({ params, searchParams }) {
16-
const { data, total } = await getPosts({
17-
authorId: params?.authorId,
18-
...searchParams,
19-
})
20-
2112
return (
2213
<div className="grid grid-cols-12 gap-10">
23-
<UserProfile authorId={params?.authorId} />
14+
{/* <UserProfile authorId={params?.authorId} /> */}
2415
<div className="col-span-8 rounded-md">
25-
<ListSummary total={total} />
26-
27-
{data?.length > 0 ? (
28-
data?.map((post) => (
29-
<PostItem
30-
key={post?.id}
31-
post={post}
32-
/>
33-
))
34-
) : (
35-
<NoItemFounded />
36-
)}
37-
{data && (
38-
<TagPagination
39-
baseUrl={`/author/${params?.authorId}`}
40-
totalPages={Math.ceil(total / (Number(searchParams?.limit) || DEFAULT_PAGE_LIMIT))}
41-
/>
42-
)}
16+
<PostList
17+
getPostParams={{
18+
authorId: params?.authorId,
19+
...searchParams,
20+
}}
21+
/>
4322
</div>
4423
</div>
4524
)

0 commit comments

Comments
 (0)