Skip to content

chore(web): style and button changes #2001

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

Merged
merged 3 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

### Pre-Requisites

If you haven't already, you need to follow all the previous steps of the **Contributing** section of the repo's [Contribution Guidelines](../CONTRIBUTING.md).
If you haven't already, you need to follow all the previous steps of the **Contributing** section of the repo's [Contribution Guidelines](../CONTRIBUTING.md)

### Getting Started

Expand Down
45 changes: 0 additions & 45 deletions web/src/components/AllCasesButton.tsx

This file was deleted.

32 changes: 17 additions & 15 deletions web/src/components/LatestCases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@ import DisputeView from "components/DisputeView";
import { SkeletonDisputeCard } from "components/StyledSkeleton";

import { Dispute_Filter } from "../graphql/graphql";
import AllCasesButton from "./AllCasesButton";
import SeeAllCasesButton from "./SeeAllCasesButton";

const Container = styled.div`
margin-top: ${responsiveSize(28, 48)};
margin-top: ${responsiveSize(32, 48)};
`;

const Title = styled.h1`
const TitleAndButtonContainer = styled.div`
display: flex;
flex-wrap: wrap;
flex-direction: row;
align-items: center;
gap: 4px 12px;
margin-bottom: ${responsiveSize(12, 24)};
`;

const Title = styled.h1`
margin-bottom: 0;
font-size: ${responsiveSize(20, 24)};
`;

Expand All @@ -30,34 +39,27 @@ const DisputeContainer = styled.div`
gap: var(--gap);
`;

const ButtonContainer = styled.div`
display: flex;
margin-top: 16px;
justify-content: center;
`;

interface ILatestCases {
title?: string;
filters?: Dispute_Filter;
courtName?: string;
}

const LatestCases: React.FC<ILatestCases> = ({ title = "Latest Cases", filters, courtName }) => {
const LatestCases: React.FC<ILatestCases> = ({ title = "Latest Cases", filters }) => {
const { data } = useCasesQuery(0, 3, filters);
const disputes: DisputeDetailsFragment[] = useMemo(() => data?.disputes as DisputeDetailsFragment[], [data]);
const courtId = typeof filters?.court === "string" ? filters?.court : undefined;

return isUndefined(disputes) || disputes.length > 0 ? (
<Container>
<Title>{title}</Title>
<TitleAndButtonContainer>
<Title>{title}</Title>
<SeeAllCasesButton {...{ courtId }} />
</TitleAndButtonContainer>
<DisputeContainer>
{isUndefined(disputes)
? Array.from({ length: 3 }).map((_, index) => <SkeletonDisputeCard key={index} />)
: disputes.map((dispute) => <DisputeView key={dispute.id} {...dispute} overrideIsList />)}
</DisputeContainer>
<ButtonContainer>
<AllCasesButton {...{ courtId, courtName }} />
</ButtonContainer>
</Container>
) : null;
};
Expand Down
24 changes: 24 additions & 0 deletions web/src/components/SeeAllCasesButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from "react";

import { encodeURIFilter } from "utils/uri";

import { BlueIconTextButtonContainer } from "./BlueIconTextButtonContainer";
import { InternalLink } from "./InternalLink";

interface ISeeAllCasesButton {
courtId?: string;
}

const SeeAllCasesButton: React.FC<ISeeAllCasesButton> = ({ courtId }) => {
const filter = courtId ? { court: courtId } : {};
const link = `/cases/display/1/desc/${encodeURIFilter(filter)}`;
const labelText = "See all";

return (
<InternalLink to={link}>
<BlueIconTextButtonContainer>{labelText}</BlueIconTextButtonContainer>
</InternalLink>
);
};

export default SeeAllCasesButton;
16 changes: 16 additions & 0 deletions web/src/components/SeeAllJurorsButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";

import { BlueIconTextButtonContainer } from "./BlueIconTextButtonContainer";
import { InternalLink } from "./InternalLink";

const SeeAllJurorsButton: React.FC = () => {
return (
<InternalLink to={"/jurors/1/desc/all"}>
<BlueIconTextButtonContainer>
<label>See all</label>
</BlueIconTextButtonContainer>
</InternalLink>
);
};

export default SeeAllJurorsButton;
6 changes: 1 addition & 5 deletions web/src/pages/Courts/CourtDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,7 @@ const CourtDetails: React.FC = () => {
<StyledCard>
<Description />
</StyledCard>
<LatestCases
{...{ courtName }}
title={`Latest Cases in ${getDescriptiveCourtName(courtName)}`}
filters={{ court: id }}
/>
<LatestCases title={`Latest Cases in ${getDescriptiveCourtName(courtName)}`} filters={{ court: id }} />
<JurorsStakedByCourt {...{ courtName }} />
<ScrollTop />
</Container>
Expand Down
28 changes: 15 additions & 13 deletions web/src/pages/Home/TopJurors/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@ import { SkeletonDisputeListItem } from "components/StyledSkeleton";

import Header from "./Header";
import JurorCard from "./JurorCard";
import JurorsLeaderboardButton from "components/JurorsLeaderboardButton";
import SeeAllJurorsButton from "components/SeeAllJurorsButton";

const Container = styled.div`
margin-top: ${responsiveSize(24, 48)};
margin-top: ${responsiveSize(28, 48)};
`;

const Title = styled.h1`
const TitleAndButtonContainer = styled.div`
display: flex;
flex-direction: row;
align-items: center;
gap: 12px;
margin-bottom: ${responsiveSize(12, 24)};
`;

const Title = styled.h1`
margin-bottom: 0;
font-size: ${responsiveSize(20, 24)};
`;

Expand All @@ -40,12 +48,6 @@ export const StyledLabel = styled.label`
font-size: 16px;
`;

const ButtonContainer = styled.div`
display: flex;
margin-top: 16px;
justify-content: center;
`;

const TopJurors: React.FC = () => {
const { data: queryJurors } = useJurorsByCoherenceScore(0, 5, "coherenceScore", "desc");

Expand All @@ -56,7 +58,10 @@ const TopJurors: React.FC = () => {

return (
<Container>
<Title>Top Jurors</Title>
<TitleAndButtonContainer>
<Title>Top Jurors</Title>
<SeeAllJurorsButton />
</TitleAndButtonContainer>
{!isUndefined(topJurors) && topJurors.length === 0 ? (
<StyledLabel>No jurors found</StyledLabel>
) : (
Expand All @@ -67,9 +72,6 @@ const TopJurors: React.FC = () => {
: [...Array(5)].map((_, i) => <SkeletonDisputeListItem key={i} />)}
</ListContainer>
)}
<ButtonContainer>
<JurorsLeaderboardButton />
</ButtonContainer>
</Container>
);
};
Expand Down
Loading