From 928c69b9012b88ed42ea3fe5a1bd84db8e7bc802 Mon Sep 17 00:00:00 2001 From: hz002 Date: Fri, 19 Sep 2025 15:31:45 +0800 Subject: [PATCH] feat: cex logo tooltips (#3181) --- src/ui/component/TokenSelector/CexLogos.tsx | 48 +++++++++++++++------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/src/ui/component/TokenSelector/CexLogos.tsx b/src/ui/component/TokenSelector/CexLogos.tsx index f46ba9d1b..fcea57ee7 100644 --- a/src/ui/component/TokenSelector/CexLogos.tsx +++ b/src/ui/component/TokenSelector/CexLogos.tsx @@ -1,17 +1,23 @@ import { globalSupportCexList } from '@/ui/models/exchange'; +import { Tooltip } from 'antd'; import React, { useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; interface Props { cexIds: string[]; } export const ExchangeLogos = ({ cexIds }: Props) => { + const { t } = useTranslation(); const logos = useMemo(() => { return cexIds ?.map((id) => { const cex = globalSupportCexList.find((cex) => cex.id === id); - return cex?.logo; + return { + logo: cex?.logo, + name: cex?.name, + }; }) - .filter(Boolean); + .filter((i) => i.logo && i.name); }, [cexIds]); if (cexIds?.length === 0) { return null; @@ -19,18 +25,36 @@ export const ExchangeLogos = ({ cexIds }: Props) => { return (
- {logos.slice(0, 4).map((url) => ( - + {logos.slice(0, 4).map(({ logo, name }) => ( + +
+ +
+
))} + {logos.length > 4 ? ( - - +{logos.length - 4} - + e.name) + .join(','), + })} + trigger={['hover']} + overlayClassName="rectangle w-[max-content]" + > + + +{logos.length - 4} + + ) : null}
);