hooked up all items on the list settings section
This commit is contained in:
parent
53df349d9f
commit
91173021b2
32 changed files with 578 additions and 178 deletions
|
|
@ -10,13 +10,12 @@ const props = defineProps<{
|
|||
const emit = defineEmits(['remove-movie']);
|
||||
|
||||
const criticScores = computed(() => {
|
||||
const scores = JSON.parse(props.selectedMovie.critic_scores)
|
||||
const parsedScores: MovieCriticScore[] = []
|
||||
scores.map((score: MovieCriticScore) => {
|
||||
parsedScores.push({Value: score.Value, Source: score.Source})
|
||||
const scores: MovieCriticScore[] = []
|
||||
props.selectedMovie.critic_scores.map((score: MovieCriticScore) => {
|
||||
scores.push({Value: score.Value, Source: score.Source})
|
||||
})
|
||||
|
||||
return parsedScores
|
||||
return scores
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
@ -49,10 +48,11 @@ const criticScores = computed(() => {
|
|||
</div>
|
||||
<div class="movie-detail">
|
||||
<dt class="detail-title">Critic Scores:</dt>
|
||||
<div v-for="score in criticScores" :key="score.Source">
|
||||
<div v-for="score in criticScores" v-if="criticScores && criticScores.length > 0" :key="score.Source">
|
||||
<dd class="critic-score-source">{{ score.Source }}</dd>
|
||||
<dd>{{ score.Value }}</dd>
|
||||
</div>
|
||||
<dd v-else>No critic scores available</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
|
|
@ -84,7 +84,8 @@ dt {
|
|||
}
|
||||
|
||||
.movie-details img {
|
||||
max-width: 15em;
|
||||
max-width: 20em;
|
||||
max-height: 25em;
|
||||
margin: 2rem auto;
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +97,7 @@ dt {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
margin: 2em 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts" setup>
|
||||
import type {MovieSearchResult} from "~/types/movie-search-results";
|
||||
import type {MovieList} from "~/types/movie-list";
|
||||
import type {ResourceResponse} from "~/types/api";
|
||||
|
||||
const emit = defineEmits(['add-movie']);
|
||||
const props = defineProps<{
|
||||
|
|
@ -21,13 +22,13 @@ const searchMovies = () => {
|
|||
}
|
||||
|
||||
const addMovieToList = (movie: MovieSearchResult) => {
|
||||
$api<MovieList>(`/api/movielists/${props.movieListId}/movies`, {
|
||||
$api<ResourceResponse<MovieList>>(`/api/movielists/${props.movieListId}/movies`, {
|
||||
body: {
|
||||
movie: movie
|
||||
},
|
||||
method: "POST"
|
||||
}).then((list) => {
|
||||
emit('add-movie', list);
|
||||
emit('add-movie', list.data);
|
||||
}).catch((error) => {
|
||||
alert(error.message)
|
||||
});
|
||||
|
|
@ -89,7 +90,7 @@ const addMovieToList = (movie: MovieSearchResult) => {
|
|||
|
||||
.movie-result img {
|
||||
height: 10rem;
|
||||
max-width: 7rem;
|
||||
width: 10rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue