Skip to content

Commit

Permalink
Merge pull request #8 from benjifs/fix/watched
Browse files Browse the repository at this point in the history
Fix: watched
  • Loading branch information
benjifs authored Jan 9, 2023
2 parents 7ef67a4 + 653b61b commit 51be093
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sparkles",
"version": "0.1.6",
"version": "0.1.7",
"description": "micropub client",
"main": "./src/js/app.js",
"scripts": {
Expand Down
18 changes: 12 additions & 6 deletions src/js/Editors/MovieEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Rating from '../Components/Rating'
import Proxy from '../Controllers/Proxy'

const OMDB_API_KEY = import.meta.env.VITE_OMDB_API_KEY
const IMDB_URL = 'https://imdb.com/title/'

const MovieEditor = () => {
if (!OMDB_API_KEY) {
Expand All @@ -30,18 +31,23 @@ const MovieEditor = () => {
}

const rating = ratingToStars()
const title = `${state.rewatched ? 'Rewatched' : 'Watched'} ${state.movie.Title}, (${state.movie.Year})${rating ? ' - ' + rating : ''}`
const properties = {
summary: [ `${state.rewatched ? 'Rewatched' : 'Watched'} ${state.movie.Title}, (${state.movie.Year})${rating ? ' - ' + rating : ''}` ],
name: [ title ],
summary: [ title ],
featured: [ state.movie.Poster ],
'u-watch-of': [
{
'type': [ 'h-cite' ],
'properties': {
title: [ state.movie.Title ],
name: [ state.movie.Title ],
photo: [ state.movie.Poster ],
uid: [ `imdb:${state.movie.imdbID}` ],
url: [ `${IMDB_URL}${state.movie.imdbID}` ],
// custom properties
year: [ state.movie.Year ],
imdbID: [ state.movie.imdbID ],
poster: [ state.movie.Poster ],
rewatch: state.rewatched === true ? true : false,
...(state.rate && { rating: state.rating })
rewatch: [ state.rewatched === true ],
...(state.rate && { rating: [ state.rating ] })
}
}
]
Expand Down

0 comments on commit 51be093

Please sign in to comment.