-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: url path tab logic, refactors, add voted ballot svg, add icons …
…to tabs
- Loading branch information
Showing
22 changed files
with
146 additions
and
78 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, { useMemo } from "react"; | ||
import { useNavigate, useParams, useSearchParams } from "react-router-dom"; | ||
|
||
import styled from "styled-components"; | ||
import { responsiveSize } from "styles/responsiveSize"; | ||
|
||
import { isUndefined } from "utils/index"; | ||
import { decodeURIFilter, useRootPath } from "utils/uri"; | ||
|
||
import { DisputeDetailsFragment, OrderDirection } from "src/graphql/graphql"; | ||
import { useMyCasesQuery } from "queries/useCasesQuery"; | ||
import { useUserQuery } from "queries/useUser"; | ||
import CasesDisplay from "components/CasesDisplay"; | ||
|
||
const StyledCasesDisplay = styled(CasesDisplay)` | ||
margin-top: ${responsiveSize(24, 32)}; | ||
.title { | ||
margin-bottom: ${responsiveSize(12, 24)}; | ||
} | ||
`; | ||
|
||
interface ICases { | ||
addressToQuery: `0x${string}`; | ||
} | ||
|
||
const Cases: React.FC<ICases> = ({ addressToQuery }) => { | ||
const { page, order, filter } = useParams(); | ||
const [searchParams] = useSearchParams(); | ||
const location = useRootPath(); | ||
const navigate = useNavigate(); | ||
|
||
const casesPerPage = 3; | ||
const pageNumber = parseInt(page ?? "1"); | ||
const disputeSkip = casesPerPage * (pageNumber - 1); | ||
const decodedFilter = decodeURIFilter(filter ?? "all"); | ||
const { data: disputesData } = useMyCasesQuery( | ||
addressToQuery, | ||
disputeSkip, | ||
decodedFilter, | ||
order === "asc" ? OrderDirection.Asc : OrderDirection.Desc | ||
); | ||
|
||
const { data: userData } = useUserQuery(addressToQuery, decodedFilter); | ||
const totalCases = userData?.user?.disputes.length; | ||
const totalResolvedCases = parseInt(userData?.user?.totalResolvedDisputes); | ||
const totalPages = useMemo( | ||
() => (!isUndefined(totalCases) ? Math.ceil(totalCases / casesPerPage) : 1), | ||
[totalCases, casesPerPage] | ||
); | ||
|
||
return ( | ||
<StyledCasesDisplay | ||
title="Cases Drawn" | ||
disputes={userData?.user !== null ? (disputesData?.user?.disputes as DisputeDetailsFragment[]) : []} | ||
numberDisputes={totalCases} | ||
numberClosedDisputes={totalResolvedCases} | ||
totalPages={totalPages} | ||
currentPage={pageNumber} | ||
setCurrentPage={(newPage: number) => | ||
navigate(`${location}/${newPage}/${order}/${filter}?${searchParams.toString()}`) | ||
} | ||
{...{ casesPerPage }} | ||
/> | ||
); | ||
}; | ||
|
||
export default Cases; |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ const CourtCardsContainer = styled.div` | |
${landscapeStyle( | ||
() => css` | ||
gap: 16px; | ||
gap: 8px; | ||
` | ||
)} | ||
`; | ||
|
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,8 @@ | ||
import React from "react"; | ||
|
||
interface IVotes {} | ||
|
||
const Votes: React.FC<IVotes> = () => { | ||
return <div></div>; | ||
}; | ||
export default Votes; |
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