Skip to content

Commit

Permalink
- fix multiple slay adventurer calls
Browse files Browse the repository at this point in the history
- swap level and gold in live table
- rename "Submitted Scores" to "Leaderboard"
  • Loading branch information
starknetdev committed Oct 3, 2023
1 parent 397b426 commit 07ca8d7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions ui/src/app/components/leaderboard/LiveRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ const LiveLeaderboardRow = ({
const { gameContract } = useContracts();
const { play: clickPlay } = useUiSounds(soundSelector.click);
const addToCalls = useTransactionCartStore((state) => state.addToCalls);
const removeEntrypointFromCalls = useTransactionCartStore(
(state) => state.removeEntrypointFromCalls
);
const { data: blockData } = useBlock({
refetchInterval: false,
});
const dead = (adventurer.health ?? 0) <= 0;
const adventurersByOwner = useQueriesStore(
(state) => state.data.adventurersByOwnerQuery?.adventurers ?? []
);
Expand All @@ -45,6 +47,7 @@ const LiveLeaderboardRow = ({
);
const topScoreAdventurer = topScores[0]?.id === adventurer.id;
const handleSlayAdventurer = async () => {
removeEntrypointFromCalls("slay_idle_adventurers");
setSlayAdventurers([
...slayAdventurers,
adventurer?.id?.toString() ?? "0",
Expand Down Expand Up @@ -93,16 +96,16 @@ const LiveLeaderboardRow = ({
}}
>
<td>{`${adventurer.name} - ${adventurer.id}`}</td>
<td>{calculateLevel(adventurer.xp ?? 0)}</td>
<td>
<span className="flex justify-center">{adventurer.xp}</span>
</td>
<td>
<span className="flex justify-center text-terminal-yellow">
<CoinIcon className="self-center w-4 h-4 sm:w-6 sm:h-6 fill-current" />
{adventurer.gold ? adventurer.gold : 0}
</span>
</td>
<td>
<span className="flex justify-center">{adventurer.xp}</span>
</td>
<td>{calculateLevel(adventurer.xp ?? 0)}</td>
<td>
<span className="flex justify-center">{adventurer.health}</span>
</td>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/components/leaderboard/LiveTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ const LiveLeaderboardTable = ({
<thead className="border border-terminal-green">
<tr>
<th className="p-1">Adventurer</th>
<th className="p-1">Gold</th>
<th className="p-1">XP</th>
<th className="p-1">Level</th>
<th className="p-1">XP</th>
<th className="p-1">Gold</th>
<th className="p-1">Health</th>
<th className="p-1">Idle</th>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/components/leaderboard/ScoreTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const ScoreLeaderboardTable = ({

return (
<div className="flex flex-col items-center p-2 gap-2">
<h4 className="text-2xl text-center sm:text-2xl m-0">Submitted Scores</h4>
<h4 className="text-2xl text-center sm:text-2xl m-0">Leaderboard</h4>
{scores.length > 0 ? (
<div className="flex flex-col w-full gap-5">
<table className="w-full sm:text-lg xl:text-xl border border-terminal-green">
Expand Down

1 comment on commit 07ca8d7

@vercel
Copy link

@vercel vercel bot commented on 07ca8d7 Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.