18 Commits

Author SHA1 Message Date
Anton Tranelis
f7f758bb00
feat(lib): enhanced LocateControl (#308)
* improved locate control

* fix(lib): clean up setTimeout and fix Chrome modal layout issue

- Add proper cleanup for setTimeout in LocateControl to prevent memory leaks
- Replace modal-open class with direct overflow style to fix Chrome scrollbar issue
- Add timeout reference tracking for better component unmount handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix linting

* set distance rule

* optimized locatecontrol

* working for new users without profile now

* test(lib): add comprehensive tests for LocateControl component

- Add 9 comprehensive unit tests covering all LocateControl functionality
- Test modal display logic for new and existing users
- Test profile creation and position updates
- Test navigation after successful operations
- Test error handling with proper toast notifications
- Mock all external dependencies (React Router, Leaflet, APIs)
- Verify dialog behavior prevents re-appearance after decline
- Include snapshot tests for UI consistency
- All tests pass with proper TypeScript typing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* removed unused code, add 1s delay

* updated tests

* fixed tests

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-20 16:39:19 +02:00
Anton Tranelis
649efe551d
refactor(lib): implement server-response-first pattern (#322)
* use server response for local state updates

* fix formatting

* refactor: comprehensive server-response-first pattern implementation

## Major Changes

### LayerProps ID Required
- Made `LayerProps.id` required (was optional)
- All layers now guaranteed to have server-provided UUID
- Enables reliable layer ID mapping from server responses

### useSelectPosition Hook Refactored
- Added reusable `handleApiOperation` helper function
- Refactored `itemUpdatePosition`, `itemUpdateParent`, `linkItem`
- All functions now use server response + layer ID mapping
- Consistent error handling and toast management

### itemFunctions.ts Complete Refactor
- **submitNewItem**: Server response with layer mapping
- **linkItem**: Server response preserves layer object
- **unlinkItem**: Same pattern as linkItem
- **handleDelete**: Simplified error handling
- **onUpdateItem**: Complex function refactored for both update/create branches

### Benefits
-  Eliminates race conditions from manual state construction
-  Server response as single source of truth for all updates
-  Consistent error handling across all API operations
-  Items no longer disappear from map after updates
-  Type-safe layer ID mapping

### Testing
- Updated ItemFunctions.spec.tsx with new toast patterns
- Added required layer IDs to test objects
- All 19 tests passing (3 skipped)
- ESLint clean

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix linting

* fix: resolve TypeScript undefined data errors

- Add non-null assertions for result.data in conditional blocks
- TypeScript now properly recognizes data is defined after success check
- All linting and TypeScript errors resolved

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fixed examples

* remove unneccessary uuid generation

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-20 15:03:30 +02:00
Anton Tranelis
94fa6321ba
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>
2025-08-14 11:27:11 +02:00
5a2d1ea856
changes on package-lock.json when running npm install (#301) 2025-08-13 20:58:11 +00:00
Anton Tranelis
4e6fb57042
fix(lib): critical vulnerability (#290)
* fix critical vulnerability

* fix same in app
2025-08-06 13:07:18 +00:00
Anton Tranelis
945e5b066a
feat(lib): add support for external images in items (#291)
* feat: add support for external images in items

Add image_external field to Item type and update HeaderView to prefer external images over internal ones when available.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: prettier formatting for external image feature

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-06 15:04:52 +02:00
Max
1e7320b895
feat(app): qR invites (#267)
* Add component to show invite link (WIP)

* Show invite link with copy functionality and QR-Code, add tests

* Query secrets

* Update directus collections

* Add config and invite api

* Let vite resolve paths using tsconfig

* Redeem invite link when logged in or after logging in

* Redirect to inviting profile when redeeming

* Fix some logic with login and redeeming

* Use correct redeem flow

* Hide missing form error

* Add basic relations view

* Pass profile to redeem Api and adapt to changed redeem flow

* Remove unnecessary aliases in vite config

* Remove dead import

* gitignore mac specific file

* Remove lazy loading

* Fix linting

* add InviteApi import

* Change case of file name (tbd)

* Don't toast error if user profile was not loaded yet

* Fix casing

* avoid app crash when profile of a new item is opened

---------

Co-authored-by: Anton Tranelis <mail@antontranelis.de>
2025-07-11 13:37:05 +02:00
Anton Tranelis
855ef3de29
fix(lib): base layer config (#276)
* add close button to custom info modal

* added attribution

* fix build examples workflow

* fix pending tests

* Revert "add close button to custom info modal"

This reverts commit 835c661009abbdc5c095a6bc86bbd6890e080e5f.
2025-07-04 08:39:13 +02:00
Anton Tranelis
12aba6a67e
fix(lib): fix labels (#278)
* fix labels

* more lables

* and the rest of the lables

* updated snapshots

* fix linting
2025-07-04 08:36:11 +02:00
Anton Tranelis
045ec726eb
fix(lib): auto close update position toast (#277)
* add close button to custom info modal

* auto close update position toat

* Revert "add close button to custom info modal"

This reverts commit cf5b9a407effe0772ed622ce2369cf16e0b82175.

* fix: reset position for new items without text
2025-07-03 13:18:10 +02:00
Anton Tranelis
712aa98ac2
refactor(other): repo setup (#271)
* direct library import

* running dev environment

* fix linting

* strickt null checks

* fix linting

* chunks

* fix jumping button

* don't exclude rollup-config from typechecks
2025-06-27 20:03:16 +02:00
Anton Tranelis
76d899dba2
fix(lib): fixed profile crash on browser translation (#270)
* fixed profile crash on browser translation

* fix linting
2025-06-26 20:36:16 +02:00
Max
13612c56aa
fix(frontend): lazy load components at top level, not inside another component (#265)
* Lazy load components at top level, not inside another component

* version

---------

Co-authored-by: Anton Tranelis <mail@antontranelis.de>
2025-06-23 07:08:49 +00:00
Anton Tranelis
1828f29cfb
fix(frontend): fixed gallery object on item update (#261)
* fixed gallery object on item update

* version
2025-06-18 13:19:01 +02:00
Anton Tranelis
d73e4886e8
fix(other): fixed lib README badges, moved map README, unpublished map changes, f… (#259)
* fixed lib README badges, moved map README, unpublished map changes, fixed vulnurability

* limit scope of rollups commonjs plugin
2025-06-15 10:29:39 +02:00
a723d4d3cf
move text files to the root directory where applicable (#258) 2025-06-13 09:48:41 +02:00
da634ba8c9
fixed related to mono-repo
issue templates

workflow: lint frontend

workflow: test lib

workflow - unit tests frontend

lib instead of frontend

missing name

workflow: lint examples

workflow: build lib

LICENSE

rename workflow build lib

docs lib

deploy docs

fix build example flow
2025-06-12 11:29:22 +02:00
d32be08be8
move utopia-ui into subfolder lib 2025-06-12 10:46:01 +02:00