mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-12 23:36:00 +00:00
fix(lib): adjust UserControl and HeaderView (#293)
* fix(lib): resolve TypeScript unsafe assignment errors in UserControl and HeaderView - Add ESLint disable for @typescript-eslint/no-unsafe-assignment in UserControl to align with other components - Refactor avatar logic in UserControl to use explicit typing and conditional assignment - Add alt attribute to avatar image in UserControl for better accessibility - Fix image priority order in HeaderView to prioritize internal images over external ones - Support both internal and external images with proper fallback in both components 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: remove unused ESLint disable and fix CI lint check The explicit typing approach resolved the TypeScript unsafe assignment errors without needing the ESLint disable rule. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * removed unused linting exception --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
This commit is contained in:
parent
34e45c6dea
commit
94fa6321ba
@ -42,6 +42,11 @@ export const UserControl = () => {
|
||||
pending: 'logging out ..',
|
||||
})
|
||||
}
|
||||
const avatar: string | undefined =
|
||||
userProfile.image && appState.assetsApi.url
|
||||
? appState.assetsApi.url + userProfile.image
|
||||
: userProfile.image_external
|
||||
|
||||
return (
|
||||
<>
|
||||
{isAuthenticated ? (
|
||||
@ -50,10 +55,10 @@ export const UserControl = () => {
|
||||
to={`${userProfile.id && '/item/' + userProfile.id}`}
|
||||
className='tw:flex tw:items-center'
|
||||
>
|
||||
{userProfile.image && (
|
||||
{avatar && (
|
||||
<div className='tw:avatar'>
|
||||
<div className='tw:w-10 tw:rounded-full'>
|
||||
<img src={appState.assetsApi.url + userProfile.image} />
|
||||
<img src={avatar} alt='User avatar' />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@ -58,8 +58,8 @@ export function HeaderView({
|
||||
const [imageLoaded, setImageLoaded] = useState(false)
|
||||
|
||||
const avatar =
|
||||
item.image_external ||
|
||||
(item.image && appState.assetsApi.url + item.image + '?width=160&heigth=160')
|
||||
(item.image && appState.assetsApi.url + item.image + '?width=160&heigth=160') ||
|
||||
item.image_external
|
||||
const title = item.name
|
||||
const subtitle = item.subname
|
||||
|
||||
|
||||
10
package-lock.json
generated
10
package-lock.json
generated
@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "utopia-map",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "utopia-map"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user