Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 9 additions & 28 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,37 +326,21 @@ function createCard(item, highlightQuery = "") {
</div>

<div class="card-footer">
newFeatures
<div class="price-section">
<span class="original-price">
₹${item.originalPrice}
</span>

<span class="price">
${formatPrice(item.price)}
</span>

<span class="discount-badge">
${Math.round(((item.originalPrice - item.price) / item.originalPrice) * 100)}% OFF
</span>
</div>

<button class="add-btn" aria-label="Add ${item.name} to cart">
Add
</button>
</div>

<span class="price">${formatPrice(item.price)}</span>
<div class="price-section">
<span class="original-price">₹${item.originalPrice || item.price}</span>
<span class="price">${formatPrice(item.price)}</span>
${item.originalPrice && item.originalPrice > item.price
? `<span class="discount-badge">${Math.round(((item.originalPrice - item.price) / item.originalPrice) * 100)}% OFF</span>`
: ''}
</div>
<button class="add-btn"
aria-label="Add ${item.name} to cart"
${buttonDisabled}
style="background-color:${buttonColor}"
>
Add
</button>

</div>
main
`;

const addBtn = card.querySelector(".add-btn");
Expand Down Expand Up @@ -415,8 +399,7 @@ function renderRecentlyViewed() {
recentItems.forEach(item => recentlyViewedContainer.appendChild(createCard(item)));
}

newFeatures
// Unified Interactive Filter Engine =====
// ===== Favorites Renderer =====
function renderFavorites() {
const favoritesContainer = document.getElementById("favorites-container");
if (!favoritesContainer) return;
Expand All @@ -426,9 +409,7 @@ function renderFavorites() {
favoritesContainer.innerHTML = "";

if (recentItems.length === 0) {
recentlyViewedSection.style.display =
"none";

favoritesContainer.innerHTML = `<p style="text-align:center;color:#5d4037;margin-top:2rem;">You have no favourites yet. Browse the menu and tap a card to save items!</p>`;
return;
}

Expand Down