mess around
This commit is contained in:
@@ -1,40 +1,41 @@
|
||||
<script>
|
||||
import StreamPage from './StreamPage.svelte';
|
||||
import MetadataEditor from './MetadataEditor.svelte';
|
||||
import Player from './Player.svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { dev } from '$app/environment';
|
||||
import { currentStream, updateCurrentStream } from '$lib/stores.js';
|
||||
import StreamPage from './StreamPage.svelte';
|
||||
import MetadataEditor from './MetadataEditor.svelte';
|
||||
import Player from './Player.svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { dev } from '$app/environment';
|
||||
import { currentStream, updateCurrentStream } from '$lib/stores.js';
|
||||
|
||||
export let data;
|
||||
$: updateCurrentStream(data.stream);
|
||||
export let data;
|
||||
$: updateCurrentStream(data.stream);
|
||||
</script>
|
||||
|
||||
<div id="streamContainer">
|
||||
<div id="streamPage">
|
||||
{#if dev}
|
||||
<MetadataEditor {...data} />
|
||||
{/if}
|
||||
<StreamPage />
|
||||
</div>
|
||||
<div id="player">
|
||||
<Player display={true} src="/media/tracks/{$currentStream.filename}" />
|
||||
</div>
|
||||
<div id="streamPage" class="panel">
|
||||
{#if dev}
|
||||
<MetadataEditor {...data} />
|
||||
{/if}
|
||||
<StreamPage />
|
||||
</div>
|
||||
<div id="player">
|
||||
<Player display={true} src="/media/tracks/{$currentStream.filename}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
#streamContainer {
|
||||
display: grid;
|
||||
grid-template-rows: 85% 15%;
|
||||
height: 100vh;
|
||||
}
|
||||
#streamContainer {
|
||||
display: grid;
|
||||
grid-template-rows: 85% 15%;
|
||||
height: calc(100vh - 1em);
|
||||
}
|
||||
|
||||
#streamPage {
|
||||
grid-row: 1 / 2;
|
||||
overflow: auto;
|
||||
}
|
||||
#streamPage {
|
||||
grid-row: 1 / 2;
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#player {
|
||||
grid-row: 2 / 3;
|
||||
}
|
||||
#player {
|
||||
grid-row: 2 / 3;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,73 +1,74 @@
|
||||
<script>
|
||||
import { page } from '$app/stores';
|
||||
import { tagList } from '$lib/stores.js';
|
||||
import { page } from '$app/stores';
|
||||
import { tagList } from '$lib/stores.js';
|
||||
|
||||
export let original;
|
||||
let tagMap = new Map();
|
||||
export let original;
|
||||
let tagMap = new Map();
|
||||
|
||||
// Create a mapping of tags and their checked status
|
||||
let reloadTags = (original) => {
|
||||
tagList.forEach((tag) => {
|
||||
tagMap.set(tag, original.tags.includes(tag));
|
||||
});
|
||||
};
|
||||
// Create a mapping of tags and their checked status
|
||||
let reloadTags = (original) => {
|
||||
tagList.forEach((tag) => {
|
||||
tagMap.set(tag, original.tags.includes(tag));
|
||||
});
|
||||
};
|
||||
|
||||
$: reloadTags(original);
|
||||
$: reloadTags(original);
|
||||
</script>
|
||||
|
||||
{#key $page.url.pathname}
|
||||
<form method="POST">
|
||||
<br />
|
||||
<label>
|
||||
<p>Title:</p>
|
||||
<input type="text" name="title" bind:value={original.title} />
|
||||
</label>
|
||||
<br />
|
||||
<form method="POST">
|
||||
<br />
|
||||
<label>
|
||||
<p>Title:</p>
|
||||
<input type="text" name="title" bind:value={original.title} />
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<label>
|
||||
<p>Description:</p>
|
||||
<textarea
|
||||
style="min-width:400px;min-height:100px"
|
||||
name="description"
|
||||
bind:value={original.description}
|
||||
/>
|
||||
</label>
|
||||
<br />
|
||||
<label>
|
||||
<p>Tags:</p>
|
||||
<div class="checkboxContainer">
|
||||
{#each tagList as tag}
|
||||
<label>
|
||||
<input type="checkbox" name="tags" value={tag} checked={tagMap.get(tag)} />
|
||||
{tag}
|
||||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
</label>
|
||||
<br />
|
||||
<label>
|
||||
<p>Description:</p>
|
||||
<textarea
|
||||
style="min-width:400px;min-height:100px"
|
||||
name="description"
|
||||
bind:value={original.description}
|
||||
/>
|
||||
</label>
|
||||
<br />
|
||||
<label>
|
||||
<p>Tags:</p>
|
||||
<div class="checkboxContainer">
|
||||
{#each tagList as tag}
|
||||
<label>
|
||||
<input type="checkbox" name="tags" value={tag} checked={tagMap.get(tag)} />
|
||||
{tag}
|
||||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
{/key}
|
||||
|
||||
<style>
|
||||
form {
|
||||
margin-left: 10px;
|
||||
}
|
||||
form {
|
||||
margin-left: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
label > p {
|
||||
margin-right: 5px;
|
||||
}
|
||||
label > p {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.checkboxContainer {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 1px;
|
||||
max-width: 50%;
|
||||
}
|
||||
.checkboxContainer {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 1px;
|
||||
max-width: 50%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,56 +1,74 @@
|
||||
<script>
|
||||
import { currentStream, currentSongIndex } from '$lib/stores.js';
|
||||
import {} from 'svelte';
|
||||
import { jumpToTrack } from './Player.svelte';
|
||||
import { currentStream, currentSongIndex } from '$lib/stores.js';
|
||||
import { jumpToTrack } from './Player.svelte';
|
||||
import { Carta } from 'carta-md';
|
||||
import { sanitize } from 'isomorphic-dompurify';
|
||||
|
||||
function prettyPrintTime(s) {
|
||||
return new Date(s * 1000).toISOString().slice(11, 19);
|
||||
}
|
||||
const carta = new Carta({
|
||||
sanitizer: sanitize
|
||||
});
|
||||
|
||||
function prettyPrintTime(s) {
|
||||
return new Date(s * 1000).toISOString().slice(11, 19);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="description-bubble">
|
||||
{$currentStream.description === '' ? 'No description available.' : $currentStream.description}
|
||||
{@html carta.renderSSR($currentStream.description || 'No description available.')}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<table>
|
||||
<tr><th>Timestamp</th><th>Artist</th><th>Title</th></tr>
|
||||
{#each $currentStream.tracks as track, i}
|
||||
<tr on:click={() => jumpToTrack(track[0])} class:current={i == $currentSongIndex}>
|
||||
<td>{prettyPrintTime(track[0])}</td>
|
||||
<td>{track[1]}</td>
|
||||
<td>{track[2]}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
<table>
|
||||
<tr><th>Timestamp</th><th>Artist</th><th>Title</th></tr>
|
||||
{#each $currentStream.tracks as track, i}
|
||||
<tr on:click={() => jumpToTrack(track[0])} class:current={i == $currentSongIndex}>
|
||||
<td>{prettyPrintTime(track[0])}</td>
|
||||
<td>{track[1]}</td>
|
||||
<td>{track[2]}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.current {
|
||||
background-color: gray;
|
||||
}
|
||||
.description-bubble {
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
border-radius: 5px;
|
||||
max-width: 80%;
|
||||
width: fit-content;
|
||||
white-space: pre-line;
|
||||
min-width: 50%;
|
||||
}
|
||||
td {
|
||||
height: 1.3em;
|
||||
}
|
||||
.current {
|
||||
background-color: gray;
|
||||
}
|
||||
.description-bubble {
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
color: black;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
border-radius: 5px;
|
||||
max-width: 80%;
|
||||
width: fit-content;
|
||||
min-width: 50%;
|
||||
font-family: Verdana;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.description-bubble::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
border-style: solid;
|
||||
border-width: 10px 0 10px 10px;
|
||||
border-color: transparent transparent transparent #ccc;
|
||||
top: 0;
|
||||
right: -10px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
.description-bubble :global(:first-child) {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.description-bubble :global(:last-child) {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.description-bubble::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
border-style: solid;
|
||||
border-width: 10px 0 10px 10px;
|
||||
border-color: transparent transparent transparent #ccc;
|
||||
top: 0;
|
||||
right: -10px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user