more ts switches, use setcontext instead of stores
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { currentStream, favoritedStreams } from '$lib/stores.svelte.js';
|
||||
import { favoritedStreams } from '$lib/stores.svelte.ts';
|
||||
import { getStreamContext } from '$lib/stream-context.svelte.ts';
|
||||
import type { StreamSummary } from '$lib/types';
|
||||
import { hashColor, shorthandCode, formatSecondsToHms, formatDate } from '$lib/utils.js';
|
||||
import { hashColor, shorthandCode, formatSecondsToHms, formatDate } from '$lib/utils.ts';
|
||||
import TagSelect from './TagSelect.svelte';
|
||||
|
||||
let { streams }: { streams: StreamSummary[] } = $props();
|
||||
const ctx = getStreamContext();
|
||||
let filteredTags = $state([]);
|
||||
let favoritesOnly = $state(false);
|
||||
let listOpen = $state();
|
||||
@@ -20,7 +21,7 @@
|
||||
});
|
||||
|
||||
function streamsToDisplay() {
|
||||
return streams.filter(
|
||||
return ctx.streams.filter(
|
||||
(stream) =>
|
||||
!('tags' in stream) || filteredTags.every((tag) => stream.tags.includes(tag))
|
||||
);
|
||||
@@ -56,9 +57,9 @@
|
||||
</div>
|
||||
|
||||
<ul class="stream-list">
|
||||
{#each streams as stream}
|
||||
{#each ctx.streams as stream}
|
||||
{@const favorited = favoritedStreams.has(stream.id)}
|
||||
{@const current = $currentStream?.id === stream.id}
|
||||
{@const current = ctx.current?.id === stream.id}
|
||||
<li
|
||||
hidden={!displayedStreams.includes(stream) || (favoritesOnly && !favorited)}
|
||||
class="stream-item {current ? 'current-stream' : ''}"
|
||||
|
||||
Reference in New Issue
Block a user