refactor: simplify network route handling in PlanInfo component

This commit is contained in:
hamster1963
2025-12-28 18:09:22 +08:00
parent 29e349505d
commit 92fada4792
+6 -11
View File
@@ -15,6 +15,9 @@ export default function PlanInfo({
: parsedData.planDataMod.extra.split(",")[0] === "" : parsedData.planDataMod.extra.split(",")[0] === ""
? [] ? []
: [parsedData.planDataMod.extra]; : [parsedData.planDataMod.extra];
const networkRoutes = parsedData.planDataMod.networkRoute
? parsedData.planDataMod.networkRoute.split(",")
: [];
return ( return (
<section className="flex gap-1 items-center flex-wrap mt-0.5"> <section className="flex gap-1 items-center flex-wrap mt-0.5">
@@ -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]", "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 {networkRoutes.map((route, index) => {
.split(",") return route + (index === networkRoutes.length - 1 ? "" : "");
.map((route, index) => { })}
return (
route +
(index ===
parsedData.planDataMod?.networkRoute.split(",").length - 1
? ""
: "")
);
})}
</p> </p>
)} )}
{extraList.map((extra, index) => { {extraList.map((extra, index) => {