Skip to content

Commit 9a09569

Browse files
committed
fix(web): code smells
1 parent 0574615 commit 9a09569

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

web/src/components/CasesDisplay/CasesGrid.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ const CasesGrid: React.FC<ICasesGrid> = ({ disputes, casesPerPage, totalPages, c
7272
<CasesListHeader />
7373
{isUndefined(disputes)
7474
? [...Array(casesPerPage)].map((_, i) => <StyledSkeleton key={i} />)
75-
: disputes.map((dispute, i) => {
76-
return <DisputeCard key={i} {...dispute} />;
75+
: disputes.map((dispute) => {
76+
return <DisputeCard key={dispute.id} {...dispute} />;
7777
})}
7878
</ListContainer>
7979
) : (
8080
<GridContainer>
8181
{isUndefined(disputes)
8282
? [...Array(casesPerPage)].map((_, i) => <StyledSkeleton key={i} />)
83-
: disputes.map((dispute, i) => {
84-
return <DisputeCard key={i} {...dispute} overrideIsList />;
83+
: disputes.map((dispute) => {
84+
return <DisputeCard key={dispute.id} {...dispute} overrideIsList />;
8585
})}
8686
</GridContainer>
8787
)}

web/src/components/Field.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
22
import { Link } from "react-router-dom";
33
import styled from "styled-components";
4-
import { useIsList } from "context/IsListProvider";
54

65
const FieldContainer = styled.div<FieldContainerProps>`
76
width: ${({ isList }) => (isList ? "auto" : "100%")};

web/src/hooks/queries/useCourtTree.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const courtTreeQuery = graphql(`
3434
`);
3535

3636
export const useCourtTree = () => {
37-
return useQuery({
37+
return useQuery<CourtTreeQuery>({
3838
queryKey: ["courtTreeQuery"],
3939
queryFn: async () => await graphqlQueryFnHelper(courtTreeQuery, {}),
4040
});
@@ -46,8 +46,8 @@ interface IItem {
4646
children?: IItem[];
4747
}
4848

49-
export const rootCourtToItems = (court: CourtTreeQuery["court"], value?: "id" | "path"): IItem => ({
50-
label: court!.name ? court!.name : "Unnamed Court",
51-
value: value === "id" ? court!.id : `/courts/${court!.id}`,
52-
children: court!.children.length > 0 ? court!.children.map((child) => rootCourtToItems(child)) : undefined,
49+
export const rootCourtToItems = (court: NonNullable<CourtTreeQuery["court"]>, value?: "id" | "path"): IItem => ({
50+
label: court.name ? court.name : "Unnamed Court",
51+
value: value === "id" ? court.id : `/courts/${court.id}`,
52+
children: court.children.length > 0 ? court.children.map((child) => rootCourtToItems(child)) : undefined,
5353
});

0 commit comments

Comments
 (0)