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:
Anton Tranelis 2025-08-14 11:27:11 +02:00 committed by GitHub
parent 34e45c6dea
commit 94fa6321ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 14 deletions

View File

@ -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>
)}

View File

@ -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
View File

@ -1,10 +0,0 @@
{
"name": "utopia-map",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "utopia-map"
}
}
}