From 94fa6321ba9eaed0c35ea2e91bd716f92069bb5c Mon Sep 17 00:00:00 2001 From: Anton Tranelis <31516529+antontranelis@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:27:11 +0200 Subject: [PATCH] fix(lib): adjust UserControl and HeaderView (#293) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 * 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 * removed unused linting exception --------- Co-authored-by: Claude Co-authored-by: Ulf Gebhardt --- lib/src/Components/AppShell/UserControl.tsx | 9 +++++++-- .../Subcomponents/ItemPopupComponents/HeaderView.tsx | 4 ++-- package-lock.json | 10 ---------- 3 files changed, 9 insertions(+), 14 deletions(-) delete mode 100644 package-lock.json diff --git a/lib/src/Components/AppShell/UserControl.tsx b/lib/src/Components/AppShell/UserControl.tsx index 2599708c..7c2902ae 100644 --- a/lib/src/Components/AppShell/UserControl.tsx +++ b/lib/src/Components/AppShell/UserControl.tsx @@ -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 && (
- + User avatar
)} diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx index 7a79481e..89ef9697 100644 --- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx @@ -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 diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index b386c5b8..00000000 --- a/package-lock.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "utopia-map", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "utopia-map" - } - } -}