Skip to content

Commit 4606204

Browse files
authored
fix(web): unify default profile image placeholder (#483)
1 parent 7244ef1 commit 4606204

4 files changed

Lines changed: 17 additions & 19 deletions

File tree

apps/web/src/app/community/[boardCode]/[postId]/CommentSection.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useState } from "react";
55
import { useDeleteComment } from "@/apis/community";
66
import Dropdown from "@/components/ui/Dropdown";
77
import Image from "@/components/ui/FallbackImage";
8+
import { DEFAULT_PROFILE_IMAGE } from "@/constants/profile";
89
import { IconMoreVertFilled, IconSubComment } from "@/public/svgs";
910
import type { Comment as CommentType, CommunityUser } from "@/types/community";
1011
import { convertISODateToDateTime } from "@/utils/datetimeUtils";
@@ -137,9 +138,7 @@ const CommentProfile = ({ user }: { user: CommunityUser }) => {
137138
<div className="h-[25px] w-[25px] rounded-full bg-bg-600">
138139
<Image
139140
className="h-full w-full rounded-full"
140-
src={
141-
user?.profileImageUrl ? convertUploadedImageUrl(user?.profileImageUrl) : "/images/placeholder/profile64.svg"
142-
}
141+
src={user?.profileImageUrl ? convertUploadedImageUrl(user?.profileImageUrl) : DEFAULT_PROFILE_IMAGE}
143142
width={40}
144143
height={40}
145144
alt="alt"

apps/web/src/app/community/[boardCode]/[postId]/Content.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useDeleteLike, usePostLike } from "@/apis/community";
44
import Image from "@/components/ui/FallbackImage";
55
import LinkifyText from "@/components/ui/LinkifyText";
66
import { COMMUNITY_MAX_UPLOAD_IMAGES } from "@/constants/community";
7+
import { DEFAULT_PROFILE_IMAGE } from "@/constants/profile";
78
import { IconCloseFilled, IconPostLikeFilled, IconPostLikeOutline } from "@/public/svgs";
89
import { IconCommunication } from "@/public/svgs/community";
910
import type { PostImage as PostImageType, Post as PostType } from "@/types/community";
@@ -117,7 +118,7 @@ const Content = ({ post, postId }: ContentProps) => {
117118
src={
118119
post.postFindSiteUserResponse.profileImageUrl
119120
? convertUploadedImageUrl(post.postFindSiteUserResponse.profileImageUrl)
120-
: "/images/placeholder/profile64.svg"
121+
: DEFAULT_PROFILE_IMAGE
121122
}
122123
width={40}
123124
height={40}

apps/web/src/components/ui/ProfileWithBadge.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Image from "@/components/ui/FallbackImage";
2-
import { IconDefaultProfile, IconGraduation } from "@/public/svgs/mentor";
2+
import { DEFAULT_PROFILE_IMAGE } from "@/constants/profile";
3+
import { IconGraduation } from "@/public/svgs/mentor";
34

45
interface ProfileWithBadgeProps {
56
profileImageUrl?: string | null;
@@ -28,20 +29,16 @@ const ProfileWithBadge = ({
2829
hasBadge ? "border-2 border-primary-1" : "border border-gray-200"
2930
}`}
3031
>
31-
{profileImageUrl ? (
32-
<Image
33-
unoptimized
34-
src={profileImageUrl}
35-
cdnHostType="upload"
36-
alt="프로필 이미지"
37-
width={width}
38-
height={height}
39-
className="h-full w-full object-cover"
40-
fallbackSrc="/images/placeholder/profile112.png"
41-
/>
42-
) : (
43-
<IconDefaultProfile />
44-
)}
32+
<Image
33+
unoptimized
34+
src={profileImageUrl || DEFAULT_PROFILE_IMAGE}
35+
cdnHostType={profileImageUrl ? "upload" : undefined}
36+
alt="프로필 이미지"
37+
width={width}
38+
height={height}
39+
className="h-full w-full object-cover"
40+
fallbackSrc={DEFAULT_PROFILE_IMAGE}
41+
/>
4542
</div>
4643

4744
{/* 학습 상태 배지 */}

apps/web/src/constants/profile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const DEFAULT_PROFILE_IMAGE = "/images/placeholder/profile64.svg";

0 commit comments

Comments
 (0)