2026-02-16 19:12:00 -06:00
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import type {Movie} from "~/types/movie";
|
2026-02-25 17:33:37 -06:00
|
|
|
import type {MovieCriticScore} from "~/types/movie-critic-score";
|
|
|
|
|
import posterPlaceholder from "~/assets/img/poster-placeholder.svg";
|
2026-04-16 17:58:28 -05:00
|
|
|
import ButtonAction from "~/components/common/button-action.vue";
|
2026-02-16 19:12:00 -06:00
|
|
|
|
2026-02-25 17:33:37 -06:00
|
|
|
const props = defineProps<{
|
2026-02-16 19:12:00 -06:00
|
|
|
selectedMovie: Movie;
|
2026-04-09 18:44:44 -05:00
|
|
|
canEdit: boolean;
|
2026-02-16 19:12:00 -06:00
|
|
|
}>();
|
|
|
|
|
|
2026-02-25 17:33:37 -06:00
|
|
|
const emit = defineEmits(['remove-movie']);
|
|
|
|
|
|
|
|
|
|
const criticScores = computed(() => {
|
2026-04-05 00:36:20 -05:00
|
|
|
const scores: MovieCriticScore[] = []
|
|
|
|
|
props.selectedMovie.critic_scores.map((score: MovieCriticScore) => {
|
|
|
|
|
scores.push({Value: score.Value, Source: score.Source})
|
2026-02-25 17:33:37 -06:00
|
|
|
})
|
|
|
|
|
|
2026-04-05 00:36:20 -05:00
|
|
|
return scores
|
2026-02-25 17:33:37 -06:00
|
|
|
})
|
2026-02-16 19:12:00 -06:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="movie-details">
|
2026-02-25 17:33:37 -06:00
|
|
|
<div class="movie-details-header">
|
|
|
|
|
<img :alt="selectedMovie.title"
|
|
|
|
|
:src="selectedMovie.poster"
|
|
|
|
|
class="movie-poster"
|
|
|
|
|
@error="(e) => (e.target as HTMLImageElement).src = posterPlaceholder"
|
|
|
|
|
/>
|
|
|
|
|
<h2 class="movie-title">{{ selectedMovie.title }} ({{ selectedMovie.year }})</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<dl class="movie-details-list">
|
|
|
|
|
<div class="movie-detail">
|
|
|
|
|
<dt>Plot</dt>
|
|
|
|
|
<dd>{{ selectedMovie.plot }}</dd>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="movie-detail">
|
|
|
|
|
<dt>Genre</dt>
|
|
|
|
|
<dd>{{ selectedMovie.genre }}</dd>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="movie-detail">
|
|
|
|
|
<dt>Actors</dt>
|
|
|
|
|
<dd>{{ selectedMovie.actors }}</dd>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="movie-detail">
|
|
|
|
|
<dt>Directed By</dt>
|
|
|
|
|
<dd>{{ selectedMovie.director }}</dd>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="movie-detail">
|
|
|
|
|
<dt class="detail-title">Critic Scores:</dt>
|
2026-04-05 00:36:20 -05:00
|
|
|
<div v-for="score in criticScores" v-if="criticScores && criticScores.length > 0" :key="score.Source">
|
2026-02-25 17:33:37 -06:00
|
|
|
<dd class="critic-score-source">{{ score.Source }}</dd>
|
|
|
|
|
<dd>{{ score.Value }}</dd>
|
|
|
|
|
</div>
|
2026-04-05 00:36:20 -05:00
|
|
|
<dd v-else>No critic scores available</dd>
|
2026-02-25 17:33:37 -06:00
|
|
|
</div>
|
|
|
|
|
</dl>
|
|
|
|
|
|
2026-04-16 18:06:28 -05:00
|
|
|
<ButtonAction
|
|
|
|
|
v-if="canEdit"
|
|
|
|
|
button-text="Remove From List"
|
|
|
|
|
buttonColor="danger"
|
|
|
|
|
@action="emit('remove-movie', selectedMovie.id)"
|
2026-04-16 17:58:28 -05:00
|
|
|
/>
|
2026-02-16 19:12:00 -06:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-02-25 17:33:37 -06:00
|
|
|
dt {
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.movie-detail {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-16 19:12:00 -06:00
|
|
|
.movie-details {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
padding: 2rem;
|
2026-02-25 17:33:37 -06:00
|
|
|
max-width: 40rem;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.movie-details img {
|
2026-04-05 00:36:20 -05:00
|
|
|
max-width: 20em;
|
|
|
|
|
max-height: 25em;
|
2026-02-25 17:33:37 -06:00
|
|
|
margin: 2rem auto;
|
2026-02-16 19:12:00 -06:00
|
|
|
}
|
|
|
|
|
|
2026-02-25 17:33:37 -06:00
|
|
|
.movie-details-header {
|
|
|
|
|
margin: 2em 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.movie-details-list {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 1rem;
|
2026-04-05 00:36:20 -05:00
|
|
|
margin: 2em 0;
|
2026-02-25 17:33:37 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2026-02-16 19:12:00 -06:00
|
|
|
.movie-poster {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-25 17:33:37 -06:00
|
|
|
.movie-title {
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 1300px) {
|
|
|
|
|
.movie-plot {
|
|
|
|
|
margin: unset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-16 19:12:00 -06:00
|
|
|
@media (max-width: 767px) {
|
|
|
|
|
.movie-details {
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-25 17:33:37 -06:00
|
|
|
|
|
|
|
|
.movie-details img {
|
|
|
|
|
max-height: 15em;
|
|
|
|
|
max-width: 10em;
|
2026-02-16 19:12:00 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|