commit
This commit is contained in:
35
figma_html_page/js/select-product.js
Normal file
35
figma_html_page/js/select-product.js
Normal file
@@ -0,0 +1,35 @@
|
||||
let selectedProducts = [];
|
||||
|
||||
function toggleSelect(card) {
|
||||
const productId = card.dataset.id;
|
||||
|
||||
if (card.classList.contains('selected')) {
|
||||
card.classList.remove('selected');
|
||||
selectedProducts = selectedProducts.filter(id => id !== productId);
|
||||
} else {
|
||||
card.classList.add('selected');
|
||||
selectedProducts.push(productId);
|
||||
}
|
||||
}
|
||||
|
||||
function goGenerate() {
|
||||
if (selectedProducts.length === 0) {
|
||||
showToast();
|
||||
return;
|
||||
}
|
||||
localStorage.setItem('selectedProducts', JSON.stringify(selectedProducts));
|
||||
window.location.href = 'generate-content.html';
|
||||
}
|
||||
|
||||
function goToProfile() {
|
||||
window.location.href = 'profile.html';
|
||||
}
|
||||
|
||||
function showToast() {
|
||||
const overlay = document.getElementById('toastOverlay');
|
||||
overlay.style.display = 'flex';
|
||||
|
||||
setTimeout(() => {
|
||||
overlay.style.display = 'none';
|
||||
}, 2000);
|
||||
}
|
||||
Reference in New Issue
Block a user