Overview
This page documents the TypeScript types and interfaces used throughout the Version Counter application, including component props and utility types.Component Types
CounterProps
TheCounter component accepts the following props for displaying countdown timers.
Location: src/components/react/Counter.tsx
Start date for the countdown. Can be an ISO 8601 string or Date object.Default:
Date.now() (current time)Example: "2026-02-24T01:30:00Z"Duration of the version/countdown period in daysDefault:
0Example: 42Display variant for the counter. Determines the visual style and layout.Type:
"mini" | "full"Default: "mini""mini"- Compact grid layout with 4 columns (used on home page)"full"- Large glass panel blocks (used on game-specific pages)
Optional callback function triggered when the countdown reaches zeroExample:
Type Definition
Usage Examples
GameCardProps
TheGameCard component displays game version information with countdown.
Location: src/components/GameCard.astro
Game title to display on the cardExample:
"Genshin Impact New Version Countdown"Current version numberExample:
"6.4"Upcoming version numberExample:
"6.5"URL to the card’s background imageExample:
"https://fastcdn.hoyoverse.com/content-v2/plat/162828/..."ISO 8601 timestamp for version start (passed to Counter component)Example:
"2026-02-24T01:30:00Z"Duration in days (passed to Counter component)Example:
42Hex color code for the game’s themeExample:
"#4ade80"Relative path to the game’s detail pageExample:
"/genshin"Usage Example
Utility Types
Time Object
Internal type used by the Counter component to track remaining time.Variant Type
String literal union type for counter display modes.Compact 4-column grid layout
- Used on: Home page game cards
- Display: Small countdown blocks in a horizontal row
- Styling: Minimal, space-efficient design
Large glass panel blocks
- Used on: Individual game pages (e.g., /genshin, /wuwa)
- Display: Large countdown blocks with glow effects
- Styling: Premium glass-morphism design with hover states
Utility Functions
avanzarVersion
Increment version numbers following the game’s versioning scheme. Location:src/utils/change-version.ts
Current version in
major.minor formatExamples: "3.8", "4.0", "6.4"string - The next version number
Logic:
- If minor version is 8: Increments major version and resets minor to 0
- Otherwise: Increments minor version by 1
Constants
Maintenance Duration
Location:src/constants/constantes.ts
Standard maintenance window duration in hoursValue:
4Usage: Used to calculate maintenance end time when displaying patch schedulesType Safety Benefits
The Version Counter codebase uses TypeScript to provide:- IntelliSense: Auto-completion for props and types
- Type checking: Catch errors at compile time
- Documentation: Self-documenting code through type definitions
- Refactoring safety: Rename and restructure with confidence
Best Practices
When working with these types:- Always specify variant explicitly when using
<Counter>in new contexts - Use ISO 8601 format for
fecha_inicioto ensure timezone consistency - Pass complete GameCardProps to maintain visual consistency
- Leverage type inference where possible to reduce boilerplate