Initial commit

This commit is contained in:
2023-01-28 16:42:44 +01:00
commit 46c7eb35b3
27 changed files with 14014 additions and 0 deletions

20
src/stores/table.ts Normal file
View File

@ -0,0 +1,20 @@
import { writable, derived } from "svelte/store";
import type { ProgressRow, ProgressTable, RowId } from "../lib/types";
export const term = writable("");
export const items = writable<ProgressTable>(new Map());
function search([term, items]): ProgressTable {
return new Map(
[...items].filter(([_, value]: [RowId, ProgressRow]) => {
let title = value.media.title;
return (
title.english?.toLowerCase().includes(term) ||
title.romaji?.toLowerCase().includes(term)
);
})
);
}
export const filtered = derived([term, items], search);