Movie now subscribes to store. Added cast to info panel.

This commit is contained in:
2022-01-13 00:25:38 +01:00
parent 0b6398cc4c
commit dc2359ff6a
3 changed files with 153 additions and 78 deletions

40
src/components/Cast.vue Normal file
View File

@@ -0,0 +1,40 @@
<template>
<div class="cast">
<ol class="persons">
<Person v-for="person in cast" :person="person" />
</ol>
</div>
</template>
<script>
import Person from "src/components/Person";
export default {
name: "Cast",
components: { Person },
props: {
cast: {
type: Array,
required: true
}
}
};
</script>
<style lang="scss">
.cast {
position: relative;
top: 0;
left: 0;
ol {
overflow-x: scroll;
padding-bottom: 10px;
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
}
}
</style>

View File

@@ -100,47 +100,49 @@
<div class="movie__details" v-if="movie"> <div class="movie__details" v-if="movie">
<div v-if="movie.year"> <div v-if="movie.year">
<h2 class="title">Release Date</h2> <h2 class="title">Release Date</h2>
<div class="text">{{ movie.year }}</div> <span class="info">{{ movie.year }}</span>
</div> </div>
<div v-if="movie.rating"> <div v-if="movie.rating">
<h2 class="title">Rating</h2> <h2 class="title">Rating</h2>
<div class="text">{{ movie.rating }}</div> <span class="info">{{ movie.rating }}</span>
</div> </div>
<div v-if="movie.type == 'show'"> <div v-if="movie.type == 'show'">
<h2 class="title">Seasons</h2> <h2 class="title">Seasons</h2>
<div class="text">{{ movie.seasons }}</div> <span class="info">{{ movie.seasons }}</span>
</div> </div>
<div v-if="movie.genres"> <div v-if="movie.genres">
<h2 class="title">Genres</h2> <h2 class="title">Genres</h2>
<div class="text">{{ movie.genres.join(", ") }}</div> <span class="info">{{ movie.genres.join(", ") }}</span>
</div> </div>
<div v-if="movie.type == 'show'"> <div v-if="movie.type == 'show'">
<h2 class="title">Production status</h2> <h2 class="title">Production status</h2>
<div class="text">{{ movie.production_status }}</div> <span class="info">{{ movie.production_status }}</span>
</div> </div>
<div v-if="movie.type == 'show'"> <div v-if="movie.type == 'show'">
<h2 class="title">Runtime</h2> <h2 class="title">Runtime</h2>
<div class="text">{{ movie.runtime[0] }} minutes</div> <span class="info">{{ movie.runtime[0] }} minutes</span>
</div> </div>
</div> </div>
</div> </div>
<!-- TODO: change this classname, this is general --> <!-- TODO: change this classname, this is general -->
<div class="movie__admin" v-if="movie && movie.credits"> <div
<h2 class="movie__details-title">Cast</h2> class="movie__admin"
<div style="display: flex; flex-wrap: wrap"> v-if="
<person movie &&
v-for="cast in movie.credits.cast" movie.credits &&
:info="cast" movie.credits.cast &&
style="flex-basis: 0" movie.credits.cast.length
></person> "
</div> >
<h2 class="title">Cast</h2>
<Cast :cast="movie.credits.cast" />
</div> </div>
</div> </div>
@@ -157,10 +159,10 @@
</template> </template>
<script> <script>
import storage from "@/storage"; import { mapGetters } from "vuex";
import img from "@/directives/v-image"; import img from "@/directives/v-image";
import TorrentList from "./TorrentList"; import TorrentList from "./TorrentList";
import Person from "./Person"; import Cast from "./Cast";
import SidebarListElement from "./ui/sidebarListElem"; import SidebarListElement from "./ui/sidebarListElem";
import store from "@/store"; import store from "@/store";
import LoadingPlaceholder from "./ui/LoadingPlaceholder"; import LoadingPlaceholder from "./ui/LoadingPlaceholder";
@@ -186,7 +188,7 @@ export default {
type: String type: String
} }
}, },
components: { TorrentList, Person, LoadingPlaceholder, SidebarListElement }, components: { TorrentList, Cast, LoadingPlaceholder, SidebarListElement },
directives: { img: img }, // TODO decide to remove or use directives: { img: img }, // TODO decide to remove or use
data() { data() {
return { return {
@@ -197,9 +199,7 @@ export default {
poster: undefined, poster: undefined,
backdrop: undefined, backdrop: undefined,
matched: false, matched: false,
userLoggedIn: storage.sessionId ? true : false,
requested: false, requested: false,
admin: localStorage.getItem("admin") == "true" ? true : false,
showTorrents: false, showTorrents: false,
compact: false, compact: false,
loading: true, loading: true,
@@ -226,6 +226,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters("user", ["loggedIn", "admin"]),
numberOfTorrentResults: () => { numberOfTorrentResults: () => {
let numTorrents = store.getters["torrentModule/resultCount"]; let numTorrents = store.getters["torrentModule/resultCount"];
return numTorrents !== null ? numTorrents + " results" : null; return numTorrents !== null ? numTorrents + " results" : null;
@@ -260,14 +261,14 @@ export default {
poster.src = `${this.ASSET_URL}${this.ASSET_SIZES[0]}${this.poster}`; poster.src = `${this.ASSET_URL}${this.ASSET_SIZES[0]}${this.poster}`;
}, },
sendRequest() { sendRequest() {
request(this.id, this.type, storage.token).then(resp => { request(this.id, this.type).then(resp => {
if (resp.success) { if (resp.success) {
this.requested = true; this.requested = true;
} }
}); });
}, },
openInPlex() { openInPlex() {
watchLink(this.title, this.movie.year, storage.token).then( watchLink(this.title, this.movie.year).then(
watchLink => (window.location = watchLink) watchLink => (window.location = watchLink)
); );
}, },
@@ -395,6 +396,21 @@ header {
} }
} }
h2.title {
margin: 0;
font-weight: 400;
text-transform: uppercase;
font-size: 1.2rem;
color: $green;
}
span.info {
font-weight: 300;
font-size: 1rem;
letter-spacing: 0.8px;
margin-top: 5px;
}
.movie { .movie {
&__wrap { &__wrap {
display: flex; display: flex;
@@ -510,21 +526,6 @@ header {
margin-bottom: 30px; margin-bottom: 30px;
margin-right: 30px; margin-right: 30px;
} }
& .title {
margin: 0;
font-weight: 400;
text-transform: uppercase;
font-size: 14px;
color: $green;
@include tablet-min {
font-size: 16px;
}
}
& .text {
font-weight: 300;
font-size: 14px;
margin-top: 5px;
}
} }
} }
&__admin { &__admin {

View File

@@ -1,63 +1,97 @@
<template> <template>
<div class="persons"> <li class="card">
<div class="persons--image" :style="{ <a :href="tmdbLink">
'background-image': 'url(' + getPicture(info) + ')' }"></div> <img class="persons--image" :src="pictureUrl" />
<span>{{ info.name }}</span> <p class="name">{{ person.name }}</p>
</div> <p class="meta">{{ person.character }}</p>
<!-- <p class="meta">{{ person.type }}</p> -->
</a>
</li>
</template> </template>
<script> <script>
export default { export default {
name: 'Person', name: "Person",
components: {
},
props: { props: {
info: Object person: {
}, type: Object,
data() { required: true
return {
} }
}, },
created() {},
beforeMount() {},
computed: { computed: {
tmdbLink() {
const { id } = this.person;
if (id) return `https://www.themoviedb.org/person/${id}`;
},
pictureUrl() {
const { profile_path } = this.person;
if (profile_path) return "https://image.tmdb.org/t/p/w185" + profile_path;
}, return "";
methods: {
getPicture: (person) => {
if (person)
return 'https://image.tmdb.org/t/p/w185' + person.profile_path;
} }
} }
} };
</script> </script>
<style lang="scss"> <style lang="scss">
.persons { li a p:first-of-type {
display: flex; padding-top: 10px;
// border: 1px solid black; }
flex-direction: column;
margin: 0 0.5rem; li p {
font-size: 1em;
padding: 0 10px;
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
}
span { li.card {
font-size: 0.6rem; margin: 10px;
margin-right: 4px;
padding-bottom: 10px;
border-radius: 8px;
overflow: hidden;
min-width: 140px;
width: 140px;
background-color: var(--background-color-secondary);
color: var(--text-color);
transition: transform 0.5s ease, color 0.4s ease, border-color 0.4s ease;
transform: scale(0.97) translateZ(0);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
&:first-of-type {
margin-left: 0;
} }
&--image { &:hover {
border-radius: 50%; transform: scale(1.03);
height: 70px;
width: 70px;
// height: auto;
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
} }
&--name { .name {
font-weight: 500;
}
.character {
font-size: 0.9em;
}
.meta {
font-size: 0.9em;
color: var(--text-color-70);
}
a {
display: block;
text-decoration: none;
}
img {
width: 100%;
height: 100%;
} }
} }
</style> </style>