feat: add ratings

This commit is contained in:
Cory Dransfeldt 2024-05-17 13:05:04 -07:00
parent c37fc2f1a3
commit 614d1e210c
No known key found for this signature in database
13 changed files with 98 additions and 66 deletions

View file

@ -22,6 +22,7 @@ export default async function () {
status: book['status'],
tags: book['tags'],
categories: book['categories']?.length > 1 ? book['categories'].join(', ') : book['categories']?.[0],
rating: book['rating'] !== 'unrated' ? book['rating'] : '',
type: 'book',
}
})

View file

@ -10308,7 +10308,7 @@
"isbn": "9781501182891",
"dateAdded": "2024-05-03",
"status": "finished",
"rating": "unrated",
"rating": "⭐️⭐️⭐️⭐️",
"tags": [
"\"politics\"",
"\"economics\"",

View file

@ -22,7 +22,8 @@ const fetchAllMovies = async () => {
year,
collected,
plays,
favorite
favorite,
rating
`)
.order('last_watched', { ascending: false })
.range(rangeStart, rangeStart + PAGE_SIZE - 1)
@ -51,12 +52,13 @@ export default async function () {
year: item['year'],
url: `https://www.themoviedb.org/movie/${item['tmdb_id']}`,
description: `<p>${item['title']} (${item['year']})</p><p>Watched at: ${DateTime.fromISO(item['last_watched'], { zone: 'utc' }).setZone('America/Los_Angeles').toFormat('MMMM d, yyyy, h:mma')}</p>`,
type: 'movie',
image: `https://coryd.dev/media/movies/poster-${item['tmdb_id']}.jpg`,
backdrop: `https://coryd.dev/media/movies/backdrops/backdrop-${item['tmdb_id']}.jpg`,
plays: item['plays'],
collected: item['collected'],
favorite: item['favorite'],
rating: item['rating'],
type: 'movie'
}
return movie
}).filter(movie => watched ? movie['lastWatched'] : !movie['lastWatched'])

View file

@ -1,7 +1,7 @@
---
layout: default
---
{%- assign bookData = books | bookStatus: 'finished' | bookFinishedYear: year -%}
{%- assign bookData = books | bookStatus: 'finished' | bookFinishedYear: year | bookSortDescending -%}
{%- capture currentYear -%}{% currentYear %}{%- endcapture -%}
{%- assign yearString = year | append: '' -%}
{%- assign currentYearString = currentYear | append: '' -%}

View file

@ -16,8 +16,13 @@
</image>
{% for entry in entries limit: 20 -%}
{% assign author = entry.url | stripUtm | authorLookup %}
{% assign rating = entry.rating %}
<item>
<title>{{ entry.title | escape }}{% if author %} via {{ author }}{% endif %}</title>
<title>
{{ entry.title | escape }}
{% if author %} via {{ author }}{% endif %}
{% if rating %} ({{ rating }}){% endif %}
</title>
<link>{{ entry.url | stripUtm | encodeAmp }}</link>
<pubDate>{{ entry.date | stringToRFC822Date }}</pubDate>
<guid>{{ entry.url | stripUtm | encodeAmp }}</guid>

View file

@ -3,7 +3,7 @@
<div class="media-grid {% if shape == 'square' %}square{% else %}vertical{% endif %}">
{% for item in media limit: count %}
{% assign alt = item.alt | strip | escape %}
{% assign hasMeta = item.type != 'book' and item.type != 'movie' %}
{% assign hasMeta = item.type != 'book' %}
<a href="{{ item.url | stripUtm }}" title="{{ alt }}">
<div class="item-wrapper{% if hasMeta %} shadow{% endif %}">
{% if hasMeta %}

View file

@ -1,7 +1,10 @@
{% capture alt %}{{ movie.title | escape }} ({{ movie.year }}){% endcapture %}
<a href="{{ movie.url }}">
<div class="watching hero shadow">
<span>{{ movie.title }} ({{ movie.year }})</span>
<div class="meta-text">
<div class="header">{{ movie.title }} ({{ movie.year }})</div>
<div class="subheader">Last watched @ {{ movie.dateAdded | date: "%B %e, %Y" }}</div>
</div>
<img src="https://coryd.dev/.netlify/images/?url={{ movie.backdrop }}&fit=cover&w=1200&h=675&fm=webp&q=80" alt="{{ alt }}" loading="eager" decoding="async" width="1200" height="765" />
</div>
</a>

View file

@ -7,13 +7,28 @@
position: relative;
overflow: hidden;
span {
color: white;
font-weight: var(--font-weight-bold);
position: absolute;
left: var(--sizing-sm);
bottom: var(--sizing-md);
z-index: 2;
div {
&.meta-text{
color: white;
position: absolute;
left: var(--sizing-sm);
bottom: var(--sizing-lg);
z-index: 2;
& .header {
font-weight: var(--font-weight-bold);
}
& .subheader {
font-size: var(--font-size-sm);
}
& .header,
& .subheader {
line-height: 1.5;
text-shadow: rgba(0, 0, 0, 0.7) 0px 0px 10px;
}
}
}
& img {

View file

@ -3,7 +3,7 @@ layout: null
eleventyExcludeFromCollections: true
permalink: /feeds/books
---
{%- assign bookData = books | bookStatus: 'started' | reverse -%}
{%- assign bookData = books | bookStatus: 'finished' | bookSortDescending -%}
{% render "partials/feeds/rss.liquid"
permalink:"/feeds/books"
title:"Books • Cory Dransfeldt"