Create base.html template with shared header/navbar

- Added base.html with header, nav, user menu, and scripts
- Updated dashboard.html, analyze.html, train.html, history.html to extend base.html
- Added active_page parameter to render_template calls in web.py for dynamic nav highlighting
parent eb2a270a
<!DOCTYPE html> {% extends "base.html" %}
<html>
<head> {% block title %}Analyze Media - VidAI{% endblock %}
<title>Analyze Media - VidAI</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"> {% block head %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"> <style>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; } * { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #f8fafc; } body { font-family: 'Inter', sans-serif; background: #f8fafc; }
.header { background: white; padding: 1rem 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); } .header { background: white; padding: 1rem 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
...@@ -57,7 +56,7 @@ ...@@ -57,7 +56,7 @@
.breadcrumb a { color: #667eea; text-decoration: none; } .breadcrumb a { color: #667eea; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; } .breadcrumb a:hover { text-decoration: underline; }
</style> </style>
<script> <script>
function updateStats() { function updateStats() {
fetch('/stats') fetch('/stats')
.then(response => response.json()) .then(response => response.json())
...@@ -185,39 +184,11 @@ ...@@ -185,39 +184,11 @@
const dropdown = document.getElementById('userDropdown'); const dropdown = document.getElementById('userDropdown');
dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block'; dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block';
} }
</script> </script>
</head> {% endblock %}
<body>
<header class="header">
<div class="header-content">
<div class="logo">VidAI</div>
<nav class="nav">
<a href="/dashboard">Dashboard</a>
<a href="/analyze" class="active">Analyze</a>
<a href="/train">Train</a>
<a href="/history">History</a>
<a href="/api_tokens">API Tokens</a>
<a href="/settings">Settings</a>
</nav>
<div class="user-menu">
<div class="user-icon" onclick="toggleUserMenu()">
<i class="fas fa-user"></i>
</div>
<div id="userDropdown" class="user-dropdown">
<a href="/account">Account</a>
{% if user.get('role') != 'admin' %}
<a href="/api_tokens">Tokens</a>
{% else %}
<a href="/admin/users">Users</a>
<a href="/config">Configurations</a>
{% endif %}
<a href="/logout">Logout</a>
</div>
</div>
</div>
</header>
<div class="container"> {% block content %}
<div class="container">
<div class="main"> <div class="main">
<div class="tokens"> <div class="tokens">
...@@ -296,5 +267,5 @@ ...@@ -296,5 +267,5 @@
</div> </div>
</div> </div>
</div> </div>
</body> </div>
</html> {% endblock %}
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}VidAI{% endblock %}</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #f8fafc; }
.header { background: white; padding: 1rem 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.header-content { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; }
.logo { font-size: 1.5rem; font-weight: 700; color: #667eea; }
.nav { display: flex; gap: 2rem; }
.nav a { text-decoration: none; color: #64748b; font-weight: 500; }
.nav a.active { color: #667eea; }
.user-menu { display: flex; align-items: center; gap: 1rem; position: relative; }
.user-icon { cursor: pointer; padding: 0.5rem; border-radius: 50%; background: #f8fafc; transition: background 0.2s; }
.user-icon:hover { background: #e2e8f0; }
.user-icon i { font-size: 1.2rem; color: #64748b; }
.user-dropdown { display: none; position: absolute; top: 100%; right: 0; background: white; min-width: 200px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 8px; z-index: 1000; }
.user-dropdown a { display: block; padding: 0.75rem 1rem; text-decoration: none; color: #374151; border-bottom: 1px solid #f1f5f9; }
.user-dropdown a:last-child { border-bottom: none; color: #dc2626; }
.user-dropdown a:hover { background: #f8fafc; }
</style>
{% block head %}{% endblock %}
</head>
<body>
<header class="header">
<div class="header-content">
<div class="logo">VidAI</div>
<nav class="nav">
<a href="/dashboard" {% if active_page == 'dashboard' %}class="active"{% endif %}>Dashboard</a>
<a href="/analyze" {% if active_page == 'analyze' %}class="active"{% endif %}>Analyze</a>
<a href="/train" {% if active_page == 'train' %}class="active"{% endif %}>Train</a>
<a href="/history" {% if active_page == 'history' %}class="active"{% endif %}>History</a>
<a href="/api_tokens" {% if active_page == 'api_tokens' %}class="active"{% endif %}>API Tokens</a>
<a href="/settings" {% if active_page == 'settings' %}class="active"{% endif %}>Settings</a>
</nav>
<div class="user-menu">
<div class="user-icon" onclick="toggleUserMenu()">
<i class="fas fa-user"></i>
</div>
<div id="userDropdown" class="user-dropdown">
<a href="/account">Account</a>
{% if user.get('role') != 'admin' %}
<a href="/api_tokens">Tokens</a>
{% else %}
<a href="/admin/users">Users</a>
<a href="/config">Configurations</a>
{% endif %}
<a href="/logout">Logout</a>
</div>
</div>
</div>
</header>
{% block content %}{% endblock %}
<script>
function toggleUserMenu() {
const dropdown = document.getElementById('userDropdown');
dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block';
}
// Close dropdown when clicking outside
window.onclick = function(event) {
const dropdown = document.getElementById('userDropdown');
const icon = document.querySelector('.user-icon');
if (!icon.contains(event.target) && !dropdown.contains(event.target)) {
dropdown.style.display = 'none';
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html> {% extends "base.html" %}
<html>
<head> {% block title %}Dashboard - VidAI{% endblock %}
<title>Dashboard - VidAI</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"> {% block head %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"> <style>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #f8fafc; }
.header { background: white; padding: 1rem 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.header-content { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; }
.logo { font-size: 1.5rem; font-weight: 700; color: #667eea; }
.nav { display: flex; gap: 2rem; }
.nav a { text-decoration: none; color: #64748b; font-weight: 500; }
.nav a.active { color: #667eea; }
.user-menu { display: flex; align-items: center; gap: 1rem; position: relative; }
.user-icon { cursor: pointer; padding: 0.5rem; border-radius: 50%; background: #f8fafc; transition: background 0.2s; }
.user-icon:hover { background: #e2e8f0; }
.user-icon i { font-size: 1.2rem; color: #64748b; }
.user-dropdown { display: none; position: absolute; top: 100%; right: 0; background: white; min-width: 200px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 8px; z-index: 1000; }
.user-dropdown a { display: block; padding: 0.75rem 1rem; text-decoration: none; color: #374151; border-bottom: 1px solid #f1f5f9; }
.user-dropdown a:last-child { border-bottom: none; color: #dc2626; }
.user-dropdown a:hover { background: #f8fafc; }
.container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; } .container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; } .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { background: white; padding: 1.5rem; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); } .stat-card { background: white; padding: 1.5rem; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
...@@ -38,39 +21,11 @@ ...@@ -38,39 +21,11 @@
.status-processing { background: #dbeafe; color: #2563eb; } .status-processing { background: #dbeafe; color: #2563eb; }
.status-completed { background: #d1fae5; color: #065f46; } .status-completed { background: #d1fae5; color: #065f46; }
.status-failed { background: #fee2e2; color: #dc2626; } .status-failed { background: #fee2e2; color: #dc2626; }
</style> </style>
</head> {% endblock %}
<body>
<header class="header">
<div class="header-content">
<div class="logo">VidAI</div>
<nav class="nav">
<a href="/dashboard" class="active">Dashboard</a>
<a href="/analyze">Analyze</a>
<a href="/train">Train</a>
<a href="/history">History</a>
<a href="/api_tokens">API Tokens</a>
<a href="/settings">Settings</a>
</nav>
<div class="user-menu">
<div class="user-icon" onclick="toggleUserMenu()">
<i class="fas fa-user"></i>
</div>
<div id="userDropdown" class="user-dropdown">
<a href="/account">Account</a>
{% if user.get('role') != 'admin' %}
<a href="/api_tokens">Tokens</a>
{% else %}
<a href="/admin/users">Users</a>
<a href="/config">Configurations</a>
{% endif %}
<a href="/logout">Logout</a>
</div>
</div>
</div>
</header>
<div class="container"> {% block content %}
<div class="container">
<div class="stats-grid"> <div class="stats-grid">
<div class="stat-card"> <div class="stat-card">
<div class="stat-value">{{ tokens }}</div> <div class="stat-value">{{ tokens }}</div>
...@@ -129,22 +84,5 @@ ...@@ -129,22 +84,5 @@
<div style="text-align: center; padding: 1rem; color: #64748b;">No jobs yet</div> <div style="text-align: center; padding: 1rem; color: #64748b;">No jobs yet</div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endblock %}
<script> \ No newline at end of file
function toggleUserMenu() {
const dropdown = document.getElementById('userDropdown');
dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block';
}
// Close dropdown when clicking outside
window.onclick = function(event) {
const dropdown = document.getElementById('userDropdown');
const icon = document.querySelector('.user-icon');
if (!icon.contains(event.target) && !dropdown.contains(event.target)) {
dropdown.style.display = 'none';
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html> {% extends "base.html" %}
<html>
<head> {% block title %}Job History - VidAI{% endblock %}
<title>Job History - VidAI</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"> {% block head %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"> <style>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #f8fafc; }
.header { background: white; padding: 1rem 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.header-content { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; }
.logo { font-size: 1.5rem; font-weight: 700; color: #667eea; }
.nav { display: flex; gap: 2rem; }
.nav a { text-decoration: none; color: #64748b; font-weight: 500; }
.nav a.active { color: #667eea; }
.user-menu { display: flex; align-items: center; gap: 1rem; position: relative; }
.user-icon { cursor: pointer; padding: 0.5rem; border-radius: 50%; background: #f8fafc; transition: background 0.2s; }
.user-icon:hover { background: #e2e8f0; }
.user-icon i { font-size: 1.2rem; color: #64748b; }
.user-dropdown { display: none; position: absolute; top: 100%; right: 0; background: white; min-width: 200px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 8px; z-index: 1000; }
.user-dropdown a { display: block; padding: 0.75rem 1rem; text-decoration: none; color: #374151; border-bottom: 1px solid #f1f5f9; }
.user-dropdown a:last-child { border-bottom: none; color: #dc2626; }
.user-dropdown a:hover { background: #f8fafc; }
.container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; } .container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; }
.history-table { background: white; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); overflow: hidden; } .history-table { background: white; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); overflow: hidden; }
.table-header { padding: 2rem; border-bottom: 1px solid #e5e7eb; } .table-header { padding: 2rem; border-bottom: 1px solid #e5e7eb; }
...@@ -37,39 +20,11 @@ ...@@ -37,39 +20,11 @@
.status-failed { background: #fee2e2; color: #dc2626; } .status-failed { background: #fee2e2; color: #dc2626; }
.job-tokens { font-weight: 600; color: #667eea; text-align: center; } .job-tokens { font-weight: 600; color: #667eea; text-align: center; }
.no-jobs { text-align: center; padding: 3rem; color: #6b7280; } .no-jobs { text-align: center; padding: 3rem; color: #6b7280; }
</style> </style>
</head> {% endblock %}
<body>
<header class="header">
<div class="header-content">
<div class="logo">VidAI</div>
<nav class="nav">
<a href="/dashboard">Dashboard</a>
<a href="/analyze">Analyze</a>
<a href="/train">Train</a>
<a href="/history" class="active">History</a>
<a href="/api_tokens">API Tokens</a>
<a href="/settings">Settings</a>
</nav>
<div class="user-menu">
<div class="user-icon" onclick="toggleUserMenu()">
<i class="fas fa-user"></i>
</div>
<div id="userDropdown" class="user-dropdown">
<a href="/account">Account</a>
{% if user.get('role') != 'admin' %}
<a href="/api_tokens">Tokens</a>
{% else %}
<a href="/admin/users">Users</a>
<a href="/config">Configurations</a>
{% endif %}
<a href="/logout">Logout</a>
</div>
</div>
</div>
</header>
<div class="container"> {% block content %}
<div class="container">
<div class="history-table"> <div class="history-table">
<div class="table-header"> <div class="table-header">
<h2><i class="fas fa-history"></i> Job History</h2> <h2><i class="fas fa-history"></i> Job History</h2>
...@@ -90,21 +45,5 @@ ...@@ -90,21 +45,5 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div>
<script> {% endblock %}
function toggleUserMenu() { \ No newline at end of file
const dropdown = document.getElementById('userDropdown');
dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block';
}
// Close dropdown when clicking outside
window.onclick = function(event) {
const dropdown = document.getElementById('userDropdown');
const icon = document.querySelector('.user-icon');
if (!icon.contains(event.target) && !dropdown.contains(event.target)) {
dropdown.style.display = 'none';
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html> {% extends "base.html" %}
<html>
<head> {% block title %}Train Model - VidAI{% endblock %}
<title>Train Model - VidAI</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"> {% block head %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"> <style>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #f8fafc; }
.header { background: white; padding: 1rem 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.header-content { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; }
.logo { font-size: 1.5rem; font-weight: 700; color: #667eea; }
.nav { display: flex; gap: 2rem; }
.nav a { text-decoration: none; color: #64748b; font-weight: 500; }
.nav a.active { color: #667eea; }
.user-menu { display: flex; align-items: center; gap: 1rem; position: relative; }
.user-icon { cursor: pointer; padding: 0.5rem; border-radius: 50%; background: #f8fafc; transition: background 0.2s; }
.user-icon:hover { background: #e2e8f0; }
.user-icon i { font-size: 1.2rem; color: #64748b; }
.user-dropdown { display: none; position: absolute; top: 100%; right: 0; background: white; min-width: 200px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 8px; z-index: 1000; }
.user-dropdown a { display: block; padding: 0.75rem 1rem; text-decoration: none; color: #374151; border-bottom: 1px solid #f1f5f9; }
.user-dropdown a:last-child { border-bottom: none; color: #dc2626; }
.user-dropdown a:hover { background: #f8fafc; }
.container { max-width: 800px; margin: 2rem auto; padding: 0 2rem; } .container { max-width: 800px; margin: 2rem auto; padding: 0 2rem; }
.training-form { background: white; padding: 2rem; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); } .training-form { background: white; padding: 2rem; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.form-group { margin-bottom: 1.5rem; } .form-group { margin-bottom: 1.5rem; }
...@@ -36,39 +19,11 @@ ...@@ -36,39 +19,11 @@
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; } .alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.tokens { background: #f0f9ff; padding: 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 4px solid #667eea; } .tokens { background: #f0f9ff; padding: 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 4px solid #667eea; }
.warning { background: #fef3c7; padding: 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 4px solid #d97706; } .warning { background: #fef3c7; padding: 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 4px solid #d97706; }
</style> </style>
</head> {% endblock %}
<body>
<header class="header">
<div class="header-content">
<div class="logo">VidAI</div>
<nav class="nav">
<a href="/dashboard">Dashboard</a>
<a href="/analyze">Analyze</a>
<a href="/train" class="active">Train</a>
<a href="/history">History</a>
<a href="/api_tokens">API Tokens</a>
<a href="/settings">Settings</a>
</nav>
<div class="user-menu">
<div class="user-icon" onclick="toggleUserMenu()">
<i class="fas fa-user"></i>
</div>
<div id="userDropdown" class="user-dropdown">
<a href="/account">Account</a>
{% if user.get('role') != 'admin' %}
<a href="/api_tokens">Tokens</a>
{% else %}
<a href="/admin/users">Users</a>
<a href="/config">Configurations</a>
{% endif %}
<a href="/logout">Logout</a>
</div>
</div>
</div>
</header>
<div class="container"> {% block content %}
<div class="container">
<div class="tokens"> <div class="tokens">
<strong>Available Tokens:</strong> {{ tokens }} (Training costs ~100 tokens) <strong>Available Tokens:</strong> {{ tokens }} (Training costs ~100 tokens)
</div> </div>
...@@ -126,21 +81,5 @@ ...@@ -126,21 +81,5 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div>
<script> {% endblock %}
function toggleUserMenu() { \ No newline at end of file
const dropdown = document.getElementById('userDropdown');
dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block';
}
// Close dropdown when clicking outside
window.onclick = function(event) {
const dropdown = document.getElementById('userDropdown');
const icon = document.querySelector('.user-icon');
if (!icon.contains(event.target) && !dropdown.contains(event.target)) {
dropdown.style.display = 'none';
}
}
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment