Skip to content

Commit 1927998

Browse files
committed
chore(web): use-is-empty-function
1 parent ec69044 commit 1927998

File tree

6 files changed

+14
-8
lines changed

6 files changed

+14
-8
lines changed

web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/FormContact.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Dispatch, SetStateAction, useMemo, useEffect } from "react";
22
import styled from "styled-components";
33

44
import { Field } from "@kleros/ui-components-library";
5+
import { isEmpty } from "src/utils";
56

67
const StyledLabel = styled.label`
78
display: flex;
@@ -47,7 +48,7 @@ const FormContact: React.FC<IForm> = ({
4748
};
4849

4950
const fieldVariant = useMemo(() => {
50-
if (contactInput === "" || !isEditing) {
51+
if (isEmpty(contactInput) || !isEditing) {
5152
return undefined;
5253
}
5354
return contactIsValid ? "success" : "error";

web/src/pages/Settings/EmailConfirmation/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const messageConfigs = {
110110
confirmed: {
111111
headerMsg: "Congratulations! \nYour email has been verified!",
112112
subtitleMsg:
113-
"We'll remind you when your actions are required on Court, and send you notifications on key moments to help you achieve the best of Kleros.",
113+
"We'll remind you when your actions are required on Curate, and send you notifications on key moments to help you achieve the best of Kleros.",
114114
buttonMsg: "Let's start!",
115115
buttonTo: "/",
116116
Icon: CheckIcon,

web/src/pages/SubmitItem/NavigationButtons/PreviousButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import React from "react";
22
import styled from "styled-components";
33
import { Button } from "@kleros/ui-components-library";
44
import { useNavigate } from "react-router-dom";
5+
import { isEmpty } from "src/utils";
56

67
const StyledButton = styled(Button)<{ prevRoute: string }>`
7-
display: ${({ prevRoute }) => (prevRoute === "" ? "none" : "flex")};
8+
display: ${({ prevRoute }) => (isEmpty(prevRoute) ? "none" : "flex")};
89
`;
910

1011
interface IReturnButton {

web/src/pages/SubmitList/AdvancedParameters/ArbitrationParameters.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import styled, { css } from "styled-components";
44
import LabeledInput from "components/LabeledInput";
55
import { landscapeStyle } from "styles/landscapeStyle";
66
import { rootCourtToItems, useCourtTree } from "hooks/queries/useCourtTree";
7-
import { isUndefined } from "utils/index";
7+
import { isEmpty, isUndefined } from "utils/index";
88
import Skeleton from "react-loading-skeleton";
99
import ETH from "svgs/icons/eth-round.svg";
1010
import LightButton from "components/LightButton";
@@ -74,7 +74,10 @@ const AbritrationParameters: React.FC = () => {
7474
const { data } = useCourtTree();
7575
const items = useMemo(() => !isUndefined(data) && [rootCourtToItems(data.court)], [data]);
7676

77-
const isGovernorValid = useMemo(() => listData.governor === "" || isAddress(listData.governor), [listData.governor]);
77+
const isGovernorValid = useMemo(
78+
() => isEmpty(listData.governor) || isAddress(listData.governor),
79+
[listData.governor]
80+
);
7881

7982
const { arbitrationCost } = useArbitrationCost(
8083
prepareArbitratorExtradata(listData.courtId ?? "1", listData.numberOfJurors)

web/src/pages/SubmitList/NavigationButtons/PreviousButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import styled from "styled-components";
33
import { Button } from "@kleros/ui-components-library";
44
import { useLocation, useNavigate } from "react-router-dom";
55
import { ListProgress, useSubmitListContext } from "context/SubmitListContext";
6+
import { isEmpty } from "src/utils";
67

78
const StyledButton = styled(Button)<{ prevRoute: string }>`
8-
display: ${({ prevRoute }) => (prevRoute === "" ? "none" : "flex")};
9+
display: ${({ prevRoute }) => (isEmpty(prevRoute) ? "none" : "flex")};
910
`;
1011

1112
interface IReturnButton {

web/src/utils/submitListUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { IList, IListData, IListMetadata, ListField } from "context/SubmitListContext";
22
import { prepareArbitratorExtradata } from "./prepareArbitratorExtradata";
33
import { Address, Log, decodeEventLog, isAddress, parseAbi, parseEther, zeroAddress } from "viem";
4-
import { isUndefined } from ".";
4+
import { isEmpty, isUndefined } from ".";
55
import { TEMPLATE_REGISTRY } from "consts/arbitration";
66
import { ItemDetailsFragment, Status } from "src/graphql/graphql";
77
import { arbitrum } from "viem/chains";
@@ -10,7 +10,7 @@ import { registrationTemplate, removalTemplate, dataMappings } from "@kleros/cur
1010
export const constructListParams = (listData: IListData, listMetadata: IListMetadata) => {
1111
const baseTemplate = { ...listData } as IList;
1212

13-
if (!isUndefined(listMetadata.policyURI) && listMetadata.policyURI === "") delete listMetadata.policyURI;
13+
if (!isUndefined(listMetadata.policyURI) && isEmpty(listMetadata.policyURI)) delete listMetadata.policyURI;
1414
baseTemplate.listMetadata = JSON.stringify(listMetadata);
1515
baseTemplate.baseDeposits = [
1616
parseEther(listData.submissionBaseDeposit),

0 commit comments

Comments
 (0)