36643-vm/dashboard.php
2025-12-04 07:22:31 +00:00

118 lines
4.9 KiB
PHP

<?php
require_once __DIR__ . '/db/config.php';
$platforms = ['youtube', 'instagram', 'tiktok', 'facebook'];
$connections = [];
try {
$pdo = db();
// Ensure platforms exist in the table
$stmt = $pdo->prepare("INSERT IGNORE INTO social_connections (platform) VALUES (?)");
foreach ($platforms as $platform) {
$stmt->execute([$platform]);
}
// Fetch all connections
$stmt = $pdo->query("SELECT platform, is_connected FROM social_connections");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$connections[$row['platform']] = $row['is_connected'];
}
} catch (PDOException $e) {
// Handle DB error gracefully
error_log("DB Error: " . $e->getMessage());
// Set all connections to false as a fallback
foreach ($platforms as $platform) {
$connections[$platform] = false;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Influencer Dashboard</title>
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<header class="app-header">
<div class="logo">
<a href="index.php">INFLUENCER AI</a>
</div>
<nav>
<a href="index.php">Home</a>
<a href="dashboard.php" class="active">Dashboard</a>
</nav>
</header>
<main class="container dashboard-container">
<section class="dashboard-header">
<h1>Your Dashboard</h1>
<p>Connect accounts, generate reports, and discover new tools.</p>
</section>
<section class="dashboard-grid">
<div class="dashboard-card">
<h3>Social Media Connections</h3>
<p>Connect your accounts to unlock powerful analytics and content insights.</p>
<div class="social-connections">
<?php foreach ($platforms as $platform): ?>
<div class="social-connection" data-platform="<?php echo $platform; ?>">
<button class="social-btn <?php echo $platform; ?>" data-action="<?php echo $connections[$platform] ? 'disconnect' : 'connect'; ?>">
<?php echo $connections[$platform] ? 'Disconnect' : 'Connect'; ?> <?php echo ucfirst($platform); ?>
</button>
<span class="status-indicator <?php echo $connections[$platform] ? 'connected' : 'not-connected'; ?>">
<?php echo $connections[$platform] ? 'Connected' : 'Not Connected'; ?>
</span>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="dashboard-card">
<h3>Report Generation</h3>
<p>Generate in-depth performance reports for your connected accounts.</p>
<button class="btn-secondary" id="generate-report-btn">Generate New Report</button>
</div>
<div class="dashboard-card">
<h3>AI Content Strategy</h3>
<p>Get personalized content ideas and strategies from our AI.</p>
<button class="btn-secondary" id="discover-strategy-btn">Discover Strategies</button>
</div>
<div class="dashboard-card">
<h3>Video Editing Tools</h3>
<p>Top-rated tools to level up your video production quality.</p>
<ul class="tools-list">
<li><a href="https://www.adobe.com/products/premiere.html" target="_blank" rel="noopener noreferrer">Adobe Premiere Pro</a></li>
<li><a href="https://www.blackmagicdesign.com/products/davinciresolve" target="_blank" rel="noopener noreferrer">DaVinci Resolve</a></li>
<li><a href="https://www.apple.com/final-cut-pro/" target="_blank" rel="noopener noreferrer">Final Cut Pro</a></li>
<li><a href="https://www.capcut.com/" target="_blank" rel="noopener noreferrer">CapCut (Mobile)</a></li>
</ul>
</div>
</section>
<section id="report-section" class="dashboard-card" style="display: none;">
<h2>Performance Report</h2>
<div id="report-content">
<!-- Report content will be injected here -->
</div>
</section>
<section id="strategy-section" class="dashboard-card" style="display: none;">
<h2>AI Content Strategy</h2>
<div id="strategy-content">
<!-- Strategy content will be injected here -->
</div>
</section>
</main>
<footer class="app-footer">
<p>&copy; <?php echo date("Y"); ?> Influencer AI. All rights reserved.</p>
</footer>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>