fix: UserTitle cards
This commit is contained in:
parent
9139c77c5f
commit
51bf7b6f7e
10 changed files with 70 additions and 15 deletions
|
|
@ -35,9 +35,9 @@ const UserPage: React.FC = () => {
|
|||
<div className={styles.container}>
|
||||
<div className={styles.header}>
|
||||
<div className={styles.avatarWrapper}>
|
||||
{user.avatar_id ? (
|
||||
{user.image?.image_path ? (
|
||||
<img
|
||||
src={`/images/${user.avatar_id}.png`}
|
||||
src={`/images/${user.image.image_path}.png`}
|
||||
alt="User Avatar"
|
||||
className={styles.avatarImg}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import { SearchBar } from "../../components/SearchBar/SearchBar";
|
|||
import { TitlesSortBox } from "../../components/TitlesSortBox/TitlesSortBox";
|
||||
import { LayoutSwitch } from "../../components/LayoutSwitch/LayoutSwitch";
|
||||
import { ListView } from "../../components/ListView/ListView";
|
||||
import { TitleCardSquare } from "../../components/cards/TitleCardSquare";
|
||||
import { TitleCardHorizontal } from "../../components/cards/TitleCardHorizontal";
|
||||
import { UserTitleCardSquare } from "../../components/cards/UserTitleCardSquare";
|
||||
import { UserTitleCardHorizontal } from "../../components/cards/UserTitleCardHorizontal";
|
||||
import type { User, UserTitle, CursorObj, TitleSort } from "../../api";
|
||||
|
||||
const PAGE_SIZE = 10;
|
||||
|
|
@ -129,7 +129,7 @@ export default function UsersIdPage({ userId }: UsersIdPageProps) {
|
|||
setLoadingMore(false);
|
||||
};
|
||||
|
||||
const getAvatarUrl = (avatarId?: number) => (avatarId ? `/api/images/${avatarId}` : "/default-avatar.png");
|
||||
// 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">
|
||||
|
|
@ -139,7 +139,7 @@ export default function UsersIdPage({ userId }: UsersIdPageProps) {
|
|||
{errorUser && <div className="mt-10 text-red-600 font-medium">{errorUser}</div>}
|
||||
{user && (
|
||||
<div className="bg-white shadow-lg rounded-xl p-6 w-full max-w-sm flex flex-col items-center mb-8">
|
||||
<img src={getAvatarUrl(user.avatar_id)} alt={user.nickname} className="w-32 h-32 rounded-full object-cover mb-4" />
|
||||
<img src={user.image?.image_path} alt={user.nickname} className="w-32 h-32 rounded-full object-cover mb-4" />
|
||||
<h2 className="text-2xl font-bold mb-2">{user.disp_name || user.nickname}</h2>
|
||||
{user.mail && <p className="text-gray-600 mb-2">{user.mail}</p>}
|
||||
{user.user_desc && <p className="text-gray-700 text-center">{user.user_desc}</p>}
|
||||
|
|
@ -167,7 +167,7 @@ export default function UsersIdPage({ userId }: UsersIdPageProps) {
|
|||
loadingMore={loadingMore}
|
||||
onLoadMore={handleLoadMore}
|
||||
renderItem={(title, layout) =>
|
||||
layout === "square" ? <TitleCardSquare title={title} /> : <TitleCardHorizontal title={title} />
|
||||
layout === "square" ? <UserTitleCardSquare title={title} /> : <UserTitleCardHorizontal title={title} />
|
||||
}
|
||||
/>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue