From f0552203cd79d8b842dd4fd7391612db408e4058 Mon Sep 17 00:00:00 2001 From: Ashlad Date: Fri, 23 Jan 2026 07:40:13 +0100 Subject: [PATCH] Fix merged changes and UI inconsistencies + updated README for new usage --- README.md | 5 +- .../lib/components/DistributionTable.svelte | 10 -- .../optimizer/BucketConfigPanel.svelte | 111 ++++++------------ 3 files changed, 42 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index 6353524..260bc73 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,12 @@ npm install -g pnpm ```bash # Backend +# Note: the library directory you provide must contain a "publish_files" directory +# with all required published files (index.json, CSV files, .jsonl.zstd files). cd backend -go run ./cmd -index /path/to/index.json +go run ./cmd -library /path/to/library # Runs on http://localhost:7754 +``` # Frontend (separate terminal) cd frontend diff --git a/frontend/src/lib/components/DistributionTable.svelte b/frontend/src/lib/components/DistributionTable.svelte index 6a226f8..05973fa 100644 --- a/frontend/src/lib/components/DistributionTable.svelte +++ b/frontend/src/lib/components/DistributionTable.svelte @@ -39,16 +39,6 @@ return `${bucket.range_start}-${bucket.range_end}`; } - // Set first bucket as expanded by default (wincap) - $effect(() => { - const sorted = sortedBuckets(); - if (sorted.length > 0 && expandedBuckets.length === 0) { - const key = getBucketKey(sorted[0]); - expandedBuckets = [key]; - loadBucketData(sorted[0], 0); - } - }); - // Reset when mode changes $effect(() => { // Track mode to reset state when it changes diff --git a/frontend/src/lib/components/optimizer/BucketConfigPanel.svelte b/frontend/src/lib/components/optimizer/BucketConfigPanel.svelte index f98e492..188018f 100644 --- a/frontend/src/lib/components/optimizer/BucketConfigPanel.svelte +++ b/frontend/src/lib/components/optimizer/BucketConfigPanel.svelte @@ -276,14 +276,19 @@ } const cost = modeInfo!.cost; - if (inputFormat === 'absolute') { - // Convert absolute -> normalized (divide by cost) - buckets = buckets.map(b => ({ ...b, min_payout: +(b.min_payout / cost), max_payout: +(b.max_payout / cost) })); - inputFormat = 'normalized'; - } else { + // Swap based on the current ABS/NORM display toggle (displayMode). + // If currently showing normalized values, convert them to absolute (multiply by cost), + // otherwise convert absolute -> normalized (divide by cost). + if (displayMode === 'norm') { // Convert normalized -> absolute (multiply by cost) buckets = buckets.map(b => ({ ...b, min_payout: +(b.min_payout * cost), max_payout: +(b.max_payout * cost) })); + displayMode = 'abs'; inputFormat = 'absolute'; + } else { + // Convert absolute -> normalized (divide by cost) + buckets = buckets.map(b => ({ ...b, min_payout: +(b.min_payout / cost), max_payout: +(b.max_payout / cost) })); + displayMode = 'norm'; + inputFormat = 'normalized'; } // Clear any prior errors error = null; @@ -842,60 +847,7 @@ >MANUAL - - {#if modeInfo?.is_bonus_mode} -
-
- - - - BONUS MODE - Cost: {modeInfo.cost}x - - - - Bucket ranges: - - - - -
- -
-

- In bonus modes, the optimizer uses normalized payouts where - 1.0x means "one mode cost". - If you select Absolute ranges, they are converted automatically before optimizing. -

- -
-

Absolute: type the multipliers exactly as shown in your distribution/payout table (e.g. 500x = 500x).

-

Normalized: type optimizer units (absolute ÷ cost).

-
- -

- The swap button converts the current bucket values to quickly view and edit buckets in the other unit and switches the selected range unit (Absolute ↔ Normalized) so everything stays consistent. -

-
-
- {/if} + {#if uiMode === 'presets'} @@ -1174,17 +1126,30 @@
+ + + + NEW {/if} @@ -1254,18 +1219,18 @@ {/if} - - {#if modeInfo?.is_bonus_mode} -
-
- BONUS MODE - Cost: {modeInfo.cost}x - - {displayMode === 'abs' ? 'Showing absolute values' : 'Showing normalized values'} - -
-
- {/if} + + {#if modeInfo?.is_bonus_mode} +
+
+ BONUS MODE + Cost: {modeInfo.cost}x + + {displayMode === 'abs' ? 'Showing absolute values' : 'Showing normalized values'} + +
+
+ {/if} {#if showProfiles && profileConfigs.length > 0}