-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to new data source for demos (#75)
* Refactor env. * Refactor hub. * Add cloudfront service. * Refactor scoreboard. * Disable playlists. * Update supabase types. * Remove playlist. * Major refactoring; switch to results from games table. * Update game browser settings. * Update browser, sidebar, pagination limit.
- Loading branch information
Showing
56 changed files
with
700 additions
and
655 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
CONVEX_DEPLOYMENT="dev:alpha-beta-123" # Deployment used by `npx convex dev` | ||
VITE_CONVEX_URL="https://alpha-beta-123.convex.cloud" | ||
VITE_QUAKEWORLD_CLOUDFRONT_URL="https://d3mei09tvo6qxe.cloudfront.net" | ||
VITE_DEMOS_CLOUDFRONT_URL="https://d.quake.world" | ||
VITE_ASSETS_CLOUDFRONT_URL="https://a.quake.world" | ||
VITE_SUPABASE_URL="https://myproject.supabase.co" | ||
VITE_SUPABASE_ANON_KEY="AAA" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Timestamp } from "../Timestamp.tsx"; | ||
import type { | ||
Game, | ||
GamePlayer, | ||
GameTeam, | ||
} from "../services/supabase/supabase.types.ts"; | ||
import { DownloadButton, PlayButton } from "./Controls.tsx"; | ||
import { ScoreSpoiler } from "./ScoreSpoiler.tsx"; | ||
|
||
export const GameList = ({ games }: { games: Game[] | null }) => { | ||
return ( | ||
<table className="text-left"> | ||
<thead> | ||
<tr className="text-slate-300 text-xs"> | ||
<th className="p-2 min-w-[100px]">Date</th> | ||
<th className="p-2">Score</th> | ||
<th className="p-2" /> | ||
</tr> | ||
</thead> | ||
<tbody className="text-sm"> | ||
{games?.map((demo) => ( | ||
<ListItem key={demo.id} Game={demo} /> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
}; | ||
|
||
const ListItem = ({ Game }: { Game: Game }) => { | ||
return ( | ||
<tr className="odd:bg-[#1a1a2a] hover:bg-white/10"> | ||
<td className="p-2 text-slate-400 text-xs"> | ||
<Timestamp timestamp={Game.timestamp} /> | ||
</td> | ||
<td className="p-2 text-slate-400 text-right">{Game.mode}</td> | ||
<td className="p-2 text-slate-400">{Game.map}</td> | ||
<td className="p-2">TODO</td> | ||
<td className="text-center"> | ||
<ScoreSpoiler | ||
score={getDemoScores( | ||
Game.teams as GameTeam[], | ||
Game.players as GamePlayer[], | ||
)} | ||
/> | ||
</td> | ||
<td className="p-2 flex items-center space-x-2"> | ||
<PlayButton id={Game.id} /> | ||
{Game.demo_sha256 && <DownloadButton sha256={Game.demo_sha256} />} | ||
</td> | ||
</tr> | ||
); | ||
}; | ||
|
||
function getDemoScores( | ||
teams: GameTeam[] = [], | ||
players: GamePlayer[] = [], | ||
): string { | ||
let p: number[]; | ||
|
||
if (teams.length > 0) { | ||
teams.sort((a, b) => a.name.localeCompare(b.name)); | ||
p = teams.map((t) => t.frags); | ||
} else { | ||
p = players.map((p) => p.frags); | ||
} | ||
|
||
return p.join(" : "); | ||
} |
Oops, something went wrong.