2023-12-10 01:15:15 +01:00
|
|
|
---
|
|
|
|
import SectionContainer from '../../components/SectionContainer.astro';
|
|
|
|
import watched from '../../data/watched.json'
|
|
|
|
|
|
|
|
const tvByYear = watched.reduce((acc:any, tv) => {
|
|
|
|
const year = new Date(tv.date.string).getFullYear();
|
|
|
|
if (!acc[year]) {
|
|
|
|
acc[year] = [];
|
|
|
|
}
|
|
|
|
acc[year].push(tv);
|
|
|
|
return acc;
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
const sortedYears = Object.keys(tvByYear).sort((a:any, b:any) => b - a);
|
|
|
|
|
2024-02-14 23:28:29 +01:00
|
|
|
/*
|
2023-12-10 01:15:15 +01:00
|
|
|
function getEmojiStars(rating:any) {
|
|
|
|
let stars = '';
|
|
|
|
for (let i = 0; i < rating; i++) {
|
|
|
|
stars += '⭐';
|
|
|
|
}
|
|
|
|
return stars;
|
|
|
|
}
|
2024-02-14 23:28:29 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
function getHeartEmoji(rating:any) {
|
|
|
|
let heart = '';
|
|
|
|
if (rating == 5) heart = "❤️";
|
|
|
|
return heart;
|
|
|
|
}
|
2024-01-06 21:35:20 +01:00
|
|
|
|
|
|
|
const today = new Date();
|
2023-12-10 01:15:15 +01:00
|
|
|
---
|
|
|
|
<SectionContainer>
|
|
|
|
<main class="flex flex-col gap-4 mt-4">
|
|
|
|
<h1 class="text-3xl font-extrabold">📺 La télévision</h1>
|
2024-01-06 21:35:20 +01:00
|
|
|
<h2 class="text-xl font-semibold">{today.getFullYear()} - Currently Watching:</h2>
|
2023-12-23 20:55:50 +01:00
|
|
|
<p>👀 ONE PIECE Egghead Arc</p>
|
2024-04-02 18:11:50 +02:00
|
|
|
<p>👀 Star Wars: The Clone Wars S04</p>
|
2023-12-10 01:15:15 +01:00
|
|
|
{sortedYears.map(year => (
|
2023-12-28 21:59:58 +01:00
|
|
|
<section>
|
|
|
|
<div class="flex items-center gap-2 text-xl font-semibold mb-2">{year} - Finished <p class="text-xs">({tvByYear[year].length} entries)</p></div>
|
|
|
|
<ul>
|
2023-12-10 01:15:15 +01:00
|
|
|
{
|
2023-12-28 21:59:58 +01:00
|
|
|
tvByYear[year].map(tv => (
|
|
|
|
<li class="flex mb-2 break-words gap-2 borderbottom">
|
|
|
|
<p class="text-s w-1/3">{tv.title}</p>
|
|
|
|
<p class="w-1/3 text-center">{tv.type}</p>
|
2024-02-14 23:28:29 +01:00
|
|
|
<p class="w-1/3 text-end">{getHeartEmoji(tv.my_rating)}</p>
|
2023-12-28 21:59:58 +01:00
|
|
|
</li>
|
2023-12-10 01:15:15 +01:00
|
|
|
))
|
|
|
|
}
|
|
|
|
</ul>
|
2023-12-28 21:59:58 +01:00
|
|
|
</section>
|
|
|
|
))}
|
2023-12-10 01:15:15 +01:00
|
|
|
</main>
|
2024-01-28 23:15:24 +01:00
|
|
|
</SectionContainer>
|