Skip to content

Commit a3926b5

Browse files
committed
fix: improve reviewer avatar handling in ProposalReviewList component
1 parent 82c5160 commit a3926b5

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/components/admin/ProposalReviewList.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { StarIcon } from '@heroicons/react/24/solid'
44
import { Review } from '@/lib/review/types'
55
import { Speaker } from '@/lib/speaker/types'
66
import { speakerImageUrl } from '@/lib/sanity/client'
7+
import { MissingAvatar } from '@/components/common/MissingAvatar'
78
import { formatDateSafe } from '@/lib/time'
89

910
interface ProposalReviewListProps {
@@ -78,7 +79,7 @@ export function ProposalReviewList({
7879
{/* Reviewer Info */}
7980
<div className="mb-3 flex items-start space-x-3">
8081
<div className="shrink-0">
81-
{reviewer?.image ? (
82+
{reviewer?.image && typeof reviewer.image === 'string' ? (
8283
<img
8384
src={speakerImageUrl(reviewer.image, {
8485
width: 64,
@@ -92,11 +93,7 @@ export function ProposalReviewList({
9293
loading="lazy"
9394
/>
9495
) : (
95-
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-700">
96-
<span className="text-xs font-medium text-gray-500 dark:text-gray-400">
97-
{reviewer?.name?.charAt(0) || 'U'}
98-
</span>
99-
</div>
96+
<MissingAvatar name={reviewer?.name || 'Unknown'} size={32} />
10097
)}
10198
</div>
10299
<div className="min-w-0 flex-1">

src/lib/proposal/data/sanity.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export async function getProposal({
9797
? `"reviews": *[_type == "review" && proposal._ref == ^._id]{
9898
...,
9999
reviewer-> {
100-
_id, name, email, image
100+
_id, name, email, "image": coalesce(image.asset->url, imageURL)
101101
}
102102
}`
103103
: ''
@@ -204,7 +204,7 @@ export async function getProposals({
204204
? `,"reviews": *[_type == "review" && proposal._ref == ^._id]{
205205
...,
206206
reviewer-> {
207-
_id, name, email, image
207+
_id, name, email, "image": coalesce(image.asset->url, imageURL)
208208
}
209209
}`
210210
: ''
@@ -498,7 +498,7 @@ export async function searchProposals({
498498
"reviews": *[_type == "review" && proposal._ref == ^._id]{
499499
...,
500500
reviewer-> {
501-
_id, name, email, image
501+
_id, name, email, "image": coalesce(image.asset->url, imageURL)
502502
}
503503
}`
504504
: ''

0 commit comments

Comments
 (0)