--- import SectionContainer from '../../components/SectionContainer.astro'; import books from '../../data/biblioteca.json' const booksByYear = books.reduce((acc:any, book) => { const year = new Date(book.date.string).getFullYear(); if (!acc[year]) { acc[year] = []; } acc[year].push(book); return acc; }, {}); const sortedYears = Object.keys(booksByYear).sort((a:any, b:any) => b - a); /* function getEmojiStars(rating:any) { let stars = ''; for (let i = 0; i < rating; i++) { stars += '⭐'; } return stars; } */ function getHeartEmoji(rating:any) { let heart = ''; if (rating == 5) heart = "❤️"; return heart; } const today = new Date(); ---

📚 ¿Dónde está la biblioteca?

on the shelf

on the nightstand

📖 The Intelligent Investor (NO)

{sortedYears.map(year => (
{year}

({booksByYear[year].length} entries)

    { booksByYear[year].map((book) => (

    {book.title}

    {getHeartEmoji(book.my_rating)}

    )) }
)) }