Karan Adhikari commited on
Commit
d82374d
·
unverified ·
1 Parent(s): 066105f

Refactor base.html to use theme variables

Browse files
Files changed (1) hide show
  1. Backend/fastapi/templates/base.html +82 -135
Backend/fastapi/templates/base.html CHANGED
@@ -17,21 +17,10 @@
17
  primary: '{{ theme.colors.primary }}',
18
  secondary: '{{ theme.colors.secondary }}',
19
  accent: '{{ theme.colors.accent }}',
20
- background: '#0f172a', // Enforced dark base for glassmorphism
21
- card: 'rgba(255, 255, 255, 0.03)',
22
- text: '#f8fafc',
23
- 'text-secondary': '#94a3b8'
24
- },
25
- animation: {
26
- 'blob': 'blob 7s infinite',
27
- },
28
- keyframes: {
29
- blob: {
30
- '0%': { transform: 'translate(0px, 0px) scale(1)' },
31
- '33%': { transform: 'translate(30px, -50px) scale(1.1)' },
32
- '66%': { transform: 'translate(-20px, 20px) scale(0.9)' },
33
- '100%': { transform: 'translate(0px, 0px) scale(1)' },
34
- }
35
  }
36
  }
37
  }
@@ -40,98 +29,65 @@
40
 
41
  <style>
42
  body {
43
- background-color: theme('colors.background');
44
- color: theme('colors.text');
45
- /* Smooth dark gradient base */
46
- background-image: radial-gradient(at 0% 0%, rgba(30, 27, 75, 0.8) 0px, transparent 50%),
47
- radial-gradient(at 100% 0%, rgba(15, 23, 42, 0.8) 0px, transparent 50%);
48
- background-attachment: fixed;
49
  }
50
 
51
- /* Glassmorphism Base Classes */
52
- .glass-panel {
53
- background: rgba(255, 255, 255, 0.03);
54
- backdrop-filter: blur(16px);
55
- -webkit-backdrop-filter: blur(16px);
56
- border: 1px solid rgba(255, 255, 255, 0.05);
57
- box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
58
- }
59
-
60
- .glass-input {
61
- background: rgba(0, 0, 0, 0.2);
62
- border: 1px solid rgba(255, 255, 255, 0.1);
63
- color: white;
64
- transition: all 0.3s ease;
65
- }
66
-
67
- .glass-input:focus {
68
- background: rgba(0, 0, 0, 0.3);
69
- border-color: rgba(139, 92, 246, 0.5); /* Purple focus */
70
- outline: none;
71
- box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
72
  }
73
 
74
  .active-link {
75
- background: linear-gradient(to right, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
76
- border-left: 3px solid var(--tw-color-primary, #8b5cf6);
77
- color: white;
78
  }
79
-
80
- /* Custom Scrollbar */
81
- ::-webkit-scrollbar { width: 8px; height: 8px; }
82
- ::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
83
- ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
84
- ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
85
  </style>
86
  </head>
87
 
88
- <body class="min-h-screen flex flex-col relative overflow-x-hidden font-sans antialiased">
89
-
90
- <div class="fixed inset-0 w-full h-full pointer-events-none z-[-1] overflow-hidden">
91
- <div class="absolute top-0 -left-4 w-72 h-72 bg-purple-500 rounded-full mix-blend-multiply filter blur-[128px] opacity-20 animate-blob"></div>
92
- <div class="absolute top-0 -right-4 w-72 h-72 bg-blue-500 rounded-full mix-blend-multiply filter blur-[128px] opacity-20 animate-blob animation-delay-2000"></div>
93
- <div class="absolute -bottom-8 left-20 w-72 h-72 bg-indigo-500 rounded-full mix-blend-multiply filter blur-[128px] opacity-20 animate-blob animation-delay-4000"></div>
94
- </div>
95
 
96
- <nav class="glass-panel sticky top-0 z-50 border-b border-white/5">
 
97
  <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
98
- <div class="flex justify-between items-center h-20">
99
 
100
- <div class="flex items-center gap-8">
101
- <h1 class="text-xl md:text-2xl font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-blue-400 to-purple-500 flex items-center gap-3 tracking-tight">
102
- <div class="w-10 h-10 rounded-xl bg-gradient-to-br from-blue-500/20 to-purple-500/20 flex items-center justify-center border border-white/10 shadow-lg shadow-purple-500/10">
103
- <i class="fas fa-paper-plane text-purple-400 text-lg"></i>
104
- </div>
105
- TG Stremio
106
  </h1>
107
 
108
  {% if current_user %}
109
- <div class="hidden lg:flex items-center gap-1 bg-black/20 p-1.5 rounded-2xl border border-white/5">
110
  <a href="/" class="nav-link {% if request.url.path == '/' %}active-link{% endif %}">
111
- <i class="fas fa-home w-4 text-center"></i> Dashboard
112
  </a>
113
  <a href="/media/manage" class="nav-link {% if '/media' in request.url.path %}active-link{% endif %}">
114
- <i class="fas fa-photo-film w-4 text-center"></i> Media
115
  </a>
116
  <a href="/admin/dashboard" class="nav-link {% if '/admin/dashboard' in request.url.path %}active-link{% endif %}">
117
- <i class="fas fa-chart-line w-4 text-center"></i> Admin
118
  </a>
119
  <a href="/admin/subscriptions" class="nav-link {% if '/subscriptions' in request.url.path %}active-link{% endif %}">
120
- <i class="fas fa-credit-card w-4 text-center"></i> Subscriptions
121
  </a>
122
  <a href="/admin/access" class="nav-link {% if '/access' in request.url.path %}active-link{% endif %}">
123
- <i class="fas fa-user-shield w-4 text-center"></i> Access
124
  </a>
125
  </div>
126
  {% endif %}
127
  </div>
128
 
129
- <div class="flex items-center gap-4 relative">
130
- <form method="post" action="/set-theme" id="theme-form" class="hidden sm:block">
 
 
 
131
  <select name="theme" onchange="this.form.submit()"
132
- class="glass-input rounded-xl px-4 py-2 text-sm cursor-pointer appearance-none pr-8 relative">
133
  {% for theme_key, theme_data in themes.items() %}
134
- <option value="{{ theme_key }}" {% if current_theme==theme_key %}selected{% endif %} class="bg-slate-900 text-white">
135
  {{ theme_data.name }}
136
  </option>
137
  {% endfor %}
@@ -139,124 +95,114 @@
139
  </form>
140
 
141
  {% if current_user %}
 
142
  <div class="relative">
143
- <button id="profile-btn" class="flex items-center gap-3 text-sm hover:bg-white/5 px-3 py-2 rounded-xl transition-all border border-transparent hover:border-white/10">
144
- <div class="w-8 h-8 rounded-full bg-gradient-to-r from-blue-500 to-purple-600 flex items-center justify-center shadow-lg">
145
- <i class="fas fa-user text-white text-xs"></i>
146
- </div>
147
- <span class="hidden sm:block font-medium text-gray-200">{{ current_user }}</span>
148
- <i class="fas fa-chevron-down text-xs text-gray-400"></i>
149
  </button>
150
 
151
- <div id="profile-menu" class="hidden absolute right-0 mt-3 w-48 glass-panel rounded-xl py-2 transform origin-top-right transition-all">
152
- <div class="px-4 py-2 border-b border-white/5 mb-1 sm:hidden">
153
- <p class="text-xs text-gray-400">Logged in as</p>
154
- <p class="text-sm font-semibold truncate">{{ current_user }}</p>
155
- </div>
156
- <a href="/logout" class="dropdown-link text-red-400 hover:text-red-300 hover:bg-red-500/10 flex items-center gap-2">
157
- <i class="fas fa-sign-out-alt"></i> Logout
158
- </a>
159
  </div>
160
  </div>
161
  {% else %}
162
  <a href="/login"
163
- class="bg-gradient-to-r from-blue-600 to-indigo-600 text-white px-6 py-2 rounded-xl hover:from-blue-500 hover:to-indigo-500 text-sm font-semibold transition-all shadow-lg shadow-blue-500/20 border border-blue-500/30">
164
  Login
165
  </a>
166
  {% endif %}
167
 
168
- <button id="menu-btn" class="lg:hidden w-10 h-10 rounded-xl glass-panel flex items-center justify-center text-gray-300 hover:text-white transition-colors">
 
169
  <i class="fas fa-bars"></i>
170
  </button>
171
  </div>
172
  </div>
173
  </div>
174
 
 
175
  {% if current_user %}
176
- <div id="mobile-menu" class="hidden lg:hidden px-4 pb-6 pt-2 animate-slideDown border-t border-white/5 bg-black/40 backdrop-blur-2xl absolute w-full left-0 shadow-2xl">
177
- <div class="flex flex-col gap-1 max-w-7xl mx-auto">
178
- <a href="/" class="mobile-link"><i class="fas fa-home w-6"></i> Dashboard</a>
179
- <a href="/media/manage" class="mobile-link"><i class="fas fa-photo-film w-6"></i> Media</a>
180
- <a href="/admin/dashboard" class="mobile-link"><i class="fas fa-chart-line w-6"></i> Admin</a>
181
- <a href="/admin/subscriptions" class="mobile-link"><i class="fas fa-credit-card w-6"></i> Subscriptions</a>
182
- <a href="/admin/access" class="mobile-link"><i class="fas fa-user-shield w-6"></i> Access</a>
183
  </div>
184
  </div>
185
  {% endif %}
186
  </nav>
187
 
188
- <main class="flex-1 relative z-10 w-full">
 
189
  {% block content %}{% endblock %}
190
  </main>
191
 
192
- <footer class="mt-auto border-t border-white/5 glass-panel z-10 relative">
193
- <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
194
- <div class="flex flex-col md:flex-row justify-between items-center gap-4">
195
- <div class="flex items-center gap-3">
196
- <div class="w-8 h-8 rounded-lg bg-gradient-to-br from-blue-500/20 to-purple-500/20 flex items-center justify-center border border-white/10">
197
- <i class="fas fa-paper-plane text-purple-400 text-sm"></i>
198
- </div>
199
- <p class="text-gray-400 text-sm font-medium">© 2026 Telegram Stremio. All rights reserved.</p>
200
- </div>
201
- <div class="flex gap-6">
202
- <a href="/status" class="footer-link">System Status</a>
203
  <a href="/stremio" class="footer-link">Stremio Guide</a>
204
  </div>
205
  </div>
206
  </div>
207
  </footer>
208
 
 
209
  <style>
 
 
 
 
 
210
  .nav-link {
211
  display: flex;
212
  align-items: center;
213
- gap: 8px;
214
- padding: 8px 16px;
215
- border-radius: 12px;
216
  font-size: 14px;
217
- font-weight: 500;
218
- color: #94a3b8;
219
- transition: all 0.2s ease;
220
  }
221
 
222
  .nav-link:hover {
223
- color: white;
224
  background-color: rgba(255,255,255,0.05);
 
225
  }
226
 
227
  .mobile-link {
228
- display: flex;
229
- align-items: center;
230
- padding: 12px 16px;
231
- border-radius: 12px;
232
- font-size: 15px;
233
- font-weight: 500;
234
- color: #e2e8f0;
235
- transition: 0.2s;
236
  }
237
 
238
  .mobile-link:hover {
239
- background-color: rgba(255,255,255,0.08);
240
- color: white;
241
  }
242
 
243
  .dropdown-link {
244
  display: block;
245
- padding: 10px 16px;
246
  font-size: 14px;
247
- font-weight: 500;
248
- transition: 0.2s;
 
 
249
  }
250
 
251
  .footer-link {
252
  font-size: 14px;
253
- color: #94a3b8;
254
- font-weight: 500;
255
  transition: 0.2s;
256
  }
257
 
258
  .footer-link:hover {
259
- color: #c084fc;
260
  }
261
 
262
  @keyframes slideDown {
@@ -265,10 +211,11 @@
265
  }
266
 
267
  .animate-slideDown {
268
- animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
269
  }
270
  </style>
271
 
 
272
  <script>
273
  const btn = document.getElementById('menu-btn');
274
  const menu = document.getElementById('mobile-menu');
 
17
  primary: '{{ theme.colors.primary }}',
18
  secondary: '{{ theme.colors.secondary }}',
19
  accent: '{{ theme.colors.accent }}',
20
+ background: '{{ theme.colors.background }}',
21
+ card: '{{ theme.colors.card }}',
22
+ text: '{{ theme.colors.text }}',
23
+ 'text-secondary': '{{ theme.colors.text_secondary }}'
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
  }
26
  }
 
