"use client"; import React, { useState, useEffect } from "react"; import Link from "next/link"; import axios from "axios"; import { ApiServerBaseUrl } from "@/utils/baseurl.utils"; import { Instagram, UserCircle2, TrendingUp, BarChart3, MessageSquare, Image as ImageIcon, Shield, CheckCircle, AlertCircle, Sparkles, Zap, Users, Clock, Globe, Lock } from "lucide-react"; const DashboardPage = () => { const [connectionStatus, setConnectionStatus] = useState<"connected" | "not_connected" | "loading" | "error">("loading"); const [instagramUsername, setInstagramUsername] = useState(null); // Check Instagram connection status useEffect(() => { async function checkConnection() { try { const userId = localStorage.getItem("user_email"); const res = await axios.get( `${ApiServerBaseUrl}/social/auth/status`, { params: { userId }, withCredentials: true } ); if (res.data.connected) { setConnectionStatus("connected"); if (res.data.username) { setInstagramUsername(res.data.username); } } else { setConnectionStatus("not_connected"); } } catch (err) { console.error(err); setConnectionStatus("error"); } } checkConnection(); }, []); const cards = [ { name: "Instagram Media", icon: , description: "Browse and manage your Instagram posts, stories, and media library.", link: "/social-media-posts", title: "View and organize your Instagram media content", status: connectionStatus === "connected" ? "active" : "requires-connection" }, { name: "Social Media Channels", icon: , description: "Manage all your connected social media profiles and channels in one place.", link: "/social-media-channels", title: "Toggle and manage your connected social media channels", status: "active" }, { name: "Performance Insights", icon: , description: "Track engagement, reach, and growth metrics for your Instagram content.", link: "/insights", title: "View analytics and performance insights", status: connectionStatus === "connected" ? "active" : "requires-connection" }, { name: "Comment Management", icon: , description: "Reply, hide, or delete comments across your Instagram posts.", link: "/comments", title: "Manage Instagram comments from one dashboard", status: connectionStatus === "connected" ? "active" : "requires-connection" }, { name: "Account Settings", icon: , description: "Manage your profile, billing, subscription, and preferences.", link: "/account-settings", title: "Account configuration and settings", status: "active" }, { name: "Quick Actions", icon: , description: "Quick access to common tasks and time-saving features.", link: "/quick-actions", title: "Quick action shortcuts", status: "active" }, ]; const benefits = [ { icon: , text: "Save time managing Instagram engagement" }, { icon: , text: "Easily respond to your audience" }, { icon: , text: "Track content performance with insights" }, { icon: , text: "Complete control over your content" } ]; return (
{/* Floating background bubbles */}
{/* Main container */}
{/* Header Section */}

Social Buddy Dashboard

Welcome back! Manage your social presence from one place.

{/* Connection Status Badge */}

{connectionStatus === "connected" ? "Instagram Connected" : connectionStatus === "not_connected" ? "Instagram Not Connected" : "Checking Connection..."}

{connectionStatus === "connected" && instagramUsername && (

@{instagramUsername}

)}
{/* Connection Status Overview */}
Instagram Status {connectionStatus === "connected" ? ( ) : ( )}
{connectionStatus === "connected" ? "Connected" : "Not Connected"}
Available Features
{connectionStatus === "connected" ? "All" : "Basic"}
Media Access
{connectionStatus === "connected" ? "Enabled" : "Connect to enable"}
{/* Main Content Grid */}
{/* Left Column - Features Grid */}

Available Features

Connect your Instagram account to unlock all management tools.

{cards.map((card) => ( { if (card.status === "requires-connection" && connectionStatus !== "connected") { e.preventDefault(); } }} > {/* Lock icon for features requiring connection */} {card.status === "requires-connection" && connectionStatus !== "connected" && (
)} {/* Icon */}
{card.icon}
{/* Content */}

{card.name}

{card.description}

{/* Status indicator */}
{card.status === "requires-connection" && connectionStatus !== "connected" ? ( Connect Instagram to access ) : ( Click to access )}
{/* Hover overlay */}
))}
{/* Connection Prompt */} {connectionStatus === "not_connected" && (

Connect Your Instagram Account

Connect your Instagram account to access media management, insights, and comment moderation tools. All features are user-controlled and require manual action.

Connect Instagram Account
)}
{/* Right Column - Sidebar */}
{/* Benefits Card */}

What You Can Do

{benefits.map((benefit, index) => (
{benefit.icon}

{benefit.text}

))}
{/* Connection Status Card */}

Connection Overview

Instagram Account
{connectionStatus === "connected" ? "Connected" : connectionStatus === "not_connected" ? "Not Connected" : "Checking..."}
Media Management {connectionStatus === "connected" ? "Available" : "Requires connection"}
Performance Insights {connectionStatus === "connected" ? "Available" : "Requires connection"}
Comment Moderation {connectionStatus === "connected" ? "Available" : "Requires connection"}
{connectionStatus === "not_connected" ? ( Connect Instagram Account ) : connectionStatus === "connected" ? ( Manage Connection Settings ) : null}
{/* Important Notes - For Meta Approval */}

Important Notes

  • All actions are user-initiated and user-controlled
  • No automated commenting or AI-generated responses
  • Manual moderation tools only
{/* Animation Styles */}
); }; export default DashboardPage;