💄 replace stars with hearts in log-ratings
Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
1d42a5830a
commit
726534e60f
2 changed files with 19 additions and 3 deletions
|
@ -13,6 +13,7 @@ const booksByYear = books.reduce((acc:any, book) => {
|
|||
|
||||
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++) {
|
||||
|
@ -20,6 +21,13 @@ function getEmojiStars(rating:any) {
|
|||
}
|
||||
return stars;
|
||||
}
|
||||
*/
|
||||
|
||||
function getHeartEmoji(rating:any) {
|
||||
let heart = '';
|
||||
if (rating == 5) heart = "❤️";
|
||||
return heart;
|
||||
}
|
||||
|
||||
const today = new Date();
|
||||
---
|
||||
|
@ -36,7 +44,7 @@ const today = new Date();
|
|||
booksByYear[year].map((book) => (
|
||||
<div class="flex justify-between mb-2 break-words gap-2 borderbottom">
|
||||
<p class="text-s">{book.title}</p>
|
||||
<p>{getEmojiStars(book.my_rating)}</p>
|
||||
<p>{getHeartEmoji(book.my_rating)}</p>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
|
@ -45,4 +53,4 @@ const today = new Date();
|
|||
))
|
||||
}
|
||||
</main>
|
||||
</SectionContainer>
|
||||
</SectionContainer>
|
||||
|
|
|
@ -13,6 +13,7 @@ const tvByYear = watched.reduce((acc:any, tv) => {
|
|||
|
||||
const sortedYears = Object.keys(tvByYear).sort((a:any, b:any) => b - a);
|
||||
|
||||
/*
|
||||
function getEmojiStars(rating:any) {
|
||||
let stars = '';
|
||||
for (let i = 0; i < rating; i++) {
|
||||
|
@ -20,6 +21,13 @@ function getEmojiStars(rating:any) {
|
|||
}
|
||||
return stars;
|
||||
}
|
||||
*/
|
||||
|
||||
function getHeartEmoji(rating:any) {
|
||||
let heart = '';
|
||||
if (rating == 5) heart = "❤️";
|
||||
return heart;
|
||||
}
|
||||
|
||||
const today = new Date();
|
||||
---
|
||||
|
@ -39,7 +47,7 @@ const today = new Date();
|
|||
<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>
|
||||
<p class="w-1/3 text-end">{getEmojiStars(tv.my_rating)}</p>
|
||||
<p class="w-1/3 text-end">{getHeartEmoji(tv.my_rating)}</p>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue