diff --git a/src/components/AdminPricingManager.tsx b/src/components/AdminPricingManager.tsx
index 0c56754..41071b1 100644
--- a/src/components/AdminPricingManager.tsx
+++ b/src/components/AdminPricingManager.tsx
@@ -7,6 +7,67 @@ interface AdminPricingManagerProps {
fetchCourses: () => void;
}
+function CoursePricingCard({ course, saveLoading, onSave }: { course: Course, saveLoading: string | null, onSave: (id: string, locked: boolean, price: number) => void }) {
+ const [localPrice, setLocalPrice] = useState(course.price || 0);
+ const [localLocked, setLocalLocked] = useState(course.isLocked || false);
+
+ const isChanged = localPrice !== (course.price || 0) || localLocked !== (course.isLocked || false);
+
+ return (
+
+
+
{course.title}
+
{course.category}
+
+
+ Acesso
+
+
+
+ {localLocked && (
+
+
+
+
+ setLocalPrice(parseFloat(e.target.value) || 0)}
+ className="w-full bg-black/40 border border-white/10 rounded-lg pl-9 pr-3 py-2 text-sm text-white focus:outline-none focus:border-red-500 transition-colors"
+ />
+
+
+ )}
+
+
+
+
+ );
+}
+
export const AdminPricingManager: React.FC = ({ courses, fetchCourses }) => {
const [plans, setPlans] = useState([]);
const [loading, setLoading] = useState(true);
@@ -126,67 +187,14 @@ export const AdminPricingManager: React.FC = ({ course
- {courses.map(course => {
- // Local state to handle fast typing before saving
- const [localPrice, setLocalPrice] = useState(course.price || 0);
- const [localLocked, setLocalLocked] = useState(course.isLocked || false);
-
- const isChanged = localPrice !== (course.price || 0) || localLocked !== (course.isLocked || false);
-
- return (
-
-
-
{course.title}
-
{course.category}
-
-
- Acesso
-
-
-
- {localLocked && (
-
-
-
-
- setLocalPrice(parseFloat(e.target.value) || 0)}
- className="w-full bg-black/40 border border-white/10 rounded-lg pl-9 pr-3 py-2 text-sm text-white focus:outline-none focus:border-red-500 transition-colors"
- />
-
-
- )}
-
-
-
-
- );
- })}
+ {courses.map(course => (
+
+ ))}