mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: types
This commit is contained in:
1 parent
9ae8b0ac49
commit
3c80a43435
255 files changed
+797
-838
No files matched your search
@@ -16,6 +16,8 @@
|
||||
"@react-three/drei": "^9.111.5",
|
||||
"@react-three/fiber": "^8.17.6",
|
||||
"react": "^18.3.1",
|
||||
"markdown-to-jsx": "^7.5.0",
|
||||
"compare-versions": "^6.1.1",
|
||||
"react-device-detect": "^2.2.3",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-fuzzysort": "^1.0.1",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Region } from '@blitzkit/core';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { Region } from '../../../../../../constants/regions';
|
||||
import getRatingInfo from '../../../../../../core/blitz/getRatingInfo';
|
||||
|
||||
export async function GET(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Region } from '@blitzkit/core';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { Region } from '../../../../../../../constants/regions';
|
||||
import { getRatingLeague } from '../../../../../../../core/blitz/getRatingLeague';
|
||||
|
||||
export async function GET(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Region } from '@blitzkit/core';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { Region } from '../../../../../../../constants/regions';
|
||||
import { searchCurrentRatingPlayers } from '../../../../../../../core/blitz/searchCurrentRatingPlayers';
|
||||
|
||||
export async function GET(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { assertSecret } from '../../../../../core/blitzkit/secret';
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
@@ -12,7 +12,9 @@ export async function GET(
|
||||
process.env.NEXT_PUBLIC_PATREON_CLIENT_ID,
|
||||
)}&client_secret=${assertSecret(
|
||||
process.env.PATREON_CLIENT_SECRET,
|
||||
)}&redirect_uri=${assertSecret(process.env.NEXT_PUBLIC_PATREON_REDIRECT_URI)}`,
|
||||
)}&redirect_uri=${assertSecret(
|
||||
process.env.NEXT_PUBLIC_PATREON_REDIRECT_URI,
|
||||
)}`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { assertSecret } from '../../../../../core/blitzkit/secret';
|
||||
|
||||
interface PatreonMembershipResponse {
|
||||
data: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { assertSecret } from '../../../../../core/blitzkit/secret';
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { tankDefinitions, usersDatabase } from '@blitzkit/core';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { isValidBlitzId } from '../../../../../core/blitz/isValidBlitzId';
|
||||
import { tankDefinitions } from '../../../../../core/blitzkit/tankDefinitions';
|
||||
import { usersDatabase } from '../../../../../databases/users';
|
||||
import {
|
||||
BlitzkitResponse,
|
||||
BlitzkitResponseError,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { tankDefinitions, usersDatabase } from '@blitzkit/core';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { isValidBlitzId } from '../../../../../core/blitz/isValidBlitzId';
|
||||
import { tankDefinitions } from '../../../../../core/blitzkit/tankDefinitions';
|
||||
import { usersDatabase } from '../../../../../databases/users';
|
||||
import {
|
||||
BlitzkitResponse,
|
||||
BlitzkitResponseError,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'use client';
|
||||
|
||||
import { assertSecret, idToRegion } from '@blitzkit/core';
|
||||
import { Button, Flex, Heading, Link, Text } from '@radix-ui/themes';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { idToRegion } from '@blitzkit/core';
|
||||
import * as App from '../../stores/app';
|
||||
import { CURRENT_POLICIES_AGREEMENT_INDEX } from '../../stores/app/constants';
|
||||
import { PatreonAuthResponse } from '../auth/[provider]/page';
|
||||
@@ -77,9 +77,9 @@ export function Checks() {
|
||||
fetch(
|
||||
`https://api.worldoftanks.${idToRegion(
|
||||
wargaming.id,
|
||||
)}/wot/auth/prolongate/?application_id=${assertSecret(process.env.WARGAMING_APPLICATION_ID)}&access_token=${
|
||||
wargaming.token
|
||||
}`,
|
||||
)}/wot/auth/prolongate/?application_id=${assertSecret(
|
||||
process.env.NEXT_PUBLIC_WARGAMING_APPLICATION_ID,
|
||||
)}&access_token=${wargaming.token}`,
|
||||
)
|
||||
.then((response) => response.json() as Promise<Extension>)
|
||||
.then((json) => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
import { Table } from '@radix-ui/themes';
|
||||
import Markdown from 'markdown-to-jsx';
|
||||
import { use } from 'react';
|
||||
import { Link } from '../../../../components/Link';
|
||||
import PageWrapper from '../../../../components/PageWrapper';
|
||||
import { assertSecret } from '../../../../core/blitzkit/secret';
|
||||
|
||||
export default function Page({
|
||||
params,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { asset, TankCharacteristics } from '@blitzkit/core';
|
||||
import { Flex, Heading, IconButton, Table } from '@radix-ui/themes';
|
||||
import { StickyColumnHeaderCell } from '../../../../components/StickyColumnHeaderCell';
|
||||
import { asset } from '../../../../core/blitzkit/asset';
|
||||
import { TankCharacteristics } from '../../../../core/blitzkit/tankCharacteristics';
|
||||
import * as CompareEphemeral from '../../../../stores/compareEphemeral';
|
||||
import { CompareRow } from './CompareRow';
|
||||
import { CompareSectionTitle } from './CompareSectionTitle';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { TankCharacteristics } from '@blitzkit/core';
|
||||
import {
|
||||
CaretLeftIcon,
|
||||
CaretRightIcon,
|
||||
CaretSortIcon,
|
||||
} from '@radix-ui/react-icons';
|
||||
import { Flex, IconButton, Table, Text } from '@radix-ui/themes';
|
||||
import { theme } from '../../../../../../bot/src/stitches.config';
|
||||
import { StickyRowHeaderCell } from '../../../../components/StickyRowHeaderCell';
|
||||
import { TankCharacteristics } from '../../../../core/blitzkit/tankCharacteristics';
|
||||
import { theme } from '../../../../stitches.config';
|
||||
import * as CompareEphemeral from '../../../../stores/compareEphemeral';
|
||||
import * as ComparePersistent from '../../../../stores/comparePersistent';
|
||||
|
||||
@@ -103,8 +103,8 @@ export function CompareRow({
|
||||
const resolvedDisplayValue = display
|
||||
? display(stats[index])
|
||||
: decimals === undefined
|
||||
? value
|
||||
: value?.toFixed(decimals);
|
||||
? value
|
||||
: value?.toFixed(decimals);
|
||||
|
||||
return (
|
||||
<Table.Cell
|
||||
@@ -117,12 +117,12 @@ export function CompareRow({
|
||||
value === values[0]
|
||||
? undefined
|
||||
: (
|
||||
deltaType === 'higherIsBetter'
|
||||
? value > values[0]
|
||||
: value < values[0]
|
||||
)
|
||||
? `color-mix(in srgb, ${theme.colors.componentCallToActionInteractive_green} ${normalizedDeltaPercentage}%, ${theme.colors.componentCallToActionInteractive_green}00)`
|
||||
: `color-mix(in srgb, ${theme.colors.componentCallToActionInteractive_red} ${normalizedDeltaPercentage}%, ${theme.colors.componentCallToActionInteractive_red}00)`,
|
||||
deltaType === 'higherIsBetter'
|
||||
? value > values[0]
|
||||
: value < values[0]
|
||||
)
|
||||
? `color-mix(in srgb, ${theme.colors.componentCallToActionInteractive_green} ${normalizedDeltaPercentage}%, ${theme.colors.componentCallToActionInteractive_green}00)`
|
||||
: `color-mix(in srgb, ${theme.colors.componentCallToActionInteractive_red} ${normalizedDeltaPercentage}%, ${theme.colors.componentCallToActionInteractive_red}00)`,
|
||||
}}
|
||||
>
|
||||
<Flex
|
||||
@@ -149,8 +149,8 @@ export function CompareRow({
|
||||
deltaNominalDisplay
|
||||
? deltaNominalDisplay(delta)
|
||||
: decimals === undefined
|
||||
? delta
|
||||
: delta.toFixed(decimals)
|
||||
? delta
|
||||
: delta.toFixed(decimals)
|
||||
}`}
|
||||
)
|
||||
</Text>
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
import {
|
||||
TankCharacteristics,
|
||||
asset,
|
||||
availableProvisions,
|
||||
checkConsumableProvisionInclusivity,
|
||||
consumableDefinitions,
|
||||
equipmentDefinitions,
|
||||
provisionDefinitions,
|
||||
skillDefinitions,
|
||||
} from '@blitzkit/core';
|
||||
import { permanentSkills } from '@blitzkit/core/src/blitz/permanentSkills';
|
||||
import { ComponentPlaceholderIcon } from '@radix-ui/react-icons';
|
||||
import { Button, Flex, Popover, Slider, Table, Text } from '@radix-ui/themes';
|
||||
import { debounce, times } from 'lodash';
|
||||
import { use } from 'react';
|
||||
import { theme } from '../../../../../../bot/src/stitches.config';
|
||||
import { BlitzkitButtonGrayIcon } from '../../../../components/BlitzkitButtonGrayIcon';
|
||||
import { ConsumablesManager } from '../../../../components/ConsumablesManager';
|
||||
import { CrewSkillManager } from '../../../../components/CrewSkillManager';
|
||||
import { EquipmentManager } from '../../../../components/EquipmentManager';
|
||||
@@ -10,16 +22,6 @@ import { ModuleManager } from '../../../../components/ModuleManager';
|
||||
import { ProvisionsManager } from '../../../../components/ProvisionsManager';
|
||||
import { StickyColumnHeaderCell } from '../../../../components/StickyColumnHeaderCell';
|
||||
import { StickyTableRoot } from '../../../../components/StickyTableRoot';
|
||||
import { asset } from '../../../../core/blitzkit/asset';
|
||||
import { availableProvisions } from '../../../../core/blitzkit/availableProvisions';
|
||||
import { checkConsumableProvisionInclusivity } from '../../../../core/blitzkit/checkConsumableProvisionInclusivity';
|
||||
import { consumableDefinitions } from '../../../../core/blitzkit/consumableDefinitions';
|
||||
import { equipmentDefinitions } from '../../../../core/blitzkit/equipmentDefinitions';
|
||||
import { provisionDefinitions } from '../../../../core/blitzkit/provisionDefinitions';
|
||||
import { skillDefinitions } from '../../../../core/blitzkit/skillDefinitions';
|
||||
import { TankCharacteristics } from '../../../../core/blitzkit/tankCharacteristics';
|
||||
import { BlitzkitButtonGray } from '../../../../icons/BlitzkitButtonGray';
|
||||
import { theme } from '../../../../stitches.config';
|
||||
import * as CompareEphemeral from '../../../../stores/compareEphemeral';
|
||||
import { EquipmentMatrix } from '../../../../stores/duel';
|
||||
import { Body } from './Body';
|
||||
@@ -56,7 +58,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
align="center"
|
||||
justify="center"
|
||||
>
|
||||
<BlitzkitButtonGray opacity="0.25" width={64} height={64} />
|
||||
<BlitzkitButtonGrayIcon opacity="0.25" width={64} height={64} />
|
||||
<InsertionMarker index={0} />
|
||||
</Flex>
|
||||
</StickyColumnHeaderCell>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { provisionDefinitions } from '@blitzkit/core';
|
||||
import { PlusIcon, TrashIcon } from '@radix-ui/react-icons';
|
||||
import { Button, Dialog, Flex, SegmentedControl } from '@radix-ui/themes';
|
||||
import { use } from 'react';
|
||||
import { provisionDefinitions } from '../../../../core/blitzkit/provisionDefinitions';
|
||||
import { tankToCompareMember } from '../../../../core/blitzkit/tankToCompareMember';
|
||||
import * as CompareEphemeral from '../../../../stores/compareEphemeral';
|
||||
import * as ComparePersistent from '../../../../stores/comparePersistent';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { theme } from '../../../../../stitches.config';
|
||||
import { theme } from '../../../../../../../bot/src/stitches.config';
|
||||
import { insertionMarkers } from './constants';
|
||||
|
||||
export function InsertionMarker({ index }: { index: number }) {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { TankDefinition, tankIcon } from '@blitzkit/core';
|
||||
import { Flex, Text } from '@radix-ui/themes';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { Vector2 } from 'three';
|
||||
import { StickyColumnHeaderCell } from '../../../../components/StickyColumnHeaderCell';
|
||||
import { TankDefinition } from '../../../../core/blitzkit/tankDefinitions';
|
||||
import { tankIcon } from '../../../../core/blitzkit/tankIcon';
|
||||
import * as CompareEphemeral from '../../../../stores/compareEphemeral';
|
||||
import { InsertionMarker } from './IntersectionMarker';
|
||||
import { insertionMarkers } from './IntersectionMarker/constants';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { provisionDefinitions } from '@blitzkit/core';
|
||||
import { ExternalLinkIcon, LoopIcon, TrashIcon } from '@radix-ui/react-icons';
|
||||
import { Dialog, Flex, IconButton } from '@radix-ui/themes';
|
||||
import Link from 'next/link';
|
||||
import { use, useState } from 'react';
|
||||
import { provisionDefinitions } from '../../../../core/blitzkit/provisionDefinitions';
|
||||
import { tankToCompareMember } from '../../../../core/blitzkit/tankToCompareMember';
|
||||
import * as CompareEphemeral from '../../../../stores/compareEphemeral';
|
||||
import { TankSearch } from '../../tankopedia/components/TankSearch';
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
createDefaultSkills,
|
||||
equipmentDefinitions,
|
||||
modelDefinitions,
|
||||
provisionDefinitions,
|
||||
skillDefinitions,
|
||||
tankCharacteristics,
|
||||
tankDefinitions,
|
||||
} from '@blitzkit/core';
|
||||
import { PlusIcon } from '@radix-ui/react-icons';
|
||||
import { Box, Flex, Heading, IconButton, Text } from '@radix-ui/themes';
|
||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||
import { use, useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import PageWrapper from '../../../components/PageWrapper';
|
||||
import { createDefaultSkills } from '../../../core/blitzkit/createDefaultSkills';
|
||||
import { equipmentDefinitions } from '../../../core/blitzkit/equipmentDefinitions';
|
||||
import { modelDefinitions } from '../../../core/blitzkit/modelDefinitions';
|
||||
import { provisionDefinitions } from '../../../core/blitzkit/provisionDefinitions';
|
||||
import { skillDefinitions } from '../../../core/blitzkit/skillDefinitions';
|
||||
import { tankCharacteristics } from '../../../core/blitzkit/tankCharacteristics';
|
||||
import { tankDefinitions } from '../../../core/blitzkit/tankDefinitions';
|
||||
import { tankToCompareMember } from '../../../core/blitzkit/tankToCompareMember';
|
||||
import * as CompareEphemeral from '../../../stores/compareEphemeral';
|
||||
import { CompareTable } from './components/CompareTable';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { imgur } from '@blitzkit/core';
|
||||
import {
|
||||
CodeIcon,
|
||||
HeightIcon,
|
||||
@@ -15,7 +16,6 @@ import { ReactNode, useEffect, useRef, useState } from 'react';
|
||||
import { stringify } from 'urlon';
|
||||
import { CopyButton } from '../../../../components/CopyButton';
|
||||
import PageWrapper from '../../../../components/PageWrapper';
|
||||
import { imgur } from '../../../../core/blitzkit/imgur';
|
||||
import * as App from '../../../../stores/app';
|
||||
import * as EmbedState from '../../../../stores/embedState';
|
||||
import { EmbedConfig } from '../../../../stores/embedState';
|
||||
@@ -97,7 +97,9 @@ export default function Page({
|
||||
state: stringify(shallowState),
|
||||
});
|
||||
|
||||
return `${location.origin}/tools/embed/${params.embed}/host?${searchParams.toString()}`;
|
||||
return `${location.origin}/tools/embed/${
|
||||
params.embed
|
||||
}/host?${searchParams.toString()}`;
|
||||
}}
|
||||
>
|
||||
<Link2Icon />
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import {
|
||||
CompositeStatsKey,
|
||||
compositeStatsKeys,
|
||||
tankDefinitionsArray,
|
||||
} from '@blitzkit/core';
|
||||
import strings from '@blitzkit/core/lang/en-US.json';
|
||||
import { grayA, grayDark, grayDarkA } from '@radix-ui/colors';
|
||||
import { use } from 'react';
|
||||
import {
|
||||
BreakdownEmbedCard,
|
||||
BreakdownEmbedWrapper,
|
||||
} from '../../../../components/TanksEmbed';
|
||||
import { tankDefinitionsArray } from '../../../../core/blitzkit/tankDefinitions';
|
||||
import {
|
||||
CompositeStatsKey,
|
||||
compositeStatsKeys,
|
||||
} from '../../../../core/statistics/compositeStats/constants';
|
||||
import strings from '../../../../lang/en-US.json';
|
||||
import { EmbedConfig } from '../../../../stores/embedState';
|
||||
import { EmbedItemType } from '../../../../stores/embedState/constants';
|
||||
import { useEmbedStateCurry } from '../../../../stores/embedState/utilities';
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
'use client';
|
||||
|
||||
import { averageDefinitions, formatCompact } from '@blitzkit/core';
|
||||
import { InfoCircledIcon } from '@radix-ui/react-icons';
|
||||
import { Callout, Flex } from '@radix-ui/themes';
|
||||
import { use } from 'react';
|
||||
import { averageDefinitions } from '../../../../core/blitzkit/averageDefinitions';
|
||||
import { discoveredIdsDefinitions } from '../../../../core/blitzkit/discoveredIdDefinitions';
|
||||
import { formatCompact } from '../../../../core/math/formatCompact';
|
||||
|
||||
export function Info() {
|
||||
const awaitedDiscoveredIdsDefinitions = use(discoveredIdsDefinitions);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import {
|
||||
TankDefinition,
|
||||
averageDefinitions,
|
||||
formatCompact,
|
||||
} from '@blitzkit/core';
|
||||
import { Table } from '@radix-ui/themes';
|
||||
import { memo, use } from 'react';
|
||||
import { TankRowHeaderCell } from '../../../../components/TankRowHeaderCell';
|
||||
import { averageDefinitions } from '../../../../core/blitzkit/averageDefinitions';
|
||||
import { TankDefinition } from '../../../../core/blitzkit/tankDefinitions';
|
||||
import { formatCompact } from '../../../../core/math/formatCompact';
|
||||
import { useAveragesExclusionRatio } from '../../../../hooks/useAveragesExclusionRatio';
|
||||
import * as TankPerformancePersistent from '../../../../stores/tankPerformancePersistent';
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
averageDefinitionsArray,
|
||||
filterTank,
|
||||
tankDefinitions,
|
||||
} from '@blitzkit/core';
|
||||
import { Table } from '@radix-ui/themes';
|
||||
import { times } from 'lodash';
|
||||
import { Suspense, use, useEffect, useMemo, useState } from 'react';
|
||||
import { averageDefinitionsArray } from '../../../../core/blitzkit/averageDefinitions';
|
||||
import { filterTank } from '../../../../core/blitzkit/filterTank';
|
||||
import { tankDefinitions } from '../../../../core/blitzkit/tankDefinitions';
|
||||
import * as TankFilters from '../../../../stores/tankFilters';
|
||||
import * as TankPerformancePersistent from '../../../../stores/tankPerformancePersistent';
|
||||
import * as TankPerformanceSort from '../../../../stores/tankPerformanceSort';
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
averageDefinitionsArray,
|
||||
formatCompact,
|
||||
TANK_CLASSES,
|
||||
TankClass,
|
||||
tankDefinitions,
|
||||
Tier,
|
||||
TIER_ROMAN_NUMERALS,
|
||||
} from '@blitzkit/core';
|
||||
import strings from '@blitzkit/core/lang/en-US.json';
|
||||
import { ResponsiveBar } from '@nivo/bar';
|
||||
import { Box, Flex, Heading } from '@radix-ui/themes';
|
||||
import { times } from 'lodash';
|
||||
import { use } from 'react';
|
||||
import { TankClass } from '../../../../components/Tanks';
|
||||
import { TANK_CLASSES } from '../../../../components/Tanks/components/Item/constants';
|
||||
import { averageDefinitionsArray } from '../../../../core/blitzkit/averageDefinitions';
|
||||
import {
|
||||
tankDefinitions,
|
||||
Tier,
|
||||
} from '../../../../core/blitzkit/tankDefinitions';
|
||||
import { TIER_ROMAN_NUMERALS } from '../../../../core/blitzkit/tankDefinitions/constants';
|
||||
import { formatCompact } from '../../../../core/math/formatCompact';
|
||||
import { nivoTheme } from '../../../../core/nivo/theme';
|
||||
import strings from '../../../../lang/en-US.json';
|
||||
|
||||
export function TierBreakdown() {
|
||||
const awaitedAverageDefinitionsArray = use(averageDefinitionsArray);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Table } from '@radix-ui/themes';
|
||||
import { memo, use, useCallback } from 'react';
|
||||
import { StickyRowHeaderCell } from '../../../../components/StickyRowHeaderCell';
|
||||
import {
|
||||
averageDefinitions,
|
||||
AverageDefinitionsEntryWithId,
|
||||
} from '../../../../core/blitzkit/averageDefinitions';
|
||||
import { formatCompact } from '../../../../core/math/formatCompact';
|
||||
import { BlitzkitStats } from '../../../../core/statistics/compositeStats/constants';
|
||||
BlitzkitStats,
|
||||
formatCompact,
|
||||
} from '@blitzkit/core';
|
||||
import { Table } from '@radix-ui/themes';
|
||||
import { memo, use, useCallback } from 'react';
|
||||
import { StickyRowHeaderCell } from '../../../../components/StickyRowHeaderCell';
|
||||
import { useAveragesExclusionRatio } from '../../../../hooks/useAveragesExclusionRatio';
|
||||
import * as TankPerformancePersistent from '../../../../stores/tankPerformancePersistent';
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
FIRST_MINIMAL_ARCHIVED_RATING_SEASON,
|
||||
LEAGUES,
|
||||
Region,
|
||||
REGIONS,
|
||||
UNLOCALIZED_REGION_NAMES,
|
||||
} from '@blitzkit/core';
|
||||
import { blackA, orangeDark } from '@radix-ui/colors';
|
||||
import { MagnifyingGlassIcon } from '@radix-ui/react-icons';
|
||||
import {
|
||||
@@ -15,16 +22,13 @@ import { produce } from 'immer';
|
||||
import { debounce, range } from 'lodash';
|
||||
import { ChangeEvent, useEffect, useRef, useState } from 'react';
|
||||
import { create } from 'zustand';
|
||||
import { RatingInfo, RatingPlayer } from '../../../commands/ratingLeaderboard';
|
||||
import {
|
||||
RatingInfo,
|
||||
RatingPlayer,
|
||||
} from '../../../../../bot/src/commands/ratingLeaderboard';
|
||||
import { theme } from '../../../../../bot/src/stitches.config';
|
||||
import PageWrapper from '../../../components/PageWrapper';
|
||||
import { Skeleton } from '../../../components/Skeleton';
|
||||
import { LEAGUES } from '../../../constants/leagues';
|
||||
import { FIRST_MINIMAL_ARCHIVED_RATING_SEASON } from '../../../constants/rating';
|
||||
import {
|
||||
REGIONS,
|
||||
Region,
|
||||
UNLOCALIZED_REGION_NAMES,
|
||||
} from '../../../constants/regions';
|
||||
import fetchBlitz from '../../../core/blitz/fetchBlitz';
|
||||
import { getClanAccountInfo } from '../../../core/blitz/getClanAccountInfo';
|
||||
import getRatingInfo from '../../../core/blitz/getRatingInfo';
|
||||
@@ -38,7 +42,6 @@ import {
|
||||
import { getArchivedLatestSeasonNumber } from '../../../core/blitzkit/getArchivedLatestSeasonNumber';
|
||||
import getArchivedRatingInfo from '../../../core/blitzkit/getArchivedRatingInfo';
|
||||
import { getArchivedRatingLeaderboard } from '../../../core/blitzkit/getArchivedRatingLeaderboard';
|
||||
import { theme } from '../../../stitches.config';
|
||||
import { PageTurner } from './components/PageTurner';
|
||||
|
||||
const ROWS_PER_PAGE = Math.floor(100 / 3);
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
IndividualTankStats,
|
||||
UNLOCALIZED_REGION_NAMES_SHORT,
|
||||
deltaTankStats,
|
||||
idToRegion,
|
||||
tankDefinitions,
|
||||
} from '@blitzkit/core';
|
||||
import {
|
||||
ArrowDownIcon,
|
||||
MagnifyingGlassIcon,
|
||||
@@ -22,7 +29,6 @@ import { debounce } from 'lodash';
|
||||
import { use, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import PageWrapper from '../../../components/PageWrapper';
|
||||
import { TankRowHeaderCell } from '../../../components/TankRowHeaderCell';
|
||||
import { UNLOCALIZED_REGION_NAMES_SHORT } from '../../../constants/regions';
|
||||
import {
|
||||
STAT_KEYS,
|
||||
STAT_NAMES,
|
||||
@@ -36,15 +42,11 @@ import {
|
||||
getAccountInfo,
|
||||
} from '../../../core/blitz/getAccountInfo';
|
||||
import getTankStats from '../../../core/blitz/getTankStats';
|
||||
import { idToRegion } from '../../../core/blitz/idToRegion';
|
||||
import searchPlayersAcrossRegions, {
|
||||
AccountListWithServer,
|
||||
} from '../../../core/blitz/searchPlayersAcrossRegions';
|
||||
import { tankDefinitions } from '../../../core/blitzkit/tankDefinitions';
|
||||
import { tankAverages } from '../../../core/blitzstars/tankAverages';
|
||||
import { deltaTankStats } from '../../../core/statistics/deltaTankStats';
|
||||
import * as Session from '../../../stores/session';
|
||||
import { IndividualTankStats } from '../../../types/tanksStats';
|
||||
|
||||
export default function Page({
|
||||
searchParams,
|
||||
|
||||
+5
@@ -1,9 +1,14 @@
|
||||
import {
|
||||
asset,
|
||||
formatCompact,
|
||||
ModuleDefinition,
|
||||
ModuleType,
|
||||
TankDefinition,
|
||||
tankDefinitions,
|
||||
tankIcon,
|
||||
Tier,
|
||||
TIER_ROMAN_NUMERALS,
|
||||
Unlock,
|
||||
} from '@blitzkit/core';
|
||||
import {
|
||||
Button,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { resolveNearPenetration, tankDefinitions, Var } from '@blitzkit/core';
|
||||
import { Box, Flex, Heading, Text } from '@radix-ui/themes';
|
||||
import { Suspense, use, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { ThicknessRange } from '../../../../../../components/Armor/components/StaticArmor';
|
||||
import { classIcons } from '../../../../../../components/ClassIcon';
|
||||
import { NAVBAR_HEIGHT } from '../../../../../../components/Navbar/index.css';
|
||||
import { useFullScreen } from '../../../../../../hooks/useFullScreen';
|
||||
|
||||
+4
-2
@@ -1,9 +1,9 @@
|
||||
'use client';
|
||||
|
||||
import { formatCompact } from '@blitzkit/core';
|
||||
import { Flex, Heading, Skeleton, Text } from '@radix-ui/themes';
|
||||
import { memo } from 'react';
|
||||
import { WargamingLoginButton } from '../../../../../../../../../components/Navbar/components/WargamingLoginButton';
|
||||
import { formatCompact } from '../../../../../../../../../core/math/formatCompact';
|
||||
import { useTankVotes } from '../../../../../../../../../hooks/useTankVotes';
|
||||
import * as App from '../../../../../../../../../stores/app';
|
||||
import * as Duel from '../../../../../../../../../stores/duel';
|
||||
@@ -71,7 +71,9 @@ export const Votes = memo(
|
||||
{votes ? (
|
||||
wargaming ? (
|
||||
votes.last_updated ? (
|
||||
`You voted on ${new Date(votes.last_updated).toLocaleDateString()}`
|
||||
`You voted on ${new Date(
|
||||
votes.last_updated,
|
||||
).toLocaleDateString()}`
|
||||
) : (
|
||||
`You haven't voted yet`
|
||||
)
|
||||
|
||||
@@ -11,6 +11,7 @@ import { use, useState } from 'react';
|
||||
import { classIcons } from '../../../../../../../components/ClassIcon';
|
||||
import { Link } from '../../../../../../../components/Link';
|
||||
import { ScienceIcon } from '../../../../../../../components/ScienceIcon';
|
||||
import { tankToDuelMember } from '../../../../../../../core/blitzkit/tankToDuelMember';
|
||||
import * as App from '../../../../../../../stores/app';
|
||||
import * as Duel from '../../../../../../../stores/duel';
|
||||
import * as TankopediaEphemeral from '../../../../../../../stores/tankopediaEphemeral';
|
||||
|
||||
@@ -159,7 +159,7 @@ export const TankSandbox = forwardRef<HTMLCanvasElement, TankSandboxProps>(
|
||||
<Canvas
|
||||
frameloop={onScreen ? 'demand' : 'never'}
|
||||
gl={{
|
||||
clippingPlanes: Object.freeze([]),
|
||||
clippingPlanes: [],
|
||||
localClippingEnabled: true,
|
||||
preserveDrawingBuffer: true,
|
||||
}}
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
import { asset } from '@blitzkit/core';
|
||||
import { IconButton } from '@radix-ui/themes';
|
||||
import { invalidate } from '@react-three/fiber';
|
||||
import { useArmor } from '../../../../../../../../../hooks/useArmor';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Flex, TextField } from '@radix-ui/themes';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { degToRad, radToDeg } from 'three/src/math/MathUtils';
|
||||
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
||||
import { modelTransformEvent } from '../../../../../../core/blitzkit/modelTransform';
|
||||
import { modelTransformEvent, ModelTransformEventData } from '../../../../../../core/blitzkit/modelTransform';
|
||||
import { useEquipment } from '../../../../../../hooks/useEquipment';
|
||||
import { useTankModelDefinition } from '../../../../../../hooks/useTankModelDefinition';
|
||||
import * as Duel from '../../../../../../stores/duel';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Flex } from '@radix-ui/themes';
|
||||
import { ShotDisplayCard } from '../../../../../components/Armor/components/ShotDisplayCard';
|
||||
import * as TankEphemeral from '../../../../../stores/tankopediaEphemeral';
|
||||
|
||||
export function ShotDisplaySection() {
|
||||
|
||||
@@ -2,12 +2,12 @@ import { CaretRightIcon, UpdateIcon } from '@radix-ui/react-icons';
|
||||
import { Button, Dialog, Flex, Heading } from '@radix-ui/themes';
|
||||
import Link from 'next/link';
|
||||
import { use, useState } from 'react';
|
||||
import { TREE_TYPE_ICONS } from '../../../../../components/Tanks/components/Item/constants';
|
||||
import { provisionDefinitions } from '../../../../../core/blitzkit/provisionDefinitions';
|
||||
import { pushTankopediaPath } from '../../../../../core/blitzkit/pushTankopediaPath';
|
||||
import { tankToDuelMember } from '../../../../../core/blitzkit/tankToDuelMember';
|
||||
import * as Duel from '../../../../../stores/duel';
|
||||
import { TankSearch } from '../../components/TankSearch';
|
||||
import { provisionDefinitions } from '@blitzkit/core';
|
||||
import { TREE_TYPE_ICONS } from '../../../../../../../bot/src/components/Tanks/components/Item/constants';
|
||||
|
||||
export function Title() {
|
||||
const awaitedProvisionDefinitions = use(provisionDefinitions);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { CaretLeftIcon, CaretRightIcon } from '@radix-ui/react-icons';
|
||||
import { Flex, IconButton, TextField } from '@radix-ui/themes';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { TankDefinition } from '../../../../core/blitzkit/tankDefinitions';
|
||||
import * as TankopediaPersistent from '../../../../stores/tankopediaPersistent';
|
||||
import { TankDefinition } from '@blitzkit/core';
|
||||
|
||||
interface PageTurnerProps {
|
||||
searchedList: TankDefinition[];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { TankDefinition } from '@blitzkit/core';
|
||||
import { CaretRightIcon } from '@radix-ui/react-icons';
|
||||
import { Button, Link, TextField } from '@radix-ui/themes';
|
||||
import { TankDefinition } from '../../../../core/blitzkit/tankDefinitions';
|
||||
import * as TankFilters from '../../../../stores/tankFilters';
|
||||
|
||||
interface QuickLinkProps {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { TankDefinition } from '@blitzkit/core';
|
||||
import { MagnifyingGlassIcon } from '@radix-ui/react-icons';
|
||||
import { Flex, Spinner, TextField } from '@radix-ui/themes';
|
||||
import { debounce } from 'lodash';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { KeyboardEventHandler, useCallback, useRef } from 'react';
|
||||
import { TankDefinition } from '../../../../core/blitzkit/tankDefinitions';
|
||||
import * as TankFilters from '../../../../stores/tankFilters';
|
||||
import { QuickLink } from './QuickLink';
|
||||
import { Sort } from './Sort';
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import {
|
||||
asset,
|
||||
modelDefinitions,
|
||||
normalizeBoundingBox,
|
||||
resolveDpm,
|
||||
resolveNearPenetration,
|
||||
TankDefinition,
|
||||
tankIcon,
|
||||
unionBoundingBox,
|
||||
} from '@blitzkit/core';
|
||||
import { Flex, Text } from '@radix-ui/themes';
|
||||
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
||||
import Link from 'next/link';
|
||||
import { use, useMemo } from 'react';
|
||||
import { classIcons } from '../../../../components/ClassIcon';
|
||||
import { resolveReload } from '../../../../core/blitzkit/resolveReload';
|
||||
import * as TankopediaSort from '../../../../stores/tankopediaSort';
|
||||
import * as styles from './TankCard.css';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TreeType } from '../../../../../components/Tanks';
|
||||
import { TreeType } from '@blitzkit/core';
|
||||
|
||||
export const treeTypeOrder: TreeType[] = [
|
||||
'researchable',
|
||||
|
||||
@@ -6,10 +6,13 @@ import {
|
||||
filterTank,
|
||||
gameDefinitions,
|
||||
modelDefinitions,
|
||||
normalizeBoundingBox,
|
||||
resolveDpm,
|
||||
resolveNearPenetration,
|
||||
tankDefinitions,
|
||||
tankDefinitionsArray,
|
||||
tankNames,
|
||||
unionBoundingBox,
|
||||
} from '@blitzkit/core';
|
||||
import { Callout, Flex, FlexProps, Link, Text } from '@radix-ui/themes';
|
||||
import { go } from 'fuzzysort';
|
||||
@@ -17,6 +20,7 @@ import { times } from 'lodash';
|
||||
import { Fragment, memo, use, useEffect, useMemo, useState } from 'react';
|
||||
import { AdMidSectionResponsive } from '../../../../../components/AdMidSectionResponsive';
|
||||
import { ExperimentIcon } from '../../../../../components/ExperimentIcon';
|
||||
import { resolveReload } from '../../../../../core/blitzkit/resolveReload';
|
||||
import { useAdExempt } from '../../../../../hooks/useAdExempt';
|
||||
import * as TankFilters from '../../../../../stores/tankFilters';
|
||||
import {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Tier, TIER_ROMAN_NUMERALS } from '@blitzkit/core';
|
||||
import { Flex, IconButton, Text } from '@radix-ui/themes';
|
||||
import { times } from 'lodash';
|
||||
import { memo } from 'react';
|
||||
import { Tier } from '../../../../core/blitzkit/tankDefinitions';
|
||||
import { TIER_ROMAN_NUMERALS } from '../../../../core/blitzkit/tankDefinitions/constants';
|
||||
import * as TankFilters from '../../../../stores/tankFilters';
|
||||
import * as TankopediaSort from '../../../../stores/tankopediaSort';
|
||||
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
import { style } from '@vanilla-extract/css';
|
||||
import { theme } from '../../../stitches.config';
|
||||
|
||||
export const listing = style({});
|
||||
|
||||
export const flag = style({
|
||||
transitionDuration: theme.durations.regular,
|
||||
left: '0',
|
||||
top: '0',
|
||||
scale: 1.5,
|
||||
opacity: 0.75,
|
||||
|
||||
[`.${listing}:hover &, .${listing}:active &`]: {
|
||||
opacity: 1,
|
||||
},
|
||||
|
||||
// [`.${listing}:hover &, .${listing}:active &`]: {
|
||||
// transform: 'translateX(-25%)',
|
||||
// filter: 'blur(3rem)',
|
||||
// },
|
||||
});
|
||||
|
||||
export const listingShadow = style({
|
||||
boxShadow: `inset 64px -80px 64px -64px ${theme.colors.appBackground1}`,
|
||||
|
||||
[`.${listing}:hover &, .${listing}:active &`]: {
|
||||
boxShadow: `inset 0 0 0 -64px ${theme.colors.appBackground1}`,
|
||||
},
|
||||
});
|
||||
|
||||
export const listingLabel = style({
|
||||
transition: `transform ${theme.durations.regular}`,
|
||||
transform: 'translateY(0)',
|
||||
|
||||
// [`.${listing}:hover &, .${listing}:active &`]: {
|
||||
// transform: 'translateY(200%)',
|
||||
// },
|
||||
});
|
||||
|
||||
export const listingImage = style({
|
||||
transition: `transform ${theme.durations.regular}`,
|
||||
position: 'absolute',
|
||||
left: '50%',
|
||||
top: '-25%',
|
||||
|
||||
// [`.${listing}:hover &, .${listing}:active &`]: {
|
||||
// transform: 'translate(-25%, 10%)',
|
||||
// },
|
||||
});
|
||||
|
||||
export const alignTopRight = style({
|
||||
'@media': {
|
||||
'screen and (min-width: 400px)': {
|
||||
position: 'absolute',
|
||||
right: 16,
|
||||
top: 16,
|
||||
},
|
||||
|
||||
'screen and (max-width: 399px)': {
|
||||
// left: 16,
|
||||
// bottom: 16,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const characteristics = style({
|
||||
display: 'flex',
|
||||
gap: 32,
|
||||
|
||||
'@media': {
|
||||
'screen and (max-width: 800px)': {
|
||||
flexDirection: 'column',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const configuration = style({
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 16,
|
||||
flex: 1,
|
||||
});
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
import { Html } from '@react-three/drei';
|
||||
import { useRef } from 'react';
|
||||
import { radToDeg } from 'three/src/math/MathUtils';
|
||||
import { resolveArmorIndex } from '../../../core/blitzkit/resolveArmorIndex';
|
||||
import * as App from '../../../stores/app';
|
||||
import * as Duel from '../../../stores/duel';
|
||||
import * as TankopediaEphemeral from '../../../stores/tankopediaEphemeral';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { J_HAT, K_HAT } from '@blitzkit/core';
|
||||
import { Box, Flex, Text } from '@radix-ui/themes';
|
||||
import { Html } from '@react-three/drei';
|
||||
import { useFrame } from '@react-three/fiber';
|
||||
|
||||
@@ -2,6 +2,12 @@ import { normalizeAngleRad } from '@blitzkit/core/src/math/normalizeAngleRad';
|
||||
import { ThreeEvent, useThree } from '@react-three/fiber';
|
||||
import { memo, useRef } from 'react';
|
||||
import { Group, Plane, Vector2, Vector3 } from 'three';
|
||||
import { applyPitchYawLimits } from '../../../core/blitz/applyPitchYawLimits';
|
||||
import { correctZYTuple } from '../../../core/blitz/correctZYTuple';
|
||||
import { hasEquipment } from '../../../core/blitzkit/hasEquipment';
|
||||
import { modelTransformEvent } from '../../../core/blitzkit/modelTransform';
|
||||
import { nameToArmorId } from '../../../core/blitzkit/nameToArmorId';
|
||||
import { resolveArmor } from '../../../core/blitzkit/resolveThickness';
|
||||
import { useArmor } from '../../../hooks/useArmor';
|
||||
import { useModel } from '../../../hooks/useModel';
|
||||
import { useTankModelDefinition } from '../../../hooks/useTankModelDefinition';
|
||||
|
||||
@@ -15,6 +15,13 @@ import {
|
||||
Quaternion,
|
||||
Vector3,
|
||||
} from 'three';
|
||||
import { unrotateDavaVector } from '../../../core/blitz/unrotateDavaVector';
|
||||
import { jsxTree } from '../../../core/blitzkit/jsxTree';
|
||||
import {
|
||||
ModelTransformEventData,
|
||||
modelTransformEvent,
|
||||
} from '../../../core/blitzkit/modelTransform';
|
||||
import { discardClippingPlane } from '../../../core/three/discardClippingPlane';
|
||||
import * as TankopediaEphemeral from '../../../stores/tankopediaEphemeral';
|
||||
import { ArmorType } from './SpacedArmorScene';
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TankClass } from '@blitzkit/core';
|
||||
import { ComponentProps, ReactNode } from 'react';
|
||||
import { TankClass } from '../Tanks';
|
||||
import { ClassHeavy } from './components/ClassHeavy';
|
||||
import { ClassLight } from './components/ClassLight';
|
||||
import { ClassMedium } from './components/ClassMedium';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { EquipmentPreset } from '@blitzkit/core/src/blitzkit/equipmentDefinitions';
|
||||
import { Flex } from '@radix-ui/themes';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { EquipmentMatrix } from '../stores/duel';
|
||||
import { EquipmentButton } from './ModuleButtons/EquipmentButton';
|
||||
|
||||
interface EquipmentManagerProps {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { gameDefinitions } from '@blitzkit/core';
|
||||
import { Code } from '@radix-ui/themes';
|
||||
import { use } from 'react';
|
||||
import { gameDefinitions } from '../../../core/blitzkit/gameDefinitions';
|
||||
|
||||
export function WoTBVersion() {
|
||||
const awaitedGameDefinitions = use(gameDefinitions);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { DropdownMenu, Flex } from '@radix-ui/themes';
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
EngineDefinition,
|
||||
GunDefinition,
|
||||
ShellDefinition,
|
||||
TankDefinition,
|
||||
TIER_ROMAN_NUMERALS,
|
||||
TrackDefinition,
|
||||
TurretDefinition,
|
||||
} from '../core/blitzkit/tankDefinitions';
|
||||
import { TIER_ROMAN_NUMERALS } from '../core/blitzkit/tankDefinitions/constants';
|
||||
} from '@blitzkit/core';
|
||||
import { DropdownMenu, Flex } from '@radix-ui/themes';
|
||||
import { useState } from 'react';
|
||||
import { ModuleButton } from './ModuleButtons/ModuleButton';
|
||||
|
||||
interface ModuleManagerProps {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { idToRegion } from '@blitzkit/core';
|
||||
import { Text } from '@radix-ui/themes';
|
||||
import { use, useMemo } from 'react';
|
||||
import { getAccountInfo } from '../../../core/blitz/getAccountInfo';
|
||||
import * as App from '../../../stores/app';
|
||||
|
||||
export function WargamingAccountName() {
|
||||
|
||||
@@ -29,7 +29,7 @@ export function WargamingLoginButton({ children, ...props }: ButtonProps) {
|
||||
href={
|
||||
typeof window !== 'undefined'
|
||||
? `https://api.worldoftanks.${region}/wot/auth/login/?application_id=${assertSecret(
|
||||
process.env.WARGAMING_APPLICATION_ID,
|
||||
process.env.NEXT_PUBLIC_WARGAMING_APPLICATION_ID,
|
||||
)}&redirect_uri=${encodeURIComponent(
|
||||
`${location.origin}/auth/wargaming?return=${location.origin}${location.pathname}`,
|
||||
)}`
|
||||
|
||||
@@ -275,7 +275,10 @@ export function Navbar() {
|
||||
position: 'relative',
|
||||
borderRadius: 'var(--radius-2)',
|
||||
overflow: 'hidden',
|
||||
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.MediumThumbnail })})`,
|
||||
backgroundImage: `url(${imgur(tool.image, {
|
||||
format: 'jpeg',
|
||||
size: ImgurSize.MediumThumbnail,
|
||||
})})`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
aspectRatio: '2 / 1',
|
||||
@@ -295,7 +298,10 @@ export function Navbar() {
|
||||
<Box
|
||||
flexGrow="1"
|
||||
style={{
|
||||
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.MediumThumbnail })})`,
|
||||
backgroundImage: `url(${imgur(tool.image, {
|
||||
format: 'jpeg',
|
||||
size: ImgurSize.MediumThumbnail,
|
||||
})})`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Flex, FlexProps, Theme } from '@radix-ui/themes';
|
||||
import { ComponentProps } from 'react';
|
||||
import { RadixSize } from '../../packages/website/src/stores/embedState';
|
||||
import { RadixSize } from '../stores/embedState';
|
||||
|
||||
type PageWrapperProps = FlexProps & {
|
||||
color?: ComponentProps<typeof Theme>['accentColor'];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { TankDefinition } from '@blitzkit/core';
|
||||
import { tankIcon } from '@blitzkit/core/src/blitzkit/tankIcon';
|
||||
import { classIcons } from '../../packages/website/src/components/ClassIcon';
|
||||
import { TankDefinition } from '../core/blitzkit/tankDefinitions';
|
||||
import { classIcons } from './ClassIcon';
|
||||
import { ExperimentIcon } from './ExperimentIcon';
|
||||
import { Link } from './Link';
|
||||
import { StickyRowHeaderCell } from './StickyRowHeaderCell';
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import {
|
||||
CompositeStatsKey,
|
||||
previewCompositeStat,
|
||||
TankDefinition,
|
||||
} from '@blitzkit/core';
|
||||
import strings from '@blitzkit/core/lang/en-US.json';
|
||||
import { amberDark, blueDark } from '@radix-ui/colors';
|
||||
import { Flex, Text } from '@radix-ui/themes';
|
||||
import { times } from 'lodash';
|
||||
import { ReactNode } from 'react';
|
||||
import { ClassHeavy } from '../../packages/website/src/components/ClassIcon/components/ClassHeavy';
|
||||
import { ClassLight } from '../../packages/website/src/components/ClassIcon/components/ClassLight';
|
||||
import { ClassMedium } from '../../packages/website/src/components/ClassIcon/components/ClassMedium';
|
||||
import { ClassTankDestroyer } from '../../packages/website/src/components/ClassIcon/components/ClassTankDestroyer';
|
||||
import { useEmbedStateCurry } from '../../packages/website/src/stores/embedState/utilities';
|
||||
import { breakdownConfig } from '../app/tools/embed/configurations/breakdown';
|
||||
import { toRadiusVar } from '../app/tools/embed/utilities';
|
||||
import { TankDefinition } from '../core/blitzkit/tankDefinitions';
|
||||
import { previewCompositeStat } from '../core/statistics/compositeStats';
|
||||
import { CompositeStatsKey } from '../core/statistics/compositeStats/constants';
|
||||
import strings from '../lang/en-US.json';
|
||||
import { useEmbedStateCurry } from '../stores/embedState/utilities';
|
||||
import { ClassHeavy } from './ClassIcon/components/ClassHeavy';
|
||||
import { ClassLight } from './ClassIcon/components/ClassLight';
|
||||
import { ClassMedium } from './ClassIcon/components/ClassMedium';
|
||||
import { ClassTankDestroyer } from './ClassIcon/components/ClassTankDestroyer';
|
||||
|
||||
interface BreakdownEmbedWrapperProps {
|
||||
children: ReactNode;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { ShellDefinition, ShellType } from '@blitzkit/core';
|
||||
|
||||
export function canSplash(type: ShellDefinition['type']): type is ShellType.HE {
|
||||
return type === ShellType.HE;
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
import {
|
||||
Hierarchy,
|
||||
Sc2ReadStream,
|
||||
ScgReadStream,
|
||||
VertexAttribute,
|
||||
} from '@blitzkit/core';
|
||||
import { Accessor, Document, Node, Scene } from '@gltf-transform/core';
|
||||
import { times } from 'lodash';
|
||||
import { Hierarchy, Sc2ReadStream } from '../streams/sc2';
|
||||
import { ScgReadStream } from '../streams/scg';
|
||||
import { VertexAttribute } from '../streams/scpg';
|
||||
import { readDVPLFile } from '../../../../scripts/src/core/blitz/readDVPLFile';
|
||||
import {
|
||||
vertexAttributeGLTFName,
|
||||
vertexAttributeGltfVectorSizes,
|
||||
} from './extractModel/constants';
|
||||
import { readDVPLFile } from './readDVPLFile';
|
||||
|
||||
export async function extractArmor(data: string, fileName: string) {
|
||||
const sc2Path = `${data}/3d/Tanks/CollisionMeshes/${fileName}.sc2.dvpl`;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { vertexAttributeVectorSizes } from '../../streams/scg';
|
||||
import { VertexAttribute } from '../../streams/scpg';
|
||||
import { VertexAttribute, vertexAttributeVectorSizes } from '@blitzkit/core';
|
||||
|
||||
export const vertexAttributeGLTFName: Partial<Record<VertexAttribute, string>> =
|
||||
{
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import {
|
||||
Hierarchy,
|
||||
Sc2ReadStream,
|
||||
ScgReadStream,
|
||||
Textures,
|
||||
VertexAttribute,
|
||||
} from '@blitzkit/core';
|
||||
import { Document, Material, Node, Scene } from '@gltf-transform/core';
|
||||
import { times } from 'lodash';
|
||||
import { dirname } from 'path';
|
||||
import { Matrix4, Quaternion, Vector3, Vector4Tuple } from 'three';
|
||||
import { readDVPLFile } from '../../../../../scripts/src/core/blitz/readDVPLFile';
|
||||
import { readTexture } from '../../blitzkit/readTexture';
|
||||
import { TextureMutation } from '../../blitzkit/readTexture/constants';
|
||||
import { Hierarchy, Sc2ReadStream, Textures } from '../../streams/sc2';
|
||||
import { ScgReadStream } from '../../streams/scg';
|
||||
import { VertexAttribute } from '../../streams/scpg';
|
||||
import { readDVPLFile } from '../readDVPLFile';
|
||||
import {
|
||||
vertexAttributeGLTFName,
|
||||
vertexAttributeGltfVectorSizes,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
import { assertSecret, Region } from '@blitzkit/core';
|
||||
import { EventManager } from '@blitzkit/core/src/blitzkit/eventManager';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { patientFetch } from '../blitzkit/patientFetch';
|
||||
|
||||
const RETRY_ERRORS = ['REQUEST_LIMIT_EXCEEDED', 'SOURCE_NOT_AVAILABLE'];
|
||||
@@ -73,7 +72,9 @@ export default function fetchBlitz<Data extends object>(
|
||||
return new Promise<Data>((resolve) => {
|
||||
queue.push({
|
||||
url: `https://api.wotblitz.${region}/wotb/${path}/?${Object.entries({
|
||||
application_id: assertSecret(process.env.WARGAMING_APPLICATION_ID),
|
||||
application_id: assertSecret(
|
||||
process.env.NEXT_PUBLIC_WARGAMING_APPLICATION_ID,
|
||||
),
|
||||
...params,
|
||||
})
|
||||
.filter(([_, value]) => value !== undefined)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import calculateWN8 from '../statistics/calculateWN8';
|
||||
import { BlitzStats } from '../statistics/compositeStats/constants';
|
||||
import { BlitzStats } from '@blitzkit/core';
|
||||
import calculateWN8 from '@blitzkit/core/src/statistics/calculateWN8';
|
||||
|
||||
export type Stat = keyof ReturnType<typeof generateStats>;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { Region } from '@blitzkit/core';
|
||||
import fetchBlitz from './fetchBlitz';
|
||||
import { normalizeIds } from './normalizeIds';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { BlitzStats } from '../statistics/compositeStats/constants';
|
||||
import { BlitzStats, Region } from '@blitzkit/core';
|
||||
import fetchBlitz, { FetchBlitzParams } from './fetchBlitz';
|
||||
import { normalizeIds } from './normalizeIds';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { Region } from '@blitzkit/core';
|
||||
import fetchBlitz from './fetchBlitz';
|
||||
import { normalizeIds } from './normalizeIds';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { Region } from '@blitzkit/core';
|
||||
import fetchBlitz from './fetchBlitz';
|
||||
import { normalizeIds } from './normalizeIds';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LEAGUES } from '../../constants/leagues';
|
||||
import { LEAGUES } from '@blitzkit/core';
|
||||
|
||||
export function getLeagueFromScore(score: number) {
|
||||
return LEAGUES.find(({ minScore }) => score >= minScore)!;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RatingInfo } from '../../commands/ratingLeaderboard';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { Region } from '@blitzkit/core';
|
||||
import { RatingInfo } from '../../../../bot/src/commands/ratingLeaderboard';
|
||||
import { context } from '../blitzkit/context';
|
||||
import { patientFetch } from '../blitzkit/patientFetch';
|
||||
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { LeagueTop, RatingPlayer } from '../../commands/ratingLeaderboard';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { Region } from '@blitzkit/core';
|
||||
import {
|
||||
LeagueTop,
|
||||
RatingPlayer,
|
||||
} from '../../../../bot/src/commands/ratingLeaderboard';
|
||||
import { context } from '../blitzkit/context';
|
||||
import { patientFetch } from '../blitzkit/patientFetch';
|
||||
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RatingNeighbors } from '../../commands/ratingLeaderboard';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { Region } from '@blitzkit/core';
|
||||
import { RatingNeighbors } from '../../../../bot/src/commands/ratingLeaderboard';
|
||||
import { patientFetch } from '../blitzkit/patientFetch';
|
||||
import { withCORSProxy } from '../blitzkit/withCORSProxy';
|
||||
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { TanksStats } from '../../types/tanksStats';
|
||||
import { Region, TanksStats } from '@blitzkit/core';
|
||||
import fetchBlitz, { FetchBlitzParams } from './fetchBlitz';
|
||||
|
||||
export default async function getTankStats(
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import { idToRegion } from './idToRegion';
|
||||
import { Region, assertSecret, idToRegion } from '@blitzkit/core';
|
||||
|
||||
export async function isValidBlitzId(id: number, token?: string) {
|
||||
let region: Region;
|
||||
@@ -12,9 +10,9 @@ export async function isValidBlitzId(id: number, token?: string) {
|
||||
}
|
||||
|
||||
const json = await fetch(
|
||||
`https://api.wotblitz.${region}/wotb/account/info/?account_id=${
|
||||
id
|
||||
}&application_id=${WARGAMING_APPLICATION_ID}${
|
||||
`https://api.wotblitz.${region}/wotb/account/info/?account_id=${id}&application_id=${assertSecret(
|
||||
process.env.NEXT_PUBLIC_WARGAMING_APPLICATION_ID,
|
||||
)}${
|
||||
token === undefined ? '' : `&access_token=${token}`
|
||||
}&fields=account_id%2C-account_id`,
|
||||
).then(
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import { readDVPLFile } from './readDVPLFile';
|
||||
|
||||
export async function readBase64DVPL(file: string) {
|
||||
const buffer = await readDVPLFile(file);
|
||||
return buffer.toString('base64');
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
import { crc32 } from 'crc';
|
||||
import { decompressBlock } from 'lz4js';
|
||||
|
||||
/**
|
||||
* Thanks Maddoxkkm! Modified heavily to be modern.
|
||||
* https://github.com/Maddoxkkm/dvpl_converter/
|
||||
*/
|
||||
export function readDVPL(buffer: Buffer) {
|
||||
const footerBuffer = buffer.subarray(buffer.length - 20, buffer.length);
|
||||
|
||||
if (
|
||||
footerBuffer.toString('utf8', 16, 20) !== 'DVPL' ||
|
||||
footerBuffer.length !== 20
|
||||
) {
|
||||
throw new SyntaxError('Invalid DVPL footer');
|
||||
}
|
||||
|
||||
const footerData = {
|
||||
oSize: footerBuffer.readUInt32LE(0),
|
||||
cSize: footerBuffer.readUInt32LE(4),
|
||||
crc32: footerBuffer.readUInt32LE(8),
|
||||
type: footerBuffer.readUInt32LE(12),
|
||||
};
|
||||
const targetBlock = buffer.subarray(0, buffer.length - 20);
|
||||
|
||||
if (targetBlock.length !== footerData.cSize) {
|
||||
throw new RangeError('DVPL size mismatch');
|
||||
}
|
||||
if (crc32(targetBlock) !== footerData.crc32) {
|
||||
throw new TypeError('DVPL CRC32 mismatch');
|
||||
}
|
||||
|
||||
if (footerData.type === 0) {
|
||||
if (!(footerData.oSize === footerData.cSize && footerData.type === 0)) {
|
||||
throw new RangeError('DVPL type and size mismatch');
|
||||
}
|
||||
|
||||
return targetBlock;
|
||||
} else if (footerData.type === 1 || footerData.type === 2) {
|
||||
const source = new Uint8Array(targetBlock);
|
||||
const destination = new Uint8Array(footerData.oSize);
|
||||
const decompressedSize = decompressBlock(
|
||||
source,
|
||||
destination,
|
||||
0,
|
||||
source.length,
|
||||
0,
|
||||
);
|
||||
|
||||
if (decompressedSize !== footerData.oSize) {
|
||||
throw new RangeError(
|
||||
`Decompressed DVPL size mismatch (${decompressedSize} vs ${footerData.oSize})`,
|
||||
);
|
||||
}
|
||||
|
||||
return Buffer.from(destination);
|
||||
} else {
|
||||
throw new SyntaxError('Unknown DVPL format');
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import { readFile } from 'fs/promises';
|
||||
import { readDVPL } from './readDVPL';
|
||||
|
||||
export async function readDVPLFile(file: string) {
|
||||
return readDVPL(await readFile(file));
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import { readDVPLFile } from './readDVPLFile';
|
||||
|
||||
export async function readStringDVPL(file: string) {
|
||||
const buffer = await readDVPLFile(file);
|
||||
return buffer.toString();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { XMLParser } from 'fast-xml-parser';
|
||||
import { readStringDVPL } from './readStringDVPL';
|
||||
|
||||
export async function readXMLDVPL<Type>(file: string) {
|
||||
const parser = new XMLParser();
|
||||
const xml = await readStringDVPL(file);
|
||||
|
||||
return parser.parse(xml) as Type;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { readFile } from 'fs/promises';
|
||||
import { parse } from 'yaml';
|
||||
|
||||
export async function readYAML<Type>(file: string) {
|
||||
const yaml = (await readFile(file)).toString();
|
||||
return parse(yaml) as Type;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { parse } from 'yaml';
|
||||
import { readStringDVPL } from './readStringDVPL';
|
||||
|
||||
export async function readYAMLDVPL<Type>(file: string) {
|
||||
const yaml = await readStringDVPL(file);
|
||||
|
||||
return parse(yaml) as Type;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Region, RegionSubdomain } from '../../constants/regions';
|
||||
import { Region, RegionSubdomain } from "@blitzkit/core";
|
||||
|
||||
export default function regionSubdomainToRegion(
|
||||
regionDomain: RegionSubdomain,
|
||||
): Region {
|
||||
return regionDomain === 'na' ? 'com' : regionDomain;
|
||||
return regionDomain === 'na' ? 'com' : regionDomain;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Region, RegionSubdomain } from '../../constants/regions';
|
||||
import { Region, RegionSubdomain } from "@blitzkit/core";
|
||||
|
||||
export default function regionToRegionSubdomain(
|
||||
regionDomain: Region,
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { tankDefinitions, tankNames } from '@blitzkit/core';
|
||||
import { Locale } from 'discord.js';
|
||||
import { go } from 'fuzzysort';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import { tankNamesTechTreeOnly } from '../../../../bot/src/core/discord/autocompleteTanks';
|
||||
import { translator } from '../../../../bot/src/core/localization/translator';
|
||||
import { UserError } from '../../hooks/userError';
|
||||
import { tankDefinitions } from '../blitzkit/tankDefinitions';
|
||||
import { tankNames } from '../blitzkit/tankDefinitions/tankNames';
|
||||
import { tankNamesTechTreeOnly } from '../discord/autocompleteTanks';
|
||||
import { translator } from '../localization/translator';
|
||||
|
||||
export default async function resolveTankId(
|
||||
tank: string | number,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { ClanList } from '../../types/clanList';
|
||||
import { Region } from '@blitzkit/core';
|
||||
import { ClanList } from '../../../../bot/src/types/clanList';
|
||||
import fetchBlitz from './fetchBlitz';
|
||||
|
||||
export default async function searchClansAcrossRegions(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { Region } from '@blitzkit/core';
|
||||
import { context } from '../blitzkit/context';
|
||||
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Region } from '../../../constants/regions';
|
||||
import { Region } from '@blitzkit/core';
|
||||
import fetchBlitz from '../fetchBlitz';
|
||||
import { usernamePattern } from './constants';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NATION_IDS } from '../../constants/nations';
|
||||
import { NATION_IDS } from "@blitzkit/core";
|
||||
|
||||
export function toUniqueId(nation: string, id: number) {
|
||||
return (id << 8) + (NATION_IDS[nation] << 4) + 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { tankDefinitions } from '@blitzkit/core';
|
||||
import { resolveAncestry } from './resolveAncestry';
|
||||
import { tankDefinitions } from './tankDefinitions';
|
||||
|
||||
export async function buildTechTreeLine(start: number, end: number) {
|
||||
const awaitedTankDefinitions = await tankDefinitions;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { assertSecret } from '../../../packages/core/src/blitzkit/assertSecret';
|
||||
import { ASSETS_REPO } from '../../constants/assets';
|
||||
import commitMultipleFiles, { FileChange } from './commitMultipleFiles';
|
||||
|
||||
export async function commitAssets(message: string, changes: FileChange[]) {
|
||||
console.log(`Committing ${message}...`);
|
||||
|
||||
if (changes.length === 0) return;
|
||||
|
||||
await commitMultipleFiles(
|
||||
'tresabhi',
|
||||
ASSETS_REPO,
|
||||
assertSecret(process.env.NEXT_PUBLIC_ASSET_BRANCH),
|
||||
`${message} - ${new Date().toDateString()}`,
|
||||
changes,
|
||||
);
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
import ProgressBar from 'progress';
|
||||
import { GithubChangeBlob, createBlob } from './createBlob';
|
||||
import { octokit } from './octokit';
|
||||
|
||||
export interface FileChange {
|
||||
path: string;
|
||||
content: string;
|
||||
encoding: 'utf-8' | 'base64';
|
||||
}
|
||||
|
||||
export default async function commitMultipleFiles(
|
||||
owner: string,
|
||||
repo: string,
|
||||
branch: string,
|
||||
message: string,
|
||||
changes: FileChange[],
|
||||
) {
|
||||
const latestCommitSha = (
|
||||
await octokit.git.getRef({
|
||||
owner,
|
||||
repo,
|
||||
ref: `heads/${branch}`,
|
||||
})
|
||||
).data.object.sha;
|
||||
const treeSha = (
|
||||
await octokit.git.getCommit({
|
||||
owner,
|
||||
repo,
|
||||
commit_sha: latestCommitSha,
|
||||
})
|
||||
).data.tree.sha;
|
||||
const blobs: GithubChangeBlob[] = [];
|
||||
const bar = new ProgressBar('Blobs :bar', changes.length);
|
||||
|
||||
for (const changeIndexString in changes) {
|
||||
const changeIndex = parseInt(changeIndexString);
|
||||
const change = changes[changeIndex];
|
||||
const createdBlob = await createBlob(owner, repo, change);
|
||||
blobs.push(createdBlob!);
|
||||
bar.tick();
|
||||
}
|
||||
|
||||
const { data: treeData } = await octokit.git.createTree({
|
||||
owner,
|
||||
repo,
|
||||
base_tree: treeSha,
|
||||
tree: blobs,
|
||||
});
|
||||
const { data: newCommitData } = await octokit.git.createCommit({
|
||||
owner,
|
||||
repo,
|
||||
message,
|
||||
tree: treeData.sha,
|
||||
parents: [latestCommitSha],
|
||||
});
|
||||
await octokit.git.updateRef({
|
||||
owner,
|
||||
repo,
|
||||
ref: `heads/${branch}`,
|
||||
sha: newCommitData.sha,
|
||||
force: true,
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { throttle } from 'lodash';
|
||||
import { FileChange } from './commitMultipleFiles';
|
||||
import { FileChange } from '../../../../scripts/src/core/github/commitMultipleFiles';
|
||||
import { octokit } from './octokit';
|
||||
|
||||
export interface GithubChangeBlob {
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
import { times } from 'lodash';
|
||||
import { decompress } from 'lz4js';
|
||||
import ProgressBar from 'progress';
|
||||
import { DidsReadStream } from '../streams/dids';
|
||||
import { asset } from './asset';
|
||||
import { DiscoveredIdsDefinitions } from './discoveredIdDefinitions';
|
||||
|
||||
export async function fetchPreDiscoveredIds() {
|
||||
const idChunks: number[][] = [];
|
||||
const manifest = (await fetch(asset('ids/manifest.json')).then((response) =>
|
||||
response.json(),
|
||||
)) as DiscoveredIdsDefinitions;
|
||||
const bar = new ProgressBar(
|
||||
`Fetching ${manifest.count.toLocaleString()} ids in ${manifest.chunks} chunks :bar`,
|
||||
manifest.chunks,
|
||||
);
|
||||
|
||||
bar.render();
|
||||
await Promise.all(
|
||||
times(manifest.chunks, async (chunkIndex) => {
|
||||
const preDiscovered = await fetch(
|
||||
asset(`ids/${chunkIndex}.dids.lz4`),
|
||||
).then(async (response) => {
|
||||
const buffer = await response.arrayBuffer();
|
||||
const decompressed = decompress(new Uint8Array(buffer)).buffer;
|
||||
return new DidsReadStream(decompressed as ArrayBuffer).dids();
|
||||
});
|
||||
|
||||
idChunks.push(preDiscovered);
|
||||
bar.tick();
|
||||
}),
|
||||
);
|
||||
|
||||
return idChunks.sort((a, b) => a[0] - b[0]).flat();
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
import {
|
||||
StatFilters,
|
||||
tankDefinitions,
|
||||
Tier,
|
||||
TIER_ROMAN_NUMERALS,
|
||||
} from '@blitzkit/core';
|
||||
import { Locale } from 'discord.js';
|
||||
import { translator } from '../localization/translator';
|
||||
import { StatFilters } from '../statistics/filterStats';
|
||||
import { Tier, tankDefinitions } from './tankDefinitions';
|
||||
import { TIER_ROMAN_NUMERALS } from './tankDefinitions/constants';
|
||||
import { translator } from '../../../../bot/src/core/localization/translator';
|
||||
|
||||
export async function filtersToDescription(
|
||||
{ nation, tier, tankType, treeType, tank }: StatFilters,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { usersDatabase } from '../../databases/users';
|
||||
import { usersDatabase } from '@blitzkit/core';
|
||||
|
||||
export async function flagUserActivity(blitzId: number) {
|
||||
await usersDatabase.user.upsert({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ASSETS_REPO } from '../../constants/assets';
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
import getRatingInfo from '../blitz/getRatingInfo';
|
||||
|
||||
interface GitHubTrees {
|
||||
@@ -17,7 +17,9 @@ export async function getArchivedLatestSeasonNumber() {
|
||||
if (ratingInfo.detail) {
|
||||
const regionsURL = (
|
||||
(await fetch(
|
||||
`https://api.github.com/repos/tresabhi/${ASSETS_REPO}/git/trees/main`,
|
||||
`https://api.github.com/repos/tresabhi/${assertSecret(
|
||||
process.env.NEXT_PUBLIC_ASSET_REPO,
|
||||
)}/git/trees/main`,
|
||||
).then((response) => response.json())) as GitHubTrees
|
||||
).tree.find(({ path }) => path === 'regions')!.url;
|
||||
const comURL = (
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Region, asset } from '@blitzkit/core';
|
||||
import { superDecompress } from '@blitzkit/core/src/blitzkit/superDecompress';
|
||||
import { RatingInfo } from '../../commands/ratingLeaderboard';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { asset } from './asset';
|
||||
import { RatingInfo } from '../../../../bot/src/commands/ratingLeaderboard';
|
||||
|
||||
const cache: Record<
|
||||
Region,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { BkrlDiscriminatedEntries, BkrlReadStream } from '../streams/bkrl';
|
||||
import { asset } from './asset';
|
||||
import {
|
||||
asset,
|
||||
BkrlDiscriminatedEntries,
|
||||
BkrlReadStream,
|
||||
Region,
|
||||
} from '@blitzkit/core';
|
||||
|
||||
const cache: Record<Region, Record<number, BkrlDiscriminatedEntries>> = {
|
||||
asia: {},
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { Region } from '../../constants/regions';
|
||||
import { BkrlDiscriminatedEntries, BkrlReadStream } from '../streams/bkrl';
|
||||
import { asset } from './asset';
|
||||
import {
|
||||
asset,
|
||||
BkrlDiscriminatedEntries,
|
||||
BkrlReadStream,
|
||||
Region,
|
||||
} from '@blitzkit/core';
|
||||
|
||||
const cache: Record<Region, Record<number, BkrlDiscriminatedEntries | null>> = {
|
||||
com: {},
|
||||
|
||||
Loaded 100 of 255 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user