Browse Source

Add attributes to MovieRow, prepare for show support

pull/1/head
James Hawkins 4 years ago
parent
commit
e8a4b96002
  1. 2
      README.md
  2. 9
      src/components/MovieRow.css
  3. 3
      src/components/MovieRow.js
  4. 9
      src/lib/lookMovie.js
  5. 8
      src/views/Search.js

2
README.md

@ -2,4 +2,4 @@
Small web app for watching movies easily. Check it out at **[movie.squeezebox.dev](https://movie.squeezebox.dev)**. Small web app for watching movies easily. Check it out at **[movie.squeezebox.dev](https://movie.squeezebox.dev)**.
## Credits ## Credits
- Thanks to [@JipFr](https://github.com/JipFr) for initial work on [movie-cli](https://github.com/JipFr/movie-cli) - Thanks to [@JipFr](https://github.com/JipFr) for initial work on [movie-cli](https://github.com/JipFr/movie-cli)
- Thanks to [@mrjvs](https://github.com/mrjvs) for help porting to React - Thanks to [@mrjvs](https://github.com/mrjvs) for help porting to React, and for the beautiful design

9
src/components/MovieRow.css

@ -44,6 +44,15 @@
transform: translateX(.3rem) translateY(.1rem); transform: translateX(.3rem) translateY(.1rem);
} }
.attribute {
color: white;
background-color: #D678B7;
font-size: .75rem;
padding: .25rem;
border-radius: 10px;
margin-right: 10px;
}
@media screen and (max-width: 400px) { @media screen and (max-width: 400px) {
.movieRow { .movieRow {
flex-direction: column; flex-direction: column;

3
src/components/MovieRow.js

@ -11,7 +11,8 @@ export function MovieRow(props) {
{props.title} {props.title}
</div> </div>
<div className="watch"> <div className="watch">
<p>Watch movie</p> <span className="attribute">year: {props.year}</span>
<p>Watch {props.type}</p>
<Arrow/> <Arrow/>
</div> </div>
</div> </div>

9
src/lib/lookMovie.js

@ -57,7 +57,7 @@ async function getStreamUrl(slug, type) {
const videoUrl = await getVideoUrl({ const videoUrl = await getVideoUrl({
slug: slug, slug: slug,
movieId: data.id_movie, movieId: data.id_movie,
type: "movie", type: type,
}); });
return { url: videoUrl } return { url: videoUrl }
@ -83,15 +83,16 @@ async function findMovie(searchTerm) {
matchedResults.forEach((r) => res.options.push({ matchedResults.forEach((r) => res.options.push({
title: r.title, title: r.title,
slug: r.slug, slug: r.slug,
type: r.type type: r.type,
year: r.year
})); }));
return res; return res;
} else { } else {
const { title, slug, type } = matchedResults[0]; const { title, slug, type, year } = matchedResults[0];
return { return {
options: [{ title, slug, type }] options: [{ title, slug, type, year }]
} }
} }
} }

8
src/views/Search.js

@ -58,9 +58,9 @@ export function SearchView() {
return fail("Could not find that movie") return fail("Could not find that movie")
} else if (options.length > 1) { } else if (options.length > 1) {
setProgress(2); setProgress(2);
setText("Choose your movie") setText("Choose your movie");
setOptions(options.map(v=>({ title: v.title, slug: v.slug, type: v.type }))); setOptions(options);
setShowingOptions(true) setShowingOptions(true);
return; return;
} }
@ -86,7 +86,7 @@ export function SearchView() {
Whoops, there are a few movies like that Whoops, there are a few movies like that
</Title> </Title>
{options?.map((v, i) => ( {options?.map((v, i) => (
<MovieRow key={i} title={v.title} onClick={() => { <MovieRow key={i} title={v.title} type={v.type} year={v.year} onClick={() => {
setShowingOptions(false) setShowingOptions(false)
getStream(v.title, v.slug, v.type) getStream(v.title, v.slug, v.type)
}}/> }}/>

Loading…
Cancel
Save