diff options
| author | Fuwn <[email protected]> | 2024-10-09 00:41:20 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-09 00:41:43 -0700 |
| commit | 998b63a35256ac985a5a2714dd1ca451af4dfd8a (patch) | |
| tree | 50796121a9d5ab0330fdc5d7e098bda2860d9726 /src/routes/hololive | |
| parent | feat(graphql): add badgeCount field (diff) | |
| download | due.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.tar.xz due.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.zip | |
chore(prettier): use spaces instead of tabs
Diffstat (limited to 'src/routes/hololive')
| -rw-r--r-- | src/routes/hololive/[[stream]]/+page.server.ts | 6 | ||||
| -rw-r--r-- | src/routes/hololive/[[stream]]/+page.svelte | 120 |
2 files changed, 63 insertions, 63 deletions
diff --git a/src/routes/hololive/[[stream]]/+page.server.ts b/src/routes/hololive/[[stream]]/+page.server.ts index 87839c14..6eb5dad1 100644 --- a/src/routes/hololive/[[stream]]/+page.server.ts +++ b/src/routes/hololive/[[stream]]/+page.server.ts @@ -1,5 +1,5 @@ export const load = ({ params }) => { - return { - stream: params.stream - }; + return { + stream: params.stream + }; }; diff --git a/src/routes/hololive/[[stream]]/+page.svelte b/src/routes/hololive/[[stream]]/+page.svelte index 777f1e70..d5419711 100644 --- a/src/routes/hololive/[[stream]]/+page.svelte +++ b/src/routes/hololive/[[stream]]/+page.svelte @@ -1,82 +1,82 @@ <script lang="ts"> - import { onMount } from 'svelte'; - import Message from '$lib/Loading/Message.svelte'; - import Skeleton from '$lib/Loading/Skeleton.svelte'; - import HeadTitle from '$lib/Home/HeadTitle.svelte'; - import { parseScheduleHtml } from '$lib/Data/hololive'; - import proxy from '$lib/Utility/proxy'; - import locale from '$stores/locale'; - import root from '$lib/Utility/root'; - import identity from '$stores/identity'; - import Lives from '$lib/Hololive/Lives.svelte'; - import { typeSchedule } from '$lib/Hololive/hololive'; + import { onMount } from 'svelte'; + import Message from '$lib/Loading/Message.svelte'; + import Skeleton from '$lib/Loading/Skeleton.svelte'; + import HeadTitle from '$lib/Home/HeadTitle.svelte'; + import { parseScheduleHtml } from '$lib/Data/hololive'; + import proxy from '$lib/Utility/proxy'; + import locale from '$stores/locale'; + import root from '$lib/Utility/root'; + import identity from '$stores/identity'; + import Lives from '$lib/Hololive/Lives.svelte'; + import { typeSchedule } from '$lib/Hololive/hololive'; - export let data; + export let data; - let schedulePromise: Promise<Response>; - let pinnedStreams: string[] = []; + let schedulePromise: Promise<Response>; + let pinnedStreams: string[] = []; - onMount(() => getPinnedStreams()); + onMount(() => getPinnedStreams()); - const getPinnedStreams = () => { - let streams: string[] = []; + const getPinnedStreams = () => { + let streams: string[] = []; - const setSchedule = () => { - pinnedStreams = streams; - schedulePromise = fetch(proxy('https://schedule.hololive.tv'), { - headers: { - Cookie: 'timezone=Asia/Tokyo' - } - }); - }; + const setSchedule = () => { + pinnedStreams = streams; + schedulePromise = fetch(proxy('https://schedule.hololive.tv'), { + headers: { + Cookie: 'timezone=Asia/Tokyo' + } + }); + }; - if ($identity.id !== -2) { - fetch(root(`/api/preferences?id=${$identity.id}`)).then((response) => { - if (response.ok) - response.json().then((data) => { - if (data && data.pinned_hololive_streams) streams = data.pinned_hololive_streams; + if ($identity.id !== -2) { + fetch(root(`/api/preferences?id=${$identity.id}`)).then((response) => { + if (response.ok) + response.json().then((data) => { + if (data && data.pinned_hololive_streams) streams = data.pinned_hololive_streams; - setSchedule(); - }); - }); + setSchedule(); + }); + }); - return; - } + return; + } - setSchedule(); - }; + setSchedule(); + }; </script> <HeadTitle route="hololive Schedule" path="/hololive" /> {#await schedulePromise} - <Message message="Loading schedule ..." /> + <Message message="Loading schedule ..." /> - <Skeleton grid={true} count={100} width="49%" height="16.25em" /> + <Skeleton grid={true} count={100} width="49%" height="16.25em" /> {:then scheduleResponse} - {#if scheduleResponse} - {#await scheduleResponse.text()} - <Message message="Parsing schedule ..." /> + {#if scheduleResponse} + {#await scheduleResponse.text()} + <Message message="Parsing schedule ..." /> - <Skeleton grid={true} count={100} width="49%" height="16.25em" /> - {:then untypedSchedule} - {@const schedule = typeSchedule(parseScheduleHtml(untypedSchedule))} + <Skeleton grid={true} count={100} width="49%" height="16.25em" /> + {:then untypedSchedule} + {@const schedule = typeSchedule(parseScheduleHtml(untypedSchedule))} - <Lives {schedule} {pinnedStreams} {getPinnedStreams} filter={data.stream} /> - {:catch} - <Message loader="ripple" slot> - {$locale().hololive.parseError} - <a href={'#'} on:click={() => location.reload()}>Try again?</a> - </Message> - {/await} - {:else} - <Message message="Loading schedule ..." /> + <Lives {schedule} {pinnedStreams} {getPinnedStreams} filter={data.stream} /> + {:catch} + <Message loader="ripple" slot> + {$locale().hololive.parseError} + <a href={'#'} on:click={() => location.reload()}>Try again?</a> + </Message> + {/await} + {:else} + <Message message="Loading schedule ..." /> - <Skeleton grid={true} count={100} width="49%" height="16.25em" /> - {/if} + <Skeleton grid={true} count={100} width="49%" height="16.25em" /> + {/if} {:catch} - <Message loader="ripple" slot> - {$locale().hololive.loadError} Please - <a href={'#'} on:click={() => location.reload()}>try again</a> later. - </Message> + <Message loader="ripple" slot> + {$locale().hololive.loadError} Please + <a href={'#'} on:click={() => location.reload()}>try again</a> later. + </Message> {/await} |