29
 
30
  <style>
31
  body {
32
+ background-color: {{ theme.colors.background }};
33
+ color: {{ theme.colors.text }};
 
 
 
 
34
  }
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 %}
 
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="/logout" class="dropdown-link text-red-500">Logout</a>
 
 
 
 
 
 
108
  </div>
109
  </div>
110
  {% else %}
111
  <a href="/login"
112
+ class="bg-blue-600 text-white px-3 py-1.5 rounded-md hover:bg-blue-700 text-sm transition">
113
  Login
114
  </a>
115
  {% endif %}
116
 
117
+ <!-- MOBILE BUTTON -->
118
+ <button id="menu-btn" class="md:hidden text-xl">
119
  <i class="fas fa-bars"></i>
120
  </button>
121
  </div>
122
  </div>
123
  </div>
124
 
125
+ <!-- MOBILE MENU -->
126
  {% if current_user %}
127
+ <div id="mobile-menu" class="hidden md:hidden px-4 pb-4 animate-slideDown">
128
+ <div class="flex flex-col gap-2">
129
+ <a href="/" class="mobile-link">Dashboard</a>
130
+ <a href="/media/manage" class="mobile-link">Media</a>
131
+ <a href="/admin/dashboard" class="mobile-link">Admin</a>
132
+ <a href="/admin/subscriptions" class="mobile-link">Subscriptions</a>
133
+ <a href="/admin/access" class="mobile-link">Access</a>
134
  </div>
135
  </div>
136
  {% endif %}
137
  </nav>
138
 
139
+ <!-- MAIN -->
140
+ <main class="flex-1">
141
  {% block content %}{% endblock %}
142
  </main>
143
 
144
+ <!-- FOOTER -->
145
+ <footer class="theme-card border-t mt-auto text-text">
146
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
147
+ <div class="flex flex-col md:flex-row justify-between items-center gap-3">
148
+ <p class="theme-text-secondary text-sm">© 2026 Telegram Stremio. All rights reserved.</p>
149
+ <div class="flex gap-4">
150
+ <a href="/status" class="footer-link">Status</a>
 
 
 
 
151
  <a href="/stremio" class="footer-link">Stremio Guide</a>
152
  </div>
153
  </div>
154
  </div>
155
  </footer>
156
 
157
+ <!-- STYLES -->
158
  <style>
159
+ .theme-primary { background-color: {{ theme.colors.primary }}; }
160
+ .theme-secondary { background-color: {{ theme.colors.secondary }}; }
161
+ .theme-accent { background-color: {{ theme.colors.accent }}; }
162
+ .theme-text-secondary { color: {{ theme.colors.text_secondary }}; }
163
+
164
  .nav-link {
165
  display: flex;
166
  align-items: center;
167
+ gap: 6px;
168
+ padding: 6px 10px;
169
+ border-radius: 6px;
170
  font-size: 14px;
171
+ transition: 0.2s;
 
 
172
  }
173
 
174
  .nav-link:hover {
 
175
  background-color: rgba(255,255,255,0.05);
176
+ color: var(--tw-color-primary);
177
  }
178
 
179
  .mobile-link {
180
+ padding: 10px;
181
+ border-radius: 6px;
182
+ font-size: 14px;
 
 
 
 
 
183
  }
184
 
185
  .mobile-link:hover {
186
+ background-color: rgba(255,255,255,0.05);
 
187
  }
188
 
189
  .dropdown-link {
190
  display: block;
191
+ padding: 8px 12px;
192
  font-size: 14px;
193
+ }
194
+
195
+ .dropdown-link:hover {
196
+ background-color: rgba(255,255,255,0.05);
197
  }
198
 
199
  .footer-link {
200
  font-size: 14px;
 
 
201
  transition: 0.2s;
202
  }
203
 
204
  .footer-link:hover {
205
+ color: var(--tw-color-primary);
206
  }
207
 
208
  @keyframes slideDown {
 
211
  }
212
 
213
  .animate-slideDown {
214
+ animation: slideDown 0.25s ease;
215
  }
216
  </style>
217
 
218
+ <!-- SCRIPT -->
219
  <script>
220
  const btn = document.getElementById('menu-btn');
221
  const menu = document.getElementById('mobile-menu');