Commit graph

27 commits

Author SHA1 Message Date
d053a9377e add race/proficiency/gender to CollectionFilters type 2025-12-02 15:32:11 -08:00
60ac5d4ab2 add collection API layer
Types, adapter, queries, and mutations for managing user collections
(characters, weapons, summons, job accessories). Supports both private
collection management and public collection viewing with privacy.
2025-12-02 09:28:22 -08:00
67b87c7d1b add season, series, promotions to entity types 2025-12-02 05:25:23 -08:00
b6db09bcc4 add formal promotion to enums 2025-12-02 05:25:10 -08:00
1cbcd91f94 entity adapter: add raw data fetch methods 2025-12-01 09:54:39 -08:00
8bfa31d925 types: add NO_AWAKENING sentinel and update entity types 2025-11-30 20:05:50 -08:00
8b078cdfd8 feat: add conflict dialog for duplicate characters/weapons 2025-11-30 02:32:03 -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
3b2782ec89 refactor: consolidate Awakening type definition
Phase 3.1: Remove duplicate Awakening interface
- Removed unused src/lib/types/Awakening.d.ts
- Using entities.ts as single source of truth for Awakening type
- Awakening now properly uses LocalizedName interface
- No breaking changes (unused file had zero imports)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 21:48:21 -08:00
271dcb3c81 refactor: add wx-svelte-grid Cell type for database cells
Phase 2.2: Add proper type definitions for wx-svelte-grid
- Created Cell interface export in wx-svelte-grid declarations
- Updated all 9 database cell components to use Cell type
- Removed custom Props interfaces with loose IRow typing
- Improved IntelliSense support for grid component props

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 21:46:48 -08:00
c074ea8bda refactor: unify visibility types to string literals
Changed from numeric (0/1/2) to string literals ('public'/'private'/'unlisted')
- Created PartyVisibility type with const assertion
- Updated Party and PartyPreview interfaces
- Updated PartyUpdatePayload interface
- Updated Zod schemas for validation
- Updated test mocks to use string literals
- Added deprecated conversion helpers for backward compat

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 21:43:55 -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
45b51d8880 fix: Phase 3 - fix adapter type issues (43 -> 42 errors)
Fixed three key type definition issues in the adapter layer:

1. Added missing element property to Party interface
   - Added `element?: number` to Party type
   - Used throughout codebase but was missing from interface

2. Aligned onError callback types for consistency
   - Changed ResourceOptions.onError from Error to AdapterError
   - Now matches AdapterOptions.onError type signature

3. Exported Grid types from grid.adapter.ts
   - Re-exported GridWeapon, GridCharacter, GridSummon
   - Makes types available for test files

Files modified:
- src/lib/types/api/party.ts: Added element property
- src/lib/api/adapters/types.ts: Fixed onError callback type
- src/lib/api/adapters/grid.adapter.ts: Added type re-exports

Result: 43 → 42 errors (-1)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 19:25:23 -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
cab0a84588 fix: type errors in svelte-main branch (372 -> 217 errors)
- Fix Button variant errors (outlined -> ghost, contained -> primary)
- Fix search.queries.ts import path and property names (snake_case -> camelCase)
- Fix PartyContext export from party.service.ts
- Fix User type missing avatar property
- Fix exactOptionalPropertyTypes violations in Unit components
- Fix MenuItems Props interface
- Fix RequestOptions, SearchParams, SearchFilters types
- Fix UpdateUncapParams type
- Fix Select.ItemIndicator and maxLength errors
- Fix Summon/Weapon hp/atk properties in entity.adapter.ts

Co-Authored-By: Justin Edmund <justin@jedmund.com>
2025-11-28 20:32:38 +00:00
Devin AI
dfbb1e4e48 fix: type errors and cleanup for svelte-main branch
- Fix RequestOptions cache type incompatibility in adapters/types.ts
- Add missing properties to Character type in entity.adapter.ts and entities.ts
- Create adapters index.ts for module exports
- Update users.ts to use userAdapter instead of removed core module
- Fix UserSettingsModal.svelte switch import and type errors
- Add type shims for wx-svelte-grid and $env/static/public
- Accept upstream versions for SearchSidebar.svelte and teams/new/+page.svelte
- Add CLEANUP_PLAN.md documenting remaining work

Reduces type errors from ~412 to ~378. See CLEANUP_PLAN.md for remaining fixes.

Co-Authored-By: Justin Edmund <justin@jedmund.com>
2025-11-28 20:08:10 +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
d8e18c00e1 update ui components 2025-09-29 23:48:02 -07:00
79c0de3128 remove barrel files and update imports 2025-09-29 23:37:37 -07:00
3666b8db86 add perpetuity ring toggle and fix grid api response handling 2025-09-25 01:08:25 -07:00
9bb9bd6320 add user settings modal and page 2025-09-24 22:02:25 -07:00
d6b868a9fd add auth store and update auth flow 2025-09-23 22:09:14 -07:00
7c7ed8b579 chore: update dependencies and misc files 2025-09-17 10:48:15 -07:00
fed7b5ae50 implement visual party segmented control 2025-09-16 20:08:57 -07:00
e8fa1545f8 Add API type definitions 2025-09-15 04:04:39 -07:00
660cc8d028 Add export keyword types 2025-09-09 03:17:38 -07:00
7b05fa0497 Migrate type defs 2025-09-09 00:27:26 -07:00