From 92fada4792249dd5f3bd2e1a7922cdb5bb7597c3 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Sun, 28 Dec 2025 18:09:22 +0800 Subject: [PATCH] refactor: simplify network route handling in PlanInfo component --- src/components/PlanInfo.tsx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/components/PlanInfo.tsx b/src/components/PlanInfo.tsx index 827ca24..f1db76c 100644 --- a/src/components/PlanInfo.tsx +++ b/src/components/PlanInfo.tsx @@ -15,6 +15,9 @@ export default function PlanInfo({ : parsedData.planDataMod.extra.split(",")[0] === "" ? [] : [parsedData.planDataMod.extra]; + const networkRoutes = parsedData.planDataMod.networkRoute + ? parsedData.planDataMod.networkRoute.split(",") + : []; return (
@@ -60,17 +63,9 @@ export default function PlanInfo({ "text-[9px] bg-blue-600 text-blue-200 dark:bg-blue-800 dark:text-blue-300 w-fit rounded-[5px] px-[3px] py-[1.5px]", )} > - {parsedData.planDataMod.networkRoute - .split(",") - .map((route, index) => { - return ( - route + - (index === - parsedData.planDataMod?.networkRoute.split(",").length - 1 - ? "" - : "|") - ); - })} + {networkRoutes.map((route, index) => { + return route + (index === networkRoutes.length - 1 ? "" : "|"); + })}

)} {extraList.map((extra, index) => {