Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
15 lines
482 B
TypeScript
15 lines
482 B
TypeScript
import { DEFAULT_AVATAR_FEMALE, DEFAULT_AVATAR_MALE, DEFAULT_AVATAR_OTHER } from '@/constants/images'
|
|
|
|
type GenderLike = string | null | undefined
|
|
|
|
export const resolveUserAvatarSrc = ({ avatarUrl, gender }: { avatarUrl?: string | null; gender?: GenderLike }): string => {
|
|
const trimmed = avatarUrl?.trim()
|
|
|
|
if (trimmed) return trimmed
|
|
|
|
if (gender === 'female') return DEFAULT_AVATAR_FEMALE
|
|
if (gender === 'male') return DEFAULT_AVATAR_MALE
|
|
|
|
return DEFAULT_AVATAR_OTHER
|
|
}
|