avatar-widget showing external image (#330)

This commit is contained in:
Anton Tranelis 2025-08-25 11:03:59 +02:00 committed by GitHub
parent 2baabe7940
commit fbe1eb9e0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -10,14 +10,16 @@ import UserSVG from '#assets/user.svg'
import { useAppState } from '#components/AppShell/hooks/useAppState'
import DialogModal from '#components/Templates/DialogModal'
import type { Item } from '#types/Item'
import type { Crop } from 'react-image-crop'
interface AvatarWidgetProps {
avatar?: string
setAvatar: React.Dispatch<React.SetStateAction<any>>
item?: Item
}
export const AvatarWidget: React.FC<AvatarWidgetProps> = ({ avatar, setAvatar }) => {
export const AvatarWidget: React.FC<AvatarWidgetProps> = ({ avatar, setAvatar, item }) => {
const [crop, setCrop] = useState<Crop>()
const [image, setImage] = useState<string>('')
const [cropModalOpen, setCropModalOpen] = useState<boolean>(false)
@ -181,7 +183,7 @@ export const AvatarWidget: React.FC<AvatarWidgetProps> = ({ avatar, setAvatar })
</div>
) : (
<div className='tw:h-20 tw:w-20'>
<img src={UserSVG} className='tw:rounded-full'></img>
<img src={item?.image_external ?? UserSVG} className='tw:rounded-full'></img>
</div>
)}
</label>

View File

@ -26,6 +26,7 @@ export const FormHeader = ({ item, state, setState }: Props) => {
image: i,
}))
}
item={item}
/>
<ColorPicker
color={state.color}