mirror of
https://github.com/tcgdex/cards-database.git
synced 2025-06-14 08:39:17 +00:00
feat: Add status Dashboard (#187)
* feat: Add status Dashboard Still need some polishing like using the compiler instead of the live DB Signed-off-by: Avior <github@avior.me> * refactor: Simplified compiler files generators Signed-off-by: Avior <florian.bouillon@delta-wings.net> * chore: Add step to compiler for stats and optimize Signed-off-by: Avior <github@avior.me> * refactor: Remove unused variable Signed-off-by: Avior <github@avior.me>
This commit is contained in:
@ -11,6 +11,11 @@ export const DB_PATH = "../"
|
||||
|
||||
const fileCache: fileCacheInterface = {}
|
||||
|
||||
/**
|
||||
* Fetch a JSON file from a remote location
|
||||
* @param url the URL to fetch
|
||||
* @returns the JSON file content
|
||||
*/
|
||||
export async function fetchRemoteFile<T = any>(url: string): Promise<T> {
|
||||
if (!fileCache[url]) {
|
||||
const resp = await fetch(url, {
|
||||
@ -32,6 +37,13 @@ export async function smartGlob(query: string): Promise<Array<string>> {
|
||||
return globCache[query]
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a card is currently Legal
|
||||
* @param type the type of legality
|
||||
* @param card the card to check
|
||||
* @param localId the card localid
|
||||
* @returns {boolean} if the card is currently in the legal type
|
||||
*/
|
||||
export function cardIsLegal(type: 'standard' | 'expanded', card: Card, localId: string): boolean {
|
||||
const legal = legals[type]
|
||||
if (
|
||||
@ -47,6 +59,12 @@ export function cardIsLegal(type: 'standard' | 'expanded', card: Card, localId:
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a set is currently Legal
|
||||
* @param type the type of legality
|
||||
* @param set the set to check
|
||||
* @returns {boolean} if the set is currently in the legal type
|
||||
*/
|
||||
export function setIsLegal(type: 'standard' | 'expanded', set: Set): boolean {
|
||||
const legal = legals[type]
|
||||
if (
|
||||
|
Reference in New Issue
Block a user