diff --git a/docs/guide/timezones.md b/docs/guide/timezones.md index 3b344cc55..631450aaf 100644 --- a/docs/guide/timezones.md +++ b/docs/guide/timezones.md @@ -2,8 +2,8 @@ What is considered a "day's worth of games" is determined by the reset time. The reset time is generally at midnight everyday after which newer games are counted towards the next day. Reset times vary from region to region: -- North America: UTC-5:00 (Central North American Time midnight) -- Europe: UTC+1:00 (Central European Time midnight) -- Asia: UTC+7:00 (Central Asia Standard Time midnight) +- North America: `UTC-5:00` (Central North American Time midnight) +- Europe: `UTC+1:00` (Central European Time midnight) +- Asia: `UTC+7:00` (Central Asia Standard Time midnight) **Reset times are different from Blitz Stars** (Blitz Stars resets at 5:00 am locally relative to the user opening their website). Inconsistencies with Blitz Stars only occur with sleep-deprived players and players who play in the wrong region. diff --git a/src/commands/fullStats.tsx b/src/commands/fullStats.tsx index 4991a4bb6..cfe3bdace 100644 --- a/src/commands/fullStats.tsx +++ b/src/commands/fullStats.tsx @@ -19,7 +19,7 @@ import { AccountInfo } from '../types/accountInfo.js'; export const fullStatsCommand: CommandRegistry = { inProduction: true, - inDevelopment: false, + inDevelopment: true, inPublic: true, command: addStatTypeSubCommandGroups( diff --git a/src/commands/help.ts b/src/commands/help.ts index c5bd5135f..711041db2 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -33,7 +33,7 @@ function addDocsSubcommands(option: SlashCommandSubcommandsOnlyBuilder) { export const helpCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, + inDevelopment: false, inPublic: true, command: addDocsSubcommands( diff --git a/src/components/GenericAllStats.tsx b/src/components/GenericAllStats.tsx deleted file mode 100644 index 54ff834f3..000000000 --- a/src/components/GenericAllStats.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import getWN8Percentile from '../core/blitz/getWN8Percentile.js'; -import isNumber from '../core/node/isNumber.js'; -import { AllStats, SupplementaryStats } from '../types/accountInfo.js'; -import GenericStats from './GenericStats/index.js'; - -export interface GenericAllStatsProps { - stats: AllStats; - supplementaryStats?: SupplementaryStats; -} - -export default function GenericAllStats({ - stats, - supplementaryStats, -}: GenericAllStatsProps) { - const damageRatio = stats.damage_dealt / stats.damage_received; - const killsToDeathRatio = - stats.frags / (stats.battles - stats.survived_battles); - - return ( - - ); -} diff --git a/src/components/GenericAllStats/components/Card.tsx b/src/components/GenericAllStats/components/Card.tsx new file mode 100644 index 000000000..518c7e5d1 --- /dev/null +++ b/src/components/GenericAllStats/components/Card.tsx @@ -0,0 +1,91 @@ +import { Percentile } from '../../../constants/percentiles.js'; +import { theme } from '../../../stitches.config.js'; +import PercentileIndicator from '../../PercentileIndicator.js'; + +export interface CardItem { + label: string; + value: string | number | undefined; + percentile?: Percentile; +} + +export interface CardProps { + items: CardItem[]; + title: string; +} + +export function Card({ items, title }: CardProps) { + return ( +
+ + {title} + + +
+ {items.map((item) => ( +
+ + {item.label} + + +
+ +
+ {item.percentile !== undefined && ( + + )} + + {item.value === undefined || Number.isNaN(item.value) + ? '--' + : item.value} + +
+
+ ))} +
+
+ ); +} diff --git a/src/components/GenericAllStats/components/Root.tsx b/src/components/GenericAllStats/components/Root.tsx new file mode 100644 index 000000000..0cf26bfde --- /dev/null +++ b/src/components/GenericAllStats/components/Root.tsx @@ -0,0 +1,17 @@ +export interface RootProps { + children: React.ReactNode; +} + +export function Root({ children }: RootProps) { + return ( +
+ {children} +
+ ); +} diff --git a/src/components/GenericAllStats/components/Row.tsx b/src/components/GenericAllStats/components/Row.tsx new file mode 100644 index 000000000..dcb083a60 --- /dev/null +++ b/src/components/GenericAllStats/components/Row.tsx @@ -0,0 +1,7 @@ +export interface RowProps { + children: React.ReactNode; +} + +export function Row({ children }: RowProps) { + return
{children}
; +} diff --git a/src/components/GenericAllStats/index.tsx b/src/components/GenericAllStats/index.tsx new file mode 100644 index 000000000..bb1821b4f --- /dev/null +++ b/src/components/GenericAllStats/index.tsx @@ -0,0 +1,124 @@ +import getWN8Percentile from '../../core/blitz/getWN8Percentile.js'; +import isNumber from '../../core/node/isNumber.js'; +import { AllStats, SupplementaryStats } from '../../types/accountInfo.js'; +import { Card } from './components/Card.js'; +import { Root } from './components/Root.js'; +import { Row } from './components/Row.js'; + +// TODO: remove the .js endings + +export interface GenericAllStatsProps { + stats: AllStats; + supplementaryStats?: SupplementaryStats; +} + +export default function GenericAllStats({ + stats, + supplementaryStats, +}: GenericAllStatsProps) { + const damageRatio = stats.damage_dealt / stats.damage_received; + const killsToDeathRatio = + stats.frags / (stats.battles - stats.survived_battles); + + return ( + + + + + + + + + + + ); +} diff --git a/src/renderers/fullStats.tsx b/src/renderers/fullStats.tsx index 698d8794a..a9ecae06e 100644 --- a/src/renderers/fullStats.tsx +++ b/src/renderers/fullStats.tsx @@ -1,4 +1,4 @@ -import GenericAllStats from '../components/GenericAllStats.js'; +import GenericAllStats from '../components/GenericAllStats/index.js'; import NoData, { NoDataType } from '../components/NoData.js'; import PoweredBy, { PoweredByType } from '../components/PoweredBy.js'; import TierWeights, { TierWeightsRecord } from '../components/TierWeights.js'; diff --git a/src/routes/today.tsx b/src/routes/today.tsx index b4bf67298..257c79473 100644 --- a/src/routes/today.tsx +++ b/src/routes/today.tsx @@ -5,7 +5,7 @@ import { RouteRegistry } from '../server.js'; export const todayRoute: RouteRegistry = { route: '/today', inProduction: true, - inDevelopment: true, + inDevelopment: false, async handler(req) { const player = resolvePlayerFromRequest(req);