diff --git a/src/app/page.tsx b/src/app/page.tsx index be489a2..2c2a4fd 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -6,8 +6,59 @@ import HeroCarouselLogo from '@/components/sections/hero/heroCarouselLogo/HeroCa import MetricCardTen from '@/components/sections/metrics/MetricCardTen'; import FeatureCardSeven from '@/components/sections/feature/FeatureCardSeven'; import FooterBase from '@/components/sections/footer/FooterBase'; +import { useState } from 'react'; export default function CreatorDashboard() { + const [metrics, setMetrics] = useState([ + { + id: "1", title: "Total Earnings", subtitle: "Revenue from all services and products", category: "Revenue", value: "$12,450.50", buttons: [{ text: "View Details", href: "#" }], + }, + { + id: "2", title: "Subscriber Count", subtitle: "Active engaged community members", category: "Community", value: "3,847", buttons: [{ text: "Manage Subs", href: "#" }], + }, + { + id: "3", title: "Profile Views", subtitle: "Total visits to your profile this month", category: "Engagement", value: "15,230", buttons: [{ text: "Analyze", href: "#" }], + }, + { + id: "4", title: "Conversion Rate", subtitle: "Percentage of visitors becoming subscribers", category: "Growth", value: "8.4%", buttons: [{ text: "Optimize", href: "#" }], + }, + ]); + + const [profilePhoto, setProfilePhoto] = useState( + "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3AeufBStYsT20rVSz6VwZGbgKZJ/a-modern-creator-dashboard-interface-wit-1772965513803-84c53169.png" + ); + + const [isEditingMetric, setIsEditingMetric] = useState(null); + const [editValue, setEditValue] = useState(""); + const [isEditingPhoto, setIsEditingPhoto] = useState(false); + const [photoUrl, setPhotoUrl] = useState(profilePhoto); + + const handleMetricEdit = (metricId: string) => { + const metric = metrics.find(m => m.id === metricId); + if (metric) { + setIsEditingMetric(metricId); + setEditValue(metric.value); + } + }; + + const handleMetricSave = (metricId: string) => { + setMetrics(metrics.map(m => + m.id === metricId ? { ...m, value: editValue } : m + )); + setIsEditingMetric(null); + setEditValue(""); + }; + + const handlePhotoEdit = () => { + setIsEditingPhoto(true); + setPhotoUrl(profilePhoto); + }; + + const handlePhotoSave = () => { + setProfilePhoto(photoUrl); + setIsEditingPhoto(false); + }; + return (
- +
+ +
+ +
+ {isEditingPhoto && ( +
+
+

Edit Profile Photo URL

+ setPhotoUrl(e.target.value)} + className="w-full px-3 py-2 border border-gray-300 rounded mb-4" + placeholder="Enter photo URL" + /> +
+ + +
+
+
+ )} +
({ + ...metric, + buttons: [ + { + text: isEditingMetric === metric.id ? "Save" : "Edit", onClick: () => { + if (isEditingMetric === metric.id) { + handleMetricSave(metric.id); + } else { + handleMetricEdit(metric.id); + } + } + } + ] + }))} /> + {isEditingMetric && ( +
+
+

Edit Metric Value

+ setEditValue(e.target.value)} + className="w-full px-3 py-2 border border-gray-300 rounded mb-4" + placeholder="Enter new value" + autoFocus + /> +
+ + +
+
+
+ )}