Skip to content
1        10        20        30        40        50        60        70        80        90        100       110       120       130       140       150       160       170       180       190       2001use crate::battle_ticket::{generate_battle_pin, generate_qr_svg};2use maud::{Markup, PreEscaped, html};34pub fn battler_view() -> Markup {5    let pin = generate_battle_pin();6    let qr_svg = generate_qr_svg(&format!("/battle?pin={pin}")).unwrap_or_default();78    html! {9        div class="battler-hero" {10            div class="coming-soon-badge" {11                "⚔️ AutoBattler Arena — Coming soon"12            }13            h2 class="battler-title" {14                "Automated Pokémon Tournament"15            }16            p class="battler-desc" {17                "The Pokémon League arena is currently under active preparation. Scan the generated QR code or enter your battle PIN to preview player check-in."18            }1920            // QR Code and Generated PIN Section21            div id="battle-ticket-container" class="my-6 max-w-sm mx-auto p-6 bg-[#fbf8f2] border-2 border-[#c6b297] rounded-2xl shadow-md text-center" {22                (battle_ticket_card(&pin, &qr_svg))23            }2425            // Coming Soon Notice26            div class="p-4 bg-[#fcf4e2] border-l-4 border-[#c99335] text-left text-sm text-[#5a4432] rounded-md my-6" {27                p class="font-bold mb-1" { "🌿 Battles Coming Soon" }28                p {29                    "AutoBattler matches are not yet live. When enabled, your scanned QR code will register your selected Pokémon, after which 20-second turns with automatic move fallbacks will commence."30                }31            }3233            div class="feature-cards-grid" {34                div class="feature-box" {35                    h4 { "📱 QR Code Check-In" }36                    p { "Admin hosts a tournament and presents QR codes for mobile check-in." }37                }38                div class="feature-box" {39                    h4 { "⏱️ 20-Second Turns" }40                    p { "Quick-turn automated combat ensures battles conclude promptly." }41                }42                div class="feature-box" {43                    h4 { "🏆 Elimination Brackets" }44                    p { "Single elimination tournament brackets with automated round progression." }45                }46                div class="feature-box" {47                    h4 { "📺 Live WebSocket Feed" }48                    p { "Real-time match broadcast with live HP bar updates and combat text." }49                }50            }5152            div class="mt-8 pt-6 border-t border-dashed border-stone-300 flex justify-center gap-4" {53                a54                    href="/"55                    class="cottage-btn cottage-btn-primary"56                    hx-get="/pokedex"57                    hx-target="#main-content"58                    hx-push-url="/" {59                    "🌿 Return to Pokédex"60                }61                a62                    href="/debug"63                    class="cottage-btn cottage-btn-secondary"64                    hx-get="/debug"65                    hx-target="#main-content"66                    hx-push-url="/debug" {67                    "🛠️ Tournament Admin Debug"68                }69            }70        }71    }72}7374pub fn battle_ticket_card(pin: &str, qr_svg: &str) -> Markup {75    html! {76        div {77            p class="text-xs uppercase font-bold tracking-widest text-[#5b7c60] mb-2" {78                "Player Battle Pass"79            }8081            div class="inline-block p-3 bg-white border border-[#e3d5c1] rounded-xl shadow-inner my-2" {82                div class="w-48 h-48 flex items-center justify-center mx-auto" {83                    (PreEscaped(qr_svg))84                }85            }8687            div class="my-3" {88                p class="text-xs text-stone-500 uppercase font-semibold" {89                    "Player Battle PIN"90                }91                p class="font-mono text-3xl font-bold tracking-widest text-[#5a4432] my-1" {92                    (pin)93                }94                p class="text-xs text-stone-500 italic" {95                    "Scan QR code or use PIN above to enter arena"96                }97            }9899            button100                type="button"101                class="cottage-btn cottage-btn-secondary text-xs mt-2"102                hx-get="/battler/ticket"103                hx-target="#battle-ticket-container" {104                "🔄 Generate New PIN & QR"105            }106        }107    }108}109110pub fn battle_coming_soon_view(pin: Option<&str>) -> Markup {111    html! {112        div class="battler-hero" {113            div class="coming-soon-badge" {114                "⚔️ Player Match — Coming soon"115            }116            h2 class="battler-title" {117                "Match Lobby"118            }119            @if let Some(p) = pin {120                div class="my-4 p-4 bg-[#fbf8f2] border border-[#c6b297] rounded-xl inline-block" {121                    p class="text-xs text-stone-500 uppercase font-bold" { "Entered Battle PIN" }122                    p class="font-mono text-2xl font-bold text-[#5a4432]" { (p) }123                }124            }125            p class="battler-desc" {126                "Battling with other trainers is coming soon! Please check back shortly when the Pokémon League tournament begins."127            }128            div class="mt-6 flex justify-center gap-4" {129                a130                    href="/"131                    class="cottage-btn cottage-btn-primary"132                    hx-get="/pokedex"133                    hx-target="#main-content"134                    hx-push-url="/" {135                    "🌿 Return to Pokédex"136                }137            }138        }139    }140}