feat: cooler info chips, minor refactoring

This commit is contained in:
afn
2022-10-23 10:54:19 -04:00
parent 831c4d9d47
commit aac71915e5
8 changed files with 74 additions and 84 deletions

View File

@@ -1,14 +1,12 @@
import { readable } from 'svelte/store';
import type { Repository } from '$lib/types';
import type { Repository } from 'src/data/types';
export type ContribData = { repositories: Repository[] };
const fetchContributors = async (): Promise<ContribData> => {
const response = await fetch('https://releases.rvcd.win/contributors');
const data = await response.json();
return data;
const data = await response.json();
return data;
};
export const ContributorsStore = readable(fetchContributors());

View File

@@ -1,5 +1,5 @@
import { readable } from 'svelte/store';
import type { Patch } from '$lib/types';
import type { Patch } from 'src/data/types';
export type PatchesData = { patches: Patch[]; packages: string[] };

34
src/data/types.ts Normal file
View File

@@ -0,0 +1,34 @@
export interface Contributor {
login: string;
avatar_url: string;
html_url: string;
}
export interface Repository {
name: string;
contributors: Contributor[];
}
export interface Patch {
name: string;
description: string;
version: string;
excluded: boolean;
deprecated: boolean;
dependencies: string[];
options: PatchOption[];
compatiblePackages: CompatiblePackage[];
}
export interface CompatiblePackage {
name: string;
versions: string[];
}
export interface PatchOption {
key: string;
title: string;
description: string;
required: boolean;
choices: string[];
}