chore: add auto-adventurer toggle to adventurer panel header
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m9s
CI / Lint, Build & Test (pull_request) Successful in 1m10s

The toggle is now visible directly in the adventurer shop panel whenever
the auto_adventurer prestige upgrade has been purchased. It mirrors the
auto-boss button styling and only renders when the feature is unlocked,
so players who haven't reached prestige yet see no change.

Closes #89
This commit is contained in:
2026-03-20 10:31:38 -07:00
committed by Naomi Carrigan
parent 635c630e49
commit 5ee4a7f7d5
@@ -175,7 +175,7 @@ const AdventurerCard = ({
* @returns The JSX element. * @returns The JSX element.
*/ */
const AdventurerPanel = (): JSX.Element => { const AdventurerPanel = (): JSX.Element => {
const { state, formatNumber } = useGame(); const { state, formatNumber, toggleAutoAdventurer } = useGame();
const [ showLocked, setShowLocked ] = useState(true); const [ showLocked, setShowLocked ] = useState(true);
const [ batchSize, setBatchSize ] = useState<BatchSize>(() => { const [ batchSize, setBatchSize ] = useState<BatchSize>(() => {
return parseBatchSize(localStorage.getItem("elysium_batch_size")); return parseBatchSize(localStorage.getItem("elysium_batch_size"));
@@ -207,6 +207,11 @@ const AdventurerPanel = (): JSX.Element => {
} }
} }
const autoAdventurerUnlocked = state.prestige.purchasedUpgradeIds.includes(
"auto_adventurer",
);
const autoAdventurerOn = state.autoAdventurer === true;
function handleToggle(): void { function handleToggle(): void {
setShowLocked((current) => { setShowLocked((current) => {
return !current; return !current;
@@ -217,11 +222,34 @@ const AdventurerPanel = (): JSX.Element => {
<section className="panel adventurer-panel"> <section className="panel adventurer-panel">
<div className="panel-header"> <div className="panel-header">
<h2>{"Adventurers"}</h2> <h2>{"Adventurers"}</h2>
<LockToggle <div className="panel-header-controls">
lockedCount={locked.length} {autoAdventurerUnlocked
onToggle={handleToggle} ? <button
showLocked={showLocked} className={`auto-toggle-btn ${
/> autoAdventurerOn
? "auto-toggle-on"
: "auto-toggle-off"
}`}
onClick={toggleAutoAdventurer}
title={
"Automatically purchase the highest-tier"
+ " affordable adventurer"
}
type="button"
>
{"🤖 Auto: "}
{autoAdventurerOn
? "ON"
: "OFF"}
</button>
: null
}
<LockToggle
lockedCount={locked.length}
onToggle={handleToggle}
showLocked={showLocked}
/>
</div>
</div> </div>
<div className="batch-selector"> <div className="batch-selector">
{batchOptions.map((option) => { {batchOptions.map((option) => {