This is the code that runs https://bandolier.learnjsthehardway.com/ for you to review. It uses the https://git.learnjsthehardway.com/learn-javascript-the-hard-way/bandolier-template to create the documentation for the project.
https://bandolier.learnjsthehardway.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
3.7 KiB
160 lines
3.7 KiB
<script context="module">
|
|
import live from "$/rendered/pages/live/index.js";
|
|
let past_streams = [];
|
|
|
|
export const getPaths = async () => {
|
|
past_streams = await live.load_paths();
|
|
return [past_streams];
|
|
}
|
|
|
|
export const getData = streams => ({ streams });
|
|
</script>
|
|
|
|
<script>
|
|
import { link } from 'svelte-spa-router';
|
|
import Layout from "$/rendered/Layout.svelte";
|
|
import IconImage from "$/client/components/IconImage.svelte";
|
|
import SnapImage from "$/client/components/SnapImage.svelte";
|
|
import Markdown from "$/client/components/Markdown.svelte";
|
|
import formatDistanceToNow from "date-fns/formatDistanceToNow";
|
|
import parseISO from "date-fns/parseISO";
|
|
import { Hydrate } from '@jamcart/7ty/components';
|
|
|
|
export let streams;
|
|
|
|
const streaming_info = {
|
|
title: "Livestreams",
|
|
description: "Past, present, and future live education."
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
streams {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
padding-top: 0.5em;
|
|
}
|
|
|
|
streams card {
|
|
width: 100%;
|
|
border: 0px;
|
|
border-bottom: 1px solid var(--value5);
|
|
border-radius: unset;
|
|
box-shadow: unset;
|
|
}
|
|
|
|
streams card middle {
|
|
height: 100%;
|
|
padding-left: 0px;
|
|
padding-right: 0px;
|
|
}
|
|
|
|
streams card bottom {
|
|
font-size: 0.9em;
|
|
color: var(--color-border-tabs);
|
|
padding-bottom: 0.5rem;
|
|
}
|
|
|
|
streams card top {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: start;
|
|
padding-top: 0.5rem;
|
|
}
|
|
|
|
title-time {
|
|
display: flex;
|
|
flex-direction: row;
|
|
flex-grow: 10;
|
|
}
|
|
|
|
title-time span.start-time {
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
title-time h4 {
|
|
margin-top: 0px;
|
|
flex-grow: 10;
|
|
}
|
|
|
|
@media only screen and (max-width: 700px) {
|
|
content {
|
|
width: 650px;
|
|
}
|
|
}
|
|
|
|
@media only screen and (max-width: 800px) {
|
|
content {
|
|
width: 100%;
|
|
flex-direction: column-reverse;
|
|
}
|
|
|
|
right {
|
|
width: 100%;
|
|
}
|
|
|
|
left {
|
|
width: 100%;
|
|
max-width: unset;
|
|
min-width: unset;
|
|
box-shadow: unset;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<Layout authenticated={ false } testid="streams-page" footer={ false } header={ true } fixed={ true }>
|
|
<content>
|
|
<left>
|
|
<h1>Sidebar</h1>
|
|
</left>
|
|
|
|
<right>
|
|
<streams>
|
|
{#each streams as stream}
|
|
<card>
|
|
<top>
|
|
<title-time>
|
|
<h4>
|
|
{#if stream.state === "live"}
|
|
<a data-testid="stream-link-{ stream.id }" href="/client/#/live/{ stream.slug }/" use:link>
|
|
{ stream.title }
|
|
</a>
|
|
{:else}
|
|
<a data-testid="stream-link-{ stream.id }" href="/live/{ stream.slug }/">
|
|
{ stream.title }
|
|
</a>
|
|
{/if}
|
|
</h4>
|
|
{#if stream.state === "pending"}
|
|
<span class="start-time">{ formatDistanceToNow(parseISO(stream.starts_on), {addSuffix: true}) }</span>
|
|
{:else if stream.state === "live"}
|
|
<span class="start-time">Live Now!</span>
|
|
{:else}
|
|
<span class="start-time">{ formatDistanceToNow(parseISO(stream.updated_at), {addSuffix: true}) }</span>
|
|
{/if}
|
|
</title-time>
|
|
|
|
</top>
|
|
|
|
<middle>
|
|
<a href="/live/{ stream.slug }/">
|
|
{#if stream.poster }
|
|
<figure>
|
|
<Hydrate component={ SnapImage } props={ { src: stream.poster } } />
|
|
</figure>
|
|
{:else}
|
|
<IconImage name="video" />
|
|
{/if}
|
|
</a>
|
|
</middle>
|
|
|
|
<bottom>
|
|
<Markdown content={ stream.description } />
|
|
</bottom>
|
|
</card>
|
|
{/each}
|
|
</streams>
|
|
</right>
|
|
</content>
|
|
</Layout>
|
|
|