♻️ Refactor icon picker (#724)

This commit is contained in:
Manuel
2023-02-20 22:11:30 +01:00
committed by GitHub
parent 2c1b329dfd
commit f5686fbf2c
17 changed files with 441 additions and 258 deletions

View File

@@ -0,0 +1,32 @@
export abstract class AbstractIconRepository {
constructor(readonly copyright?: string) {}
async fetch(): Promise<NormalizedIconRepositoryResult> {
try {
return await this.fetchInternally();
} catch (err) {
return {
success: false,
count: 0,
entries: [],
name: '',
copyright: this.copyright,
};
}
}
protected abstract fetchInternally(): Promise<NormalizedIconRepositoryResult>;
}
export type NormalizedIconRepositoryResult = {
name: string;
success: boolean;
count: number;
copyright: string | undefined;
entries: NormalizedIcon[];
};
export type NormalizedIcon = {
url: string;
name: string;
size: number;
};