diff --git a/templates/dashboard.templ b/templates/dashboard.templ index 3b3f5af..5a7214e 100644 --- a/templates/dashboard.templ +++ b/templates/dashboard.templ @@ -129,21 +129,80 @@ templ Dashboard(user User) { }); } - function renderEbooks(ebooks) { + async function renderEbooks(ebooks) { const container = document.getElementById('ebooks-container'); container.innerHTML = ''; - ebooks.forEach(ebook => { + for (const ebook of ebooks) { const card = document.createElement('div'); card.className = 'card p-4 rounded-lg border hover:shadow-lg transition-shadow'; card.style.cssText = 'background-color: var(--bg-secondary); border-color: var(--border);'; const coverUrl = ebook.cover_image_path ? ebook.cover_image_path : '/static/placeholder-book.svg'; + + // Get user's rating for this ebook + const rating = await getEbookRating(ebook.id); + const ratingStars = renderRatingStars(ebook.id, rating); - card.innerHTML = '
by ' + ebook.author + '
' : '') + 'by ' + ebook.author + '
' : '') + '