Karan Adhikari commited on
Commit
15fea8d
·
unverified ·
1 Parent(s): 7787e06

Revamp navbar and footer structure with theme support

Browse files

Refactor navigation bar and footer layout, update theme handling.

Files changed (1) hide show
  1. Backend/fastapi/templates/base.html +193 -79
Backend/fastapi/templates/base.html CHANGED
@@ -35,99 +35,213 @@
35
 
36
  .theme-card {
37
  background-color: {{ theme.colors.card }};
38
- color: {{ theme.colors.text }};
39
- }
40
-
41
- .theme-primary {
42
- background-color: {{ theme.colors.primary }};
43
- }
44
-
45
- .theme-secondary {
46
- background-color: {{ theme.colors.secondary }};
47
  }
48
 
49
- .theme-accent {
50
- background-color: {{ theme.colors.accent }};
51
- }
52
-
53
- .theme-text-secondary {
54
- color: {{ theme.colors.text_secondary }};
55
  }
56
  </style>
57
  </head>
58
 
59
  <body class="min-h-screen flex flex-col">
60
- <!-- Navigation -->
61
- <nav class="theme-card shadow-lg border-b text-text">
62
- <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
63
- <div class="flex justify-between items-center h-16">
64
- <div class="flex items-center space-x-4">
65
- <h1 class="text-2xl font-bold text-primary">Telegram Stremio</h1>
66
- {% if current_user %}
67
- <div class="hidden md:flex space-x-4">
68
- <a href="/"
69
- class="text-text hover:text-primary px-3 py-2 rounded-md transition-colors">Dashboard</a>
70
- <a href="/media/manage"
71
- class="text-text hover:text-primary px-3 py-2 rounded-md transition-colors">Media</a>
72
- <a href="/admin/dashboard"
73
- class="text-text hover:text-primary px-3 py-2 rounded-md transition-colors">Admin</a>
74
- <a href="/admin/subscriptions"
75
- class="text-text hover:text-primary px-3 py-2 rounded-md transition-colors">Sub Manage</a>
76
- <a href="/admin/access"
77
- class="text-text hover:text-primary px-3 py-2 rounded-md transition-colors">Access</a>
78
- </div>
79
- {% endif %}
 
 
 
 
 
 
 
 
 
 
80
  </div>
 
 
81
 
82
- <div class="flex items-center space-x-4">
83
- <!-- Theme Selector -->
84
- <div class="relative">
85
- <form method="post" action="/set-theme" id="theme-form">
86
- <select name="theme" onchange="document.getElementById('theme-form').submit()"
87
- class="theme-card border border-gray-300 rounded-md px-3 py-2 text-sm">
88
- {% for theme_key, theme_data in themes.items() %}
89
- <option value="{{ theme_key }}" {% if current_theme==theme_key %}selected{% endif %}>
90
- {{ theme_data.name }}
91
- </option>
92
- {% endfor %}
93
- </select>
94
- </form>
95
- </div>
 
 
 
 
 
 
 
 
 
96
 
97
- {% if current_user %}
98
- <div class="flex items-center space-x-4">
99
- <span class="text-sm theme-text-secondary">{{ current_user }}</span>
100
- <a href="/logout"
101
- class="bg-red-600 text-white px-4 py-2 rounded-md hover:bg-red-700 transition-colors">Logout</a>
102
  </div>
103
- {% else %}
104
- <a href="/login"
105
- class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md transition-colors">Login</a>
106
- {% endif %}
107
  </div>
 
 
 
 
 
 
 
 
 
 
 
108
  </div>
109
  </div>
110
- </nav>
111
-
112
- <!-- Main Content -->
113
- <main class="flex-1">
114
- {% block content %}{% endblock %}
115
- </main>
116
-
117
- <!-- Footer -->
118
- <footer class="theme-card border-t mt-auto text-text">
119
- <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
120
- <div class="flex justify-between items-center">
121
- <p class="theme-text-secondary text-sm">© 2025 Telegram Stremio. All rights reserved.</p>
122
- <div class="flex space-x-4">
123
- <a href="/status"
124
- class="theme-text-secondary hover:text-primary text-sm transition-colors">Status</a>
125
- <a href="/stremio" class="theme-text-secondary hover:text-primary text-sm transition-colors">Stremio
126
- Guide</a>
127
- </div>
 
 
 
 
 
 
 
 
 
 
 
128
  </div>
129
  </div>
130
- </footer>
131
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  .theme-card {
37
  background-color: {{ theme.colors.card }};
 
 
 
 
 
 
 
 
 
38
  }
39
 
40
+ .active-link {
41
+ background-color: rgba(255,255,255,0.08);
42
+ color: var(--tw-color-primary);
 
 
 
43
  }
44
  </style>
45
  </head>
46
 
47
  <body class="min-h-screen flex flex-col">
48
+
49
+ <!-- NAVBAR -->
50
+ <nav class="theme-card border-b shadow-sm sticky top-0 z-50 backdrop-blur">
51
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
52
+ <div class="flex justify-between items-center h-16">
53
+
54
+ <!-- LEFT -->
55
+ <div class="flex items-center gap-6">
56
+ <h1 class="text-xl md:text-2xl font-bold text-primary flex items-center gap-2">
57
+ <i class="fas fa-paper-plane"></i>
58
+ Telegram Stremio
59
+ </h1>
60
+
61
+ {% if current_user %}
62
+ <div class="hidden md:flex items-center gap-2">
63
+ <a href="/" class="nav-link {% if request.url.path == '/' %}active-link{% endif %}">
64
+ <i class="fas fa-home"></i> Dashboard
65
+ </a>
66
+ <a href="/media/manage" class="nav-link {% if '/media' in request.url.path %}active-link{% endif %}">
67
+ <i class="fas fa-photo-film"></i> Media
68
+ </a>
69
+ <a href="/admin/dashboard" class="nav-link {% if '/admin/dashboard' in request.url.path %}active-link{% endif %}">
70
+ <i class="fas fa-chart-line"></i> Admin
71
+ </a>
72
+ <a href="/admin/subscriptions" class="nav-link {% if '/subscriptions' in request.url.path %}active-link{% endif %}">
73
+ <i class="fas fa-credit-card"></i> Subscriptions
74
+ </a>
75
+ <a href="/admin/access" class="nav-link {% if '/access' in request.url.path %}active-link{% endif %}">
76
+ <i class="fas fa-user-shield"></i> Access
77
+ </a>
78
  </div>
79
+ {% endif %}
80
+ </div>
81
 
82
+ <!-- RIGHT -->
83
+ <div class="flex items-center gap-3 relative">
84
+
85
+ <!-- THEME -->
86
+ <form method="post" action="/set-theme" id="theme-form">
87
+ <select name="theme" onchange="this.form.submit()"
88
+ class="theme-card border rounded-md px-2 py-1 text-sm">
89
+ {% for theme_key, theme_data in themes.items() %}
90
+ <option value="{{ theme_key }}" {% if current_theme==theme_key %}selected{% endif %}>
91
+ {{ theme_data.name }}
92
+ </option>
93
+ {% endfor %}
94
+ </select>
95
+ </form>
96
+
97
+ {% if current_user %}
98
+ <!-- PROFILE DROPDOWN -->
99
+ <div class="relative">
100
+ <button id="profile-btn" class="flex items-center gap-2 text-sm">
101
+ <i class="fas fa-user-circle text-lg"></i>
102
+ <span class="hidden sm:block">{{ current_user }}</span>
103
+ <i class="fas fa-chevron-down text-xs"></i>
104
+ </button>
105
 
106
+ <div id="profile-menu" class="hidden absolute right-0 mt-2 w-40 theme-card border rounded-lg shadow-lg py-2">
107
+ <a href="#" class="dropdown-link">Profile</a>
108
+ <a href="#" class="dropdown-link">Settings</a>
109
+ <a href="/logout" class="dropdown-link text-red-500">Logout</a>
 
110
  </div>
 
 
 
 
111
  </div>
112
+ {% else %}
113
+ <a href="/login"
114
+ class="bg-blue-600 text-white px-3 py-1.5 rounded-md hover:bg-blue-700 text-sm transition">
115
+ Login
116
+ </a>
117
+ {% endif %}
118
+
119
+ <!-- MOBILE BUTTON -->
120
+ <button id="menu-btn" class="md:hidden text-xl">
121
+ <i class="fas fa-bars"></i>
122
+ </button>
123
  </div>
124
  </div>
