Commit graph

130 commits

Author SHA1 Message Date
devin-ai-integration[bot]
7a0e3b4f3d
Low-risk cleanup: unused imports, gitignore, auth types, test routes (#439)
## Summary

This PR performs low-risk cleanup tasks on the svelte-main branch:

1. **Remove unused imports** from `base.adapter.ts` - `snakeToCamel` and
`camelToSnake` were imported but never used
2. **Add `/.next` to `.gitignore`** - This is a SvelteKit project but
had a stale Next.js build artifact showing in git status
3. **Fix broken auth import** - `map.ts` was importing
`UserInfoResponse` from `$lib/api/resources/users` which never existed.
Created the type in `oauth.ts` based on actual usage in `buildCookies()`
4. **Remove test/example routes** - Deleted development scaffolding that
had no references elsewhere:
   - `src/lib/components/examples/SearchExample.svelte`
   - `src/routes/test-sidebar/+page.svelte`
   - `src/routes/test/drag-drop/+page.svelte`

## Review & Testing Checklist for Human

- [ ] **Verify `UserInfoResponse` type matches actual API response** - I
inferred the type from usage in `map.ts`, but haven't verified against
the actual `/users/info` endpoint response from hensei-api. Fields:
`id`, `username`, `role`, `avatar.picture`, `avatar.element`,
`language`, `gender`, `theme`
- [ ] **Confirm test routes are not needed** - These appeared to be dev
scaffolding with no code references, but verify they're not used in any
manual QA workflows
- [ ] **Test auth flow** - Login/signup should still work correctly with
the new type location

**Recommended test plan:** Log in to the app and verify user info
(avatar, language, theme preferences) loads correctly after
authentication.

### Notes

- The broken `$lib/api/resources/users` import was pre-existing (the
file never existed), not caused by the previous API layer cleanup PR
- Running `pnpm check` confirms the auth/map error is resolved;
remaining type errors are unrelated pre-existing issues

Link to Devin run:
https://app.devin.ai/sessions/611580bc2db94e20a48c3692d3cbd432
Requested by: Justin Edmund (justin@jedmund.com) / @jedmund

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Justin Edmund <justin@jedmund.com>
2025-11-28 11:21:24 -08:00
devin-ai-integration[bot]
9b54039a15
Remove legacy API layer (APIClient, core.ts, resources/) (#438)
# Remove legacy API layer (APIClient, core.ts, resources/)

## Summary

This PR consolidates the API layer by removing unused legacy code. The
codebase had two API patterns:
1. **Adapters layer** (`src/lib/api/adapters/`) - The newer, canonical
HTTP layer with retry logic, caching, and proper error handling
2. **Legacy layer** (`src/lib/api/client.ts`, `core.ts`, `resources/`) -
An older pattern using SvelteKit proxy endpoints that was no longer
imported anywhere

The legacy layer was confirmed unused via grep analysis. The only
exception was `transformResponse` and `transformRequest` functions in
`client.ts` which were still used by `BaseAdapter` and
`schemas/party.ts` - these have been moved to `schemas/transforms.ts`.

**Files deleted:**
- `src/lib/api/client.ts` (732 lines - APIClient class was dead code)
- `src/lib/api/core.ts` (helper functions, unused)
- `src/lib/api/index.ts` (empty file)
- `src/lib/api/resources/` directory (search.ts, weapons.ts,
characters.ts, summons.ts - all unused)

**Files modified:**
- `src/lib/api/schemas/transforms.ts` - Added `transformResponse`,
`transformRequest`, and their helper functions
- `src/lib/api/adapters/base.adapter.ts` - Updated import path
- `src/lib/api/schemas/party.ts` - Updated import path

## Review & Testing Checklist for Human

- [ ] **Verify transform functions work correctly** - The
`transformResponse` and `transformRequest` functions handle critical
data transformation (snake_case ↔ camelCase, object ↔ entity field
renaming). Test that party data loads correctly with proper field names.
- [ ] **Test party CRUD operations** - Create, update, and delete a
party to verify the adapters layer still works end-to-end
- [ ] **Test grid operations** - Add/remove weapons, characters, and
summons to verify the entity field renaming still works correctly
- [ ] **Check for any runtime errors** - The local type checking
couldn't run due to missing dev dependencies, so CI is the first line of
defense

**Recommended test plan:**
1. Load an existing party page and verify all data displays correctly
2. Create a new party and add weapons/characters/summons
3. Edit an existing party (update name, add/remove items)
4. Verify search functionality works for weapons/characters/summons

### Notes
- Local lint/typecheck commands failed due to missing dependencies
(prettier-plugin-svelte, eslint-config-prettier) - relying on CI for
type verification
- The services layer (`src/lib/services/`) was intentionally kept as
it's a business logic layer that wraps the adapters

Link to Devin run:
https://app.devin.ai/sessions/611580bc2db94e20a48c3692d3cbd432
Requested by: Justin Edmund (justin@jedmund.com) / @jedmund

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Justin Edmund <justin@jedmund.com>
2025-11-28 11:09:08 -08:00
d8eb6b965a Update description sidebar padding and title 2025-09-24 00:45:40 -07:00
b564a5e5e0 Update layout
Sidebar now animates properly. Navigation has progressive blur behind it on scroll
2025-09-24 00:45:28 -07:00
06a91bd532 Add Youtube video rendering to DescriptionRenderer 2025-09-24 00:43:06 -07:00
0324adb0a4 update services and uncap utilities 2025-09-23 22:10:22 -07:00
53df1db2bc update themes and global styles 2025-09-23 22:10:01 -07:00
0c03332988 update ui components for better interaction 2025-09-23 22:09:39 -07:00
d6b868a9fd add auth store and update auth flow 2025-09-23 22:09:14 -07:00
838e09d17b add sidebar components for descriptions and details 2025-09-23 22:08:51 -07:00
fc32e18ea8 refactor api adapters to use new pattern 2025-09-23 22:06:42 -07:00
9ed6a00f5f feat: auto-close sidebar on navigation
- Added beforeNavigate hook to close sidebar when navigating between pages
- Prevents search sidebar from staying open when browsing different sections
- Ensures clean UI state transitions between pages
2025-09-20 21:36:49 -07:00
fc711a7a5d feat: adapt SearchSidebar to use new sidebar system with component-based content 2025-09-20 12:54:18 -07:00
f5361c5ace fix: use close.svg icon directly in SidebarHeader for visibility 2025-09-20 12:49:37 -07:00
eace0530fa fix: update CharacterRep and SummonRep to use correct adapter field names and shared image utilities 2025-09-20 12:33:08 -07:00
713886a290 fix: prevent duplicate icon rendering in Button component when iconOnly is true 2025-09-20 03:02:55 -07:00
2cf29275b6 Fix database pages to use camelCase field names
- Update database grid navigation to use granblueId
- Update column definitions to use granblueId
- Fix all detail pages to use camelCase field names from transformed API responses
- Fix field names for HP/ATK stats, abilities, and metadata
2025-09-20 02:57:27 -07:00
0797892ea4 Fix last updated field to use camelCase field names 2025-09-20 02:47:08 -07:00
eaa9e1c847 Fix database pages and images
- Update DatabaseProvider to use SearchAdapter instead of direct fetch
- Fix RequestCache error by using cacheTTL instead of cache
- Update image cells to use shared image utilities with correct parameters
- Use only camelCase field names (granblueId) from transformed responses
2025-09-20 02:46:13 -07:00
100a04eda6 Fix adapter field names and runed import
- Update Party interface to use transformed field names (weapons/characters/summons)
- Fix runed import to use useDebounce instead of debounced
- Clean up debug logging
2025-09-20 02:26:54 -07:00
1a6a112efd fix: adapter initialization and image loading
- Add centralized adapter config with proper baseURL
- Fix API response transformation (object -> weapon/character/summon)
- Update components to use image service and correct property names
- Fix Svelte 5 $derived syntax and missing PartyAdapter.list method

Images now display correctly in grids.
2025-09-20 01:54:40 -07:00
842321efd2 feat: Complete Phase 4 & 5 - Finish adapter migration
Phase 4 - Page Server Components:
- Migrated database page servers to use EntityAdapter directly
- Removed fetch parameter from all page server loads

Phase 5 - Utility Files:
- Deleted lib/api.ts (functionality inlined)
- Deleted lib/server/detail/load.ts (no longer needed)
- Updated DatabaseProvider to use PUBLIC_SIERO_API_URL directly
- Updated OAuth to use native fetch type

Migration Complete:
- All 32 files migrated from api/core to adapter pattern
- Zero remaining dependencies on lib/api/core
- Clean separation of concerns with dedicated adapters
2025-09-20 01:16:58 -07:00
8332ecc158 refactor: Complete Phase 3 - Migrate API route handlers from core to utilities
- Created dedicated utility functions for API route proxies (buildApiUrl, extractHeaders, handleApiError)
- Migrated all 20 API route handlers to use new utilities instead of api/core
- Routes continue to act as proxies to Rails API (correct architecture)
- Removed dependency on buildUrl from api/core in all route handlers
- Updated migration plan to reflect completed Phase 3
2025-09-20 01:11:08 -07:00
87a65408f9 test: Add comprehensive tests for UserAdapter
- Tests for all UserAdapter methods (getInfo, getProfile, getFavorites, etc.)
- Tests for error handling and caching behavior
- Fixed caching tests to explicitly enable caching (disabled by default)
- Added cache clearing after profile updates
- All 21 tests passing successfully
2025-09-20 00:46:28 -07:00
683c28e172 feat: Create UserAdapter and complete Phase 1 & 2 of migration
- Created new UserAdapter for user profile and favorites operations
- Updated routes/teams/explore and routes/[username] to use adapters directly
- Deleted resource facade files (parties.ts, grid.ts, users.ts)
- All services and initial routes now use adapters without backward compatibility
- Updated migration plan to track completed work
2025-09-20 00:42:13 -07:00
2605a539b6 refactor: Remove backward compatibility in adapter migration
- Update services to use adapters directly without FetchLike
- Remove constructor fetch dependency from services
- Add favorite/unfavorite methods to PartyAdapter
- Simplify API resource files to act as facades temporarily
- Services now instantiate without fetch parameter
- Direct adapter usage improves type safety and reduces complexity
2025-09-20 00:37:26 -07:00
fd172e6558 test: Add comprehensive tests for grid and entity adapters
- Add tests for GridAdapter covering weapons, characters, and summons
- Add tests for EntityAdapter covering canonical data access
- Test CRUD operations, positioning, uncap updates, and caching
- Verify snake_case transformation and error handling
- Ensure proper cache management with TTL support
2025-09-20 00:19:00 -07:00
49fc0fb069 feat: Implement GridAdapter and EntityAdapter
- Add GridAdapter for managing user grid item instances
- Support CRUD, position management, and uncap operations
- Add EntityAdapter for read-only canonical game data
- Separate user instances from game reference data
- Export all adapters from index
2025-09-20 00:11:51 -07:00
4f8beab3ea fix: Update PartyAdapter to match corrected API endpoints
- Remove non-existent batch update methods for grid items
- Add gridUpdate for atomic batch operations
- Add preview management methods
- Split job management into separate endpoints
- Update tests to match new API structure
2025-09-20 00:04:36 -07:00
114427241f feat: Implement PartyAdapter with comprehensive functionality
- Add PartyAdapter for party CRUD and grid management
- Create reactive PartyResource with optimistic updates
- Support user parties listing with filters
- Handle grid conflicts and job updates
- Include comprehensive test coverage
2025-09-19 23:19:24 -07:00
20c6de3834 docs: add search example component demonstrating adapter usage
- Create comprehensive example showing search functionality
- Demonstrate filtering, debouncing, and error handling
- Show proper integration with Svelte 5 reactive patterns
2025-09-19 23:07:24 -07:00
99e58d0b3c feat: add reactive search resource using Svelte 5 runes
- Create SearchResource class with reactive state management
- Implement debounced search using Runed utilities
- Support concurrent searches for different entity types
- Add request cancellation and state management
- Include tests for resource functionality
2025-09-19 23:06:59 -07:00
ece44a54a3 feat: add search adapter for entity searches
- Implement SearchAdapter extending BaseAdapter
- Support searching weapons, characters, and summons
- Add filtering by element, rarity, proficiency, etc.
- Include pagination support
- Add comprehensive test coverage
2025-09-19 23:06:46 -07:00
51c30edc50 feat: implement base adapter with retry logic and caching
- Add BaseAdapter class with request/response transformation
- Implement comprehensive error handling and normalization
- Add retry logic with exponential backoff for network/server errors
- Support request cancellation and deduplication
- Include response caching with configurable TTL
- Add full test coverage for adapter functionality
2025-09-19 23:03:36 -07:00
6f9479f697 Fix double load 2025-09-19 13:59:55 -07:00
a642cdd857 fix: linter fixes 2025-09-17 22:16:10 -07:00
24bf7da892 CSS changes to DatabaseGridWithProvider 2025-09-17 22:15:57 -07:00
5c407f3ef7 Small changes to Navigation 2025-09-17 22:15:37 -07:00
5c8e23a38e Added editable mode to character detail 2025-09-17 22:15:24 -07:00
0e92b9baf5 small changes and fixes to character datagrid 2025-09-17 22:15:01 -07:00
b71c2c2109 Add role to summons and weapons detail pages 2025-09-17 22:14:42 -07:00
a8dfe28b07 added details components for database section 2025-09-17 22:14:19 -07:00
bca4843885 Refactored Select component 2025-09-17 22:10:38 -07:00
5466a70916 Refactored Input component 2025-09-17 22:08:37 -07:00
be2f723962 Remove everything in stories folder for now 2025-09-17 22:08:19 -07:00
3e7ccf8fdb Refactored Button component 2025-09-17 22:06:45 -07:00
c09154b138 Remove test-ui route 2025-09-17 22:04:49 -07:00
7fb9ef2d9a Tweaked CSS variables
Added some new variables for elevation, rounder corners, and tweaked some other things
2025-09-17 22:04:26 -07:00
be09e67d42 added methods for getting options from type utils 2025-09-17 21:51:26 -07:00
94a3227632 dummy text for collection route 2025-09-17 21:50:23 -07:00