mercy-gameweek

byDawud Raza

import React, { useState, useEffect } from "react"; import { base44 } from "@/api/base44Client"; import { Calendar, Trophy, CalendarClock, Radio, Target } from "lucide-react"; import StatCards from "@/components/StatCards"; import TopPerformers from "@/components/TopPerformers"; import GameweekFixtures from "@/components/GameweekFixtures"; import SidebarLeagueTable from "@/components/SidebarLeagueTable"; import FixtureTicker from "@/components/FixtureTicker"; import CalendarSync from "@/components/CalendarSync"; import { CalendarPlus } from "lucide-react"; import { fetchPlStandings } from "@/lib/plStandings"; export default function FixturesHub() { const [matches, setMatches] = useState([]); const [players, setPlayers] = useState([]); const [table, setTable] = useState([]); const [loading, setLoading] = useState(true); const [syncOpen, setSyncOpen] = useState(false); useEffect(() => { (async () => { try { const [pl] = await Promise.all([base44.entities.Player.list("-avg_points", 60)]); setPlayers(pl); try { const plRes = await base44.functions.invoke("plLive"); if (plRes.data?.matches?.length) { setMatches(plRes.data.matches); } else { setMatches(await base44.entities.Match.list("-kickoff", 50)); } } catch { setMatches(await base44.entities.Match.list("-kickoff", 50)); } fetchPlStandings() .then((r) => setTable(r.table || [])) .catch(() => {}); } finally { setLoading(false); } })(); }, []); if (loading) return ( <div className="flex items-center justify-center h-96"> <div className="w-8 h-8 border-4 border-gold-500/20 border-t-gold-500 rounded-full animate-spin" /> </div> ); const live = matches.filter((m) => m.status === "live"); const upcoming = matches.filter((m) => m.status === "scheduled"); const finished = matches.filter((m) => m.status === "finished"); const currentGw = live[0]?.gameweek || upcoming[0]?.gameweek || finished[0]?.gameweek || null; const gwMatches = currentGw ? matches.filter((m) => m.gameweek === currentGw) : []; const gwLive = gwMatches.filter((m) => m.status === "live"); const gwDone = gwMatches.filter((m) => m.status === "finished"); const gwGoals = gwMatches.reduce( (s, m) => s + (m.home_score || 0) + (m.away_score || 0), 0 ); const statItems = [ { label: currentGw ? `Gameweek ${currentGw}` : "Gameweek", value: currentGw ?? "—", icon: CalendarClock }, { label: "Fixtures", value: gwMatches.length, icon: Calendar }, { label: "Live Now", value: gwLive.length, icon: Radio, pulse: gwLive.length > 0 }, { label: "Goals (GW)", value: gwGoals, icon: Target }, ]; return ( <div className="space-y-6"> <div className="flex items-start justify-between gap-4 flex-wrap"> <div> <h1 className="text-3xl font-bold tracking-tight flex items-center gap-3"> <Calendar className="w-7 h-7 text-gold-400" /> Fixtures Hub </h1> <p className="text-slate-400 mt-2">Live gameweek fixtures, top performers, and the Premier League table.</p> </div> <button onClick={() => setSyncOpen(true)} className="inline-flex items-center gap-2 px-4 py-2.5 rounded-xl bg-gold-500 text-[#0a0e14] font-semibold text-sm hover:bg-gold-400 transition-colors shrink-0" > <CalendarPlus className="w-4 h-4" /> Sync to Calendar </button> </div> <StatCards items={statItems} /> <div className="grid lg:grid-cols-3 gap-6"> <div className="lg:col-span-2 space-y-6"> <TopPerformers players={players} gameweek={currentGw} /> <section> <div className="flex items-center gap-2 mb-4"> <Calendar className="w-5 h-5 text-gold-400" /> <h2 className="text-xl font-bold">Gameweek Fixtures</h2> </div> <GameweekFixtures matches={matches} /> </section> </div> <aside className="space-y-6"> <section> <div className="flex items-center gap-2 mb-4"> <Trophy className="w-5 h-5 text-gold-400" /> <h2 className="text-xl font-bold">League Table</h2> </div> <SidebarLeagueTable table={table} /> </section> <section className="rounded-2xl bg-[#0d131c] border border-gold-500/15 overflow-hidden"> <div className="flex items-center gap-2 px-4 py-3 bg-gradient-to-r from-gold-500/10 to-transparent border-b border-gold-500/15"> <Calendar className="w-4 h-4 text-gold-400" /> <span className="text-sm font-semibold text-gold-300">Fixture Ticker</span> </div> <div className="overflow-x-auto p-3"> <FixtureTicker matches={matches} /> </div> </section> </aside> </div> <CalendarSync open={syncOpen} onClose={() => setSyncOpen(false)} matches={matches} /> </div> ); }

