Skip to content

Commit

Permalink
runs formatting command
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-garrett committed Jan 15, 2025
1 parent 52ae0d1 commit e0addd4
Show file tree
Hide file tree
Showing 45 changed files with 886 additions and 779 deletions.
12 changes: 6 additions & 6 deletions apps/flame-defi/app/components/DepositCard/DepositCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function DepositCard(): React.ReactElement {
return defaultEvmCurrencyOption;
}
const matchingEvmCurrency = selectedEvmChain?.currencies.find(
(currency) => currency.coinDenom === selectedIbcCurrency.coinDenom
(currency) => currency.coinDenom === selectedIbcCurrency.coinDenom,
);
if (!matchingEvmCurrency) {
return null;
Expand Down Expand Up @@ -102,7 +102,7 @@ export default function DepositCard(): React.ReactElement {
setRecipientAddressOverride("");
};
const updateRecipientAddressOverride = (
event: React.ChangeEvent<HTMLInputElement>
event: React.ChangeEvent<HTMLInputElement>,
) => {
setRecipientAddressOverride(event.target.value);
};
Expand All @@ -123,7 +123,7 @@ export default function DepositCard(): React.ReactElement {

const checkIsFormValid = (
addressInput: string | null,
amountInput: string
amountInput: string,
) => {
if (addressInput === null) {
setIsRecipientAddressValid(false);
Expand Down Expand Up @@ -194,7 +194,7 @@ export default function DepositCard(): React.ReactElement {
try {
const formattedAmount = Decimal.fromUserInput(
amount,
selectedIbcCurrency.coinDecimals
selectedIbcCurrency.coinDecimals,
).atomics;

const signer = await getCosmosSigningClient();
Expand All @@ -203,7 +203,7 @@ export default function DepositCard(): React.ReactElement {
fromAddress,
recipientAddress,
formattedAmount,
selectedIbcCurrency
selectedIbcCurrency,
);
addNotification({
toastOpts: {
Expand Down Expand Up @@ -280,7 +280,7 @@ export default function DepositCard(): React.ReactElement {
RightIcon: PlusIcon,
},
],
[connectCosmosWallet]
[connectCosmosWallet],
);

const additionalEvmChainOptions = useMemo(() => {
Expand Down
12 changes: 6 additions & 6 deletions apps/flame-defi/app/components/WithdrawCard/WithdrawCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function WithdrawCard(): React.ReactElement {
return defaultIbcCurrencyOption;
}
const matchingIbcCurrency = selectedCosmosChain?.currencies.find(
(currency) => currency.coinDenom === selectedEvmCurrency.coinDenom
(currency) => currency.coinDenom === selectedEvmCurrency.coinDenom,
);
if (!matchingIbcCurrency) {
return null;
Expand Down Expand Up @@ -95,7 +95,7 @@ export default function WithdrawCard(): React.ReactElement {
setRecipientAddressOverride("");
};
const updateRecipientAddressOverride = (
event: React.ChangeEvent<HTMLInputElement>
event: React.ChangeEvent<HTMLInputElement>,
) => {
setRecipientAddressOverride(event.target.value);
};
Expand All @@ -115,7 +115,7 @@ export default function WithdrawCard(): React.ReactElement {

const checkIsFormValid = (
recipientAddressInput: string | null,
amountInput: string
amountInput: string,
) => {
if (recipientAddressInput === null) {
setIsRecipientAddressValid(false);
Expand Down Expand Up @@ -199,15 +199,15 @@ export default function WithdrawCard(): React.ReactElement {
const withdrawerSvc = createWithdrawerService(
wagmiConfig,
contractAddress,
Boolean(selectedEvmCurrency.erc20ContractAddress)
Boolean(selectedEvmCurrency.erc20ContractAddress),
);
await withdrawerSvc.withdrawToIbcChain(
selectedEvmChain.chainId,
recipientAddress,
amount,
selectedEvmCurrency.coinDecimals,
selectedEvmCurrency.ibcWithdrawalFeeWei,
""
"",
);
addNotification({
toastOpts: {
Expand Down Expand Up @@ -279,7 +279,7 @@ export default function WithdrawCard(): React.ReactElement {
rightIconClass: "fas fa-pen-to-square",
},
],
[handleConnectCosmosWallet, handleEditRecipientClick]
[handleConnectCosmosWallet, handleEditRecipientClick],
);

const additionalEvmOptions = useMemo(() => {
Expand Down
7 changes: 6 additions & 1 deletion apps/flame-defi/app/config/chainConfigs/ChainConfigsDawn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { CelestiaIcon, FlameIcon, NeutronIcon, NobleIcon } from "@repo/ui/icons";
import {
CelestiaIcon,
FlameIcon,
NeutronIcon,
NobleIcon,
} from "@repo/ui/icons";
import type {
CosmosChainInfo,
CosmosChains,
Expand Down
1 change: 0 additions & 1 deletion apps/flame-defi/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default function RootLayout({
}: {
children: React.ReactNode;
}) {

return (
<html lang="en">
<body>
Expand Down
2 changes: 1 addition & 1 deletion apps/flame-defi/app/swap/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function SwapPage(): React.ReactElement {
setInputSelected(
inputSelected === TOKEN_INPUTS.TOKEN_ONE
? TOKEN_INPUTS.TOKEN_TWO
: TOKEN_INPUTS.TOKEN_ONE
: TOKEN_INPUTS.TOKEN_ONE,
);
setInputOne((prev) => ({ ...prev, token: inputTwo.token }));
setInputTwo((prev) => ({ ...prev, token: inputOne.token }));
Expand Down
84 changes: 45 additions & 39 deletions apps/flame-defi/app/swap/useTokenModal.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,49 @@
import { CelestiaIcon, MilkTiaIcon, StrideTiaIcon, UsdcIcon, WrappedTiaIcon } from "@repo/ui/icons";
import {
CelestiaIcon,
MilkTiaIcon,
StrideTiaIcon,
UsdcIcon,
WrappedTiaIcon,
} from "@repo/ui/icons";
import { IconProps } from "@repo/ui/types";

export interface TokenItem {
Icon: React.ComponentType<IconProps>;
title: string;
symbol: string;
}

// NOTE: temporary tokens until we have a real token list from a api
const tokens: TokenItem[] = [
{
Icon: CelestiaIcon,
title: "TIA",
symbol: "TIA",
},
{
Icon: WrappedTiaIcon,
title: "Wrapped Celestia",
symbol: "WTIA",
},
{
Icon: MilkTiaIcon,
title: "Milk TIA",
symbol: "milkTIA",
},
{
Icon: StrideTiaIcon,
title: "Stride TIA",
symbol: "stTIA",
},
{
Icon: UsdcIcon,
title: "USDC",
symbol: "USDC",
},
];
Icon: React.ComponentType<IconProps>;
title: string;
symbol: string;
}

export function useTokenModal() {
return {
tokens,
};
}
// NOTE: temporary tokens until we have a real token list from a api
const tokens: TokenItem[] = [
{
Icon: CelestiaIcon,
title: "TIA",
symbol: "TIA",
},
{
Icon: WrappedTiaIcon,
title: "Wrapped Celestia",
symbol: "WTIA",
},
{
Icon: MilkTiaIcon,
title: "Milk TIA",
symbol: "milkTIA",
},
{
Icon: StrideTiaIcon,
title: "Stride TIA",
symbol: "stTIA",
},
{
Icon: UsdcIcon,
title: "USDC",
symbol: "USDC",
},
];

export function useTokenModal() {
return {
tokens,
};
}
7 changes: 3 additions & 4 deletions packages/ui/src/components/Dropdown/Dropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,25 @@ describe("Dropdown Component", () => {
{ label: "Option 2", value: "option2" },
{ label: "Option 3", value: "option3" },
];

test("displays selected option", () => {
render(
<Dropdown
options={mockOptions}
defaultOption={mockOptions[1]} // Use "Option 2" as default
onSelect={() => {}}
/>
/>,
);
expect(screen.getByText("Option 2")).toBeInTheDocument();
});

test("displays selected option after user clicks it", () => {
render(<Dropdown options={mockOptions} onSelect={() => {}} />);

fireEvent.click(screen.getByRole("button"));
fireEvent.click(screen.getByText("Option 2"));
expect(screen.getByText("Option 2")).toBeInTheDocument();
});


test("calls onSelect with correct value when option is clicked", () => {
const onSelect = jest.fn();
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const Dropdown = <T,>({
setIsActive(false);
onSelect(option.value);
},
[onSelect]
[onSelect],
);

const toggleDropdown = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const SettingsPopover: React.FC<SettingsPopoverProps> = () => {
const [showExpertModeDialog, setShowExpertModeDialog] = useState(false);

const handleCustomSlippageChange = (
e: React.ChangeEvent<HTMLInputElement>
e: React.ChangeEvent<HTMLInputElement>,
) => {
const value = e.target.value;
setCustomSlippage(value);
Expand Down
20 changes: 10 additions & 10 deletions packages/ui/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export * from './ActionButton/ActionButton';
export * from './CopyToClipboardButton/CopyToClipboardButton';
export * from './Dropdown/Dropdown';
export * from './AnimatedDownArrowSpacer/AnimatedDownArrowSpacer';
export * from './Footer/Footer';
export * from './SideTag/SideTag';
export * from './TokenSelector/TokenSelector';
export * from './SettingsPopover/SettingsPopover';
export * from './InfoTooltip/InfoTooltip';
export * from './TxnInfo/TxnInfo';
export * from "./ActionButton/ActionButton";
export * from "./CopyToClipboardButton/CopyToClipboardButton";
export * from "./Dropdown/Dropdown";
export * from "./AnimatedDownArrowSpacer/AnimatedDownArrowSpacer";
export * from "./Footer/Footer";
export * from "./SideTag/SideTag";
export * from "./TokenSelector/TokenSelector";
export * from "./SettingsPopover/SettingsPopover";
export * from "./InfoTooltip/InfoTooltip";
export * from "./TxnInfo/TxnInfo";
26 changes: 14 additions & 12 deletions packages/ui/src/icons/ArrowUpDownIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
import type { IconProps } from "../types";

export const ArrowUpDownIcon: React.FC<IconProps> = ({ className = "", size = 24 }) => {
export const ArrowUpDownIcon: React.FC<IconProps> = ({
className = "",
size = 24,
}) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor"
width={size}
height={size}
className={className}
aria-hidden="true"

>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M3 7.5 7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5"
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M3 7.5 7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5"
/>
</svg>
);
};
};
29 changes: 16 additions & 13 deletions packages/ui/src/icons/CelestiaIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import type { IconProps } from "../types";

export const CelestiaIcon: React.FC<IconProps> = ({ className = "", size = 24 }) => {
return (
<div
className={`inline-block bg-contain bg-no-repeat bg-center ${className}`}
style={{
width: size,
height: size,
backgroundImage: "url(/assets/icons/logos/celestia-logo-color.png)"
}}
/>
);
};

export const CelestiaIcon: React.FC<IconProps> = ({
className = "",
size = 24,
}) => {
return (
<div
className={`inline-block bg-contain bg-no-repeat bg-center ${className}`}
style={{
width: size,
height: size,
backgroundImage: "url(/assets/icons/logos/celestia-logo-color.png)",
}}
/>
);
};
7 changes: 5 additions & 2 deletions packages/ui/src/icons/ChevronDownIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type { IconProps } from "../types";

export const ChevronDownIcon: React.FC<IconProps> = ({ className = "", size = 24 }) => {
export const ChevronDownIcon: React.FC<IconProps> = ({
className = "",
size = 24,
}) => {
return (
<svg
width={size}
Expand All @@ -20,4 +23,4 @@ export const ChevronDownIcon: React.FC<IconProps> = ({ className = "", size = 24
/>
</svg>
);
};
};
Loading

0 comments on commit e0addd4

Please sign in to comment.