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

The auto-adventurer toggle is now surfaced directly in the adventurer shop panel header, mirroring the auto-boss button. It only renders when the `auto_adventurer` prestige upgrade has been purchased, so players who have not reached prestige see no change.

Closes #89

 This PR was created with help from Hikari~ 🌸

Reviewed-on: #94
Co-authored-by: Hikari <hikari@nhcarrigan.com>
Co-committed-by: Hikari <hikari@nhcarrigan.com>
This commit was merged in pull request #94.
This commit is contained in:
2026-03-20 14:35:04 -07:00
committed by Naomi Carrigan
parent 635c630e49
commit dc1782bec9
@@ -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,12 +222,35 @@ 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>
<div className="panel-header-controls">
{autoAdventurerUnlocked
? <button
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 <LockToggle
lockedCount={locked.length} lockedCount={locked.length}
onToggle={handleToggle} onToggle={handleToggle}
showLocked={showLocked} showLocked={showLocked}
/> />
</div> </div>
</div>
<div className="batch-selector"> <div className="batch-selector">
{batchOptions.map((option) => { {batchOptions.map((option) => {
function handleBatchSelect(): void { function handleBatchSelect(): void {