feat: confirm dialog for changing decks
This commit is contained in:
		@ -280,6 +280,12 @@
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function handleDeckChange() {
 | 
						function handleDeckChange() {
 | 
				
			||||||
 | 
							if (!confirm('Are you sure you want to change the deck? This will reset the current session.')) {
 | 
				
			||||||
 | 
								// If the user cancels, revert the selection
 | 
				
			||||||
 | 
								const previousDeck = cards.length > 0 ? deckConfigs.findIndex(d => d.cards[0] === cards[0].frontImage) : 0;
 | 
				
			||||||
 | 
								selectedDeck = previousDeck;
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		initializeDeck();
 | 
							initializeDeck();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user