mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add UserProfilePopup to UserAvatar and update CoursesActions to show profile popups for authors
This commit is contained in:
parent
5a2732258f
commit
04c5b845fb
6 changed files with 264 additions and 9 deletions
|
|
@ -3,6 +3,7 @@ import { getUriWithOrg } from '@services/config/config'
|
|||
import { useParams } from 'next/navigation'
|
||||
import { getUserAvatarMediaDirectory } from '@services/media/media'
|
||||
import { useLHSession } from '@components/Contexts/LHSessionContext'
|
||||
import UserProfilePopup from './UserProfilePopup'
|
||||
|
||||
type UserAvatarProps = {
|
||||
width?: number
|
||||
|
|
@ -13,6 +14,8 @@ type UserAvatarProps = {
|
|||
borderColor?: string
|
||||
predefined_avatar?: 'ai' | 'empty'
|
||||
backgroundColor?: 'bg-white' | 'bg-gray-100'
|
||||
showProfilePopup?: boolean
|
||||
userId?: string
|
||||
}
|
||||
|
||||
function UserAvatar(props: UserAvatarProps) {
|
||||
|
|
@ -69,7 +72,7 @@ function UserAvatar(props: UserAvatarProps) {
|
|||
return getUriWithOrg(params.orgslug, '/empty_avatar.png')
|
||||
}
|
||||
|
||||
return (
|
||||
const avatarImage = (
|
||||
<img
|
||||
alt="User Avatar"
|
||||
width={props.width ?? 50}
|
||||
|
|
@ -88,6 +91,16 @@ function UserAvatar(props: UserAvatarProps) {
|
|||
`}
|
||||
/>
|
||||
)
|
||||
|
||||
if (props.showProfilePopup && props.userId) {
|
||||
return (
|
||||
<UserProfilePopup userId={props.userId}>
|
||||
{avatarImage}
|
||||
</UserProfilePopup>
|
||||
)
|
||||
}
|
||||
|
||||
return avatarImage
|
||||
}
|
||||
|
||||
export default UserAvatar
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue