This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
maatma-videos/src/routes/[vid]/+page.svelte

76 lines
2.1 KiB
Svelte
Raw Normal View History

2022-04-17 09:45:09 +00:00
<script>
import {
2022-04-17 11:07:55 +00:00
Container,
2022-04-17 09:45:09 +00:00
Col,
Row,
} from 'sveltestrap';
2022-12-15 11:51:07 +00:00
import { videos, idx_videos } from '$lib/stores/videos.js';
import Commento from '$lib/components/Commento.svelte';
import VideoThumb from '$lib/components/VideoThumb.svelte';
2022-04-17 09:45:09 +00:00
2022-12-15 11:51:07 +00:00
export let data;
2022-04-17 09:45:09 +00:00
</script>
2022-12-15 11:51:07 +00:00
{#if $idx_videos[data.video_id]}
2022-04-17 09:45:09 +00:00
<Row class="mt-3 mb-5">
<Col>
<div class="ratio ratio-16x9 mb-3">
2022-12-15 11:51:07 +00:00
<video controls autoplay poster={$idx_videos[data.video_id].thumb} src={$idx_videos[data.video_id].url} />
2022-04-17 09:45:09 +00:00
</div>
2022-12-15 11:51:07 +00:00
{#if $idx_videos[data.video_id].title}
2022-04-17 09:45:09 +00:00
<h1>
2022-12-15 11:51:07 +00:00
{$idx_videos[data.video_id].title}
2022-04-17 09:45:09 +00:00
</h1>
{/if}
2022-12-15 11:51:07 +00:00
{#if $idx_videos[data.video_id].description}
2022-04-17 09:45:09 +00:00
<p>
2022-12-15 11:51:07 +00:00
{@html $idx_videos[data.video_id].description}
2022-04-17 09:45:09 +00:00
</p>
{/if}
2022-12-15 11:51:07 +00:00
<Commento pageId={'/videos/' + data.video_id} />
2022-04-17 09:45:09 +00:00
</Col>
<Col md="3" lg="4">
2022-12-15 11:51:07 +00:00
{#if $idx_videos[data.video_id].next && $idx_videos[$idx_videos[data.video_id].next]}
2022-04-17 09:45:09 +00:00
<Row>
<Col xs="auto">
<h4>Prochaine vidéo</h4>
</Col>
<Col>
<hr>
</Col>
</Row>
2022-12-15 11:51:07 +00:00
<VideoThumb video={$idx_videos[$idx_videos[data.video_id].next]} />
2022-04-17 09:45:09 +00:00
<div class="mt-3"></div>
{/if}
<Row>
<Col xs="auto">
<h4>Autres vidéos</h4>
</Col>
<Col>
<hr>
</Col>
</Row>
2022-12-15 11:51:07 +00:00
{#each $videos as video (video.id)}
{#if video.id != $idx_videos[data.video_id].next && video.id != data.video_id}
2022-04-17 09:45:09 +00:00
<VideoThumb {video} />
{/if}
{/each}
</Col>
</Row>
{:else}
2022-04-17 11:07:55 +00:00
<Container class="mt-3 mb-5 text-center">
<h1>
Erreur 404
<small class="text-muted">Vidéo introuvable</small>
</h1>
<p>
La vidéo à laquelle vous essayez d'accéder n'existe pas&nbsp;!
</p>
<p>
Vous pouvez retourner à <a href=".">la page d'accueil</a>.
</p>
</Container>
2022-04-17 09:45:09 +00:00
{/if}