Skip to content

Commit

Permalink
chore: use renamed @bleu.builders/ui instead of @bleu/ui pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
ribeirojose committed Nov 9, 2024
1 parent c0bc34d commit 1083e25
Show file tree
Hide file tree
Showing 38 changed files with 112 additions and 135 deletions.
4 changes: 0 additions & 4 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@ strict-peer-dependencies=false

; Yarn Node Linker
node-linker=node-modules

# Scoped Registry Configuration for bleu-fi
@bleu:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
2 changes: 1 addition & 1 deletion apps/claim-vesting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@bleu/cow-hooks-ui": "workspace:*",
"@bleu/tsconfig": "workspace:*",
"@bleu/ui": "0.1.131",
"@bleu.builders/ui": "0.1.133",
"@cowprotocol/cow-sdk": "^5.5.1",
"@cowprotocol/hook-dapp-lib": "1.1.0-RC0",
"@ethersproject/providers": "5.7.2",
Expand Down
4 changes: 2 additions & 2 deletions apps/claim-vesting/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useDebounceValue } from "@bleu/ui";
import { useDebounceValue } from "@bleu.builders/ui";

import {
type CoWHookDappActions,
Expand Down 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
8 changes: 4 additions & 4 deletions apps/claim-vesting/src/hooks/useClaimVestingData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatNumber } from "@bleu/ui";
import { formatNumber } from "@bleu.builders/ui";
import type { SupportedChainId } from "@cowprotocol/cow-sdk";
import { useMemo } from "react";
import { type Address, isAddress } from "viem";
Expand Down 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
2 changes: 1 addition & 1 deletion apps/claim-vesting/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const commonConfig = require("../../packages/cow-hooks-ui/tailwind.config.base.j
module.exports = {
content: [
"./src/**/*.{js,ts,jsx,tsx}",
"./node_modules/@bleu/ui/dist/**/*",
"./node_modules/@bleu.builders/ui/dist/**/*",
"../../packages/cow-hooks-ui/src/**/*.{js,ts,jsx,tsx}",
],
theme: commonConfig.theme,
Expand Down
2 changes: 1 addition & 1 deletion apps/create-vesting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@bleu/cow-hooks-ui": "workspace:*",
"@bleu/tsconfig": "workspace:*",
"@bleu/ui": "0.1.131",
"@bleu.builders/ui": "0.1.133",
"@bleu/utils": "workspace:*",
"@cowprotocol/cow-sdk": "^5.5.1",
"@cowprotocol/hook-dapp-lib": "1.2.0",
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 @@ -3,7 +3,7 @@
import { type PropsWithChildren, useCallback, useMemo } from "react";

import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { Form } from "@bleu/ui";
import { Form } from "@bleu.builders/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/ui";
import { formatNumber } from "@bleu.builders/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
4 changes: 2 additions & 2 deletions apps/create-vesting/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = {
important: true,
content: [
"./src/**/*.{js,ts,jsx,tsx}",
"./node_modules/@bleu/ui/dist/**/*",
"../../node_modules/@bleu/ui/dist/**/*",
"./node_modules/@bleu.builders/ui/dist/**/*",
"../../node_modules/@bleu.builders/ui/dist/**/*",
"../../packages/cow-hooks-ui/src/**/*.{js,ts,jsx,tsx}",
],
theme: commonConfig.theme,
Expand Down
2 changes: 1 addition & 1 deletion apps/deposit-pool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@balancer/sdk": "0.26.1",
"@bleu/cow-hooks-ui": "workspace:*",
"@bleu/tsconfig": "workspace:*",
"@bleu/ui": "0.1.131",
"@bleu.builders/ui": "0.1.133",
"@bleu/utils": "workspace:*",
"@cowprotocol/cow-sdk": "^5.5.1",
"@cowprotocol/hook-dapp-lib": "1.1.0-RC0",
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
Expand Up @@ -4,7 +4,7 @@ import {
Spinner,
useIFrameContext,
} from "@bleu/cow-hooks-ui";
import { Label, formatNumber } from "@bleu/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/ui";
import { formatNumber } from "@bleu.builders/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/ui";
import { Button, Input, formatNumber } from "@bleu.builders/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 @@ -3,7 +3,7 @@
import { type PropsWithChildren, useCallback, useMemo } from "react";

import { useIFrameContext } from "@bleu/cow-hooks-ui";
import { Form } from "@bleu/ui";
import { Form } from "@bleu.builders/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
8 changes: 4 additions & 4 deletions apps/deposit-pool/src/utils/formatTokenBalance.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { formatNumber } from "@bleu/ui";
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
4 changes: 2 additions & 2 deletions apps/deposit-pool/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = {
important: true,
content: [
"./src/**/*.{js,ts,jsx,tsx}",
"./node_modules/@bleu/ui/dist/**/*",
"../../node_modules/@bleu/ui/dist/**/*",
"./node_modules/@bleu.builders/ui/dist/**/*",
"../../node_modules/@bleu.builders/ui/dist/**/*",
"../../packages/cow-hooks-ui/src/**/*.{js,ts,jsx,tsx}",
"../../packages/cow-hooks-ui/node_modules/tailwind-scrollbar/**/*",
],
Expand Down
2 changes: 1 addition & 1 deletion apps/withdraw-pool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@balancer/sdk": "0.26.1",
"@bleu/cow-hooks-ui": "workspace:*",
"@bleu/tsconfig": "workspace:*",
"@bleu/ui": "0.1.131",
"@bleu.builders/ui": "0.1.133",
"@bleu/utils": "workspace:*",
"@cowprotocol/contracts": "1.6.0",
"@cowprotocol/cow-sdk": "^5.5.1",
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/ui";
import { formatNumber } from "@bleu.builders/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/ui";
import { Button } from "@bleu.builders/ui";
import { useMemo } from "react";
import { useFormContext, useFormState, useWatch } from "react-hook-form";

Expand Down
Loading

0 comments on commit 1083e25

Please sign in to comment.