feat: title cards linked to title pages

This commit is contained in:
nihonium 2025-11-27 10:01:52 +03:00
parent 98178731b9
commit de22dbfb50
Signed by: nihonium
GPG key ID: 0251623741027CFC
4 changed files with 13 additions and 12 deletions

View file

@ -9,6 +9,7 @@ import { ListView } from "../../components/ListView/ListView";
import { UserTitleCardSquare } from "../../components/cards/UserTitleCardSquare";
import { UserTitleCardHorizontal } from "../../components/cards/UserTitleCardHorizontal";
import type { User, UserTitle, CursorObj, TitleSort } from "../../api";
import { Link } from "react-router-dom";
const PAGE_SIZE = 10;
@ -129,8 +130,6 @@ export default function UserPage({ userId }: UserPageProps) {
setLoadingMore(false);
};
// const getAvatarUrl = (avatarId?: number) => (avatarId ? `/api/images/${avatarId}` : "/default-avatar.png");
return (
<div className="w-full min-h-screen bg-gray-50 p-6 flex flex-col items-center">
@ -166,9 +165,11 @@ export default function UserPage({ userId }: UserPageProps) {
hasMore={!!cursor || nextPage.length > 1}
loadingMore={loadingMore}
onLoadMore={handleLoadMore}
renderItem={(title, layout) =>
layout === "square" ? <UserTitleCardSquare title={title} /> : <UserTitleCardHorizontal title={title} />
}
renderItem={(title, layout) => (
<Link to={`/titles/${title.title?.id}`} key={title.title?.id} className="block">
{layout === "square" ? <UserTitleCardSquare title={title} /> : <UserTitleCardHorizontal title={title} />}
</Link>
)}
/>
{!cursor && nextPage.length === 0 && (