import { MIcon } from "@components/common/MIcon";
import { useActiveRoute } from "@hooks/apis/common/quote/useActiveRoute";
import { isAutoQuote } from "@hooks/apis/common/quote/useQuote";

export const RefundWarning = () => {
	const { data: activeRoute } = useActiveRoute();
	const isAutoRoute = isAutoQuote(activeRoute);
	const { isSwapRoute } = activeRoute || {};

	// if not auto route or swap route, return null
	if (!isAutoRoute || isSwapRoute) return null;

	// if swap output token is 0x, return null
	const nullSwapOutputToken =
		activeRoute?.signTypedData?.values?.witness?.swapOutputToken ===
		"0x0000000000000000000000000000000000000000";
	if (nullSwapOutputToken) return null;

	return (
		<div className="bn-px-4 bn-py-2 bn-space-x-2 bn-flex bn-items-center bn-border-t bn-border-dashed bn-border-strong">
			<MIcon name="info" classNames="bn-text-theme bn-text-2xl" />
			<p className="bn-text-primary bn-text-[13px]">
				To lock in trade value, we convert your tokens into USDC. Unfilled amounts might
				be refunded in USDC.
			</p>
		</div>
	);
};
