Skip to content

Commit 923f2d4

Browse files
committed
Merge branch 'fix(web)/courts-not-appearing-dashboard' of github.com:kleros/kleros-v2 into fix(web)/courts-not-appearing-dashboard
2 parents 4cf47e6 + 61df412 commit 923f2d4

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

subgraph/schema.graphql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface DisputeKitDispute {
1919
coreDispute: Dispute!
2020
localRounds: [DisputeKitRound!]! @derivedFrom(field: "localDispute")
2121
currentLocalRoundIndex: BigInt!
22+
timestamp: BigInt!
2223
}
2324

2425
interface DisputeKitRound {
@@ -236,6 +237,7 @@ type ClassicDispute implements DisputeKitDispute @entity {
236237
coreDispute: Dispute!
237238
localRounds: [DisputeKitRound!]! @derivedFrom(field: "localDispute")
238239
currentLocalRoundIndex: BigInt!
240+
timestamp: BigInt!
239241

240242
numberOfChoices: BigInt!
241243
extraData: Bytes!

subgraph/src/entities/ClassicDispute.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ export function createClassicDisputeFromEvent(event: DisputeCreation): void {
99
classicDispute.currentLocalRoundIndex = ZERO;
1010
classicDispute.numberOfChoices = event.params._numberOfChoices;
1111
classicDispute.extraData = event.params._extraData;
12+
classicDispute.timestamp = event.block.timestamp;
1213
classicDispute.save();
1314
}

web/src/hooks/queries/useClassicAppealQuery.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { graphqlQueryFnHelper } from "utils/graphqlQueryFnHelper";
55
export type { ClassicAppealQuery };
66

77
const classicAppealQuery = graphql(`
8-
query ClassicAppeal($disputeID: ID!) {
8+
query ClassicAppeal($disputeID: ID!, $orderBy: DisputeKitDispute_orderBy, $orderDirection: OrderDirection) {
99
dispute(id: $disputeID) {
1010
period
1111
court {
@@ -16,7 +16,7 @@ const classicAppealQuery = graphql(`
1616
id
1717
}
1818
lastPeriodChange
19-
disputeKitDispute {
19+
disputeKitDispute(orderBy: $orderBy, orderDirection: $orderDirection) {
2020
id
2121
currentLocalRoundIndex
2222
localRounds {
@@ -37,6 +37,13 @@ export const useClassicAppealQuery = (id?: string | number) => {
3737
return useQuery<ClassicAppealQuery>({
3838
queryKey: ["refetchOnBlock", `classicAppealQuery${id}`],
3939
enabled: isEnabled,
40-
queryFn: async () => await graphqlQueryFnHelper(classicAppealQuery, { disputeID: id?.toString() }),
40+
queryFn: async () =>
41+
isEnabled
42+
? await graphqlQueryFnHelper(classicAppealQuery, {
43+
disputeID: id?.toString(),
44+
orderBy: "timestamp",
45+
orderDirection: "asc",
46+
})
47+
: undefined,
4148
});
4249
};

web/src/hooks/useClassicAppealContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const getCurrentLocalRound = (dispute?: ClassicAppealQuery["dispute"]) => {
102102
if (!dispute) return undefined;
103103

104104
const period = dispute.period;
105-
const currentLocalRoundIndex = dispute.disputeKitDispute?.currentLocalRoundIndex;
105+
const currentLocalRoundIndex = dispute.disputeKitDispute.at(-1)?.currentLocalRoundIndex;
106106
const adjustedRoundIndex = ["appeal", "execution"].includes(period)
107107
? currentLocalRoundIndex
108108
: currentLocalRoundIndex - 1;

web/src/pages/Cases/CaseDetails/Appeal/Classic/Options/StageOne.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
useOptionsContext,
99
useSelectedOptionContext,
1010
} from "hooks/useClassicAppealContext";
11+
import { isUndefined } from "utils/index";
1112
import { formatUnitsWei } from "utils/format";
1213

1314
const Container = styled.div`
@@ -30,14 +31,15 @@ const StageOne: React.FC<IStageOne> = ({ setAmount }) => {
3031
const options = useOptionsContext();
3132
const loserSideCountdown = useLoserSideCountdownContext();
3233
const { selectedOption, setSelectedOption } = useSelectedOptionContext();
34+
3335
return (
3436
<Container>
3537
<StageExplainer {...{ loserSideCountdown }} />
3638
<label> Which option do you want to fund? </label>
3739
<OptionsContainer>
38-
{typeof paidFees !== "undefined" &&
39-
typeof winnerRequiredFunding !== "undefined" &&
40-
typeof loserRequiredFunding !== "undefined" &&
40+
{!isUndefined(paidFees) &&
41+
!isUndefined(winnerRequiredFunding) &&
42+
!isUndefined(loserRequiredFunding) &&
4143
options?.map((answer: string, i: number) => {
4244
const requiredFunding = i.toString() === winningChoice ? winnerRequiredFunding : loserRequiredFunding;
4345
return (

web/src/pages/Dashboard/Courts/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const Courts: React.FC = () => {
2525
const { address } = useAccount();
2626
const { data } = useUserQuery(address?.toLowerCase() as `0x${string}`);
2727
const user = getFragment(userFragment, data?.user);
28-
console.log(user);
2928

3029
return (
3130
<Container>

0 commit comments

Comments
 (0)