From 8b628822ec8744efc65dfcc80bfa834f2b4810ff Mon Sep 17 00:00:00 2001 From: Mike Johnston Date: Thu, 29 Jan 2026 01:18:45 -0500 Subject: [PATCH] fix style --- frontend/src/App.css | 23 ++++++++++ frontend/src/pages/ChallengeDetail.jsx | 30 +++++++++++-- frontend/src/pages/ChallengeList.jsx | 60 +++++++++++++++++++++++++- 3 files changed, 107 insertions(+), 6 deletions(-) diff --git a/frontend/src/App.css b/frontend/src/App.css index e93285e..b387289 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -196,6 +196,16 @@ body { color: var(--text-muted); } +.challenge-detail-layout { + display: grid; + gap: 2rem; + grid-template-columns: minmax(0, 1fr) 300px; +} + +#leaderboard-mobile { + display: none; +} + @media (max-width: 768px) { .nav { flex-direction: column; @@ -223,6 +233,19 @@ body { .btn { width: 100%; } + + /* Show mobile leaderboard, hide desktop sidebar */ + #leaderboard-mobile { + display: block; + } + + .challenge-sidebar { + display: none; + } + + .challenge-detail-layout { + grid-template-columns: 1fr; + } } @media (max-width: 1024px) { diff --git a/frontend/src/pages/ChallengeDetail.jsx b/frontend/src/pages/ChallengeDetail.jsx index 784276a..482d850 100644 --- a/frontend/src/pages/ChallengeDetail.jsx +++ b/frontend/src/pages/ChallengeDetail.jsx @@ -196,9 +196,31 @@ export default function ChallengeDetail() { )} -
+ {/* Leaderboard - Desktop: Sidebar, Mobile: Top */} +
+

Leaderboard

+ {leaderboard.length === 0 ? ( +

No points yet

+ ) : ( +
+ {leaderboard.map((entry, index) => ( +
+
+ {index + 1}. + {entry.username} +
+ + {entry.validated_points} pts + +
+ ))} +
+ )} +
+ +
{/* Main Content */} -
+
{/* New Prediction */}

Make a Prediction

@@ -272,8 +294,8 @@ export default function ChallengeDetail() { )}
- {/* Sidebar - Leaderboard */} -
+ {/* Sidebar - Leaderboard (Desktop only) */} +

Leaderboard

{leaderboard.length === 0 ? ( diff --git a/frontend/src/pages/ChallengeList.jsx b/frontend/src/pages/ChallengeList.jsx index 7dab72d..10fee64 100644 --- a/frontend/src/pages/ChallengeList.jsx +++ b/frontend/src/pages/ChallengeList.jsx @@ -4,6 +4,7 @@ import api from '../api'; export default function ChallengeList() { const [challenges, setChallenges] = useState([]); + const [pendingInvites, setPendingInvites] = useState([]); const [searchQuery, setSearchQuery] = useState(''); const [showResults, setShowResults] = useState([]); const [loading, setLoading] = useState(true); @@ -18,6 +19,10 @@ export default function ChallengeList() { try { const data = await api.getChallenges(); setChallenges(data.challenges); + + // Filter out pending invitations + const pending = data.challenges.filter(c => c.participation_status === 'pending'); + setPendingInvites(pending); } catch (err) { console.error('Failed to load challenges:', err); } finally { @@ -25,6 +30,15 @@ export default function ChallengeList() { } }; + const handleRespondToInvite = async (challengeId, status) => { + try { + await api.respondToChallenge(challengeId, status); + await loadChallenges(); + } catch (err) { + alert('Failed to respond: ' + err.message); + } + }; + const handleSearch = (query) => { setSearchQuery(query); @@ -84,6 +98,48 @@ export default function ChallengeList() {

My Challenges

+ {/* Pending Invitations */} + {pendingInvites.length > 0 && ( +
+

📬 Pending Invitations

+
+ {pendingInvites.map(challenge => ( +
+
+ {challenge.cover_image_url && ( + {challenge.title} + )} +
+
{challenge.title}
+
+ Invited by {challenge.creator_username} +
+
+
+
+ + +
+
+ ))} +
+
+ )} + {/* Search/Create */}
{/* Challenge List */} - {challenges.length === 0 ? ( + {challenges.filter(c => c.participation_status !== 'pending').length === 0 ? (

No challenges yet. Search for a show above to create one!

) : (
- {challenges.map(challenge => ( + {challenges.filter(c => c.participation_status !== 'pending').map(challenge => (
{challenge.cover_image_url && (