-
Notifications
You must be signed in to change notification settings - Fork 0
[fix] 상품 상세 판매자 프로필 정보 표시 수정 #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -244,25 +244,19 @@ export default function ProductDetailScreen({ | |
| showToastRef.current = showToast; | ||
| }, [showToast]); | ||
|
|
||
| const displaySellerBio = productData?.seller?.bio ?? "정보없음"; | ||
| const sellerBio = auctionDetail?.seller?.bio ?? productData?.seller?.bio; | ||
| const displaySellerBio = | ||
| sellerBio == null || sellerBio.trim() === "" ? "정보없음" : sellerBio; | ||
| const sellerRating = | ||
| auctionDetail?.seller?.rating ?? productData?.seller?.rating; | ||
|
|
||
| const displaySellerRating = | ||
| productData?.seller?.rating == null | ||
| ? "정보없음" | ||
| : productData.seller.rating.toFixed(1); | ||
| sellerRating == null ? "정보없음" : sellerRating.toFixed(1); | ||
| const displaySellerWarning = | ||
| productData?.seller?.warningCount == null | ||
| ? "정보없음" | ||
| : `${productData.seller.warningCount}회`; | ||
| const displaySellerAddress = displayLocation; | ||
| const sellerRecentSales = productData?.seller?.recentSales ?? []; | ||
|
|
||
| function formatSellerRecentSalePrice(price?: number | null) { | ||
| if (price == null) { | ||
| return "정보없음"; | ||
| } | ||
|
|
||
| return `${price.toLocaleString()}원`; | ||
| } | ||
|
|
||
| useEffect(() => { | ||
| if (regularPrice != null) { | ||
|
|
@@ -753,7 +747,7 @@ export default function ProductDetailScreen({ | |
| <span> | ||
| {displaySellerRating === "정보없음" | ||
| ? "정보없음" | ||
| : `${displaySellerRating} (거래 ${sellerRecentSales.length}건)`} | ||
| : displaySellerRating} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
References
|
||
| </span> | ||
| </div> | ||
| </div> | ||
|
|
@@ -947,9 +941,6 @@ export default function ProductDetailScreen({ | |
| </div> | ||
| <div> | ||
| <h3 className="text-xl font-bold">{displaySellerName}</h3> | ||
| <p className="text-sm text-gray-500 mt-1"> | ||
| {displaySellerBio} | ||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
|
|
@@ -978,34 +969,9 @@ export default function ProductDetailScreen({ | |
| </div> | ||
|
|
||
| <div className="space-y-3"> | ||
| <h4 className="font-bold text-sm">상대 판매내역 (최근 3건)</h4> | ||
| <div className="space-y-2"> | ||
| {sellerRecentSales.length === 0 ? ( | ||
| <div className="p-3 bg-gray-50 rounded-xl text-sm text-gray-500"> | ||
| 정보없음 | ||
| </div> | ||
| ) : ( | ||
| sellerRecentSales.map((item, idx) => ( | ||
| <div | ||
| key={idx} | ||
| className="flex items-center justify-between p-3 bg-gray-50 rounded-xl" | ||
| > | ||
| <span className="text-sm font-medium text-gray-800"> | ||
| {item.title ?? "정보없음"} | ||
| </span> | ||
| <div className="text-right"> | ||
| <p className="text-xs font-bold"> | ||
| {formatSellerRecentSalePrice(item.price)} | ||
| </p> | ||
| <p | ||
| className={`text-[10px] ${item.status === "판매완료" ? "text-gray-400" : "text-blue-500"}`} | ||
| > | ||
| {item.status ?? "정보없음"} | ||
| </p> | ||
| </div> | ||
| </div> | ||
| )) | ||
| )} | ||
| <h4 className="font-bold text-sm">소개글</h4> | ||
| <div className="rounded-xl bg-gray-50 p-4 text-sm leading-relaxed text-gray-600"> | ||
| {displaySellerBio} | ||
| </div> | ||
| </div> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
삼항 연산자와
trim()을 사용한 빈 문자열 검사 로직은?.연산자와||연산자를 활용하여 훨씬 간결하고 가독성 좋게 작성할 수 있습니다.sellerBio?.trim() || "정보없음"과 같이 작성하면 동일한 동작을 하면서도 코드가 명확해집니다.References