Commit graph

31 commits

Author SHA1 Message Date
c0dc3d0bc1 utils: update grid helpers and modification utilities 2025-11-30 20:05:54 -08:00
3007aadbb0 sync pictureData with available profile images 2025-11-30 06:02:56 -08:00
5e77bb3093 feat: add weapon series utility and i18n messages 2025-11-30 02:32:07 -08:00
d51fe03905 fix: character slot selection glow and empty protagonist
- character grid starts at position 1 (skip protagonist)
- add isEmptySelected state for glow on empty slots
- empty protagonist shows relief.png background only
2025-11-30 02:31:48 -08:00
f457343e26
Complete TanStack Query v6 migration (#445)
## Overview

Complete migration from service layer to TanStack Query v6 with
mutations, queries, and automatic cache management.

## What Was Completed

### Phase 1: Entity Queries & Database Pages 
- Created `entity.queries.ts` with query options for weapons,
characters, and summons
- Migrated all database detail pages to use TanStack Query with
`withInitialData()` pattern
- SSR with client-side hydration working correctly

### Phase 2: Server Load Cleanup 
- Removed PartyService dependency from teams detail server load
- Server loads now use adapters directly instead of service layer
- Cleaner separation of concerns

### Phase 3: Party.svelte Refactoring 
- Removed all PartyService, GridService, and ConflictService
dependencies
- Migrated to TanStack Query mutations for all operations:
  - Grid operations: create, update, delete, swap, move
  - Party operations: update, delete, remix, favorite, unfavorite
- Added swap/move mutations for drag-and-drop operations
- Automatic cache invalidation and query refetching

### Phase 4: Service Layer Removal 
- Deleted all service layer files (~1,345 lines removed):
  - `party.service.ts` (620 lines)
  - `grid.service.ts` (450 lines)
  - `conflict.service.ts` (120 lines)
  - `gridOperations.ts` (unused utility)
- Deleted empty `services/` directory
- Created utility functions for cross-cutting concerns:
  - `localId.ts`: Anonymous user local ID management
  - `editKeys.ts`: Edit key management for anonymous editing
  - `party-context.ts`: Extracted PartyContext type

### Phase 5: /teams/new Migration 
- Migrated party creation wizard to use TanStack Query mutations
- Replaced all direct adapter calls with mutations (7 locations)
- Maintains existing behavior and flow
- Automatic cache invalidation for newly created parties

## Benefits

### Performance
- Automatic request deduplication
- Better cache utilization across pages
- Background refetching for fresh data
- Optimistic updates for instant UI feedback

### Developer Experience
- Single source of truth for data fetching
- Consistent patterns across entire app
- Query devtools for debugging
- Less boilerplate code

### Code Quality
- ~1,088 net lines removed
- Simpler mental model (no service layer)
- Better TypeScript inference
- Easier to test

### Architecture
- **100% TanStack Query coverage** - no service layer, no direct adapter
calls
- Clear separation: UI ← Queries/Mutations ← Adapters ← API
- Automatic cache management
- Consistent mutation patterns everywhere

## Testing

All features verified:
- Party creation (anonymous & authenticated)
- Grid operations (add, remove, update, swap, move)
- Party operations (update, delete, remix, favorite)
- Cache invalidation across tabs
- Error handling and rollback
- SSR with hydration

## Files Modified

### Created (3)
- `src/lib/types/party-context.ts`
- `src/lib/utils/editKeys.ts`
- `src/lib/utils/localId.ts`

### Deleted (4)
- `src/lib/services/party.service.ts`
- `src/lib/services/grid.service.ts`
- `src/lib/services/conflict.service.ts`
- `src/lib/utils/gridOperations.ts`

### Modified (13)
- `src/lib/api/mutations/grid.mutations.ts`
- `src/lib/components/grids/CharacterGrid.svelte`
- `src/lib/components/grids/SummonGrid.svelte`
- `src/lib/components/grids/WeaponGrid.svelte`
- `src/lib/components/party/Party.svelte`
- `src/routes/teams/new/+page.svelte`
- Database entity pages (characters, weapons, summons)
- Other supporting files

## Migration Complete

This PR completes the TanStack Query migration. The entire application
now uses TanStack Query v6 for all data fetching and mutations, with
zero remaining service layer code.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-29 22:32:15 -08:00
149f30c538
Make parties more DRY (#444)
We extracted utility functions from the Party.svelte component in order
to make things more DRY.
2025-11-29 03:29:28 -08:00
009758a997 fix: API adapters and type mapping
- transform job skills pagination meta to include page/perPage
- fix UserInfo avatar type (optional properties -> required when present)
- add visibility number-to-string mapping in party service (0=public, 1=private, 2=unlisted)
- change mapToApiPayload return type from Partial<Party> to CreatePartyParams
- fix raid/job mapping to use IDs instead of nested objects
- add generic type argument to RestDataProvider<any>
- add type assertion in optionalProps (value as T[keyof T])
2025-11-28 21:04:51 -08:00
c821873ac6 fix: test fixtures and awakening type issues
- remove recruits property from Character test mock (doesn't exist in type)
- add missing subaura property to Summon test mocks
- consolidate Awakening imports to use entities source
- make awakening type/level optional in GridWeapon/GridSummon
- fix null handling in AwakeningDisplay (null -> undefined)
2025-11-28 21:04:26 -08:00
84be6ea30f fix: resolve string undefined assignment errors
- Fix jobUtils proficiency type narrowing by storing intermediate values
- Add default empty string for openDescriptionSidebar title parameter
- Remove explicit undefined assignments in search resource tests

Reduces errors from 68 to 63.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 18:44:20 -08:00
a74653ee93 fix: apply exactOptionalPropertyTypes shims to adapters and services
- Add optionalProps shim to base.adapter.ts for RequestInit compatibility
- Apply optionalProps to UserSettingsModal updateData
- Use conditional spreading for Navigation Button element prop
- Apply optionalProps to drag-drop target object creation
- Apply optionalProps to party.service create/update methods
- Apply optionalProps to grid.service CRUD operations
- Fix transcendenceStage -> transcendenceStep typo in grid.service
- Update UserUpdateParams interface to include | undefined
- Update DragOperation interface properties to include | undefined

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 18:42:38 -08:00
b54ac91638 fix: correct type comparison errors
- jobUtils.ts: Remove string comparison for job.row (row is typed as number)
  - job.row === '1' comparison is always false, removed
- grid.service.ts: Fix swap operation to compare position with position
  - Changed i.id === operation.targetPosition to i.position === operation.targetPosition
  - targetPosition is a number (position), not a string (id)

Fixes "This comparison appears to be unintentional because the types have no overlap" errors.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 18:26:18 -08:00
e52f6ef479 fix: consolidate WeaponKey type definition
- Update entities.ts WeaponKey to include all required fields (granblue_id, series, group, order)
- Use snake_case naming (granblue_id) to match API/database conventions
- Update modifiers.ts to import from entities.ts and use snake_case property
- Removes duplicate WeaponKey type and eliminates type conflicts

Fixes "Property 'granblueId' does not exist on type 'WeaponKey'" and type assignment errors.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 18:05:46 -08:00
Devin AI
67eb624bfc fix: type errors cleanup (161 -> 130 errors)
- Fix Party.svelte: add null checks for existingChar/existingWeapon/existingSummon
- Fix DropdownItem.svelte: replace asChild with child snippet pattern for bits-ui v2
- Fix UncapStar.svelte, TranscendenceStar.svelte: tabIndex -> tabindex
- Fix Party.svelte, Navigation.svelte: remove asChild prop usage
- Fix images.ts: add | undefined to pose/element params for exactOptionalPropertyTypes
- Fix ItemHeader.svelte, UncapIndicator.svelte: accept number | null | undefined
- Fix GridRepCollection.svelte, GuidebookUnit.svelte: PartyView -> Party type
- Fix search.adapter.ts: add optional type property to SearchResult
- Update various Props interfaces for exactOptionalPropertyTypes compliance

Co-Authored-By: Justin Edmund <justin@jedmund.com>
2025-11-28 21:58:11 +00:00
5403aebe48 fix job skill types and slot styling
- update JobSkill type with emp/base boolean flags
- use new skill fields in jobUtils and components
- update job adapter with locale and filter params
- restyle empty skill slots with cleaner placeholder
- simplify ML badge to not show level number
2025-11-28 11:04:16 -08:00
a88411eb46 add context menu to job components 2025-09-30 03:43:41 -07:00
a00b8a8d18 update utility functions 2025-09-29 23:47:11 -07:00
1298ae1a35 add mastery display 2025-09-29 23:46:04 -07:00
4161a615ba add job system 2025-09-29 23:45:50 -07:00
3666b8db86 add perpetuity ring toggle and fix grid api response handling 2025-09-25 01:08:25 -07:00
f090d2fe41 add modifier utils for weapon keys, awakenings, and stat modifications 2025-09-25 00:22:58 -07:00
9bb9bd6320 add user settings modal and page 2025-09-24 22:02:25 -07:00
bb3aa1a252 migrate existing image utilities 2025-09-24 03:29:41 -07:00
91524ed064 add centralized image utility system 2025-09-24 03:28:26 -07:00
e6b95f7c12 extract avatar utilities and update user profile 2025-09-24 02:51:51 -07:00
0324adb0a4 update services and uncap utilities 2025-09-23 22:10:22 -07:00
be09e67d42 added methods for getting options from type utils 2025-09-17 21:51:26 -07:00
54491b1158 add detail UI components and uncap utility 2025-09-17 13:39:28 -07:00
6b5f2b4868 Add race and gender utility mappings 2025-09-17 07:12:37 -07:00
78a617db0e Use local square images instead of hotlinking 2025-09-17 06:43:20 -07:00
2cf3c2067e Add element and proficiency utility mappings 2025-09-17 06:42:28 -07:00
034e8e48cd add database pages with svar grid 2025-09-17 05:32:38 -07:00