1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

Add attributes to MovieRow, prepare for show support

This commit is contained in:
James Hawkins 2021-07-14 09:43:45 +01:00
parent 21a4f095c4
commit e8a4b96002
5 changed files with 21 additions and 10 deletions

View file

@ -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

View file

@ -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;

View file

@ -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>

View file

@ -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 }]
} }
} }
} }

View file

@ -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)
}}/> }}/>