Add a marketing landing hero and a live chain/round status strip

The user page's login screen was a bare test dashboard with no explanation
of how the lottery works; it now leads with a hero (3-step explainer, trust
pills) shown only while logged out, plus a bento-style nav and a glowing
round card during the draw.

Both the user and admin pages now show the current chain tip height and
lottery status (open / drawing / waiting for next round) via a small status
strip, polled from /rounds/current (extended with chain_tip_height sourced
from ElectrumListener.tip_height).
This commit is contained in:
2026-07-22 10:16:51 +02:00
parent 8627f3fa0c
commit 78109aa4c4
3 changed files with 295 additions and 15 deletions
+9 -3
View File
@@ -1,6 +1,6 @@
from datetime import timedelta, timezone
from fastapi import APIRouter, Depends
from fastapi import APIRouter, Depends, Request
from pydantic import BaseModel
from sqlalchemy import func, select
from sqlalchemy.ext.asyncio import AsyncSession
@@ -24,16 +24,21 @@ class CurrentRoundResponse(BaseModel):
draw_animation_seconds: int
winner_user_id: int | None = None
winner_amount_sats: int | None = None
chain_tip_height: int | None = None
@router.get("/current", response_model=CurrentRoundResponse)
async def current_round(session: AsyncSession = Depends(get_session)) -> CurrentRoundResponse:
async def current_round(request: Request, session: AsyncSession = Depends(get_session)) -> CurrentRoundResponse:
config = await get_round_config(session)
round_ = await get_active_round(session)
listener = request.app.state.electrum_listener
chain_tip_height = listener.tip_height or None
if round_ is None:
await session.commit()
return CurrentRoundResponse(
bet_amount_sats=config.bet_amount_sats, draw_animation_seconds=config.draw_animation_seconds
bet_amount_sats=config.bet_amount_sats,
draw_animation_seconds=config.draw_animation_seconds,
chain_tip_height=chain_tip_height,
)
participant_count = await session.scalar(
@@ -54,4 +59,5 @@ async def current_round(session: AsyncSession = Depends(get_session)) -> Current
draw_animation_seconds=config.draw_animation_seconds,
winner_user_id=round_.winner_user_id,
winner_amount_sats=round_.winner_amount_sats,
chain_tip_height=chain_tip_height,
)