LandingFixtures Hub
Landing

Comments (0)

No comments yet. Be the first!

Project Tasks

59 tasks
#1

Generate system requirement document

0m 49s0.2 cr used
Done
#2

Generate personas & user flows

0m 6s0.2 cr used
Done
#7

Create flow for FPL Manager

0m 6sCredits in parent
Done
#8

Landing

1m 56sCredits in subtasks
Done
#16

Fix Landing review finding: frontend/src/components/Navigation.jsx and…

0m 12s0.4 cr used
Done
#12

Landing / Navigation

0m 16s1.6 cr used
Done
#10

Landing / Masthead

0m 21s1.6 cr used
Done
#11

Landing / Companion Brief

0m 20s1.6 cr used
Done
#13

Landing / Footer

0m 19s1.6 cr used
Done
#14

Navigation

0m 16sCredits in parent
Done
#15

Footer

0m 19sCredits in parent
Done
#9

Fixtures Hub

19m 0sCredits in subtasks
Done
#31

Fix Fixtures Hub review findings: The main content grid is reversed from the requested… (+2 more)

2m 22s0.4 cr used
Done
#29

Fix Fixtures Hub review finding: Q1 as reviewed now: The reduced-motion mobile ticker still…

1m 11s0.4 cr used
Done
#28

Fix Fixtures Hub review finding: Q1 as reviewed now: Mobile reduced-motion ticker still…

1m 2s0.4 cr used
Done
#27

Fix Fixtures Hub review finding: Q1 as reviewed now: Reduced-motion mobile ticker still…

0m 16s0.4 cr used
Done
#26

Fix Fixtures Hub review findings: Fixture ticker content is clipped at both viewport edges… (+4 more)

1m 23s0.4 cr used
Done
#17

Fixtures Hub / Navigation

0m 0s1.6 cr used
Backlog
#18

Fixtures Hub / Masthead

0m 32s1.6 cr used
Done
#19

Fixtures Hub / Stat Modules

0m 24s1.6 cr used
Done
#20

Fixtures Hub / Top Performers

0m 30s1.6 cr used
Done
#21

Fixtures Hub / Gameweek Fixtures

0m 35s1.6 cr used
Done
#22

Fixtures Hub / League Table

0m 45s1.6 cr used
Done
#23

Fixtures Hub / Fixture Ticker

0m 35s1.6 cr used
Done
#24

Fixtures Hub / Calendar Sync

0m 51s1.6 cr used
Done
#25

Fixtures Hub / Footer

0m 0s1.6 cr used
Backlog
#30

Retry Failed Pages

3m 32s0.4 cr used
Done
#5

Architecture

1m 42s0.2 cr used
Done
#32

Create backend_modules diagram

1m 14sCredits in parent
Done
#33

Create frontend_modules diagram

1m 14sCredits in parent
Done
#34

Create sequence diagram

1m 13sCredits in parent
Done
#35

Create service_network diagram

1m 13sCredits in parent
Done
#6

Workspace task plan

2m 30s0.2 cr used
Done
#36

Serve Fixtures Hub gameweek data, standings, and top performers

