From da91a513239c91b427b810d6298f15bb2c1af293 Mon Sep 17 00:00:00 2001 From: barsa Date: Wed, 22 Oct 2025 14:36:51 +0900 Subject: [PATCH] Refactor internet and SIM plan components for improved UI and functionality - Removed unused imports and components for cleaner code. - Updated styling and layout in InternetPlanCard for better visual consistency. - Introduced CatalogBackLink for navigation in InternetConfigureContainer and SimConfigureView. - Enhanced loading states and error handling in InternetPlans and SimPlans views. - Improved button interactions and accessibility in ActivationForm and SimConfigureView. - Streamlined plan display logic and added dynamic features in various components. --- .../components/base/CatalogBackLink.tsx | 49 +++++ .../catalog/components/base/CatalogHero.tsx | 47 +++++ .../components/internet/InternetPlanCard.tsx | 86 ++++---- .../configure/InternetConfigureContainer.tsx | 17 +- .../catalog/components/sim/ActivationForm.tsx | 20 +- .../components/sim/SimConfigureView.tsx | 30 +-- .../features/catalog/views/InternetPlans.tsx | 144 ++++++-------- .../src/features/catalog/views/SimPlans.tsx | 184 +++++++++--------- .../src/features/catalog/views/VpnPlans.tsx | 70 ++----- 9 files changed, 341 insertions(+), 306 deletions(-) create mode 100644 apps/portal/src/features/catalog/components/base/CatalogBackLink.tsx create mode 100644 apps/portal/src/features/catalog/components/base/CatalogHero.tsx diff --git a/apps/portal/src/features/catalog/components/base/CatalogBackLink.tsx b/apps/portal/src/features/catalog/components/base/CatalogBackLink.tsx new file mode 100644 index 00000000..573d3a4d --- /dev/null +++ b/apps/portal/src/features/catalog/components/base/CatalogBackLink.tsx @@ -0,0 +1,49 @@ +"use client"; + +import { Button } from "@/components/atoms/button"; +import { cn } from "@/lib/utils"; +import { ArrowLeftIcon } from "@heroicons/react/24/outline"; +import type { ReactNode } from "react"; + +type Alignment = "left" | "center" | "right"; + +interface CatalogBackLinkProps { + href: string; + label?: string; + align?: Alignment; + className?: string; + buttonClassName?: string; + icon?: ReactNode; +} + +const alignmentMap: Record = { + left: "justify-start", + center: "justify-center", + right: "justify-end", +}; + +export function CatalogBackLink({ + href, + label = "Back", + align = "left", + className, + buttonClassName, + icon = , +}: CatalogBackLinkProps) { + return ( +
+ +
+ ); +} + +export type { CatalogBackLinkProps }; diff --git a/apps/portal/src/features/catalog/components/base/CatalogHero.tsx b/apps/portal/src/features/catalog/components/base/CatalogHero.tsx new file mode 100644 index 00000000..ec8bf48b --- /dev/null +++ b/apps/portal/src/features/catalog/components/base/CatalogHero.tsx @@ -0,0 +1,47 @@ +"use client"; + +import { cn } from "@/lib/utils"; +import type { ReactNode } from "react"; + +type Alignment = "left" | "center"; + +interface CatalogHeroProps { + title: string; + description: string; + align?: Alignment; + eyebrow?: ReactNode; + children?: ReactNode; + className?: string; +} + +const alignmentMap: Record = { + left: "text-left items-start", + center: "text-center items-center", +}; + +export function CatalogHero({ + title, + description, + align = "center", + eyebrow, + children, + className, +}: CatalogHeroProps) { + return ( +
+ {eyebrow ?
{eyebrow}
: null} +

{title}

+

{description}

+ {children ?
{children}
: null} +
+ ); +} + +export type { CatalogHeroProps }; diff --git a/apps/portal/src/features/catalog/components/internet/InternetPlanCard.tsx b/apps/portal/src/features/catalog/components/internet/InternetPlanCard.tsx index 33fb7960..42a93922 100644 --- a/apps/portal/src/features/catalog/components/internet/InternetPlanCard.tsx +++ b/apps/portal/src/features/catalog/components/internet/InternetPlanCard.tsx @@ -2,7 +2,7 @@ import { AnimatedCard } from "@/components/molecules"; import { Button } from "@/components/atoms/button"; -import { CurrencyYenIcon, ArrowRightIcon } from "@heroicons/react/24/outline"; +import { ArrowRightIcon } from "@heroicons/react/24/outline"; import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, @@ -27,6 +27,8 @@ export function InternetPlanCard({ const isGold = tier === "Gold"; const isPlatinum = tier === "Platinum"; const isSilver = tier === "Silver"; + const isDevEnvironment = process.env.NODE_ENV === "development"; + const isDisabled = disabled && !isDevEnvironment; const installationPrices = installations .map(installation => { @@ -45,59 +47,61 @@ export function InternetPlanCard({ const getBorderClass = () => { if (isGold) - return "border-2 border-yellow-400/50 bg-gradient-to-br from-yellow-50/80 to-amber-50/80 backdrop-blur-sm shadow-xl hover:shadow-2xl ring-2 ring-yellow-200/30"; + return "border border-yellow-200 bg-white shadow-lg hover:shadow-xl ring-1 ring-yellow-100"; if (isPlatinum) - return "border-2 border-indigo-400/50 bg-gradient-to-br from-indigo-50/80 to-purple-50/80 backdrop-blur-sm shadow-xl hover:shadow-2xl ring-2 ring-indigo-200/30"; - if (isSilver) - return "border-2 border-gray-300/50 bg-gradient-to-br from-gray-50/80 to-slate-50/80 backdrop-blur-sm shadow-xl hover:shadow-2xl ring-2 ring-gray-200/30"; - return "border border-gray-200/50 bg-white/80 backdrop-blur-sm shadow-lg hover:shadow-xl"; + return "border border-indigo-200 bg-white shadow-lg hover:shadow-xl ring-1 ring-indigo-100"; + if (isSilver) return "border border-gray-200 bg-white shadow-lg hover:shadow-xl ring-1 ring-gray-100"; + return "border border-gray-200 bg-white shadow hover:shadow-lg"; }; return ( -
-
-
- - {tier || "Plan"} - - {isGold && ( - - Recommended +
+
+
+
+ + {tier || "Plan"} - )} -
- {plan.monthlyPrice && plan.monthlyPrice > 0 && ( -
-
- - {plan.monthlyPrice.toLocaleString()} - - per month + {isGold && ( + + Recommended + )} +
+

{plan.name}

+
+ + {plan.monthlyPrice && plan.monthlyPrice > 0 && ( +
+
Monthly
+
+ ¥{plan.monthlyPrice.toLocaleString()}
+ {plan.oneTimePrice && plan.oneTimePrice > 0 && ( +
One-time ¥{plan.oneTimePrice.toLocaleString()}
+ )}
)}
-

{plan.name}

-

+

{plan.catalogMetadata?.tierDescription || plan.description}

-
-

Your Plan Includes:

+
+

Your Plan Includes

    {plan.catalogMetadata?.features && plan.catalogMetadata.features.length > 0 ? ( plan.catalogMetadata.features.map((feature, index) => ( @@ -135,14 +139,14 @@ export function InternetPlanCard({
diff --git a/apps/portal/src/features/catalog/components/internet/configure/InternetConfigureContainer.tsx b/apps/portal/src/features/catalog/components/internet/configure/InternetConfigureContainer.tsx index e7afbd24..21bb46dc 100644 --- a/apps/portal/src/features/catalog/components/internet/configure/InternetConfigureContainer.tsx +++ b/apps/portal/src/features/catalog/components/internet/configure/InternetConfigureContainer.tsx @@ -2,8 +2,8 @@ import { PageLayout } from "@/components/templates/PageLayout"; import { ProgressSteps } from "@/components/molecules"; -import { Button } from "@/components/atoms/button"; -import { ServerIcon, ArrowLeftIcon } from "@heroicons/react/24/outline"; +import { ServerIcon } from "@heroicons/react/24/outline"; +import { CatalogBackLink } from "@/features/catalog/components/base/CatalogBackLink"; import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, @@ -85,18 +85,7 @@ export function InternetConfigureContainer({ description="Set up your internet service options" >
-
- -
+ {/* Plan Header */} diff --git a/apps/portal/src/features/catalog/components/sim/ActivationForm.tsx b/apps/portal/src/features/catalog/components/sim/ActivationForm.tsx index 9f15fdbe..0d28132b 100644 --- a/apps/portal/src/features/catalog/components/sim/ActivationForm.tsx +++ b/apps/portal/src/features/catalog/components/sim/ActivationForm.tsx @@ -13,12 +13,15 @@ export function ActivationForm({ onScheduledActivationDateChange, errors, }: ActivationFormProps) { + const sharedLabelClasses = + "flex items-start gap-3 p-4 rounded-lg border-2 cursor-pointer transition-colors duration-200 ease-in-out"; + return (
diff --git a/apps/portal/src/features/catalog/components/sim/SimConfigureView.tsx b/apps/portal/src/features/catalog/components/sim/SimConfigureView.tsx index d28229b5..2d794795 100644 --- a/apps/portal/src/features/catalog/components/sim/SimConfigureView.tsx +++ b/apps/portal/src/features/catalog/components/sim/SimConfigureView.tsx @@ -9,6 +9,7 @@ import { SimTypeSelector } from "@/features/catalog/components/sim/SimTypeSelect import { ActivationForm } from "@/features/catalog/components/sim/ActivationForm"; import { MnpForm } from "@/features/catalog/components/sim/MnpForm"; import { ProgressSteps } from "@/components/molecules"; +import { CatalogBackLink } from "@/features/catalog/components/base/CatalogBackLink"; import { ArrowLeftIcon, ArrowRightIcon, @@ -138,18 +139,7 @@ export function SimConfigureView({ icon={} >
-
- -
+
@@ -228,7 +218,12 @@ export function SimConfigureView({ />
-
- - {/* Enhanced Header */} -
- {/* Background decoration */} -
-
-
-
- -

- Choose Your Internet Plan -

-

- High-speed fiber internet with reliable connectivity for your home or business -

+
+ + {eligibility && ( -
+
{getEligibilityIcon(eligibility)} - Available for: {eligibility} + Available for: {eligibility}
-

- Plans shown are tailored to your house type and local infrastructure +

+ Plans shown are tailored to your house type and local infrastructure.

)} -
+
{hasActiveInternet && ( We couldn't find any internet plans available for your location at this time.

- +
)}
diff --git a/apps/portal/src/features/catalog/views/SimPlans.tsx b/apps/portal/src/features/catalog/views/SimPlans.tsx index 11685658..2929ba5a 100644 --- a/apps/portal/src/features/catalog/views/SimPlans.tsx +++ b/apps/portal/src/features/catalog/views/SimPlans.tsx @@ -15,6 +15,8 @@ import { AlertBanner } from "@/components/molecules/AlertBanner/AlertBanner"; import { useSimCatalog } from "@/features/catalog/hooks"; import type { SimCatalogProduct } from "@customer-portal/domain/catalog"; import { SimPlanTypeSection } from "@/features/catalog/components/sim/SimPlanTypeSection"; +import { CatalogBackLink } from "@/features/catalog/components/base/CatalogBackLink"; +import { CatalogHero } from "@/features/catalog/components/base/CatalogHero"; interface PlansByType { DataOnly: SimCatalogProduct[]; @@ -36,63 +38,62 @@ export function SimPlansContainer() { if (isLoading) { return ( - } - > -
- {/* Back button area */} -
-
-
+
+ } + > +
+ - {/* Title block */} -
-
-
-
+ {/* Title block */} +
+
+
+
- {/* Family discount banner slot */} -
-
-
+ {/* Family discount banner slot */} +
+
+
- {/* Tabs */} -
-
-
+ {/* Tabs */} +
+
+
- {/* Plans grid */} -
- {Array.from({ length: 6 }).map((_, i) => ( -
- - - -
- ))} -
- - {/* Terms section */} -
+ {/* Plans grid */}
{Array.from({ length: 6 }).map((_, i) => ( -
-
-
- - -
+
+ + +
))}
-
- {/* Important terms banner */} -
-
- + {/* Terms section */} +
+
+ {Array.from({ length: 6 }).map((_, i) => ( +
+
+
+ + +
+
+ ))} +
+
+ + {/* Important terms banner */} +
+
+ +
); } @@ -132,42 +133,19 @@ export function SimPlansContainer() { ); return ( -
+
} > -
- {/* Enhanced Back Button */} -
- -
+
+ - {/* Enhanced Header */} -
- {/* Background decoration */} -
-
-
-
- -

- Choose Your SIM Plan -

-

- Wide range of data options and voice plans with both physical SIM and eSIM options. -

-
+ {hasExistingSim && ( @@ -187,18 +165,24 @@ export function SimPlansContainer() {
-
+
+ +
} > -
- {/* Enhanced Back Button */} -
- -
+
+ - {/* Enhanced Header */} -
- {/* Background decoration */} -
-
-
-
- -

- SonixNet VPN Router Service -

-

- Fast and secure VPN connection to San Francisco or London for accessing geo-restricted - content. -

-
+ {vpnPlans.length > 0 ? (
@@ -123,9 +88,12 @@ export function VpnPlansView() {

We couldn't find any VPN plans available at this time.

- +
)}