Skip to content

Commit

Permalink
Merge pull request #1376 from kleros/feat/add-court-jump-notification
Browse files Browse the repository at this point in the history
feat(web): court-jump-indicator
  • Loading branch information
alcercu authored Jan 2, 2024
2 parents 2b6d97a + 4fbd067 commit 0e75b6b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions subgraph/core/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ type Round @entity {
penalties: BigInt!
drawnJurors: [Draw!]! @derivedFrom(field: "round")
dispute: Dispute!
court: Court!
feeToken: FeeToken
}

Expand Down
4 changes: 2 additions & 2 deletions subgraph/core/src/KlerosCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function handleDisputeCreation(event: DisputeCreation): void {
court.save();
createDisputeFromEvent(event);
const roundInfo = contract.getRoundInfo(disputeID, ZERO);
createRoundFromRoundInfo(disputeID, ZERO, roundInfo);
createRoundFromRoundInfo(KlerosCore.bind(event.address), disputeID, ZERO, roundInfo);
const arbitrable = event.params._arbitrable.toHexString();
updateArbitrableCases(arbitrable, ONE);
updateCases(ONE, event.block.timestamp);
Expand Down Expand Up @@ -163,7 +163,7 @@ export function handleAppealDecision(event: AppealDecision): void {
dispute.currentRound = roundID;
dispute.save();
const roundInfo = contract.getRoundInfo(disputeID, newRoundIndex);
createRoundFromRoundInfo(disputeID, newRoundIndex, roundInfo);
createRoundFromRoundInfo(KlerosCore.bind(event.address), disputeID, newRoundIndex, roundInfo);
}

export function handleCourtJump(event: CourtJump): void {
Expand Down
5 changes: 4 additions & 1 deletion subgraph/core/src/entities/Round.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { BigInt } from "@graphprotocol/graph-ts";
import { KlerosCore__getRoundInfoResultValue0Struct } from "../../generated/KlerosCore/KlerosCore";
import { KlerosCore, KlerosCore__getRoundInfoResultValue0Struct } from "../../generated/KlerosCore/KlerosCore";
import { Round } from "../../generated/schema";

export function createRoundFromRoundInfo(
contract: KlerosCore,
disputeID: BigInt,
roundIndex: BigInt,
roundInfo: KlerosCore__getRoundInfoResultValue0Struct
Expand All @@ -19,5 +20,7 @@ export function createRoundFromRoundInfo(
round.repartitions = roundInfo.repartitions;
round.penalties = roundInfo.pnkPenalties;
round.dispute = disputeID.toString();
const courtID = contract.disputes(disputeID).value0.toString();
round.court = courtID;
round.save();
}
2 changes: 1 addition & 1 deletion web/src/components/Verdict/DisputeTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const useItems = (disputeDetails?: DisputeDetailsQuery, arbitrable?: `0x${string
acc.push({
title: `Jury Decision - Round ${index + 1}`,
party: isOngoing ? "Voting is ongoing" : getVoteChoice(parsedRoundChoice, answers),
subtitle: eventDate,
subtitle: `${eventDate} / ${votingHistory?.dispute?.rounds.at(index)?.court.name}`,
rightSided: true,
variant: theme.secondaryPurple,
Icon: icon !== "" ? icon : undefined,
Expand Down
4 changes: 4 additions & 0 deletions web/src/hooks/queries/useVotingHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const votingHistoryQuery = graphql(`
id
rounds {
nbVotes
court {
id
name
}
}
disputeKitDispute {
localRounds {
Expand Down
3 changes: 2 additions & 1 deletion web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ const VotingHistory: React.FC<{ arbitrable?: `0x${string}`; isQuestion: boolean
? "All jurors voted"
: localRounds.at(currentTab)?.totalVoted.toString() +
` vote${localRounds.at(currentTab)?.totalVoted.toString() === "1" ? "" : "s"} cast out of ` +
rounds.at(currentTab)?.nbVotes}
rounds.at(currentTab)?.nbVotes}{" "}
- {rounds.at(currentTab)?.court.name}
</p>
</StyledBox>
<StyledAccordion
Expand Down

0 comments on commit 0e75b6b

Please sign in to comment.