120 cr estimated
To Do
#37

Resolve live match data with stored Match fallback

80 cr estimated
To Do
#38

Load fixtures, players, and standings, and sync fixtures to the calendar

120 cr estimated
To Do
#39

Render Fixtures Hub loading, content, and calendar sync dialog

120 cr estimated
To Do
#40

Show gameweek stats, standings, and calendar sync on the Fixtures Hub

120 cr estimated
To Do
#41

Display league table, fixtures, top performers, and ticker with live fallback

120 cr estimated
To Do
#42

Sync fixtures to the manager's calendar and open the sync interface

100 cr estimated
To Do
#43

Load standings and top performers, and show fixture statuses

100 cr estimated
To Do
#44

Derive current gameweek and serve ranked players, live-first matches, and standings

120 cr estimated
To Do
#45

Supply fixture schedule to the manager's own calendar

100 cr estimated
To Do
#46

Load and present Fixtures Hub gameweek data with resilient fallbacks

120 cr estimated
To Do
#47

Serve live-first match data, standings rows, and ticker motion behavior

120 cr estimated
To Do
#48

Serve gameweek state, live fixtures, top performers, and league table data

100 cr estimated
To Do
#49

Compute gameweek stat cards and Top Performers with reduced-motion final state

100 cr estimated
To Do
#50

Serve fixture ticker data, live-first fallback, and calendar sync

120 cr estimated
To Do
#51

Serve masthead stat modules, live gameweek state, and calendar sync dialog

120 cr estimated
To Do
#52

Sync fixture schedule to the manager's calendar

120 cr estimated
To Do
#53

Supply player data from the Player entity

60 cr estimated
To Do
#54

Supply Premier League standings

60 cr estimated
To Do
#55

Sync the loaded fixture schedule to the manager's own calendar

100 cr estimated
To Do
#56

Load League Table rows from the standings provider

60 cr estimated
To Do
#57

Deliver the fixture schedule to the manager's own calendar

100 cr estimated
To Do
#58

Supply stored match data as fallback

80 cr estimated
To Do
#59

View ranked Top Performers for the current gameweek

80 cr estimated
To Do
#60

Wire Fixtures Hub to live gameweek, player, standings, and calendar-sync data

120 cr estimated
To Do
#61

Wire Landing to live gameweek stats and entry into the Fixtures Hub

100 cr estimated
To Do
Landing design preview
Landing: Open mercy-gameweek
Landing: Read companion description
Landing: Enter Fixtures Hub
Fixtures Hub: Wait for data load
Fixtures Hub: Read masthead gameweek
Fixtures Hub: 1. Read stat modules
Fixtures Hub: 2. Read gameweek placeholders
Fixtures Hub: 3. Follow gameweek fixtures
Fixtures Hub: 4. Read top performers
Fixtures Hub: 5. Read league table
Fixtures Hub: 6. Read empty league table
Fixtures Hub: 7. Scan fixture ticker
Fixtures Hub: 8. Press Sync to Calendar
Fixtures Hub: 9. Proceed with calendar sync
Fixtures Hub: 10. Dismiss sync dialog
Fixtures Hub: 11. Return to gameweek state
Landing design preview
Landing: Open mercy-gameweek
Landing: Read companion description
Landing: Enter Fixtures Hub
Fixtures Hub: Wait for data load
Fixtures Hub: Read masthead gameweek
Fixtures Hub: 1. Read stat modules
Fixtures Hub: 2. Read gameweek placeholders
Fixtures Hub: 3. Follow gameweek fixtures
Fixtures Hub: 4. Read top performers
Fixtures Hub: 5. Read league table
Fixtures Hub: 6. Read empty league table
Fixtures Hub: 7. Scan fixture ticker
Fixtures Hub: 8. Press Sync to Calendar
Fixtures Hub: 9. Proceed with calendar sync
Fixtures Hub: 10. Dismiss sync dialog
Fixtures Hub: 11. Return to gameweek state