--- 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; } ---

📚 ¿Dónde está la biblioteca?

2023 - Currently Reading:

📖 The Summit Of The Gods: Vol.1

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

({booksByYear[year].length} entries)

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

    {book.title} - {book.author}

    {getEmojiStars(book.my_rating)}

    )) }
)) }