Add new game button to token bar
This commit is contained in:
@@ -92,6 +92,12 @@ export default function Game({ state, onStateChange }) {
|
|||||||
showMessage('You rest. The harbour sounds fade.')
|
showMessage('You rest. The harbour sounds fade.')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleNewGame() {
|
||||||
|
if (!window.confirm('Abandon this ledger and start a new one?')) return
|
||||||
|
localStorage.removeItem('otium_token')
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
|
||||||
// Progress bar values
|
// Progress bar values
|
||||||
let progressPct = 0
|
let progressPct = 0
|
||||||
let progressLabel = ''
|
let progressLabel = ''
|
||||||
@@ -257,6 +263,13 @@ export default function Game({ state, onStateChange }) {
|
|||||||
|
|
||||||
<div className="token-bar">
|
<div className="token-bar">
|
||||||
Your save code: <span className="token-code">{state.token}</span>
|
Your save code: <span className="token-code">{state.token}</span>
|
||||||
|
<button
|
||||||
|
className="btn-new-game"
|
||||||
|
onClick={handleNewGame}
|
||||||
|
title="Clear this save and start fresh"
|
||||||
|
>
|
||||||
|
New game
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user