mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: course avatar issue
This commit is contained in:
parent
a269757c86
commit
f0fc7c1d99
2 changed files with 13 additions and 5 deletions
|
|
@ -277,6 +277,7 @@ const CourseClient = (props: any) => {
|
||||||
<UserAvatar
|
<UserAvatar
|
||||||
border="border-8"
|
border="border-8"
|
||||||
avatar_url={course.authors[0].avatar_image ? getUserAvatarMediaDirectory(course.authors[0].user_uuid, course.authors[0].avatar_image) : ''}
|
avatar_url={course.authors[0].avatar_image ? getUserAvatarMediaDirectory(course.authors[0].user_uuid, course.authors[0].avatar_image) : ''}
|
||||||
|
predefined_avatar={course.authors[0].avatar_image ? undefined : 'empty'}
|
||||||
width={100}
|
width={100}
|
||||||
/>
|
/>
|
||||||
<div className="-space-y-2 ">
|
<div className="-space-y-2 ">
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,24 @@ type UserAvatarProps = {
|
||||||
| 'rounded'
|
| 'rounded'
|
||||||
border?: 'border-2' | 'border-4' | 'border-8'
|
border?: 'border-2' | 'border-4' | 'border-8'
|
||||||
borderColor?: string
|
borderColor?: string
|
||||||
predefined_avatar?: 'ai'
|
predefined_avatar?: 'ai' | 'empty'
|
||||||
}
|
}
|
||||||
|
|
||||||
function UserAvatar(props: UserAvatarProps) {
|
function UserAvatar(props: UserAvatarProps) {
|
||||||
const session = useSession() as any
|
const session = useSession() as any
|
||||||
const params = useParams() as any
|
const params = useParams() as any
|
||||||
|
|
||||||
const predefinedAvatar =
|
const predefinedAvatarFunc = () => {
|
||||||
props.predefined_avatar === 'ai'
|
if (props.predefined_avatar === 'ai') {
|
||||||
? getUriWithOrg(params.orgslug, '/ai_avatar.png')
|
return getUriWithOrg(params.orgslug, '/ai_avatar.png')
|
||||||
: null
|
}
|
||||||
|
if (props.predefined_avatar === 'empty') {
|
||||||
|
return getUriWithOrg(params.orgslug, '/empty_avatar.png')
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const predefinedAvatar = predefinedAvatarFunc()
|
||||||
const emptyAvatar = getUriWithOrg(params.orgslug, '/empty_avatar.png') as any
|
const emptyAvatar = getUriWithOrg(params.orgslug, '/empty_avatar.png') as any
|
||||||
const uploadedAvatar = getUserAvatarMediaDirectory(
|
const uploadedAvatar = getUserAvatarMediaDirectory(
|
||||||
session.user.user_uuid,
|
session.user.user_uuid,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue