File size: 22,665 Bytes
fd019a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e53c8a
 
 
 
 
40c29cf
9e53c8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40c29cf
 
9e53c8a
 
 
 
 
 
 
40c29cf
 
 
9e53c8a
 
 
 
 
40c29cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e53c8a
40c29cf
 
 
9e53c8a
40c29cf
 
 
 
 
7ff8266
 
40c29cf
 
 
7ff8266
40c29cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e53c8a
40c29cf
 
 
 
7ff8266
40c29cf
 
 
 
 
 
 
 
 
 
 
 
 
7ff8266
40c29cf
7ff8266
40c29cf
 
 
 
 
 
7ff8266
40c29cf
 
9e53c8a
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Dashboard | AI Byte</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');
        .font-space { font-family: 'Space Grotesk', sans-serif; }
        .gradient-text {
            background: linear-gradient(90deg, #6366F1 0%, #8B5CF6 50%, #EC4899 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
    </style>
</head>
<body class="bg-gray-50 font-sans">
    <!-- Navigation -->
    <nav class="bg-white/80 backdrop-blur-md border-b border-gray-200 fixed w-full z-10">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <div class="flex-shrink-0 flex items-center">
                        <a href="index.html" class="text-2xl font-bold gradient-text font-space">AI Byte</a>
                    </div>
                </div>
                <div class="hidden md:ml-6 md:flex md:items-center md:space-x-8">
                    <a href="index.html" class="text-gray-500 hover:text-purple-600 px-3 py-2 rounded-md text-sm font-medium">Home</a>
                    <a href="articles.html" class="text-gray-500 hover:text-purple-600 px-3 py-2 rounded-md text-sm font-medium">Articles</a>
                    <a href="tutorials.html" class="text-gray-500 hover:text-purple-600 px-3 py-2 rounded-md text-sm font-medium">Tutorials</a>
                    <a href="research.html" class="text-gray-500 hover:text-purple-600 px-3 py-2 rounded-md text-sm font-medium">Research Papers</a>
                    <a href="about.html" class="text-gray-500 hover:text-purple-600 px-3 py-2 rounded-md text-sm font-medium">About</a>
                    <a href="admin.html" class="text-gray-900 hover:text-purple-600 px-3 py-2 rounded-md text-sm font-medium">Admin</a>
                    <button class="bg-gradient-to-r from-purple-600 to-indigo-600 text-white px-4 py-2 rounded-md text-sm font-medium hover:opacity-90 transition">Logout</button>
                </div>
            </div>
        </div>
    </nav>

    <!-- Main Content -->
    <section class="pt-32 pb-20 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto">
        <h1 class="text-3xl font-bold text-gray-900 font-space mb-8">Admin Dashboard</h1>
        
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
            <div class="bg-white p-6 rounded-xl shadow-sm">
                <h3 class="text-lg font-medium text-gray-900 mb-4">Article Management</h3>
                <div class="space-y-4">
                    <a href="#article-section" class="block w-full bg-purple-600 hover:bg-purple-700 text-white py-2 px-4 rounded-md text-center transition">Manage Articles</a>
                    <a href="#new-article" class="block w-full border border-purple-600 text-purple-600 hover:bg-purple-50 py-2 px-4 rounded-md text-center transition">Create New Article</a>
                </div>
            </div>
            <div class="bg-white p-6 rounded-xl shadow-sm">
                <h3 class="text-lg font-medium text-gray-900 mb-4">Content Statistics</h3>
                <div class="space-y-3">
                    <div class="flex justify-between">
                        <span class="text-gray-600">Total Articles</span>
                        <span class="font-medium">42</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">Pending Approval</span>
                        <span class="font-medium text-yellow-600">3</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">Published Today</span>
                        <span class="font-medium">2</span>
                    </div>
                </div>
            </div>
            <div class="bg-white p-6 rounded-xl shadow-sm">
                <h3 class="text-lg font-medium text-gray-900 mb-4">Quick Actions</h3>
                <div class="space-y-4">
                    <a href="#" class="block w-full border border-gray-300 hover:bg-gray-50 py-2 px-4 rounded-md text-center transition">View Subscribers</a>
                    <a href="#" class="block w-full border border-gray-300 hover:bg-gray-50 py-2 px-4 rounded-md text-center transition">Site Analytics</a>
                </div>
            </div>
        </div>

        <!-- Article Management Section -->
        <div id="article-section" class="bg-white rounded-xl shadow-sm p-6 mb-8">
            <div class="flex justify-between items-center mb-6">
                <h2 class="text-xl font-bold text-gray-900">Article Management</h2>
                <div class="flex space-x-4">
                    <div class="relative">
                        <select class="appearance-none bg-white border border-gray-300 rounded-md py-2 pl-3 pr-8 text-sm focus:outline-none focus:ring-purple-600 focus:border-purple-600">
                            <option>Filter by Status</option>
                            <option>Published</option>
                            <option>Pending</option>
                            <option>Draft</option>
                        </select>
                        <i data-feather="chevron-down" class="absolute right-3 top-2.5 text-gray-400 w-4 h-4"></i>
                    </div>
                    <div class="relative">
                        <select class="appearance-none bg-white border border-gray-300 rounded-md py-2 pl-3 pr-8 text-sm focus:outline-none focus:ring-purple-600 focus:border-purple-600">
                            <option>Sort by Date</option>
                            <option>Newest First</option>
                            <option>Oldest First</option>
                        </select>
                        <i data-feather="chevron-down" class="absolute right-3 top-2.5 text-gray-400 w-4 h-4"></i>
                    </div>
                </div>
            </div>

            <div class="overflow-x-auto">
                <table class="min-w-full divide-y divide-gray-200">
                    <thead class="bg-gray-50">
                        <tr>
                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Title</th>
                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Author</th>
                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Category</th>
                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
                        </tr>
                    </thead>
                    <tbody class="bg-white divide-y divide-gray-200">
                        <!-- Article 1 -->
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="font-medium text-gray-900">Transformers in NLP</div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="text-gray-900">Dr. Sarah Chen</div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-purple-100 text-purple-800">Machine Learning</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Published</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">May 15, 2023</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                <a href="#" class="text-purple-600 hover:text-purple-900 mr-3">Edit</a>
                                <a href="#" class="text-red-600 hover:text-red-900">Delete</a>
                            </td>
                        </tr>
                        <!-- Article 2 -->
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="font-medium text-gray-900">Diffusion Models</div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="text-gray-900">Alex Rodriguez</div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Computer Vision</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Published</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Apr 28, 2023</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                <a href="#" class="text-purple-600 hover:text-purple-900 mr-3">Edit</a>
                                <a href="#" class="text-red-600 hover:text-red-900">Delete</a>
                            </td>
                        </tr>
                        <!-- Article 3 (Pending) -->
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="font-medium text-gray-900">Ethics of Generative AI</div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="text-gray-900">Prof. James Wilson</div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-indigo-100 text-indigo-800">AI Ethics</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Pending</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Jun 2, 2023</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                <a href="#" class="text-purple-600 hover:text-purple-900 mr-3">Review</a>
                                <a href="#" class="text-red-600 hover:text-red-900">Delete</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <!-- New Article Form -->
        <div id="new-article" class="bg-white rounded-xl shadow-sm p-6">
            <h2 class="text-xl font-bold text-gray-900 mb-6">Create New Article</h2>
            
            <form>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                    <div class="col-span-2">
                        <label for="title" class="block text-sm font-medium text-gray-700 mb-1">Article Title</label>
                        <input type="text" id="title" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-purple-600 focus:border-purple-600">
                    </div>
                    
                    <div>
                        <label for="category" class="block text-sm font-medium text-gray-700 mb-1">Category</label>
                        <select id="category" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-purple-600 focus:border-purple-600">
                            <option>Select Category</option>
                            <option>Machine Learning</option>
                            <option>Computer Vision</option>
                            <option>Natural Language Processing</option>
                            <option>AI Ethics</option>
                            <option>Research</option>
                        </select>
                    </div>
                    
                    <div>
                        <label for="author" class="block text-sm font-medium text-gray-700 mb-1">Author</label>
                        <select id="author" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-purple-600 focus:border-purple-600">
                            <option>Select Author</option>
                            <option>Dr. Sarah Chen</option>
                            <option>Alex Rodriguez</option>
                            <option>Prof. James Wilson</option>
                        </select>
                    </div>
                    
                    <div class="col-span-2">
                        <label for="featured-image" class="block text-sm font-medium text-gray-700 mb-1">Featured Image</label>
                        <input type="file" id="featured-image" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-purple-600 focus:border-purple-600">
                    </div>
                    
                    <div class="col-span-2">
                        <label for="content" class="block text-sm font-medium text-gray-700 mb-1">Content</label>
                        <textarea id="content" rows="10" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-purple-600 focus:border-purple-600"></textarea>
                    </div>
                    
                    <div class="col-span-2">
                        <label for="excerpt" class="block text-sm font-medium text-gray-700 mb-1">Excerpt</label>
                        <textarea id="excerpt" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-purple-600 focus:border-purple-600"></textarea>
                    </div>
                    
                    <div>
                        <label for="status" class="block text-sm font-medium text-gray-700 mb-1">Status</label>
                        <select id="status" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-purple-600 focus:border-purple-600">
                            <option value="draft">Draft</option>
                            <option value="pending">Pending Review</option>
                            <option value="published">Publish Immediately</option>
                        </select>
                    </div>
                    
                    <div>
                        <label for="publish-date" class="block text-sm font-medium text-gray-700 mb-1">Publish Date</label>
                        <input type="date" id="publish-date" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-purple-600 focus:border-purple-600">
                    </div>
                </div>
                
                <div class="mt-8 flex justify-end space-x-4">
                    <button type="button" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-600">Save Draft</button>
                    <button type="submit" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-purple-600 hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-600">Publish Article</button>
                </div>
            </form>
        </div>
    </section>

    <script>
        feather.replace();
    </script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Panel | AI Byte</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');
        .font-space { font-family: 'Space Grotesk', sans-serif; }
        .gradient-text {
            background: linear-gradient(90deg, #6366F1 0%, #8B5CF6 50%, #EC4899 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
    </style>
</head>
<body class="bg-gray-50 font-sans">
    <!-- Navigation -->
    <nav class="bg-white/80 backdrop-blur-md border-b border-gray-200 fixed w-full z-10">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <div class="flex-shrink-0 flex items-center">
                        <a href="index.html" class="text-2xl font-bold gradient-text font-space">AI Byte</a>
                    </div>
                </div>
                <div class="hidden md:ml-6 md:flex md:items-center md:space-x-8">
                    <a href="index.html" class="text-gray-500 hover:text-purple-600 px-3 py-2 rounded-md text-sm font-medium">Home</a>
                    <a href="admin.html" class="text-gray-900 hover:text-purple-600 px-3 py-2 rounded-md text-sm font-medium">Admin</a>
                </div>
            </div>
        </div>
    </nav>

    <!-- Admin Content -->
    <section class="pt-32 pb-20 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto">
        <h1 class="text-3xl font-bold text-gray-900 mb-8 font-space">Admin Panel</h1>
        
        <!-- Article Management -->
        <div class="bg-white p-6 rounded-xl shadow-md mb-8">
            <h2 class="text-xl font-bold text-gray-900 mb-4">Manage Articles</h2>
            <!-- 
            Database Form Example:
            This form would submit to a PHP handler to insert into MySQL:
            
            <form action="/api/create_article.php" method="POST" enctype="multipart/form-data">
                <div class="mb-4">
                    <label class="block text-gray-700 mb-2">Title</label>
                    <input type="text" name="title" class="w-full px-3 py-2 border rounded">
                </div>
                <div class="mb-4">
                    <label class="block text-gray-700 mb-2">Content</label>
                    <textarea name="content" class="w-full px-3 py-2 border rounded" rows="6"></textarea>
                </div>
                <div class="mb-4">
                    <label class="block text-gray-700 mb-2">Category</label>
                    <select name="category" class="w-full px-3 py-2 border rounded">
                        <option value="machine-learning">Machine Learning</option>
                        <option value="computer-vision">Computer Vision</option>
                    </select>
                </div>
                <div class="mb-4">
                    <label class="block text-gray-700 mb-2">Featured Image</label>
                    <input type="file" name="image" class="w-full">
                </div>
                <button type="submit" class="bg-purple-600 text-white px-4 py-2 rounded">Create Article</button>
            </form>
            
            The PHP handler (create_article.php) would:
            1. Connect to MySQL
            2. Sanitize inputs
            3. Handle file upload
            4. Insert into articles table
            5. Return success/error response
            -->
            
            <div class="mt-4">
                <h3 class="font-medium mb-2">Existing Articles</h3>
                <!-- 
                Database Table Example:
                This would show paginated articles from database:
                
                <?php
                $conn = new mysqli($servername, $username, $password, $dbname);
                $sql = "SELECT id, title, category, created_at FROM articles ORDER BY created_at DESC";
                $result = $conn->query($sql);
                
                if ($result->num_rows > 0) {
                    echo '<table class="w-full">';
                    echo '<tr><th class="text-left">Title</th><th class="text-left">Category</th><th class="text-left">Date</th><th>Actions</th></tr>';
                    while($row = $result->fetch_assoc()) {
                        echo '<tr>';
                        echo '<td>'.$row['title'].'</td>';
                        echo '<td>'.$row['category'].'</td>';
                        echo '<td>'.date('M j, Y', strtotime($row['created_at'])).'</td>';
                        echo '<td class="text-center">
                                <a href="/api/edit_article.php?id='.$row['id'].'" class="text-blue-600">Edit</a> | 
                                <a href="/api/delete_article.php?id='.$row['id'].'" class="text-red-600">Delete</a>
                              </td>';
                        echo '</tr>';
                    }
                    echo '</table>';
                }
                $conn->close();
                ?>
                -->
            </div>
        </div>
    </section>

    <script>
        feather.replace();
    </script>
</body>
</html>