blob: 7ef0adb5c3de25803a4d24d8ef62f2e4e7c621d9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<script lang="ts">
import Spacer from "$lib/Layout/Spacer.svelte";
import { followers } from "$lib/Data/AniList/following";
import RateLimited from "$lib/Error/RateLimited.svelte";
import Skeleton from "$lib/Loading/Skeleton.svelte";
import TextSwap from "$lib/Layout/TextTransition.svelte";
import InputTemplate from "./InputTemplate.svelte";
let submission = "";
let randomSeed = 0;
</script>
<InputTemplate
field="Username"
bind:submission
event="Random Follower"
submitText="Generate"
onSubmit={() => (randomSeed = Math.random())}
>
{#await followers(submission)}
<Skeleton card={false} count={1} height="0.9rem" list />
{:then users}
{@const user = users[Math.floor(randomSeed * users.length)]}
<Spacer />
<a href={`https://anilist.co/user/${user.id}`} target="_blank">
<TextSwap text={user.name} />
</a>
{:catch}
<RateLimited type="Followers" list={false} />
{/await}
</InputTemplate>
|