Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(web): cases filtering #1169

Merged
merged 39 commits into from
Oct 7, 2023
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
410428c
chore(web): make skeleton style global
alcercu Aug 18, 2023
f0264ef
feat(web): modularize cases query and add My cases section to dashboard
alcercu Aug 18, 2023
47223eb
style(web): improve color for light mode skeleton
alcercu Aug 18, 2023
e574146
Merge branch 'dev' into feat(web)/cases-filtering
alcercu Aug 18, 2023
c04e8c7
fix: empty CasesGrid when user has never staked
jaybuidl Aug 22, 2023
465cd8a
feat: implement filtering and search logic
nhestrompia Aug 25, 2023
91351b6
fix(web): dashboard dont show my courts if no staked anymore
kemuru Aug 28, 2023
1bdd14a
chore(web): abstract variables
kemuru Aug 28, 2023
4bed1b3
refactor: clear naming for condition
nhestrompia Aug 28, 2023
a69b335
feat: add court selection filtering and subgraph update
nhestrompia Sep 11, 2023
40ec2ca
refactor: code smell and some refactor
nhestrompia Sep 11, 2023
041c945
fix: page number and query param
nhestrompia Sep 11, 2023
bfe027c
Merge branch 'dev' into feat(web)/cases-filtering
alcercu Sep 12, 2023
23c21d8
refactor(subgraph): avoid contract binding and add numberVotingCases
alcercu Sep 13, 2023
efe8852
feat(subgraph): add blocknumber fields
alcercu Sep 13, 2023
a3b16ed
fix(web): add mainnet to chains, but in second position so it's not t…
alcercu Sep 13, 2023
3045e6c
refactor: fetching at pages
nhestrompia Sep 14, 2023
6f2228d
refactor: query naming
nhestrompia Sep 14, 2023
28547bb
fix: context states resetting
nhestrompia Sep 15, 2023
5127f0f
refactor: clear naming and query params
nhestrompia Sep 15, 2023
a29a3d8
fix: stake amount
nhestrompia Sep 15, 2023
504d5d7
feat(subgraph): add totalAppealingDisputes for user entity
alcercu Sep 15, 2023
41f261d
fix: query update based on subgraph changes
nhestrompia Sep 15, 2023
7a3ea07
refactor(web): move totalAppealingDisputes to useUser query
alcercu Sep 15, 2023
d9ef8f5
fix: dashboard new user problem
nhestrompia Sep 18, 2023
56cb87a
feat(subgraph): add periodDeadline field to dispute entity
alcercu Sep 18, 2023
4ba1cb1
chore(web): use devnet subgraph
alcercu Sep 18, 2023
5740f02
fix: dashboard pagination
nhestrompia Sep 19, 2023
36608f3
feat(web): cases filtering state tracked with url
alcercu Oct 4, 2023
61c67b6
chore(web): remove unused context
alcercu Oct 4, 2023
1596088
Merge branch 'dev' into feat(web)/cases-filtering
alcercu Oct 4, 2023
6211b52
fix(web): finish merging dev
alcercu Oct 4, 2023
0574615
fix(web): fix list view problems
alcercu Oct 5, 2023
9a09569
fix(web): code smells
alcercu Oct 5, 2023
2048cff
fix(web): wrong count and bad filter encoding
alcercu Oct 6, 2023
f29a40d
fix(subgraph): voting and appealing cases count
alcercu Oct 6, 2023
a0411a6
chore: filter ordering
jaybuidl Oct 6, 2023
a1c67ca
chore: dispute period banner more specific
jaybuidl Oct 6, 2023
f42cc14
fix: linter about shadowed variables
jaybuidl Oct 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/src/components/CasesDisplay/index.tsx
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ const StyledHR = styled.hr`
`;

interface ICasesDisplay extends ICasesGrid {
numberDisputes?: number;
numberClosedDisputes?: number;
title?: string;
className?: string;
@@ -39,7 +40,6 @@ const CasesDisplay: React.FC<ICasesDisplay> = ({
<CasesGrid
disputes={disputes}
{...{
numberDisputes,
casesPerPage,
totalPages,
currentPage,
4 changes: 2 additions & 2 deletions web/src/components/DisputeCard/DisputeInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from "react";
import styled, { css } from "styled-components";
import { useFiltersContext } from "context/FilterProvider";
import { Periods } from "consts/periods";
import BookmarkIcon from "svgs/icons/bookmark.svg";
import CalendarIcon from "svgs/icons/calendar.svg";
import LawBalanceIcon from "svgs/icons/law-balance.svg";
import PileCoinsIcon from "svgs/icons/pile-coins.svg";
import RoundIcon from "svgs/icons/round.svg";
import Field from "../Field";
import { useLocalStorage } from "react-use";

const Container = styled.div<{ isList: boolean }>`
display: flex;
@@ -56,7 +56,7 @@ const formatDate = (date: number) => {
};

const DisputeInfo: React.FC<IDisputeInfo> = ({ courtId, court, category, rewards, period, date, round }) => {
const { isList } = useFiltersContext();
const [isList, _] = useLocalStorage<boolean>("isList", false);

return (
<Container isList={isList}>
9 changes: 7 additions & 2 deletions web/src/pages/Cases/CasesFetcher.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from "react";
import { useWindowSize } from "react-use";
import { useParams, useNavigate } from "react-router-dom";
import { DisputeDetailsFragment, Dispute_Filter, OrderDirection } from "src/graphql/graphql";
import CasesDisplay from "components/CasesDisplay";
import { BREAKPOINT_LANDSCAPE } from "styles/landscapeStyle";
import { useCasesQuery } from "queries/useCasesQuery";
import { useCounterQuery, CounterQuery } from "queries/useCounter";
import { useCourtDetails, CourtDetailsQuery } from "queries/useCourtDetails";
import { decodeURIFilter, useRootPath } from "utils/uri";
import CasesDisplay from "components/CasesDisplay";
import { isUndefined } from "utils/index";

const calculateStats = (
@@ -40,7 +42,9 @@ const CasesFetcher: React.FC = () => {
const { page, order, filter } = useParams();
const location = useRootPath();
const navigate = useNavigate();
const casesPerPage = 3;
const { width } = useWindowSize();
const screenIsBig = width > BREAKPOINT_LANDSCAPE;
const casesPerPage = screenIsBig ? 9 : 3;
const pageNumber = parseInt(page ?? "1");
const disputeSkip = casesPerPage * (pageNumber - 1);
const { data: counterData } = useCounterQuery();
@@ -49,6 +53,7 @@ const CasesFetcher: React.FC = () => {
const { data: courtData } = useCourtDetails(decodedFilter?.court?.toString());
const { data } = useCasesQuery(
disputeSkip,
casesPerPage,
decodedFilter,
order === "asc" ? OrderDirection.Asc : OrderDirection.Desc
);