Commit graph

14 commits

Author SHA1 Message Date
9b60134933 Fix header not reflecting logged-in state after login
- Add useSnapshot from Valtio to make Header reactive to state changes
- Replace accountState references with accountSnap for reactive updates
- Add missing router import for navigation methods
- Fix router.reload() to router.refresh() for Next.js 13+
- Create AccountStateInitializer component to load auth from cookies
- Add initializer to root layout to ensure state is set on page load

The header now properly updates to show user avatar and authenticated menu when logging in.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 16:01:46 -07:00
04b2c0a6b2 Fix updates page translation errors and data fetching
- Fix translation interpolation format from double to single curly braces for next-intl
- Create API route handlers for characters, weapons, summons, and raids
- Fix infinite recursion in ChangelogUnit by renaming fetch function to fetchItem
- Simplify fetch logic and add proper dependencies to useEffect
- Fix activeYear defaulting to 2024 instead of current year (2025)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 16:00:17 -07:00
eec47f69b6 Migrate about, updates, and roadmap pages to App Router
- Create separate pages for about, updates, and roadmap in App Router
- Use correct translation keys from common namespace (page.titles, page.descriptions)
- Remove unstable_setRequestLocale as it's not needed
- Each page has its own client component with segmented control navigation
- Fixes 404 errors for about-related pages
2025-09-03 16:00:17 -07:00
72c734153d Fix profile page to correctly load and display user teams
- Add getUserProfile function to fetch user data with teams from /users/{username} endpoint
- Update profile page to use the correct API response structure (profile.parties)
- Fix UserInfo component to receive user object instead of individual props
- Update ProfilePageClient to fetch additional pages from the correct endpoint
- Fix pagination metadata extraction from the API response

The profile page now correctly displays user teams with working infinite scroll pagination.
2025-09-03 16:00:17 -07:00
2d02f88622 Fix Link component legacy behavior and tab switching
- Remove legacyBehavior prop and nested <a> tags from Link components
- Modernize to Next.js 13+ Link API with className directly on Link
- Convert external links to plain <a> tags (LinkItem, Discord link)
- Remove unnecessary passHref props from Header components
- Fix tab switching by mapping string values to GridType enum

The tab switching issue was caused by trying to parse string values
("characters", "weapons", "summons") as integers when they needed to
be mapped to GridType enum values.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 15:58:12 -07:00
1d9bd18848 Fix PartyPageClient trying to set non-existent appState.parties
- Remove incorrect attempt to set appState.parties[0]
- Party component already handles storing party data via storeParty
- Keep only the raid groups initialization

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 21:16:51 -07:00
59bd37e806 fix: update server components to match API response structure
- Change teamsData.parties to teamsData.results (API returns "results" not "parties")
- Change teamsData.pagination to teamsData.meta (API returns "meta" not "pagination")
- Map meta.count to record_count for pagination
- Use page parameter for current_page instead of expecting it from API
- Fix raidGroups to use direct array instead of .raid_groups property

Aligns frontend expectations with actual backend API response format

🤖 Generated with Claude Code
https://claude.ai/code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 20:41:45 -07:00
8ea7c95446 fix: import useSearchParams from next/navigation instead of next-intl
- Remove useSearchParams from next-intl's createNavigation exports
- Import useSearchParams directly from next/navigation in client components
- Fixes "useSearchParams is not a function" error
- Affected components: TeamsPageClient, ProfilePageClient, SavedPageClient, PartyHeader

next-intl's createNavigation doesn't export useSearchParams, it must be
imported from Next.js directly

🤖 Generated with Claude Code
https://claude.ai/code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 20:41:21 -07:00
727549db6b refactor: migrate App Router pages to locale segments
- Move all App Router pages under [locale] dynamic segment
- Update layout to handle locale params and server-side version fetch
- Remove duplicate pages from root app directory
- Add generateStaticParams for static generation of locale routes
- Update Header component for locale-aware navigation
- Update about page to use next-intl hooks

🤖 Generated with Claude Code
https://claude.ai/code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 20:19:47 -07:00
b7bf44498b feat: implement server-side version fetching with hydration
- Add VersionHydrator component to sync server data to client state
- Update UpdateToastClient to use valtio reactivity with useSnapshot
- Ensure version data is fetched server-side and properly hydrated
- Fix issue where appState.version was never populated from backend

🤖 Generated with Claude Code
https://claude.ai/code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 19:59:08 -07:00
c33de6f2a6 Fix Party component interface and remove incompatible head components
- Update NewPartyClient and PartyPageClient to pass correct props to Party component
- Remove SavedHead and ProfileHead usage from client components (incompatible with App Router)
- Create debugging wrapper for Party component
- Update webpack SVG configuration with safety checks
- Add TypeScript declarations for SVG imports
- Document all fixes in PRDs

These changes address the "Element type is invalid" error by fixing component interfaces
and removing Pages Router patterns incompatible with App Router.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 02:20:21 -07:00
218a524b55 Fix Party component interface and remove unstable_cache
- Update NewPartyClient and PartyPageClient to use correct Party props
- Remove unstable_cache from all data fetching functions
- Fix viewport metadata configuration in App Router
- Restore ToastViewport component in layout
- Fix import paths from 'types' to '~types' in Party components
- Add comprehensive PRD documenting the fixes

This addresses the interface mismatch between Party component and its
client wrappers that occurred during the App Router migration.
2025-09-01 19:06:22 -07:00
98604e698b Remove conflicting Pages Router files and fix App Router setup
- Remove duplicate route files that conflicted with App Router
- Create client-side Providers wrapper for React context providers
- Update app/layout.tsx to use client wrapper for providers
- Fix next/font import in pages/_app.tsx

This resolves the routing conflicts and React context errors when
running the app with both Pages and App routers.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 16:24:09 -07:00
426645813e
Fix intermittent crash: bounded caching + HTTP timeouts/keepAlive + preview route dedupe (#428)
## Summary
- Fixes periodic production crashes (undici ECONNREFUSED ::1) by
bounding server cache size/lifetime and hardening server HTTP client.

### Root cause
- React server cache (cache(...)) held axios responses indefinitely
across many parameter combinations, causing slow memory growth until the
Next.js app router worker was OOM-killed. The main server then failed
IPC to the worker (ECONNREFUSED ::1:<port>).

### Changes
- `app/lib/data.ts`: Replace unbounded cache(...) with unstable_cache
and explicit keys; TTLs: 60s for teams/detail/favorites/user, 300s for
meta (jobs/skills/accessories/raids/version).
- `app/lib/api-utils.ts`: Add shared Axios instance with 15s timeout and
keepAlive http/https agents; apply to GET/POST/PUT/DELETE helpers.
- `pages/api/preview/[shortcode].ts`: Remove duplicate handler to dedupe
route; retain the .tsx variant using `NEXT_PUBLIC_SIERO_API_URL`.

### Notes
- Build currently has pre-existing app/pages route duplication errors;
out of scope here but unrelated to this fix.
- Ensure `NEXT_PUBLIC_SIERO_API_URL` and `NEXT_PUBLIC_SIERO_OAUTH_URL`
are set on Railway.

### Risk/impact
- Low risk; behavior is unchanged aside from bounded caching and
resilient HTTP.
- Cache TTLs can be tuned later if needed.

### Test plan
- Verify saved/teams/user pages load and revalidate after TTL.
- Validate API routes still proxy correctly; timeouts occur after ~15s
for hung upstreams.
- Monitor memory over several days; expect stable usage without steady
growth.
2025-08-31 12:16:42 -07:00