Add events

This commit is contained in:
2025-12-15 03:22:29 +07:00
parent 1a882fb2e0
commit 4239ea8516
31 changed files with 7288 additions and 75 deletions

View File

@@ -43,6 +43,7 @@ export interface Marathon {
invite_code: string
is_public: boolean
game_proposal_mode: GameProposalMode
auto_events_enabled: boolean
start_date: string | null
end_date: string | null
participants_count: number
@@ -192,6 +193,58 @@ export interface DropResult {
new_drop_count: number
}
export interface DroppedAssignment {
id: number
challenge: Challenge
dropped_at: string
}
export interface SwapCandidate {
participant_id: number
user: User
challenge_title: string
challenge_description: string
challenge_points: number
challenge_difficulty: Difficulty
game_title: string
}
// Two-sided swap confirmation types
export type SwapRequestStatus = 'pending' | 'accepted' | 'declined' | 'cancelled'
export interface SwapRequestChallengeInfo {
title: string
description: string
points: number
difficulty: string
game_title: string
}
export interface SwapRequestItem {
id: number
status: SwapRequestStatus
from_user: User
to_user: User
from_challenge: SwapRequestChallengeInfo
to_challenge: SwapRequestChallengeInfo
created_at: string
responded_at: string | null
}
export interface MySwapRequests {
incoming: SwapRequestItem[]
outgoing: SwapRequestItem[]
}
// Common Enemy leaderboard
export interface CommonEnemyLeaderboardEntry {
participant_id: number
user: User
completed_at: string | null
rank: number | null
bonus_points: number
}
// Activity types
export type ActivityType =
| 'join'
@@ -218,6 +271,78 @@ export interface FeedResponse {
has_more: boolean
}
// Event types
export type EventType =
| 'golden_hour'
| 'common_enemy'
| 'double_risk'
| 'jackpot'
| 'swap'
| 'rematch'
export interface MarathonEvent {
id: number
type: EventType
start_time: string
end_time: string | null
is_active: boolean
created_by: User | null
data: Record<string, unknown> | null
created_at: string
}
export interface EventEffects {
points_multiplier: number
drop_free: boolean
special_action: string | null
description: string
}
export interface ActiveEvent {
event: MarathonEvent | null
effects: EventEffects
time_remaining_seconds: number | null
}
export interface EventCreate {
type: EventType
duration_minutes?: number
challenge_id?: number
}
export const EVENT_INFO: Record<EventType, { name: string; description: string; color: string }> = {
golden_hour: {
name: 'Золотой час',
description: 'Все очки x1.5!',
color: 'yellow',
},
common_enemy: {
name: 'Общий враг',
description: 'Все получают одинаковый челлендж. Первые 3 — бонус!',
color: 'red',
},
double_risk: {
name: 'Двойной риск',
description: 'Дропы бесплатны, но очки x0.5',
color: 'purple',
},
jackpot: {
name: 'Джекпот',
description: 'Следующий спин — сложный челлендж с x3 очками!',
color: 'green',
},
swap: {
name: 'Обмен',
description: 'Можно поменяться заданием с другим участником',
color: 'blue',
},
rematch: {
name: 'Реванш',
description: 'Можно переделать проваленный челлендж за 50% очков',
color: 'orange',
},
}
// Admin types
export interface AdminUser {
id: number