// Rules screen — dedicated page for tournament rules const { useState: useRlState, useEffect: useRlEffect } = React; function RulesScreen({ tournamentId }) { const [tournament, setTournament] = useRlState(null); const [loading, setLoading] = useRlState(true); useRlEffect(() => { fetch(`/api/tournaments/${tournamentId}`) .then(r => r.json()) .then(data => { setTournament(backendToReact(data)); setLoading(false); }) .catch(() => setLoading(false)); }, []); if (loading) { return (
); } const back = `/champion/${tournamentId}`; return (
←
Regulamento
{tournament?.name}
{tournament?.title && (
{tournament.title}
)}
{tournament?.rules ? (
{tournament.rules}
) : (
Nenhum regulamento cadastrado para este campeonato. Adicionar regras →
)}
); } window.RulesScreen = RulesScreen;