Skip to content

add main functionality + ui for characters page - #24

Merged
woopxwoop merged 7 commits into
mainfrom
vertical-investments
Jul 20, 2026
Merged

add main functionality + ui for characters page#24
woopxwoop merged 7 commits into
mainfrom
vertical-investments

Conversation

@woopxwoop

@woopxwoop woopxwoop commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added a searchable Characters directory with filters, sorting, ownership toggles, and character detail pages.
    • Character pages now include Skills and Builds tabs with recommended weapons, artifact sets, main stats, and substats.
  • Improvements
    • Team comparisons now support Best per character plus clearer baseline summaries and variant diffs.
    • Added background investment warm-up and shared caching for faster team/investment loading.
    • Enhanced tooltips and in-game text rendering; improved CDN-based asset/icon URL handling.
  • Data Updates
    • Expanded weapon dataset with full combat metadata (base ATK, substats, refinements).

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a CDN-backed Characters experience with searchable roster and detail pages, shared character and enemy contracts, cached investment loading, expanded weapon data, and new team filtering and baseline comparison presentations.

Changes

Character and investment experiences

Layer / File(s) Summary
Data contracts and asset helpers
src/lib/types/*, src/lib/asset-urls.ts, src/lib/utils.ts, src/lib/data/weapons.json, src/lib/data/artifact-sets.json
Adds character, enemy, schedule, investment, weapon, and artifact schemas; expands weapon metadata; and updates CDN URL, icon, label, and simulation helpers.
CDN fetchers and investment cache
src/lib/server/*, src/lib/cdn-fetch.ts, src/lib/app/investment.ts, src/lib/app/bootstrapClient.ts
Adds bounded CDN requests, cached character and summary fetchers, shared investment loading, in-flight request reuse, and client bootstrap prefetching.
Character navigation and pages
src/lib/ui/NavBar.svelte, src/routes/+page.svelte, src/routes/characters/*, src/lib/ui/components/*
Adds Characters navigation, searchable and filterable roster browsing, character SEO/loaders, kit tabs, build rendering, tooltips, and formatted game text.
Team investment filtering
src/routes/teams/+page.svelte
Uses the shared investment cache and adds available-cost selection, best-per-character filtering, star indicators, and updated investment labels.
Baseline and investment comparison
src/routes/teams/[slug]/+page.svelte
Separates baseline, F2P, and vertical simulations and renders baseline weapon cards with compact DPS comparison rows.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CharacterPage
  participant getCharacterKit
  participant getCharacterSummary
  participant CDN
  CharacterPage->>getCharacterKit: request kit by slug
  getCharacterKit->>CDN: fetch character kit JSON
  CharacterPage->>getCharacterSummary: request builds by goodKey
  getCharacterSummary->>CDN: fetch character summary JSON
Loading

Possibly related PRs

Poem

A bunny hops through kits so bright,
With filters twinkling left and right.
Baseline builds compare and glow,
While cached data helps them flow.
New stars shine on teams below!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: adding functionality and UI for the Characters page.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch vertical-investments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/asset-urls.ts`:
- Around line 140-176: Add an explicit timeout/abort signal to the fetch calls
in fetchCharacterKitIndex, fetchCharacterKit, and fetchEnemyIndex, using the
project’s established timeout value or CDN fetch convention. Preserve the
existing response validation, error messages, and JSON parsing behavior while
ensuring stalled CDN requests terminate within a bounded period.

In `@src/lib/data/weapons.json`:
- Around line 1025-1027: Update the id 11428 weapon entry’s awakenIcon value to
use the awakened texture suffix, setting it to
UI_EquipIcon_Sword_Purewill_Awaken while leaving icon and splashIcon unchanged.

In `@src/lib/server/character-kit.ts`:
- Around line 18-21: Add an AbortController-based timeout to the fetch in
getCharacterKit, passing its signal to the CDN request and ensuring the timer is
cleared after completion. Treat an abort or timeout like other fetch failures by
returning null, while preserving the existing successful-response and !res.ok
behavior.
- Around line 14-28: Update the cache flow in the character-kit loader to cache
negative results as null, matching the behavior of character-summary.ts. Store
null in kitCache for non-OK responses and caught fetch/JSON errors, while
preserving cached successful CharacterKit values and returning them unchanged.

In `@src/lib/server/character-summary.ts`:
- Around line 20-24: Update the fetch flow in getCharacterSummary to use an
AbortController with a timeout, passing its signal to fetch and ensuring the
timeout is cleared after completion. Preserve the existing non-OK response
behavior that caches null and returns null.

In `@src/lib/types/investment.ts`:
- Around line 93-124: Update the documentation comment above CharacterIndexFile
to describe only the output/characters.json shape, removing the misleading
reference to per-key characters/{GoodKey}.json files; leave the CharacterIndex
interface and its fields unchanged.

In `@src/lib/utils.ts`:
- Around line 37-56: Update resolveGameLinks to validate the href returned by
resolveLink before generating the anchor, allowing only safe internal targets
that begin with “#” or “/”. Treat any other scheme or invalid href as unresolved
and return the original inner text, while preserving empty-link removal and
valid-link rendering.

In `@src/routes/characters/`[slug]/+page.svelte:
- Around line 47-56: Remove event.preventDefault() from handlePointerAction and
the corresponding pointer handlers for both tab buttons, allowing pointer
activation to preserve the browser’s default focus behavior and focus ring.

In `@src/routes/characters/`+page.svelte:
- Around line 88-94: Update the matchesWeapon expression to reuse the existing
weaponTypeLabel helper for normalized weapon-type values instead of duplicating
the WEAPON_TYPE_MAP lookup and fallback logic. Preserve the current null check
and weaponFilter behavior, and reference the imported weaponTypeLabel used
elsewhere in the file.

In `@src/routes/teams/`[slug]/+page.svelte:
- Line 256: Update the baseline weapon card’s refinement value around the
{`@const` refine} declaration and the related rendering at lines 277–288 to use
displayWeaponRefinement, matching the character and compact card formatting.
Preserve the R0 convention for all 4★ weapons regardless of stored refinement
values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0f9707eb-1989-4d3d-bf63-6b3f125dde9a

📥 Commits

Reviewing files that changed from the base of the PR and between 6e08ca0 and d1f77da.

⛔ Files ignored due to path filters (1)
  • package.json is excluded by none and included by none
📒 Files selected for processing (25)
  • src/lib/app/bootstrapClient.ts
  • src/lib/app/investment.ts
  • src/lib/asset-urls.ts
  • src/lib/data/weapons.json
  • src/lib/definitions.ts
  • src/lib/server/character-kit.ts
  • src/lib/server/character-summary.ts
  • src/lib/types/character-kit.ts
  • src/lib/types/enemy.ts
  • src/lib/types/investment.ts
  • src/lib/types/schedules.ts
  • src/lib/ui/NavBar.svelte
  • src/lib/ui/components/ArtifactTooltip.svelte
  • src/lib/ui/components/GameText.svelte
  • src/lib/ui/components/HoverTooltip.svelte
  • src/lib/ui/components/WeaponTooltip.svelte
  • src/lib/utils.ts
  • src/routes/+page.svelte
  • src/routes/api/static/+server.ts
  • src/routes/characters/+page.svelte
  • src/routes/characters/+page.ts
  • src/routes/characters/[slug]/+page.server.ts
  • src/routes/characters/[slug]/+page.svelte
  • src/routes/teams/+page.svelte
  • src/routes/teams/[slug]/+page.svelte

Comment thread src/lib/asset-urls.ts
Comment thread src/lib/data/weapons.json
Comment on lines 1025 to +1027
"icon": "UI_EquipIcon_Sword_Purewill",
"awakenIcon": "UI_EquipIcon_Sword_Purewill",
"splashIcon": "UI_Gacha_EquipIcon_Sword_Purewill"
"splashIcon": "UI_Gacha_EquipIcon_Sword_Purewill",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

awakenIcon is missing the _Awaken suffix.

For id 11428 (Sword of Narzissenkreuz) awakenIcon is "UI_EquipIcon_Sword_Purewill", identical to icon and unlike every other entry which uses ..._Awaken. This will resolve the awakened variant to the base texture. Confirm the source data and set it to "UI_EquipIcon_Sword_Purewill_Awaken" if that's the intended stem.

🔧 Proposed fix
     "icon": "UI_EquipIcon_Sword_Purewill",
-    "awakenIcon": "UI_EquipIcon_Sword_Purewill",
+    "awakenIcon": "UI_EquipIcon_Sword_Purewill_Awaken",
     "splashIcon": "UI_Gacha_EquipIcon_Sword_Purewill",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"icon": "UI_EquipIcon_Sword_Purewill",
"awakenIcon": "UI_EquipIcon_Sword_Purewill",
"splashIcon": "UI_Gacha_EquipIcon_Sword_Purewill"
"splashIcon": "UI_Gacha_EquipIcon_Sword_Purewill",
"icon": "UI_EquipIcon_Sword_Purewill",
"awakenIcon": "UI_EquipIcon_Sword_Purewill_Awaken",
"splashIcon": "UI_Gacha_EquipIcon_Sword_Purewill",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/data/weapons.json` around lines 1025 - 1027, Update the id 11428
weapon entry’s awakenIcon value to use the awakened texture suffix, setting it
to UI_EquipIcon_Sword_Purewill_Awaken while leaving icon and splashIcon
unchanged.

Comment thread src/lib/server/character-kit.ts
Comment thread src/lib/server/character-kit.ts Outdated
Comment thread src/lib/server/character-summary.ts Outdated
Comment thread src/lib/types/investment.ts Outdated
Comment thread src/lib/utils.ts
Comment thread src/routes/characters/[slug]/+page.svelte
Comment thread src/routes/characters/+page.svelte Outdated
? weaponByKey.get(baselineBuild.weapon.key)
: null}
{@const icon = weapon ? weaponIconUrl(weapon.awakenIcon) : null}
{@const refine = baselineBuild?.weapon.refinement ?? null}

@coderabbitai coderabbitai Bot Jul 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Baseline weapon card shows raw refinement — 4★ weapons won't render R0.

Unlike the character/compact cards (which go through formatInvestmentCRdisplayWeaponRefinement), this badge renders the raw baselineBuild.weapon.refinement as R{refine}. For 4★ weapons this displays the stored refinement instead of the app's R0 convention, so this card disagrees with every other refinement label.

Normalize via displayWeaponRefinement for consistency:

🐛 Proposed fix
   import {
     buildGoodKeyMap,
     toGoodKey,
     getSimConfigUrl,
     humanizeInvestmentLabel,
     weaponByKey,
+    displayWeaponRefinement,
   } from "$lib/utils";
-        {`@const` refine = baselineBuild?.weapon.refinement ?? null}
+        {`@const` refine = baselineBuild
+          ? displayWeaponRefinement(
+              baselineBuild.weapon.key,
+              baselineBuild.weapon.refinement,
+            )
+          : null}
Based on learnings that refinement labels intentionally display “R0” for 4-star weapons regardless of the stored `refinement` value.

Also applies to: 277-288

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/routes/teams/`[slug]/+page.svelte at line 256, Update the baseline weapon
card’s refinement value around the {`@const` refine} declaration and the related
rendering at lines 277–288 to use displayWeaponRefinement, matching the
character and compact card formatting. Preserve the R0 convention for all 4★
weapons regardless of stored refinement values.

Source: Learnings

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@woopxwoop Understood — I’ll leave the baseline weapon refinement display as-is.

🐇 …


🧠 Learnings used
Learnt from: woopxwoop
Repo: woopxwoop/lightkeepers PR: 22
File: src/routes/teams/+page.svelte:209-225
Timestamp: 2026-07-16T03:02:42.127Z
Learning: In `src/routes/teams/**/+page.svelte`, the `formatCR` function may intentionally display “R0” for all 4-star weapons even when the underlying stored `refinement` value differs. This follows the community convention that 4-star weapon refinement ranks are not meaningful. In future reviews, do not flag this as a bug if the UI renders “R0” for 4-star weapons by design (i.e., based on the star rating) rather than reflecting the raw `refinement` value.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/server/character-summary.ts (1)

30-32: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Cache null on fetch exceptions to prevent thundering herds.

Unlike character-kit.ts, this catch block returns null without caching the failure. If the CDN times out or dns resolution fails, every subsequent request for this character will trigger another 10-second fetch rather than hitting the cache, heavily tying up server connection pools.

🔒️ Proposed fix to cache the failure state
   } catch {
+    summaryCache.set(goodKey, null);
     return null;
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/server/character-summary.ts` around lines 30 - 32, Update the
exception path in the character summary fetch function so the caught fetch
failure stores a null result in the same cache used for successful summaries
before returning null. Match the failure-caching behavior of character-kit.ts
and preserve the existing return value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/lib/server/character-summary.ts`:
- Around line 30-32: Update the exception path in the character summary fetch
function so the caught fetch failure stores a null result in the same cache used
for successful summaries before returning null. Match the failure-caching
behavior of character-kit.ts and preserve the existing return value.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d9643efa-d94b-43bb-a827-8c69740fbb8d

📥 Commits

Reviewing files that changed from the base of the PR and between d1f77da and 59dbec7.

⛔ Files ignored due to path filters (3)
  • package.json is excluded by none and included by none
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml and included by none
  • pnpm-workspace.yaml is excluded by none and included by none
📒 Files selected for processing (10)
  • src/lib/asset-urls.ts
  • src/lib/cdn-fetch.ts
  • src/lib/data/artifact-sets.json
  • src/lib/data/artifacts.json
  • src/lib/server/character-kit.ts
  • src/lib/server/character-summary.ts
  • src/lib/types/investment.ts
  • src/lib/utils.ts
  • src/routes/characters/+page.svelte
  • src/routes/characters/[slug]/+page.svelte
💤 Files with no reviewable changes (1)
  • src/routes/characters/[slug]/+page.svelte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant