mirror of
https://github.com/ReVanced/revanced-website.git
synced 2026-01-20 17:53:56 +00:00
typescript lol
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
|
||||
import next from '$lib/assets/icons/next.svg';
|
||||
import previous from '$lib/assets/icons/previous.svg';
|
||||
import type { APILogo } from '$lib/types';
|
||||
|
||||
export let name = '';
|
||||
export let selected: Array<string>;
|
||||
export let variants;
|
||||
export let selected: string[];
|
||||
export let variants: APILogo[];
|
||||
export let clicked = false;
|
||||
export let hideDetails = false;
|
||||
|
||||
@@ -17,7 +18,7 @@
|
||||
|
||||
let i = 0;
|
||||
$: current = variants[i];
|
||||
let interval = null;
|
||||
let interval = 0;
|
||||
onMount(() => {
|
||||
if (!hasVariants) {
|
||||
return;
|
||||
@@ -28,12 +29,12 @@
|
||||
} else {
|
||||
i += 1;
|
||||
}
|
||||
}, 2500);
|
||||
}, 2500) as unknown as number; // stfu typescript
|
||||
|
||||
return () => clearInterval(interval);
|
||||
});
|
||||
|
||||
function select_logo(id) {
|
||||
function select_logo(id: string) {
|
||||
clicked = !clicked;
|
||||
if (selected.includes(id)) {
|
||||
selected = selected.filter((e) => e !== id);
|
||||
|
||||
19
src/lib/types.ts
Normal file
19
src/lib/types.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export interface APILogo {
|
||||
id: string;
|
||||
gdrive_direct_url: string;
|
||||
}
|
||||
|
||||
export interface LogoAPIResponse {
|
||||
[key: string]: {
|
||||
logos: APILogo[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface Logo {
|
||||
name: string;
|
||||
variants: APILogo[];
|
||||
}
|
||||
|
||||
// export interface Selected {
|
||||
|
||||
// }
|
||||
@@ -1,8 +1,8 @@
|
||||
import { dev } from "$app/environment";
|
||||
import { dev } from '$app/environment';
|
||||
|
||||
// console.log, but only if in dev environment.
|
||||
export function dev_log(part: string, ...args) {
|
||||
if (dev) {
|
||||
console.log(`[${part}]:`, ...args);
|
||||
}
|
||||
export function dev_log(part: string, ...args: string[]) {
|
||||
if (dev) {
|
||||
console.log(`[${part}]:`, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user