Skip to content

Commit 9504d8a

Browse files
authored
Merge pull request #3 from AshladBP/fix-new-version
Fix merged changes and UI inconsistencies + updated README for new usage
2 parents 056025a + f055220 commit 9504d8a

3 files changed

Lines changed: 42 additions & 84 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ npm install -g pnpm
7878

7979
```bash
8080
# Backend
81+
# Note: the library directory you provide must contain a "publish_files" directory
82+
# with all required published files (index.json, CSV files, .jsonl.zstd files).
8183
cd backend
82-
go run ./cmd -index /path/to/index.json
84+
go run ./cmd -library /path/to/library
8385
# Runs on http://localhost:7754
86+
```
8487

8588
# Frontend (separate terminal)
8689
cd frontend

frontend/src/lib/components/DistributionTable.svelte

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@
3939
return `${bucket.range_start}-${bucket.range_end}`;
4040
}
4141
42-
// Set first bucket as expanded by default (wincap)
43-
$effect(() => {
44-
const sorted = sortedBuckets();
45-
if (sorted.length > 0 && expandedBuckets.length === 0) {
46-
const key = getBucketKey(sorted[0]);
47-
expandedBuckets = [key];
48-
loadBucketData(sorted[0], 0);
49-
}
50-
});
51-
5242
// Reset when mode changes
5343
$effect(() => {
5444
// Track mode to reset state when it changes

frontend/src/lib/components/optimizer/BucketConfigPanel.svelte

Lines changed: 38 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,19 @@
276276
}
277277
278278
const cost = modeInfo!.cost;
279-
if (inputFormat === 'absolute') {
280-
// Convert absolute -> normalized (divide by cost)
281-
buckets = buckets.map(b => ({ ...b, min_payout: +(b.min_payout / cost), max_payout: +(b.max_payout / cost) }));
282-
inputFormat = 'normalized';
283-
} else {
279+
// Swap based on the current ABS/NORM display toggle (displayMode).
280+
// If currently showing normalized values, convert them to absolute (multiply by cost),
281+
// otherwise convert absolute -> normalized (divide by cost).
282+
if (displayMode === 'norm') {
284283
// Convert normalized -> absolute (multiply by cost)
285284
buckets = buckets.map(b => ({ ...b, min_payout: +(b.min_payout * cost), max_payout: +(b.max_payout * cost) }));
285+
displayMode = 'abs';
286286
inputFormat = 'absolute';
287+
} else {
288+
// Convert absolute -> normalized (divide by cost)
289+
buckets = buckets.map(b => ({ ...b, min_payout: +(b.min_payout / cost), max_payout: +(b.max_payout / cost) }));
290+
displayMode = 'norm';
291+
inputFormat = 'normalized';
287292
}
288293
// Clear any prior errors
289294
error = null;
@@ -842,60 +847,7 @@
842847
>MANUAL</button>
843848
</div>
844849

845-
<!-- Bonus Mode / Units Banner -->
846-
{#if modeInfo?.is_bonus_mode}
847-
<div class="px-4 py-3 rounded-xl bg-violet-500/10 border border-violet-500/30">
848-
<div class="flex items-center gap-2 mb-2">
849-
<svg class="w-4 h-4 text-violet-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
850-
<path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
851-
</svg>
852-
<span class="text-sm font-mono text-violet-400">BONUS MODE</span>
853-
<span class="px-2 py-0.5 text-xs font-mono bg-violet-500/20 text-violet-300 rounded">Cost: {modeInfo.cost}x</span>
854-
855-
<!-- Input format selector + convert button -->
856-
<span class="ml-auto flex items-center gap-2">
857-
<span class="text-xs font-mono text-violet-300/80">Bucket ranges:</span>
858-
<select
859-
bind:value={inputFormat}
860-
class="bg-[var(--color-graphite)] border border-white/10 rounded px-2 py-1 text-xs font-mono text-[var(--color-light)] focus:outline-none"
861-
aria-label="Bucket range units"
862-
title="Choose how you want to type bucket Min/Max values"
863-
>
864-
<option value="absolute">Absolute (x)</option>
865-
<option value="normalized">Normalized (x / cost)</option>
866-
</select>
867-
868-
<button
869-
class="p-1 rounded text-xs bg-[var(--color-slate)]/20 text-[var(--color-mist)] hover:bg-[var(--color-slate)]/30 transition-colors"
870-
onclick={convertBucketsFormat}
871-
title="Convert all current bucket Min/Max values to the other unit using the mode cost"
872-
aria-label="Convert bucket values between absolute and normalized"
873-
>
874-
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
875-
<path stroke-linecap="round" stroke-linejoin="round" d="M7 7h10M7 7l3 3M7 7l3-3M17 17H7M17 17l-3-3M17 17l-3 3" />
876-
</svg>
877-
</button>
878-
</span>
879-
</div>
880-
881-
<div class="text-xs font-mono text-violet-200/70 space-y-2">
882-
<p>
883-
In bonus modes, the optimizer uses <span class="text-violet-300">normalized</span> payouts where
884-
<span class="text-emerald-400">1.0x</span> means "one mode cost".
885-
If you select <span class="text-violet-300">Absolute</span> ranges, they are converted automatically before optimizing.
886-
</p>
887-
888-
<div class="space-y-1">
889-
<p><span class="text-violet-300">Absolute</span>: type the multipliers exactly as shown in your distribution/payout table (e.g. 500x = 500x).</p>
890-
<p><span class="text-violet-300">Normalized</span>: type optimizer units (absolute ÷ cost).</p>
891-
</div>
892-
893-
<p class="text-violet-200/60">
894-
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.
895-
</p>
896-
</div>
897-
</div>
898-
{/if}
850+
<!-- NOTE: Top explanatory bonus-mode banner removed per UX request. -->
899851

900852
<!-- ═══════ PRESETS MODE ═══════ -->
901853
{#if uiMode === 'presets'}
@@ -1174,17 +1126,30 @@
11741126
<div class="flex gap-0.5 p-0.5 bg-[var(--color-slate)]/30 rounded">
11751127
<button
11761128
class="px-2 py-1 text-xs font-mono rounded transition-all
1177-
{displayMode === 'abs' ? 'bg-[var(--color-violet)]/20 text-[var(--color-violet)]' : 'text-[var(--color-mist)]/70 hover:text-[var(--color-mist)]'}"
1129+
{displayMode === 'abs' ? 'bg-[var(--color-violet)]/20 text-[var(--color-violet)]' : 'text-[var(--color-mist)]/70 hover:text-[var(--color-mist)]'}"
11781130
onclick={() => displayMode = 'abs'}
11791131
title="Absolute values (multiplied by cost)"
11801132
>ABS</button>
11811133
<button
11821134
class="px-2 py-1 text-xs font-mono rounded transition-all
1183-
{displayMode === 'norm' ? 'bg-[var(--color-emerald)]/20 text-[var(--color-emerald)]' : 'text-[var(--color-mist)]/70 hover:text-[var(--color-mist)]'}"
1135+
{displayMode === 'norm' ? 'bg-[var(--color-emerald)]/20 text-[var(--color-emerald)]' : 'text-[var(--color-mist)]/70 hover:text-[var(--color-mist)]'}"
11841136
onclick={() => displayMode = 'norm'}
11851137
title="Normalized values (divided by cost)"
11861138
>NORM</button>
11871139
</div>
1140+
1141+
<!-- Convert/Switch button moved from the removed banner -->
1142+
<button
1143+
class="p-1 rounded text-xs bg-[var(--color-slate)]/20 text-[var(--color-mist)] hover:bg-[var(--color-slate)]/30 transition-colors"
1144+
onclick={convertBucketsFormat}
1145+
title="Convert current bucket Min/Max values between absolute and normalized units"
1146+
aria-label="Convert bucket values between absolute and normalized"
1147+
>
1148+
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
1149+
<path stroke-linecap="round" stroke-linejoin="round" d="M7 7h10M7 7l3 3M7 7l3-3M17 17H7M17 17l-3-3M17 17l-3 3" />
1150+
</svg>
1151+
</button>
1152+
11881153
<span class="px-2 py-0.5 text-xs font-mono bg-[var(--color-cyan)]/20 text-[var(--color-cyan)] rounded">NEW</span>
11891154
</div>
11901155
{/if}
@@ -1254,18 +1219,18 @@
12541219
</div>
12551220
{/if}
12561221

1257-
<!-- Bonus Mode Info (simplified) -->
1258-
{#if modeInfo?.is_bonus_mode}
1259-
<div class="px-3 py-2 rounded-lg bg-violet-500/10 border border-violet-500/20">
1260-
<div class="flex items-center gap-2 text-xs font-mono">
1261-
<span class="text-violet-400">BONUS MODE</span>
1262-
<span class="px-1.5 py-0.5 bg-violet-500/20 text-violet-300 rounded">Cost: {modeInfo.cost}x</span>
1263-
<span class="text-violet-200/70 ml-2">
1264-
{displayMode === 'abs' ? 'Showing absolute values' : 'Showing normalized values'}
1265-
</span>
1266-
</div>
1267-
</div>
1268-
{/if}
1222+
<!-- Bonus Mode Info (simplified) -->
1223+
{#if modeInfo?.is_bonus_mode}
1224+
<div class="px-3 py-2 rounded-lg bg-violet-500/10 border border-violet-500/20">
1225+
<div class="flex items-center gap-2 text-xs font-mono">
1226+
<span class="text-violet-400">BONUS MODE</span>
1227+
<span class="px-1.5 py-0.5 bg-violet-500/20 text-violet-300 rounded">Cost: {modeInfo.cost}x</span>
1228+
<span class="text-violet-200/70 ml-2">
1229+
{displayMode === 'abs' ? 'Showing absolute values' : 'Showing normalized values'}
1230+
</span>
1231+
</div>
1232+
</div>
1233+
{/if}
12691234

12701235
<!-- Profile Selector Panel -->
12711236
{#if showProfiles && profileConfigs.length > 0}

0 commit comments

Comments
 (0)