cineclub-site/front/components/movieCard/full.vue

136 lines
4.1 KiB
Vue
Raw Normal View History

2022-07-11 01:31:21 +02:00
<template>
2022-07-13 00:37:49 +02:00
<div v-if="film">
<div class="card movie-card">
2022-07-13 00:37:49 +02:00
<header class="card-content is-flex">
<div>
<h3 class="title is-4 is-inline mr-4">{{ film.title }}</h3>
<div class="subtitle is-5 is-inline">{{ film.director }}</div>
<div class="field is-grouped is-grouped-multiline mt-4">
<div
v-for="(tag, index) of headerTags"
:key="index"
class="control"
>
<div class="tags has-addons">
<span v-if="tag.label" class="tag">{{ tag.label }}</span>
<span class="tag is-primary">{{ tag.value }}</span>
</div>
2022-07-11 01:31:21 +02:00
</div>
</div>
</div>
2022-07-13 00:37:49 +02:00
<ButtonIcon
v-if="film.trailerLink"
label="Bande-annonce"
icon="ri-play-circle-fill"
class="is-primary is-outlined ml-auto"
@click="showTrailerModal = true"
/>
</header>
<div class="is-flex">
<div
class="poster-container"
:style="{ '--poster-url': `url(${film.posterLink})` }"
>
<figure class="image m-auto">
2022-07-13 00:37:49 +02:00
<img :src="film.posterLink" alt="Affiche du film" />
</figure>
</div>
<div class="card-content">
<div class="content">
<p v-if="film.actors && film.actors.length" class="block">
2022-07-13 00:37:49 +02:00
<span class="has-text-weight-bold">Acteurs :</span>
{{ film.actors.join(", ") }}
</p>
<p v-if="film.synopsis" class="block">
2022-07-13 00:37:49 +02:00
<span class="has-text-weight-bold">Synopsis :</span>
{{ film.synopsis }}
</p>
<!-- TODO additional info about partnership etc -->
</div>
2022-07-11 01:31:21 +02:00
</div>
</div>
2022-07-13 00:37:49 +02:00
<footer class="card-content is-flex">
<div class="buttons">
<template v-if="isPast">
<ButtonIcon
label="Lire notre analyse"
icon="ri-double-quotes-l"
class="is-outlined is-primary"
/>
</template>
<template v-else>
2022-07-13 02:18:06 +02:00
<a
v-if="film.facebookEventLink"
2022-07-13 02:18:06 +02:00
:href="film.facebookEventLink"
rel="noopener noreferrer"
target="_blank"
>
<ButtonIcon
label="Événement Facebook"
icon="ri-facebook-box-fill"
class="is-outlined is-primary"
/>
</a>
2022-07-13 00:37:49 +02:00
<ButtonIcon
v-if="film.icsDownload"
2022-07-13 00:37:49 +02:00
label="Ajouter au calendrier"
icon="ri-calendar-event-fill"
class="is-outlined is-primary"
/>
</template>
</div>
<div class="ml-auto title is-4">
2022-07-13 01:02:23 +02:00
{{ prettyDate.full(film.projectionDate) }}
2022-07-13 00:37:49 +02:00
</div>
</footer>
2022-07-11 01:31:21 +02:00
</div>
2022-07-13 00:37:49 +02:00
<MovieCardTrailerModal
v-if="showTrailerModal"
:url="film.trailerLink"
:iframe-id="`film-card-${film.id}`"
@close="showTrailerModal = false"
/>
2022-07-11 01:31:21 +02:00
</div>
</template>
<script setup lang="ts">
import { Film } from "~/composables/types"
import { PropType } from "@vue/runtime-core"
2022-07-13 01:02:23 +02:00
import { prettyDate } from "~/composables/strUtils"
2022-07-11 01:31:21 +02:00
const props = defineProps({
film: { type: Object as PropType<Film>, required: true },
})
const isPast = ref<boolean>(false)
const showTrailerModal = ref<boolean>(false)
2022-07-11 01:31:21 +02:00
function generateTags(film: Film) {
const res = []
if ("isInColor" in film && film.isInColor != null)
res.push({
value: film.isInColor ? "Couleur" : "Noir et blanc",
})
if (film?.languageSubtitles)
res.push({ label: "Langue", value: film.languageSubtitles })
if (film?.duration)
res.push({
label: "Durée",
value: film.duration,
})
if (film?.releaseYear)
res.push({ label: "Sortie", value: film.releaseYear.toString() })
if (film?.originCountry)
res.push({ label: "Pays", value: film.originCountry })
return res
}
const headerTags = computed<{ label?: string; value: string }[]>(() =>
generateTags(props.film)
)
2022-07-11 01:31:21 +02:00
</script>
<style scoped lang="sass">
.movie-card .poster-container
2022-07-11 01:31:21 +02:00
width: 200px
</style>