refactor: remove repo name repitition

This commit is contained in:
afn 2022-10-12 15:30:06 -04:00
parent 3dbf275443
commit 7328c700f5
3 changed files with 6 additions and 20 deletions

View File

@ -1,15 +1,15 @@
<script lang="ts">
export let username: string;
export let name: string;
export let pfp: string;
export let url: string;
let alt = `${username}'s contributor profile picture`
let alt = `${name}'s profile picture`
</script>
<a href={url} target="_blank">
<button>
<img src={pfp} alt={alt}><slot/>
</button>
<h2>{username}</h2>
<h2>{name}</h2>
</a>
<style>

View File

@ -11,7 +11,7 @@
onMount (() => {
ContributorsStore.subscribe(async (data) => {
contribs = await data;
contribs = contribs[repo]
contribs = contribs[repo].contributors
});
});
@ -29,7 +29,7 @@
<div class="contrib-host">
{#each contribs as contrib}
{#if !usersIwantToExplodeSoBadly.includes(contrib.login)}
<ContributorButton username={contrib.login} pfp={contrib.avatar_url} url={contrib.html_url} />
<ContributorButton name={contrib.login} pfp={contrib.avatar_url} url={contrib.html_url} />
{/if}
{/each}
</div>

View File

@ -1,25 +1,11 @@
import { readable } from "svelte/store";
const fetchContributors = async () => {
let cli,
patcher,
patches,
integrations,
manager;
const response = await fetch('https://releases.rvcd.win/contributors');
const json = await response.json();
({ 0: cli, 1: patcher, 2: patches, 3: integrations, 4: manager } = json.repositories);
cli = cli.contributors
patcher = patcher.contributors
patches = patches.contributors
integrations = integrations.contributors
manager = manager.contributors
let { 0: cli, 1: patcher, 2: patches, 3: integrations, 4: manager } = json.repositories;
return {cli, patcher, patches, integrations, manager};
};
const ContributorsStore = readable(fetchContributors());