import React, { useState } from "react"; import { Area, Package } from "../services/product/type"; import { useTranslation } from "react-i18next"; interface ProductInfoModalProps { isOpen: boolean; onClose: () => void; packageInfo: Package | null; } const ProductInfoModal: React.FC = ({ isOpen, onClose, packageInfo, }) => { const { t } = useTranslation(); const [activeTab, setActiveTab] = useState<"specs" | "notes">("specs"); if (!isOpen || !packageInfo) return null; const specs = [ { label: t("coverageArea"), value: packageInfo?.coverageArea, icon: ( ), }, { label: t("networkProvider"), value: packageInfo?.carriers, icon: ( ), }, { label: t("infoRegistration") + " (eKYC)", value: packageInfo?.ekycRequired ? t("required") : t("notRequired"), icon: ( ), }, { label: t("activationMethod"), value: packageInfo?.activationMethod === 1 ? t("usageTimeCalculatedFromSignal") : t("usageTimeCalculatedFromPurchase"), icon: ( ), }, { label: t("deliveryMethod"), value: "Bạn sẽ nhận được email chứa eSIM trong vòng 5 phút sau khi thanh toán thành công. ", // packageInfo?.deliveryMethod === 0 // ? t( // "youWillReceiveAnEmailImmediatelyAfterPaymentWithEsimWaitForShippingAndReceiveYourPhysicalSim", // ) // : t("physicalSimWillBeShippedToYourAddressWithin3-5BusinessDays") icon: ( ), }, { label: t("phoneNumber"), value: packageInfo?.phoneNumber != 0 ? packageInfo.phoneNumber : "No", icon: ( ), }, { label: t("wifiHotspot"), value: packageInfo?.wifiSharing === 1 ? t("yesSupported") : t("no"), icon: ( ), }, { label: t("networkTechnology"), value: packageInfo?.networkTechnology, icon: ( ), }, { label: t("packageStartTime"), value: packageInfo?.activationMethod === 1 ? t("usageTimeCalculatedFromSignal") : t("usageTimeCalculatedFromPurchase"), icon: ( ), }, { label: t("dataResetTime"), value: // 0: Một ngày được tính đến 23:59 Giờ địa phương // 1:Gói được tính theo giờ Trung Quốc (UTC+8), nhưng sẽ reset vào 0:00 theo giờ quốc tế UTC+0. // 2: Gói được tính theo ngày (0h–24h) của múi giờ quốc gia nơi gói cước được kích hoạt. // 3: Một ngày được tính đến 23:59 giờ Bắc Kinh (GMT+8). // 4: Thời gian tính theo múi giờ UTC+0, reset lúc 0:00. // 5: Một ngày được tính đến 23:59 giờ Bắc Kinh (GMT+8) // 6: Thời gian tính theo ngày (0h–24h) của múi giờ quốc gia nơi kích hoạt gói. packageInfo?.dataResetTime === 0 ? "Một ngày được tính đến 23:59 Giờ địa phương." : packageInfo?.dataResetTime === 1 ? "Gói được tính theo giờ Trung Quốc (UTC+8), nhưng sẽ reset vào 0:00 theo giờ quốc tế UTC+0." : packageInfo?.dataResetTime === 2 ? "Gói được tính theo ngày (0h–24h) của múi giờ quốc gia nơi gói cước được kích hoạt." : packageInfo?.dataResetTime === 3 ? "Một ngày được tính đến 23:59 giờ Bắc Kinh (GMT+8)." : packageInfo?.dataResetTime === 4 ? "Thời gian tính theo múi giờ UTC+0, reset lúc 0:00." : packageInfo?.dataResetTime === 5 ? "Một ngày được tính đến 23:59 giờ Bắc Kinh (GMT+8)." : packageInfo?.dataResetTime === 6 ? "Thời gian tính theo ngày (0h–24h) của múi giờ quốc gia nơi kích hoạt gói." : "", icon: ( ), }, { label: t("unlimitedPolicy"), value: packageInfo?.unlimitedPolicy, icon: ( ), }, { label: t("appSupport"), value: packageInfo?.appSupport, icon: ( ), }, ]; return (
{/* Header */}

{t("productInformation")}

{/* Tabs */}
{/* Content */}
{activeTab === "specs" ? (
{specs.map((spec, idx) => (
{spec.icon}

{spec.label}:

{spec.value}

))}
) : (

1.{" "} {t("note1")}

2.{" "} {t("note2")}

3.{" "} {t("note3")}

4.{" "} {t("note4")}

5.{" "} {/* display html */}

6.{" "} {t("note6")}

)}
{/* Bottom Fade */}
); }; export default ProductInfoModal;