@omercnet/paseo-queens 0.1.0-next.126.2 → 0.1.0-next.128.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -144,6 +144,10 @@ function QueensPopoverGame({
|
|
|
144
144
|
? theme.colors.statusDanger
|
|
145
145
|
: theme.colors.foregroundMuted;
|
|
146
146
|
const puzzleNumber = state.activePuzzleIndex + 1;
|
|
147
|
+
const selectPuzzle = (index: number) => {
|
|
148
|
+
const clampedIndex = Math.min(Math.max(index, 0), state.puzzles.length - 1);
|
|
149
|
+
session.dispatch({ type: "select-puzzle", index: clampedIndex, now: Date.now() });
|
|
150
|
+
};
|
|
147
151
|
|
|
148
152
|
return (
|
|
149
153
|
<View style={styles.root}>
|
|
@@ -227,19 +231,19 @@ function QueensPopoverGame({
|
|
|
227
231
|
canUndo={progress.history.length > 0}
|
|
228
232
|
canHint={!progress.solved}
|
|
229
233
|
canReset={hasProgress}
|
|
230
|
-
canGoPrevious={
|
|
231
|
-
canGoNext={
|
|
234
|
+
canGoPrevious={state.activePuzzleIndex > 0}
|
|
235
|
+
canGoNext={state.activePuzzleIndex < state.puzzles.length - 1}
|
|
232
236
|
saving={session.saving}
|
|
233
237
|
disabled={session.saving}
|
|
234
238
|
dense
|
|
235
|
-
showNavigation
|
|
239
|
+
showNavigation
|
|
236
240
|
showSavingStatus={false}
|
|
237
241
|
theme={theme}
|
|
238
242
|
onUndo={() => session.dispatch({ type: "undo", now: Date.now() })}
|
|
239
243
|
onHint={() => session.dispatch({ type: "hint", now: Date.now() })}
|
|
240
244
|
onReset={() => session.dispatch({ type: "reset", now: Date.now() })}
|
|
241
|
-
onPrevious={
|
|
242
|
-
onNext={
|
|
245
|
+
onPrevious={() => selectPuzzle(state.activePuzzleIndex - 1)}
|
|
246
|
+
onNext={() => selectPuzzle(state.activePuzzleIndex + 1)}
|
|
243
247
|
/>
|
|
244
248
|
</View>
|
|
245
249
|
);
|