-
-
+
+
+
+
+
Download our app
+
+
+
+
+
+
+
diff --git a/src/pages/Home/PlanCardSkeleton.jsx b/src/pages/Home/PlanCardSkeleton.jsx
new file mode 100644
index 00000000..837ea686
--- /dev/null
+++ b/src/pages/Home/PlanCardSkeleton.jsx
@@ -0,0 +1,44 @@
+import React from "react";
+
+const SubscriptionPlanSkeleton = () => {
+ return (
+
+
+ {/* Header */}
+
+
+ {/* Price */}
+
+
+ {/* Storage & Trial */}
+
+
+ {/* Features */}
+
+ Features
+
+
+ {[1, 2, 3].map((i) => (
+ -
+
+
+ ))}
+
+
+ {/* Button */}
+
+
+
+ );
+};
+
+export default SubscriptionPlanSkeleton;
diff --git a/src/pages/Home/SubscriptionPlans.jsx b/src/pages/Home/SubscriptionPlans.jsx
index 0d44472c..24be62f9 100644
--- a/src/pages/Home/SubscriptionPlans.jsx
+++ b/src/pages/Home/SubscriptionPlans.jsx
@@ -1,115 +1,7 @@
-// // src/components/SubscriptionPlans.jsx
-// import React, { useState, useEffect } from "react";
-// import axios from "axios";
-
-// const SubscriptionPlans = () => {
-// const [plans, setPlans] = useState([]);
-// const [frequency, setFrequency] = useState(1); // 1=Monthly, 2=Quarterly, 3=Half-Yearly, 4=Yearly
-// const [loading, setLoading] = useState(false);
-
-// useEffect(() => {
-// const fetchPlans = async () => {
-// try {
-// setLoading(true);
-// const res = await axios.get(
-// `/api/market/list/subscription-plan?frequency=${frequency}`
-// );
-// setPlans(res.data?.data || []);
-// } catch (err) {
-// console.error("Error fetching plans:", err);
-// } finally {
-// setLoading(false);
-// }
-// };
-
-// fetchPlans();
-// }, [frequency]);
-
-// return (
-//
-// {/* Frequency Switcher */}
-//
-//
-// {["Monthly", "Quarterly", "Half-Yearly", "Yearly"].map((label, idx) => (
-//
-// ))}
-//
-//
-
-// {/* Cards */}
-//
-// {loading ? (
-//
Loading...
-// ) : plans.length === 0 ? (
-//
No plans found
-// ) : (
-// plans.map((plan) => (
-//
-//
-//
-//
{plan.planName}
-//
{plan.description}
-//
-//
-// {plan.currency?.symbol}
-// {plan.price}
-//
-// /mo
-//
-//
-// Max Users: {plan.maxUser} | Storage: {plan.maxStorage} MB
-//
-//
-
-//
-//
-// {plan.features?.modules &&
-// Object.values(plan.features.modules).map((mod) => (
-// -
-//
-// {mod.name}{" "}
-// {mod.enabled ? (
-// Enabled
-// ) : (
-// Disabled
-// )}
-//
-// ))}
-// -
-//
-// Support:{" "}
-// {plan.features?.supports?.prioritySupport
-// ? "Priority"
-// : plan.features?.supports?.phoneSupport
-// ? "Phone & Email"
-// : "Email Only"}
-//
-//
-//
-
-//
-//
-//
-//
-//
-// ))
-// )}
-//
-//
-// );
-// };
-
-// export default SubscriptionPlans;
-
import React, { useState, useEffect } from "react";
import axios from "axios";
+import { Link } from "react-router-dom";
+import PlanCardSkeleton from "./PlanCardSkeleton";
const SubscriptionPlans = () => {
const [plans, setPlans] = useState([]);
@@ -120,11 +12,10 @@ const SubscriptionPlans = () => {
const fetchPlans = async () => {
try {
setLoading(true);
- const res = await axios.get(`http://localhost:5032/api/market/list/subscription-plan?frequency=${frequency}`, {
- headers: {
- "Content-Type": "application/json"
- }
- });
+ const res = await axios.get(
+ `http://localhost:5032/api/market/list/subscription-plan?frequency=${frequency}`,
+ { headers: { "Content-Type": "application/json" } }
+ );
setPlans(res.data?.data || []);
} catch (err) {
console.error("Error fetching plans:", err);
@@ -137,10 +28,10 @@ const SubscriptionPlans = () => {
const frequencyLabel = (freq) => {
switch (freq) {
- case 0: return "mo";
- case 1: return "3mo";
- case 2: return "6mo";
- case 3: return "yr";
+ case 0: return "1 mo";
+ case 1: return "3 mo";
+ case 2: return "6 mo";
+ case 3: return "1 yr";
default: return "mo";
}
};
@@ -155,7 +46,7 @@ const SubscriptionPlans = () => {
key={idx}
type="button"
className={`btn btn-${frequency === idx ? "primary" : "outline-secondary"}`}
- onClick={() => setFrequency(idx)} // use idx directly (0,1,2,3)
+ onClick={() => setFrequency(idx)}
>
{label}
@@ -163,73 +54,88 @@ const SubscriptionPlans = () => {