Skip to content

Commit

Permalink
chore: fix biome issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ribeirojose committed Nov 9, 2024
1 parent 1083e25 commit adcc092
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion apps/claim-vesting/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Page() {
const { account, chainId } = context || {};

const [typedAddress, setTypedAddress] = useState<string>(
context?.hookToEdit?.hook.target || ""
context?.hookToEdit?.hook.target || "",
);

const [debouncedAddress] = useDebounceValue(typedAddress, 300, {
Expand Down
6 changes: 3 additions & 3 deletions apps/claim-vesting/src/hooks/useClaimVestingData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const useClaimVestingData = ({
chain: chainMapping[chainId],
transport: http(),
}),
[chainId]
[chainId],
);
const {
claimableAmountWei,
Expand Down Expand Up @@ -96,7 +96,7 @@ export const useClaimVestingData = ({
6,
"decimal",
"standard",
0.000001
0.000001,
)
: "0.0";
const formattedClaimableAmountFullDecimals =
Expand All @@ -106,7 +106,7 @@ export const useClaimVestingData = ({
Number(decimals),
"decimal",
"standard",
Number(`0.${"0".repeat(Number(decimals) - 1)}1`)
Number(`0.${"0".repeat(Number(decimals) - 1)}1`),
)
: "0.0";
const loading = isLoadingToken || isLoadingVesting || isLoadingGasLimit;
Expand Down
6 changes: 3 additions & 3 deletions apps/create-vesting/src/context/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { type PropsWithChildren, useCallback, useMemo } from "react";

import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { Form } from "@bleu.builders/ui";
import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useRouter } from "next/navigation";
import { useForm } from "react-hook-form";
Expand Down Expand Up @@ -95,12 +95,12 @@ export function FormContextProvider({ children }: PropsWithChildren) {
getHooksTransactions,
setError,
clearErrors,
]
],
);

const onSubmit = useMemo(
() => form.handleSubmit(onSubmitCallback),
[form, onSubmitCallback]
[form, onSubmitCallback],
);

return (
Expand Down
14 changes: 7 additions & 7 deletions apps/create-vesting/src/hooks/useFormatVariables.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { formatNumber } from "@bleu.builders/ui";
import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { useMemo } from "react";

export const useFormatVariables = ({
Expand All @@ -16,47 +16,47 @@ export const useFormatVariables = ({
userBalance !== undefined && tokenDecimals
? Number(userBalance) / 10 ** Number(tokenDecimals)
: undefined,
[userBalance, tokenDecimals]
[userBalance, tokenDecimals],
);

const swapAmountFloat = useMemo(
() =>
context?.orderParams?.buyAmount !== undefined && tokenDecimals
? Number(context?.orderParams?.buyAmount) / 10 ** Number(tokenDecimals)
: undefined,
[context?.orderParams?.buyAmount, tokenDecimals]
[context?.orderParams?.buyAmount, tokenDecimals],
);

const allAfterSwapFloat = useMemo(
() =>
userBalanceFloat !== undefined && swapAmountFloat !== undefined
? userBalanceFloat + swapAmountFloat
: undefined,
[userBalanceFloat, swapAmountFloat]
[userBalanceFloat, swapAmountFloat],
);

const formattedUserBalance = useMemo(
() =>
userBalanceFloat !== undefined
? formatNumber(userBalanceFloat, 4, "decimal", "standard", 0.0001)
: "",
[userBalanceFloat]
[userBalanceFloat],
);

const formattedSwapAmount = useMemo(
() =>
swapAmountFloat !== undefined
? formatNumber(swapAmountFloat, 4, "decimal", "standard", 0.0001)
: "",
[swapAmountFloat]
[swapAmountFloat],
);

const formattedAllAfterSwap = useMemo(
() =>
allAfterSwapFloat !== undefined
? formatNumber(allAfterSwapFloat, 6, "decimal", "standard", 0.000001)
: "",
[allAfterSwapFloat]
[allAfterSwapFloat],
);

return {
Expand Down
10 changes: 5 additions & 5 deletions apps/deposit-pool/src/components/PoolForm.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Label, formatNumber } from "@bleu.builders/ui";
import {
type IPool,
Info,
Spinner,
useIFrameContext,
} from "@bleu/cow-hooks-ui";
import { Label, formatNumber } from "@bleu.builders/ui";
import { useCallback, useEffect, useMemo } from "react";
import { useFormContext, useWatch } from "react-hook-form";
import { type Address, formatUnits } from "viem";
Expand All @@ -27,7 +27,7 @@ export function PoolForm({ pool }: { pool: IPool | undefined }) {

const { buyAmount } = useSwapAmount();
const buyAmountAfterSwap = useTokenBalanceAfterSwap(
context?.orderParams?.buyTokenAddress as Address
context?.orderParams?.buyTokenAddress as Address,
);

const { data: poolBalances, isLoading: isBalanceLoading } = usePoolBalance({
Expand All @@ -51,7 +51,7 @@ export function PoolForm({ pool }: { pool: IPool | undefined }) {

const tokenPrices = useMemo(
() => poolBalances?.map((poolBalance) => getTokenPrice(poolBalance)),
[poolBalances]
[poolBalances],
);

const totalUsd = useMemo(() => {
Expand Down Expand Up @@ -87,14 +87,14 @@ export function PoolForm({ pool }: { pool: IPool | undefined }) {
const tokenAmountKey = `amounts.${tokenAmountAddress}` as const;
const calculatedAmount = formatUnits(
tokenAmount.rawAmount,
tokenAmount.decimals
tokenAmount.decimals,
);
setValue(tokenAmountKey, calculatedAmount);
}

setValue("referenceTokenAddress", address);
},
[poolBalances, tokenPrices, pool, setValue]
[poolBalances, tokenPrices, pool, setValue],
);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/deposit-pool/src/components/PoolItemInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IPool } from "@bleu/cow-hooks-ui";
import { formatNumber } from "@bleu.builders/ui";
import type { IPool } from "@bleu/cow-hooks-ui";

export function PoolItemInfo({ pool }: { pool: IPool }) {
const aprSumPct =
Expand Down
14 changes: 7 additions & 7 deletions apps/deposit-pool/src/components/TokenAmountInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type IBalance, TokenLogoWithWeight } from "@bleu/cow-hooks-ui";
import { Button, Input, formatNumber } from "@bleu.builders/ui";
import { type IBalance, TokenLogoWithWeight } from "@bleu/cow-hooks-ui";
import { useCallback, useMemo } from "react";
import { useFormContext, useWatch } from "react-hook-form";
import type { Address } from "viem";
Expand Down Expand Up @@ -32,7 +32,7 @@ export function TokenAmountInput({
});

const tokenBalanceAfterSwap = useTokenBalanceAfterSwap(
poolBalance.token.address
poolBalance.token.address,
);

const amountUsd = useMemo(() => {
Expand All @@ -46,11 +46,11 @@ export function TokenAmountInput({
if (updateTokenAmounts) {
updateTokenAmounts(
constraintStringToBeNumeric(amount),
poolBalance.token.address as Address
poolBalance.token.address as Address,
);
}
},
[updateTokenAmounts, poolBalance.token.address]
[updateTokenAmounts, poolBalance.token.address],
);

const disabled = amountFromSwap || amountFromAccount;
Expand Down Expand Up @@ -82,7 +82,7 @@ export function TokenAmountInput({
onChange(e.target.value);
setValue(
`amounts.${poolBalance.token.address.toLowerCase()}`,
constraintStringToBeNumeric(e.target.value)
constraintStringToBeNumeric(e.target.value),
);
},
})}
Expand All @@ -104,7 +104,7 @@ export function TokenAmountInput({
4,
"decimal",
"standard",
0.0001
0.0001,
)}
</span>
{!buttonDisabled && (
Expand All @@ -115,7 +115,7 @@ export function TokenAmountInput({
onClick={() => {
setValue(
`amounts.${poolBalance.token.address.toLowerCase()}`,
tokenBalanceAfterSwap
tokenBalanceAfterSwap,
);
onChange(tokenBalanceAfterSwap);
}}
Expand Down
6 changes: 3 additions & 3 deletions apps/deposit-pool/src/contexts/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { type PropsWithChildren, useCallback, useMemo } from "react";

import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { Form } from "@bleu.builders/ui";
import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { useRouter } from "next/navigation";
import { useForm, useWatch } from "react-hook-form";
import { useGetHookInfo } from "#/hooks/useGetHookInfo";
Expand All @@ -27,7 +27,7 @@ export function FormContextProvider({ children }: PropsWithChildren) {

const selectedPool = useMemo(
() => pools?.find((pool) => pool.id === poolId),
[pools, poolId]
[pools, poolId],
);

const getHookInfo = useGetHookInfo(selectedPool);
Expand All @@ -39,7 +39,7 @@ export function FormContextProvider({ children }: PropsWithChildren) {
setHookInfo(hookInfo);
router.push("/signing");
},
[getHookInfo, setHookInfo, router]
[getHookInfo, setHookInfo, router],
);

return (
Expand Down
6 changes: 3 additions & 3 deletions apps/deposit-pool/src/utils/formatTokenBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { formatNumber } from "@bleu.builders/ui";
export const formatTokenBalance = (
balance: bigint,
tokenDecimals: number,
swapAmount: string | null
swapAmount: string | null,
) => {
const balanceNowFloat = Number(balance) / 10 ** tokenDecimals;
const swapAmountFloat =
Expand All @@ -15,15 +15,15 @@ export const formatTokenBalance = (
4,
"decimal",
"standard",
0.0001
0.0001,
);

const balanceAfterSwapFormatted = formatNumber(
balanceAfterSwapFloat,
4,
"decimal",
"standard",
0.0001
0.0001,
);

return {
Expand Down
2 changes: 1 addition & 1 deletion apps/withdraw-pool/src/components/PoolItemInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IPool } from "@bleu/cow-hooks-ui";
import { formatNumber } from "@bleu.builders/ui";
import type { IPool } from "@bleu/cow-hooks-ui";

export function PoolItemInfo({ pool }: { pool: IPool }) {
return <i>${formatNumber(pool.userBalance.walletBalanceUsd, 2)}</i>;
Expand Down
2 changes: 1 addition & 1 deletion apps/withdraw-pool/src/components/SubmitButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { Button } from "@bleu.builders/ui";
import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { useMemo } from "react";
import { useFormContext, useFormState, useWatch } from "react-hook-form";

Expand Down
4 changes: 2 additions & 2 deletions apps/withdraw-pool/src/components/WithdrawPctSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { Input } from "@bleu/cow-hooks-ui";
import { Button, Label, cn } from "@bleu.builders/ui";
import { Input } from "@bleu/cow-hooks-ui";
import { useFormContext, useWatch } from "react-hook-form";
import type { withdrawSchema } from "#/utils/schema";

Expand All @@ -23,7 +23,7 @@ export function WithdrawPctSlider() {
variant="ghost"
className={cn(
"rounded-2xl text-xs py-1 bg-accent text-accent-foreground opacity-50 hover:opacity-100 h-fit",
withdrawPct.toString() === pct.toString() ? "opacity-100" : ""
withdrawPct.toString() === pct.toString() ? "opacity-100" : "",
)}
onClick={() => setValue("withdrawPct", pct)}
>
Expand Down
6 changes: 3 additions & 3 deletions apps/withdraw-pool/src/context/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { type PropsWithChildren, useCallback, useEffect, useMemo } from "react";

import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { Form } from "@bleu.builders/ui";
import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useRouter } from "next/navigation";
import { useForm, useWatch } from "react-hook-form";
Expand Down Expand Up @@ -32,7 +32,7 @@ export function FormContextProvider({ children }: PropsWithChildren) {

const selectedPool = useMemo(() => {
return pools?.find(
(pool) => pool.id.toLowerCase() === poolId?.toLowerCase()
(pool) => pool.id.toLowerCase() === poolId?.toLowerCase(),
);
}, [pools, poolId]);

Expand All @@ -47,7 +47,7 @@ export function FormContextProvider({ children }: PropsWithChildren) {
setHookInfo(hookInfo);
router.push("/signing");
},
[getHooksTransactions, setHookInfo, router]
[getHooksTransactions, setHookInfo, router],
);

// biome-ignore lint:
Expand Down
2 changes: 1 addition & 1 deletion packages/cow-hooks-ui/src/ButtonPrimary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const ButtonPrimary: React.FC<
<button
className={cn(
"flex flex-row flex-wrap w-full items-center justify-center text-sm font-semibold border-none shadow-none rounded-2xl relative min-h-[58px] xsm:text-lg disabled:border-transparent bg-color-primary text-color-button-text transition-colors duration-200 ease-in-out focus:shadow-none focus:transform-none focus:bg-color-primary-lighter hover:shadow-none hover:transform-none hover:bg-color-primary-lighter active:shadow-none active:transform-none active:bg-color-primary-lighter disabled:outline-none disabled:cursor-auto disabled:shadow-none disabled:bg-color-paper-darker disabled:text-color-button-text-disabled mb-4",
className
className,
)}
disabled={disabled}
{...props}
Expand Down
4 changes: 2 additions & 2 deletions packages/cow-hooks-ui/src/PoolsDropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function PoolsDropdownMenu({
<a
className={cn(
"inline-flex justify-start transition-colors text-primary underline-offset-4 hover:underline p-0 m-0 text-xs h-fit w-full",
{ "justify-center": isCheckDetailsCentered }
{ "justify-center": isCheckDetailsCentered },
)}
href={poolLink}
target="_blank"
Expand Down Expand Up @@ -148,7 +148,7 @@ export function PoolLogo({ pool }: { pool: IPool }) {
context.chainId,
token.address,
token.decimals,
token.symbol
token.symbol,
)
}
weight={token.weight}
Expand Down
2 changes: 1 addition & 1 deletion packages/cow-hooks-ui/src/TokenLogoWithWeight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function TokenLogoWithWeight({
<div
className={cn(
"flex items-center rounded-xl text-md py-1 px-2 gap-1 bg-background text-foreground border border-1 border-muted w-fit",
className
className,
)}
>
<div className="hidden xsm:flex">{weight * 100}%</div>
Expand Down
Loading

0 comments on commit adcc092

Please sign in to comment.