From c227679ccfbbaac65ba7cded290081043593a874 Mon Sep 17 00:00:00 2001 From: wenliang Date: Fri, 13 Feb 2026 16:34:51 +0800 Subject: [PATCH] Fix: Address Copilot review (use slice for suffix removal, remove unused import) --- components/watchlist/TradingViewWatchlist.tsx | 2 -- lib/utils.ts | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/components/watchlist/TradingViewWatchlist.tsx b/components/watchlist/TradingViewWatchlist.tsx index 2710166..45b76f6 100644 --- a/components/watchlist/TradingViewWatchlist.tsx +++ b/components/watchlist/TradingViewWatchlist.tsx @@ -1,7 +1,5 @@ "use client"; -import React, { useEffect, useRef, memo } from 'react'; -import { useTheme } from "next-themes"; import { formatSymbolForTradingView } from '@/lib/utils'; interface TradingViewWatchlistProps { diff --git a/lib/utils.ts b/lib/utils.ts index 9d8362d..183dab7 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -160,17 +160,17 @@ export function formatSymbolForTradingView(symbol: string): string { // Shanghai if (upperSymbol.endsWith('.SS')) { - return `SSE:${upperSymbol.replace('.SS', '')}`; + return `SSE:${upperSymbol.slice(0, -3)}`; } // Shenzhen if (upperSymbol.endsWith('.SZ')) { - return `SZSE:${upperSymbol.replace('.SZ', '')}`; + return `SZSE:${upperSymbol.slice(0, -3)}`; } // Hong Kong if (upperSymbol.endsWith('.HK')) { - return `HKEX:${upperSymbol.replace('.HK', '')}`; + return `HKEX:${upperSymbol.slice(0, -3)}`; } return upperSymbol;