mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: core chunk 3
This commit is contained in:
1 parent
970ab9004e
commit
07e3660388
25 files changed
+57
-58
No files matched your search
Vendored
+1
@@ -43,6 +43,7 @@
|
||||
"wargaming",
|
||||
"webp",
|
||||
"winrate",
|
||||
"wotblitz",
|
||||
"zustand"
|
||||
],
|
||||
"deno.enable": false,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import throwError from '../node/throwError';
|
||||
import throwError from '../../core/node/throwError';
|
||||
|
||||
export type WargamingResponse<Data extends object> =
|
||||
export type BlitzResponse<Data extends object> =
|
||||
| {
|
||||
status: 'error';
|
||||
error: { field: string; message: string; code: 402; value: null };
|
||||
@@ -10,12 +10,10 @@ export type WargamingResponse<Data extends object> =
|
||||
data: Data;
|
||||
};
|
||||
|
||||
export default async function getWargamingResponse<Data extends object>(
|
||||
url: string,
|
||||
) {
|
||||
export default async function fetchBlitz<Data extends object>(url: string) {
|
||||
const data = (await fetch(url).then((response) =>
|
||||
response.json(),
|
||||
)) as WargamingResponse<Data>;
|
||||
)) as BlitzResponse<Data>;
|
||||
|
||||
if (data.status === 'ok') {
|
||||
return data.data;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from '../../core/blitz/getWargamingResponse';
|
||||
import fetchBlitz from './fetchWargaming';
|
||||
import { normalizeIds } from './normalizeIds';
|
||||
|
||||
interface IndividualAccountAchievements {
|
||||
@@ -22,7 +22,7 @@ export async function getAccountAchievements<
|
||||
? IndividualAccountAchievements
|
||||
: IndividualAccountAchievements[],
|
||||
>(region: Region, ids: Ids) {
|
||||
const object = await getWargamingResponse<AccountAchievements>(
|
||||
const object = await fetchBlitz<AccountAchievements>(
|
||||
`https://api.wotblitz.${region}/wotb/account/achievements/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${normalizeIds(
|
||||
ids,
|
||||
)}`,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from '../../core/blitz/getWargamingResponse';
|
||||
import fetchBlitz from './fetchWargaming';
|
||||
import { normalizeIds } from './normalizeIds';
|
||||
|
||||
export interface AllStats {
|
||||
@@ -75,7 +75,7 @@ export async function getAccountInfo<
|
||||
? IndividualAccountInfo
|
||||
: IndividualAccountInfo[],
|
||||
>(region: Region, ids: Ids) {
|
||||
const object = await getWargamingResponse<AccountInfo>(
|
||||
const object = await fetchBlitz<AccountInfo>(
|
||||
`https://api.wotblitz.${region}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${normalizeIds(
|
||||
ids,
|
||||
)}`,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from '../../core/blitz/getWargamingResponse';
|
||||
import fetchBlitz from './fetchWargaming';
|
||||
import { normalizeExtra } from './normalizeExtra';
|
||||
import { normalizeIds } from './normalizeIds';
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function getClanAccountInfo<
|
||||
? IndividualClanAccountInfo
|
||||
: IndividualClanAccountInfo[],
|
||||
>(region: Region, ids: Ids, extra?: string[]) {
|
||||
const object = await getWargamingResponse<ClanAccountInfo>(
|
||||
const object = await fetchBlitz<ClanAccountInfo>(
|
||||
`https://api.wotblitz.${region}/wotb/clans/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${normalizeIds(
|
||||
ids,
|
||||
)}${normalizeExtra(extra)}`,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from '../../core/blitz/getWargamingResponse';
|
||||
import fetchBlitz from './fetchWargaming';
|
||||
import { normalizeIds } from './normalizeIds';
|
||||
|
||||
export interface IndividualClanInfo {
|
||||
@@ -40,7 +40,7 @@ export async function getClanInfo<
|
||||
Ids extends number | number[],
|
||||
ReturnType = Ids extends number ? IndividualClanInfo : IndividualClanInfo[],
|
||||
>(region: Region, ids: Ids) {
|
||||
const object = await getWargamingResponse<ClanInfo>(
|
||||
const object = await fetchBlitz<ClanInfo>(
|
||||
`https://api.wotblitz.${region}/wotb/clans/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${normalizeIds(
|
||||
ids,
|
||||
)}`,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RatingsInfo } from '../../commands/ratings';
|
||||
import { Region } from '../../constants/regions';
|
||||
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
||||
import regionToRegionSubdomain from '../../core/blitz/regionToRegionSubdomain';
|
||||
|
||||
export default async function getRatingsInfo(region: Region) {
|
||||
const response = await fetch(
|
||||
@@ -1,18 +1,18 @@
|
||||
import { REGION_NAMES, Region } from '../../constants/regions';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import throwError from '../../core/node/throwError';
|
||||
import { TanksStats } from '../../types/tanksStats';
|
||||
import throwError from '../node/throwError';
|
||||
import getWargamingResponse from './getWargamingResponse';
|
||||
import fetchBlitz from './fetchWargaming';
|
||||
|
||||
export default async function getTankStats(region: Region, id: number) {
|
||||
const tankStats = await getWargamingResponse<TanksStats>(
|
||||
const tankStats = await fetchBlitz<TanksStats>(
|
||||
`https://api.wotblitz.${region}/wotb/tanks/stats/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
|
||||
);
|
||||
|
||||
if (tankStats[id] === null) {
|
||||
throw throwError(
|
||||
'No tank stats available',
|
||||
`Wargaming says there is no tank stats for this account. This account may not have any battles/tanks or exist in the ${REGION_NAMES[region]} server.`,
|
||||
"This player doesn't have any stats for tanks available. This may not be the player you are looking for.",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TreeTypeEnum } from '../../components/Tanks';
|
||||
import { tankopedia } from './tankopedia';
|
||||
import { tankopedia } from '../../core/blitz/tankopedia';
|
||||
|
||||
export default async function getTreeType(id: number) {
|
||||
const entry = (await tankopedia)[id];
|
||||
@@ -0,0 +1,3 @@
|
||||
export function emblemIdToURL(emblemId: number) {
|
||||
return `https://wotblitz-gc.gcdn.co/icons/clanEmblems1x/clan-icon-v2-${emblemId}.png`;
|
||||
}
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
import { ContextMenu } from '@radix-ui/themes';
|
||||
import { useEffect, useState } from 'react';
|
||||
import fetchBlitz from '../../../_core/blitz/fetchWargaming';
|
||||
import calculateWN8 from '../../../_core/statistics/calculateWN8';
|
||||
import { deltaTankStats } from '../../../_core/statistics/deltaTankStats';
|
||||
import * as Breakdown from '../../../components/Breakdown';
|
||||
import { TreeTypeEnum } from '../../../components/Tanks';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../../constants/wargamingApplicationID';
|
||||
import getWN8Percentile from '../../../core/blitz/getWN8Percentile';
|
||||
import getWargamingResponse from '../../../core/blitz/getWargamingResponse';
|
||||
import { TankopediaEntry, tankopedia } from '../../../core/blitz/tankopedia';
|
||||
import { tankAverages } from '../../../core/blitzstars/tankAverages';
|
||||
import { useSession } from '../../../stores/session';
|
||||
@@ -73,7 +73,7 @@ export default function SessionPage() {
|
||||
async function recalculateDiff() {
|
||||
if (session.isTracking) {
|
||||
const { id, region } = session;
|
||||
const careerRaw = await getWargamingResponse<TanksStats>(
|
||||
const careerRaw = await fetchBlitz<TanksStats>(
|
||||
`https://api.wotblitz.${region}/wotb/tanks/stats/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
|
||||
);
|
||||
const career = careerRaw[id].reduce<
|
||||
|
||||
@@ -18,10 +18,10 @@ import {
|
||||
} from '@radix-ui/themes';
|
||||
import { debounce } from 'lodash';
|
||||
import { ChangeEvent, useRef, useState } from 'react';
|
||||
import fetchBlitz from '../../../_core/blitz/fetchWargaming';
|
||||
import PageWrapper from '../../../components/PageWrapper';
|
||||
import { REGION_NAMES, Region } from '../../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from '../../../core/blitz/getWargamingResponse';
|
||||
import listPlayers, {
|
||||
AccountListWithServer,
|
||||
} from '../../../core/blitz/listPlayers';
|
||||
@@ -54,7 +54,7 @@ export default function Page() {
|
||||
input.current!.value = nickname;
|
||||
|
||||
const rawTankStats = (
|
||||
await getWargamingResponse<TanksStats>(
|
||||
await fetchBlitz<TanksStats>(
|
||||
`https://api.wotblitz.${region}/wotb/tanks/stats/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
|
||||
)
|
||||
)[id];
|
||||
|
||||
@@ -4,11 +4,11 @@ import {
|
||||
} from 'discord.js';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import { emblemIdToURL } from '../_core/blitzkrieg/emblemIdToURL';
|
||||
import * as Graph from '../components/Graph';
|
||||
import NoData, { NoDataType } from '../components/NoData';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||
import resolveTankId from '../core/blitz/resolveTankId';
|
||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||
import getPlayerHistories from '../core/blitzstars/getPlayerHistories';
|
||||
@@ -41,7 +41,7 @@ async function render(
|
||||
) {
|
||||
const accountInfo = await getAccountInfo(region, id);
|
||||
const clan = (await getClanAccountInfo(region, id))?.clan;
|
||||
const logo = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
||||
const logo = clan ? emblemIdToURL(clan.emblem_set_id) : undefined;
|
||||
const histories = await (type === 'player'
|
||||
? getPlayerHistories(region, id, {
|
||||
start,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import { emblemIdToURL } from '../_core/blitzkrieg/emblemIdToURL';
|
||||
import { StatFilters, filterStats } from '../_core/statistics/filterStats';
|
||||
import GenericAllStats from '../components/GenericAllStats';
|
||||
import NoData, { NoDataType } from '../components/NoData';
|
||||
import TierWeights from '../components/TierWeights';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
||||
import { getTierWeights } from '../core/blitzkrieg/getTierWeights';
|
||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||
@@ -38,7 +38,7 @@ async function render(
|
||||
) {
|
||||
const { nickname } = await getAccountInfo(region, id);
|
||||
const clan = (await getClanAccountInfo(region, id))?.clan;
|
||||
const clanImage = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
||||
const clanImage = clan ? emblemIdToURL(clan.emblem_set_id) : undefined;
|
||||
const diffedTankStats = await getDiffedTankStats(region, id, start, end);
|
||||
const { stats, supplementary, filteredOrder } = await filterStats(
|
||||
diffedTankStats,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import getTankStats from '../_core/blitz/getTankStats';
|
||||
import getTreeType from '../_core/blitz/getTreeType';
|
||||
import { emblemIdToURL } from '../_core/blitzkrieg/emblemIdToURL';
|
||||
import NoData, { NoDataType } from '../components/NoData';
|
||||
import * as Tanks from '../components/Tanks';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||
import getTankStats from '../core/blitz/getTankStats';
|
||||
import getTreeType from '../core/blitz/getTreeType';
|
||||
import resolveTankName from '../core/blitz/resolveTankName';
|
||||
import {
|
||||
TIER_ROMAN_NUMERALS,
|
||||
@@ -67,7 +67,7 @@ export const ownedTanksCommand: CommandRegistry = {
|
||||
name={accountInfo.nickname}
|
||||
image={
|
||||
clanAccountInfo?.clan
|
||||
? getClanLogo(clanAccountInfo.clan.emblem_set_id)
|
||||
? emblemIdToURL(clanAccountInfo.clan.emblem_set_id)
|
||||
: undefined
|
||||
}
|
||||
description={`Tier ${TIER_ROMAN_NUMERALS[tier as Tier]} tanks`}
|
||||
|
||||
@@ -7,12 +7,12 @@ import {
|
||||
import { BlitzkriegRatingsLeaderboard } from '../../scripts/buildRatingsLeaderboard';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import getRatingsInfo from '../_core/blitz/getRatingsInfo';
|
||||
import getArchivedRatingsInfo from '../_core/blitzkrieg/getArchivedRatingsInfo';
|
||||
import * as Leaderboard from '../components/Leaderboard';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { REGION_NAMES_SHORT, Region } from '../constants/regions';
|
||||
import getRatingsInfo from '../core/blitz/getRatingsInfo';
|
||||
import regionToRegionSubdomain from '../core/blitz/regionToRegionSubdomain';
|
||||
import getMidnightLeaderboard, {
|
||||
DATABASE_REPO,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import fetchBlitz from '../_core/blitz/fetchWargaming';
|
||||
import { REGION_NAMES, Region } from '../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse';
|
||||
import addClanChoices from '../core/discord/addClanChoices';
|
||||
import addRegionChoices from '../core/discord/addRegionChoices';
|
||||
import embedInfo from '../core/discord/embedInfo';
|
||||
@@ -30,7 +30,7 @@ export const searchClansCommand: CommandRegistry = {
|
||||
const server = interaction.options.getString('region') as Region;
|
||||
const clan = interaction.options.getString('clan')!;
|
||||
const limit = interaction.options.getInteger('limit') ?? 25;
|
||||
const clanList = await getWargamingResponse<ClanList>(
|
||||
const clanList = await fetchBlitz<ClanList>(
|
||||
`https://api.wotblitz.${server}/wotb/clans/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${clan}&limit=${limit}`,
|
||||
);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import fetchBlitz from '../_core/blitz/fetchWargaming';
|
||||
import { REGION_NAMES, Region } from '../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse';
|
||||
import { AccountList, usernamePattern } from '../core/blitz/listPlayers';
|
||||
import addRegionChoices from '../core/discord/addRegionChoices';
|
||||
import addUsernameChoices from '../core/discord/addUsernameChoices';
|
||||
@@ -34,7 +34,7 @@ export const searchPlayersCommand: CommandRegistry = {
|
||||
const limit = interaction.options.getInteger('limit') ?? 25;
|
||||
const trimmedSearch = name.trim();
|
||||
const players = usernamePattern.test(trimmedSearch)
|
||||
? await getWargamingResponse<AccountList>(
|
||||
? await fetchBlitz<AccountList>(
|
||||
`https://api.wotblitz.${server}/wotb/account/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${encodeURIComponent(
|
||||
trimmedSearch,
|
||||
)}&limit=${limit}`,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import { emblemIdToURL } from '../_core/blitzkrieg/emblemIdToURL';
|
||||
import { StatFilters, filterStats } from '../_core/statistics/filterStats';
|
||||
import AllStatsOverview from '../components/AllStatsOverview';
|
||||
import NoData, { NoDataType } from '../components/NoData';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||
import getDiffedTankStats from '../core/blitzstars/getDiffedTankStats';
|
||||
@@ -36,7 +36,7 @@ async function render(
|
||||
) {
|
||||
const { nickname } = await getAccountInfo(region, id);
|
||||
const clan = (await getClanAccountInfo(region, id))?.clan;
|
||||
const clanImage = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
||||
const clanImage = clan ? emblemIdToURL(clan.emblem_set_id) : undefined;
|
||||
const diffedTankStats = await getDiffedTankStats(region, id, start, end);
|
||||
const { stats, supplementary } = await filterStats(diffedTankStats, filters);
|
||||
const filterDescriptions = await filtersToDescription(filters);
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
export function getClanLogo(emblemId: number) {
|
||||
return `https://wotblitz-gc.gcdn.co/icons/clanEmblems1x/clan-icon-v2-${emblemId}.png`
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import fetchBlitz from '../../_core/blitz/fetchWargaming';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import { Clan, ClanList } from '../../types/clanList';
|
||||
import getWargamingResponse from './getWargamingResponse';
|
||||
|
||||
export type ClanListWithRegion = (Clan & {
|
||||
region: 'com' | 'eu' | 'asia';
|
||||
@@ -14,7 +14,7 @@ export default async function listClans(search: string, limit = 9) {
|
||||
|
||||
return (
|
||||
await Promise.all([
|
||||
getWargamingResponse<ClanList>(
|
||||
fetchBlitz<ClanList>(
|
||||
`https://api.wotblitz.com/wotb/clans/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${search}&limit=${normalizedLimit}`,
|
||||
).then(
|
||||
(value) =>
|
||||
@@ -24,7 +24,7 @@ export default async function listClans(search: string, limit = 9) {
|
||||
region: 'com' as Region,
|
||||
})),
|
||||
),
|
||||
getWargamingResponse<ClanList>(
|
||||
fetchBlitz<ClanList>(
|
||||
`https://api.wotblitz.eu/wotb/clans/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${search}&limit=${normalizedLimit}`,
|
||||
).then(
|
||||
(value) =>
|
||||
@@ -34,7 +34,7 @@ export default async function listClans(search: string, limit = 9) {
|
||||
region: 'eu' as Region,
|
||||
})),
|
||||
),
|
||||
getWargamingResponse<ClanList>(
|
||||
fetchBlitz<ClanList>(
|
||||
`https://api.wotblitz.asia/wotb/clans/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${search}&limit=${normalizedLimit}`,
|
||||
).then(
|
||||
(value) =>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import fetchBlitz from '../../_core/blitz/fetchWargaming';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import getWargamingResponse from './getWargamingResponse';
|
||||
|
||||
interface Account {
|
||||
nickname: string;
|
||||
@@ -22,7 +22,7 @@ export default async function listPlayers(search: string, limit = 9) {
|
||||
if (usernamePattern.test(trimmedSearch)) {
|
||||
return (
|
||||
await Promise.all([
|
||||
getWargamingResponse<AccountList>(
|
||||
fetchBlitz<AccountList>(
|
||||
`https://api.wotblitz.com/wotb/account/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${encodedSearch}&limit=${normalizedLimit}`,
|
||||
).then(
|
||||
(value) =>
|
||||
@@ -32,7 +32,7 @@ export default async function listPlayers(search: string, limit = 9) {
|
||||
region: 'com' as Region,
|
||||
})),
|
||||
),
|
||||
getWargamingResponse<AccountList>(
|
||||
fetchBlitz<AccountList>(
|
||||
`https://api.wotblitz.eu/wotb/account/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${encodedSearch}&limit=${normalizedLimit}`,
|
||||
).then(
|
||||
(value) =>
|
||||
@@ -42,7 +42,7 @@ export default async function listPlayers(search: string, limit = 9) {
|
||||
region: 'eu' as Region,
|
||||
})),
|
||||
),
|
||||
getWargamingResponse<AccountList>(
|
||||
fetchBlitz<AccountList>(
|
||||
`https://api.wotblitz.asia/wotb/account/list/?application_id=${WARGAMING_APPLICATION_ID}&search=${encodedSearch}&limit=${normalizedLimit}`,
|
||||
).then(
|
||||
(value) =>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { deburr } from 'lodash';
|
||||
import fetchBlitz from '../../_core/blitz/fetchWargaming';
|
||||
import { TreeTypeString } from '../../components/Tanks';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import { context } from '../blitzkrieg/context';
|
||||
import getWargamingResponse from './getWargamingResponse';
|
||||
import { TreeTypeString } from '../../components/Tanks';
|
||||
|
||||
export interface TankopediaEntry {
|
||||
name: string;
|
||||
@@ -16,7 +16,7 @@ export interface TankopediaEntry {
|
||||
type: string;
|
||||
description: string;
|
||||
}
|
||||
type asd = TreeTypeString
|
||||
type asd = TreeTypeString;
|
||||
export interface Tankopedia {
|
||||
[id: number]: TankopediaEntry | undefined;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export interface TankopediaInfo {
|
||||
|
||||
// this is blocking because info is needed for command creation
|
||||
console.log('Caching tankopedia info...');
|
||||
export const tankopediaInfo = getWargamingResponse<TankopediaInfo>(
|
||||
export const tankopediaInfo = fetchBlitz<TankopediaInfo>(
|
||||
`https://api.wotblitz.com/wotb/encyclopedia/info/?application_id=${WARGAMING_APPLICATION_ID}`,
|
||||
);
|
||||
console.log('Cached tankopedia info');
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import getTankStats from '../../_core/blitz/getTankStats';
|
||||
import { Region } from '../../constants/regions';
|
||||
import {
|
||||
GetHistoriesOptions,
|
||||
@@ -5,7 +6,6 @@ import {
|
||||
History,
|
||||
getHistoriesDefaultOptions,
|
||||
} from '../../types/histories';
|
||||
import getTankStats from '../blitz/getTankStats';
|
||||
import { emptyAllStats } from './getDiffedTankStats';
|
||||
|
||||
export interface TankHistory extends History {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { AllStats, getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||
import getTankStats from '../_core/blitz/getTankStats';
|
||||
import getTreeType from '../_core/blitz/getTreeType';
|
||||
import calculateWN8 from '../_core/statistics/calculateWN8';
|
||||
import * as Breakdown from '../components/Breakdown';
|
||||
import NoData, { NoDataType } from '../components/NoData';
|
||||
import TitleBar from '../components/TitleBar';
|
||||
import Wrapper from '../components/Wrapper';
|
||||
import getTankStats from '../core/blitz/getTankStats';
|
||||
import getTreeType from '../core/blitz/getTreeType';
|
||||
import getWN8Percentile from '../core/blitz/getWN8Percentile';
|
||||
import resolveTankName from '../core/blitz/resolveTankName';
|
||||
import sumStats from '../core/blitz/sumStats';
|
||||
|
||||
Reference in new issue
Block a user