sync missing updates

This commit is contained in:
41666 2023-06-10 11:00:43 -04:00
parent 2314da4763
commit 434f29b967
9 changed files with 63 additions and 76 deletions

View file

@ -30,3 +30,11 @@ export const fetchMetagameWorlds = async (): Promise<MetagameWorld[]> => {
const data: MetagameWorld[] = await response.json();
return data;
};
export const fetchSingleMetagameWorld = async (
id: string | number
): Promise<MetagameWorld> => {
const response = await fetch(`https://metagame.ps2.live/${id}`);
const data: MetagameWorld = await response.json();
return data;
};

View file

@ -37,60 +37,6 @@ export type World = {
};
};
export type Health = {
ingestReachable: string;
ingest: string;
database: string;
worlds: {
name: string;
status: string;
lastEvent: string;
}[];
};
export type IndexResponse = {
health: Health;
allWorlds: World[];
};
export const indexQuery = async (): Promise<IndexResponse> => {
const query = `{
health {
worlds {
name
status
lastEvent
}
}
allWorlds {
id
name
population {
nc
tr
vs
}
zones {
all {
id
name
population {
nc
tr
vs
}
}
}
}
}`;
const indexData: IndexResponse = await saerroFetch(query);
indexData.allWorlds.sort((a, b) => a.id - b.id);
return indexData;
};
export type WorldResponse = {
world: World;
};
@ -129,9 +75,7 @@ export const worldQuery = async (worldID: string): Promise<WorldResponse> => {
const query = `{
world(by: {id: ${Number(worldID)}}) {
id
name
population {
total
nc
tr
vs
@ -139,7 +83,6 @@ export const worldQuery = async (worldID: string): Promise<WorldResponse> => {
zones {
all {
id
name
classes {
${allClasses.map((cls) => `${cls} { total nc tr vs }`).join(" ")}
}
@ -150,7 +93,6 @@ export const worldQuery = async (worldID: string): Promise<WorldResponse> => {
.join(" ")}
}
population {
total
nc
tr
vs

View file

@ -19,11 +19,11 @@ export const humanTimeAgo = (ms: number, full?: boolean) => {
const hours = Math.floor(minutes / 60);
if (hours > 0) {
return full ? `${hours}h ${minutes % 60}m` : `${hours}h`;
return full ? `${hours}h ${minutes % 60}m ${seconds % 60}s` : `${hours}h`;
}
if (minutes > 0) {
return `${minutes}m`;
return full ? `${minutes}m ${seconds % 60}s` : `${minutes}m`;
}
if (seconds > 0) {