"""RTSport mock preview router — completely isolated from blog/admin code.
Mounts static files and HTML templates at /rtsport/* for mobile preview.
No database, no state, no backend logic — pure static mock.
"""
from pathlib import Path
from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse
from starlette.staticfiles import StaticFiles
RTS_BASE = Path("/home/hoffmann_admin/.openclaw/shared/current/frontend")
RTS_TEMPLATES = RTS_BASE / "templates"
RTS_STATIC = RTS_BASE / "static"
router = APIRouter()
def setup_rtsport_mounts(app):
"""Mount RTSport static files and add routes."""
# Mount static CSS
app.mount("/rtsport/static", StaticFiles(directory=str(RTS_STATIC)), name="rtsport_static")
@app.get("/rtsport", response_class=HTMLResponse)
@app.get("/rtsport/", response_class=HTMLResponse)
async def rtsport_index():
"""RTSport mock landing page."""
return _serve_html("index.html")
# @app.get("/rtsport/brand", response_class=HTMLResponse)
# async def rtsport_brand():
# """AthleteFlow brand identity page."""
# return _serve_html("brand.html")
@app.get("/rtsport/at", response_class=HTMLResponse)
async def rtsport_at():
"""AT dashboard."""
return _serve_html("at/dashboard.html")
@app.get("/rtsport/coach", response_class=HTMLResponse)
async def rtsport_coach():
"""Coach dashboard."""
return _serve_html("coach/dashboard.html")
@app.get("/rtsport/parent", response_class=HTMLResponse)
async def rtsport_parent():
"""Parent dashboard."""
return _serve_html("parent/dashboard.html")
@app.get("/rtsport/ad", response_class=HTMLResponse)
async def rtsport_ad():
"""AD overview dashboard."""
return _serve_html("ad/dashboard.html")
@app.get("/rtsport/timeline", response_class=HTMLResponse)
async def rtsport_timeline():
"""Shared timeline component."""
return _serve_html("components/shared-timeline.html")
@app.get("/rtsport/at/sideline-entry", response_class=HTMLResponse)
async def rtsport_sideline_entry():
"""3-tap sideline entry component (HTMX fragment)."""
return _serve_html("at/sideline-entry.html")
@app.get("/rtsport/athlete-detail", response_class=HTMLResponse)
async def rtsport_athlete_detail():
"""Athlete detail overlay component (data-backed)."""
return _serve_html("components/athlete-detail.html")
@app.get("/rtsport/notifications", response_class=HTMLResponse)
async def rtsport_notifications():
"""Notifications mock."""
return _serve_html("components/notifications.html")
def _serve_html(relative_path: str) -> str:
"""Read and return an HTML file from templates dir."""
file_path = RTS_TEMPLATES / relative_path
if not file_path.exists():
return HTMLResponse(content="
Not found
", status_code=404)content = file_path.read_text(encoding="utf-8")
return content