Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucianosc committed Sep 12, 2024
1 parent 5ea06c2 commit 696bf95
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
33 changes: 15 additions & 18 deletions apps/web/components/Forms/AllowListInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
UseFormSetValue,
} from "react-hook-form";
import { Address } from "viem";
import { FormAddressInput } from "./FormAddressInput";
import { Button } from "../Button";
import { InfoWrapper } from "../InfoWrapper";

Expand Down Expand Up @@ -146,9 +147,9 @@ export function AllowListInput({
>
<button
type="button"
className={`w-full py-2 rounded-lg text-center px-4 ${
className={`w-full py-2 rounded-lg text-center px-4 text-semibold ${
inputMode === "single" ?
"border border-secondary-content bg-secondary-soft text-black -m-[1px]"
"border border-border-neutral bg-neutral-soft text-black -m-[1px]"
: ""
}`}
onClick={() => setInputMode("single")}
Expand All @@ -157,36 +158,32 @@ export function AllowListInput({
</button>
<button
type="button"
className={`w-full py-2 rounded-lg text-center px-4 ${
className={`w-full py-2 rounded-lg text-center px-4 text-semibold ${
inputMode === "bulk" ?
"border border-secondary-content bg-secondary-soft text-black -m-[1px]"
"border border-border-neutral bg-neutral-soft text-black -m-[1px]"
: ""
}`}
onClick={() => setInputMode("bulk")}
>
Bulk Input
</button>
</div>

{inputMode === "single" ?
<div className="flex mb-4">
<input
type="text"
value={newAddress}
onChange={(e) => setNewAddress(e.target.value)}
required={required && addresses.length === 0}
<div className="flex mb-4 gap-2">
<FormAddressInput
placeholder={placeholder}
className={`input input-bordered input-info w-full max-w-md mr-2 ${
className ?? ""
}`}
required={required && addresses.length === 0}
onChange={(e) => setNewAddress(e)}
value={newAddress}
className="w-full"
/>
<Button
type="button"
btnStyle="outline"
className="!py-3 !px-4 flex items-center"
onClick={() => addAddresses(newAddress)}
>
<PlusIcon className="w-5 h-5 mr-2" /> Add
<PlusIcon className="w-5 h-5" /> Add
</Button>
</div>
: <div className="mb-4">
Expand All @@ -206,8 +203,7 @@ export function AllowListInput({
className=""
onClick={() => addAddresses(bulkAddresses)}
>
<ArrowUpTrayIcon className="w-5 h-5 mr-2 stroke-2" /> Add Bulk
Addresses
<ArrowUpTrayIcon className="w-5 h-5 stroke-2" /> Add Bulk Addresses
</Button>
</div>
}
Expand Down Expand Up @@ -252,6 +248,7 @@ export function AllowListInput({
<ul className="space-y-2 max-h-60 overflow-y-auto border1 p-2 rounded-xl">
{addresses.map((address, index) => (
<li
// eslint-disable-next-line react/no-array-index-key
key={`addr_${index}`}
className="flex items-center justify-between bg-base-200 rounded"
>
Expand All @@ -260,7 +257,7 @@ export function AllowListInput({
</span>
<Button
type="button"
btnStyle="outline"
btnStyle="link"
className="!p-[2px] !text-black !border-black"
onClick={() => removeAddress(index)}
>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/components/Forms/FormAddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Props = {
placeholder?: string;
errors?: any;
register?: any;
registerKey: string;
registerKey?: string;
registerOptions?: RegisterOptions;
required?: boolean;
readOnly?: boolean;
Expand Down Expand Up @@ -91,7 +91,7 @@ export const FormAddressInput = ({
}, [resolvedAddress, input]);

let modifier = "";
if (errors || !isValid) {
if (input && (errors || !isValid)) {
modifier = "border-error";
} else if (disabled) {
modifier = "border-disabled";
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/Forms/PoolEditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { FormRadioButton } from "./FormRadioButton";
import { FormSelect } from "./FormSelect";
import { Button } from "../Button";
import { EthAddress } from "../EthAddress";
import { InfoBox } from "../InfoBox";
import { chainConfigMap } from "@/configs/chains";
import { usePubSubContext } from "@/contexts/pubsub.context";
import { useChainFromPath } from "@/hooks/useChainFromPath";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/Forms/PoolForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export function PoolForm({ token, communityAddr }: Props) {
trigger("poolTokenAddress");
}
}, [customTokenData, watchedAddress, trigger]);
console.log(sybilResistanceValue, errors);
console.debug(sybilResistanceValue, errors);
return (
<form onSubmit={handleSubmit(handlePreview)} className="w-full">
{showPreview ?
Expand Down

0 comments on commit 696bf95

Please sign in to comment.