125
+ </div>
126
+
127
+ <!-- MOBILE MENU -->
128
+ {% if current_user %}
129
+ <div id="mobile-menu" class="hidden md:hidden px-4 pb-4 animate-slideDown">
130
+ <div class="flex flex-col gap-2">
131
+ <a href="/" class="mobile-link">Dashboard</a>
132
+ <a href="/media/manage" class="mobile-link">Media</a>
133
+ <a href="/admin/dashboard" class="mobile-link">Admin</a>
134
+ <a href="/admin/subscriptions" class="mobile-link">Subscriptions</a>
135
+ <a href="/admin/access" class="mobile-link">Access</a>
136
+ </div>
137
+ </div>
138
+ {% endif %}
139
+ </nav>
140
+
141
+ <!-- MAIN -->
142
+ <main class="flex-1">
143
+ {% block content %}{% endblock %}
144
+ </main>
145
+
146
+ <!-- FOOTER -->
147
+ <footer class="theme-card border-t mt-auto text-text">
148
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
149
+ <div class="flex flex-col md:flex-row justify-between items-center gap-3">
150
+ <p class="theme-text-secondary text-sm">© 2026 Telegram Stremio. All rights reserved.</p>
151
+ <div class="flex gap-4">
152
+ <a href="/status" class="footer-link">Status</a>
153
+ <a href="/stremio" class="footer-link">Stremio Guide</a>
154
  </div>
155
  </div>
156
+ </div>
157
+ </footer>
158
+
159
+ <!-- STYLES -->
160
+ <style>
161
+ .theme-primary { background-color: {{ theme.colors.primary }}; }
162
+ .theme-secondary { background-color: {{ theme.colors.secondary }}; }
163
+ .theme-accent { background-color: {{ theme.colors.accent }}; }
164
+ .theme-text-secondary { color: {{ theme.colors.text_secondary }}; }
165
+
166
+ .nav-link {
167
+ display: flex;
168
+ align-items: center;
169
+ gap: 6px;
170
+ padding: 6px 10px;
171
+ border-radius: 6px;
172
+ font-size: 14px;
173
+ transition: 0.2s;
174
+ }
175
+
176
+ .nav-link:hover {
177
+ background-color: rgba(255,255,255,0.05);
178
+ color: var(--tw-color-primary);
179
+ }
180
+
181
+ .mobile-link {
182
+ padding: 10px;
183
+ border-radius: 6px;
184
+ font-size: 14px;
185
+ }
186
+
187
+ .mobile-link:hover {
188
+ background-color: rgba(255,255,255,0.05);
189
+ }
190
+
191
+ .dropdown-link {
192
+ display: block;
193
+ padding: 8px 12px;
194
+ font-size: 14px;
195
+ }
196
+
197
+ .dropdown-link:hover {
198
+ background-color: rgba(255,255,255,0.05);
199
+ }
200
+
201
+ .footer-link {
202
+ font-size: 14px;
203
+ transition: 0.2s;
204
+ }
205
 
206
+ .footer-link:hover {
207
+ color: var(--tw-color-primary);
208
+ }
209
+
210
+ @keyframes slideDown {
211
+ from { opacity: 0; transform: translateY(-10px); }
212
+ to { opacity: 1; transform: translateY(0); }
213
+ }
214
+
215
+ .animate-slideDown {
216
+ animation: slideDown 0.25s ease;
217
+ }
218
+ </style>
219
+
220
+ <!-- SCRIPT -->
221
+ <script>
222
+ const btn = document.getElementById('menu-btn');
223
+ const menu = document.getElementById('mobile-menu');
224
+ const profileBtn = document.getElementById('profile-btn');
225
+ const profileMenu = document.getElementById('profile-menu');
226
+
227
+ if (btn) {
228
+ btn.addEventListener('click', () => {
229
+ menu.classList.toggle('hidden');
230
+ });
231
+ }
232
+
233
+ if (profileBtn) {
234
+ profileBtn.addEventListener('click', () => {
235
+ profileMenu.classList.toggle('hidden');
236
+ });
237
+ }
238
+
239
+ document.addEventListener('click', (e) => {
240
+ if (profileBtn && !profileBtn.contains(e.target) && !profileMenu.contains(e.target)) {
241
+ profileMenu.classList.add('hidden');
242
+ }
243
+ });
244
+ </script>
245
+
246
+ </body>
247
+ </html>